public List<SystemConfigGroup> findAllGroup() { List<SystemConfig> configs = systemConfigRepository.findAll(); Map<String, SystemConfigGroup> groupMap = new HashMap<>(); for (SystemConfig config : configs) { if (!groupMap.containsKey(config.getGroupName())) { groupMap.put(config.getGroupName(), new SystemConfigGroup()); } SystemConfigGroup group = groupMap.get(config.getGroupName()); group.setName(config.getGroupName()); group.setText(config.getGroupText()); group.setOrder(config.getGroupOrder()); group .getKeys() .add( new SystemConfigKey( config.getKeyName(), config.getKeyText(), config.getContent(), config.getKeyOrder())); } List<SystemConfigGroup> groups = new ArrayList<>(groupMap.values()); sortGroup(groups); return groups; }
public SystemConfigView get() { List<SystemConfig> configs = systemConfigRepository.findAll(); return new SystemConfigView(configs); }