|
@@ -59,20 +59,29 @@ public class AdmApplicationTests {
|
|
|
//@Transactional
|
|
|
public void testInfosCfg(){
|
|
|
String type = "se";
|
|
|
- String major = type.toUpperCase();
|
|
|
|
|
|
- List<AdmInfosConfig> dbList = infosConfigMapper.selectList(new QueryWrapper<AdmInfosConfig>().eq("major_code", major));
|
|
|
- HashMap<String, AdmInfosConfig> dbMap = new HashMap<>();
|
|
|
- dbList.stream().forEach(cfg -> dbMap.put(cfg.getClassCode(), cfg));
|
|
|
+ List<AdmComponent> compList = componentMapper.selectList(null);
|
|
|
+ HashMap<String, List<AdmComponent>> compMap = new HashMap<>();
|
|
|
+ compList.stream().forEach(comp -> {
|
|
|
+ List<AdmComponent> list = compMap.get(comp.getClassCode());
|
|
|
+ if(list == null){
|
|
|
+ list = new ArrayList<>();
|
|
|
+ compMap.put(comp.getClassCode(), list);
|
|
|
+ }
|
|
|
+ list.add(comp);
|
|
|
+ });
|
|
|
+
|
|
|
+ infosConfigMapper.delete(new QueryWrapper<AdmInfosConfig>().eq("flag", type));
|
|
|
+
|
|
|
List<AdmInfosConfig> list = new InfosCfgs().read(type);
|
|
|
for(AdmInfosConfig item : list) {
|
|
|
- AdmInfosConfig dbItem = dbMap.get(item.getClassCode());
|
|
|
- if(dbItem == null)
|
|
|
- infosConfigMapper.insert(item);
|
|
|
- else {
|
|
|
- item.setId(dbItem.getId());
|
|
|
- infosConfigMapper.updateById(item);
|
|
|
- }
|
|
|
+ item.setFlag(type);
|
|
|
+
|
|
|
+ List<AdmComponent> comps = compMap.get(item.getClassCode());
|
|
|
+ if(comps != null)
|
|
|
+ setCompsToInfo(item.getInfos(), null, comps);
|
|
|
+
|
|
|
+ infosConfigMapper.insert(item);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -81,19 +90,24 @@ public class AdmApplicationTests {
|
|
|
@Test
|
|
|
public void testRelsCfg(){
|
|
|
String type = "se";
|
|
|
-
|
|
|
- List<AdmRelsConfig> dbList = relsConfigMapper.selectList(null);
|
|
|
- HashMap<String, AdmRelsConfig> dbMap = new HashMap<>();
|
|
|
- dbList.stream().forEach(cfg -> dbMap.put(cfg.getClassCodeFrom(), cfg));
|
|
|
+ relsConfigMapper.delete(new QueryWrapper<AdmRelsConfig>().eq("flag", type));
|
|
|
List<AdmRelsConfig> list = new RelCfgs().read(type);
|
|
|
for(AdmRelsConfig item : list) {
|
|
|
- AdmRelsConfig dbItem = dbMap.get(item.getClassCodeFrom());
|
|
|
- if(dbItem == null)
|
|
|
- relsConfigMapper.insert(item);
|
|
|
- else {
|
|
|
- item.setId(dbItem.getId());
|
|
|
- relsConfigMapper.updateById(item);
|
|
|
- }
|
|
|
+ item.setFlag(type);
|
|
|
+ relsConfigMapper.insert(item);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private AdmPipeConfigMapper pipeConfigMapper;
|
|
|
+ @Test
|
|
|
+ public void testPipeCfg(){
|
|
|
+ String type = "ff";
|
|
|
+ pipeConfigMapper.delete(new QueryWrapper<AdmPipeConfig>().eq("flag", type));
|
|
|
+ List<AdmPipeConfig> list = new PipeCfgs().read(type);
|
|
|
+ for(AdmPipeConfig item : list) {
|
|
|
+ item.setFlag(type);
|
|
|
+ pipeConfigMapper.insert(item);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -121,17 +135,18 @@ public class AdmApplicationTests {
|
|
|
List<AdmComponent> comps = entry.getValue();
|
|
|
AdmInfosConfig cfg = cfgMap.get(classCode);
|
|
|
if(cfg != null){
|
|
|
- List<Map> infos = (List)cfg.getInfos();
|
|
|
- Map info = null;
|
|
|
- for(Map m : infos) {
|
|
|
- if("comp_type".equals(m.get("code"))){
|
|
|
- info = m;
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- setCompsToInfo(infos, info, comps);
|
|
|
-
|
|
|
- infosConfigMapper.updateById(cfg);
|
|
|
+ //不需要更新操作
|
|
|
+// List<Map> infos = (List)cfg.getInfos();
|
|
|
+// Map info = null;
|
|
|
+// for(Map m : infos) {
|
|
|
+// if("comp_type".equals(m.get("code"))){
|
|
|
+// info = m;
|
|
|
+// break;
|
|
|
+// }
|
|
|
+// }
|
|
|
+// setCompsToInfo(infos, info, comps);
|
|
|
+//
|
|
|
+// infosConfigMapper.updateById(cfg);
|
|
|
} else {
|
|
|
cfg = new AdmInfosConfig();
|
|
|
cfg.setId(IdUtil.simpleUUID());
|
|
@@ -168,25 +183,4 @@ public class AdmApplicationTests {
|
|
|
info.put("options", ops);
|
|
|
}
|
|
|
|
|
|
- @Autowired
|
|
|
- private AdmPipeConfigMapper pipeConfigMapper;
|
|
|
- @Test
|
|
|
- public void testPipeCfg(){
|
|
|
- String type = "ff";
|
|
|
-
|
|
|
- List<AdmPipeConfig> dbList = pipeConfigMapper.selectList(null);
|
|
|
- HashMap<String, AdmPipeConfig> dbMap = new HashMap<>();
|
|
|
- dbList.stream().forEach(cfg -> dbMap.put(cfg.getClassCodeFrom(), cfg));
|
|
|
- List<AdmPipeConfig> list = new PipeCfgs().read(type);
|
|
|
- for(AdmPipeConfig item : list) {
|
|
|
- AdmPipeConfig dbItem = dbMap.get(item.getClassCodeFrom());
|
|
|
- if(dbItem == null)
|
|
|
- pipeConfigMapper.insert(item);
|
|
|
- else {
|
|
|
- item.setId(dbItem.getId());
|
|
|
- pipeConfigMapper.updateById(item);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
}
|