public void load(DictManager dictManager) { BeanOperatorManager manager = SpringUtil .getBean(BeanOperatorManager.OPERATOR_MANAGER_BEAN); DBOperator<?> itemOperator = manager.getDbOperator(beanType); Dict dict = new Dict(beanType, beanType); Bean[] dictItemBeans = itemOperator.getBeans(sql); DictGroup dictGroup = new DictGroup("defaultGroupName", "defaultGroupName"); dict.addDictGroup(dictGroup); for (Bean bean : dictItemBeans) { String value = bean.getProperty(valueFieldName); String text = bean.getProperty(textFieldName); DictItem dictItem = new DictItem(value, text); dictGroup.addDictItem(dictItem); } putDict(dict.getName(), dict, dictManager); }
public void load(DictManager dictManager) { BeanOperatorManager manager = SpringUtil .getBean(BeanOperatorManager.OPERATOR_MANAGER_BEAN); DBOperator<?> itemOperator = manager.getDbOperator(beanType); Dict dict = new Dict(beanType, beanType); Bean[] dictItemBeans = itemOperator.getBeans(sql); DictGroup dictGroup = new DictGroup("defaultGroupName", "defaultGroupName"); dict.addDictGroup(dictGroup); for (Bean bean : dictItemBeans) { String value = bean.getProperty(valueFieldName); String text = bean.getProperty(textFieldName); DictItem dictItem = new DictItem(value, text); dictGroup.addDictItem(dictItem); } putDict(dict.getName(), dict, dictManager); }
@ServiceMethod(serviceId = "loadDictFromDatabase") @ServiceResult(name = "dictResult") public Dict getDict(String beanType, String sql, String valueFieldName, String textFieldName) { BeanOperatorManager manager = SpringUtil .getBean(BeanOperatorManager.OPERATOR_MANAGER_BEAN); DBOperator<?> itemOperator = manager.getDbOperator(beanType); Dict dict = new Dict(beanType, beanType); Bean[] dictItemBeans = itemOperator.getBeans(sql); DictGroup dictGroup = new DictGroup("defaultGroupName", "defaultGroupName"); dict.addDictGroup(dictGroup); for (Bean bean : dictItemBeans) { String value = bean.getProperty(valueFieldName); String text = bean.getProperty(textFieldName); DictItem dictItem = new DictItem(value, text); dictGroup.addDictItem(dictItem); } return dict; }
@ServiceMethod(serviceId = "loadDictFromDatabase") @ServiceResult(name = "dictResult") public Dict getDict(String beanType, String sql, String valueFieldName, String textFieldName) { BeanOperatorManager manager = SpringUtil .getBean(BeanOperatorManager.OPERATOR_MANAGER_BEAN); DBOperator<?> itemOperator = manager.getDbOperator(beanType); Dict dict = new Dict(beanType, beanType); Bean[] dictItemBeans = itemOperator.getBeans(sql); DictGroup dictGroup = new DictGroup("defaultGroupName", "defaultGroupName"); dict.addDictGroup(dictGroup); for (Bean bean : dictItemBeans) { String value = bean.getProperty(valueFieldName); String text = bean.getProperty(textFieldName); DictItem dictItem = new DictItem(value, text); dictGroup.addDictItem(dictItem); } return dict; }
public void load(DictManager dictManager) { List<TsysDictEntry> tsysDictEntryList = tsysDictEntryDao.query(null); if (tsysDictEntryList != null) { for (TsysDictEntry tDict : tsysDictEntryList) { Integer dictId = tDict.getId(); TsysDictItem tsysDictItem = new TsysDictItem(); tsysDictItem.setDictEntryId(dictId); //select * from t_dict_item where dict_id=? List<TsysDictItem> items = tsysDictItemDao.query(tsysDictItem); org.tinygroup.dict.Dict dict = new org.tinygroup.dict.Dict(); // dict.setName((String) bean.get(DICT_VALUE)); dict.setName(tDict.getDictEntryCode()); DictGroup group = new DictGroup(); if(items!=null){ for (TsysDictItem item : items) { org.tinygroup.dict.DictItem dictItem = new org.tinygroup.dict.DictItem(); // dictItem.setText((String) item.get(DICT_ITEM_NAME)); // dictItem.setValue((String) item.get(DICT_ITEM_VALUE)); dictItem.setText(item.getDictItemName()); dictItem.setValue(item.getDictItemCode()); group.addDictItem(dictItem); } } dict.addDictGroup(group); putDict(dict.getName(), dict, dictManager); } } }