private void updateContent(SystemConfig config, String value) { if ((config.getContent() == null && value == null) || config.getContent().equals(value)) return; config.setContent(value); config.setUpdateUser(""); config.setUpdateTime(new Date()); systemConfigRepository.update(config); }
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; }
private void addConfig(SystemConfig config) { config.setUpdateUser(""); config.setUpdateTime(new Date()); config.setCreateTime(new Date()); config.setCreateUser(""); config.setContent(""); systemConfigRepository.create(config); }
public SystemConfigView get() { List<SystemConfig> configs = systemConfigRepository.findAll(); return new SystemConfigView(configs); }