diff --git a/skyeye-promote/skyeye-common/src/main/java/com/skyeye/clazz/service/impl/SkyeyeClassServiceBeanServiceImpl.java b/skyeye-promote/skyeye-common/src/main/java/com/skyeye/clazz/service/impl/SkyeyeClassServiceBeanServiceImpl.java index e33afbc3..0989eeec 100644 --- a/skyeye-promote/skyeye-common/src/main/java/com/skyeye/clazz/service/impl/SkyeyeClassServiceBeanServiceImpl.java +++ b/skyeye-promote/skyeye-common/src/main/java/com/skyeye/clazz/service/impl/SkyeyeClassServiceBeanServiceImpl.java @@ -71,7 +71,7 @@ public class SkyeyeClassServiceBeanServiceImpl extends SkyeyeBusinessServiceImpl QueryWrapper wrapper = new QueryWrapper<>(); wrapper.eq(MybatisPlusUtil.toColumns(SkyeyeClassServiceBean::getSpringApplicationName), skyeyeClassServiceBeanApi.getSpringApplicationName()); List oldList = super.list(wrapper); - List oldKeys = oldList.stream().map(bean -> bean.getClassName()).collect(Collectors.toList()); + List oldKeys = oldList.stream().map(bean -> getKey(bean)).collect(Collectors.toList()); // 获取入参的数据 List classNameList = skyeyeClassServiceBeanApi.getClassNameList(); @@ -80,10 +80,10 @@ public class SkyeyeClassServiceBeanServiceImpl extends SkyeyeBusinessServiceImpl className.setSpringApplicationName(skyeyeClassServiceBeanApi.getSpringApplicationName()); }); - List newKeys = classNameList.stream().map(bean -> bean.getClassName()).collect(Collectors.toList()); + List newKeys = classNameList.stream().map(bean -> getKey(bean)).collect(Collectors.toList()); // (旧数据 - 新数据) 从数据库删除 - List deleteBeans = oldList.stream().filter(item -> !newKeys.contains(item.getClassName())).collect(Collectors.toList()); + List deleteBeans = oldList.stream().filter(item -> !newKeys.contains(getKey(item))).collect(Collectors.toList()); if (!CollectionUtils.isEmpty(deleteBeans)) { List classNames = deleteBeans.stream().map(bean -> bean.getClassName()).collect(Collectors.toList()); QueryWrapper deleteWrapper = new QueryWrapper<>(); @@ -93,7 +93,7 @@ public class SkyeyeClassServiceBeanServiceImpl extends SkyeyeBusinessServiceImpl } // (新数据 - 旧数据) 添加到数据库 - List addBeans = classNameList.stream().filter(item -> !oldKeys.contains(item.getClassName())).collect(Collectors.toList()); + List addBeans = classNameList.stream().filter(item -> !oldKeys.contains(getKey(item))).collect(Collectors.toList()); if (!CollectionUtils.isEmpty(addBeans)) { createEntity(addBeans, StringUtils.EMPTY); } @@ -102,6 +102,10 @@ public class SkyeyeClassServiceBeanServiceImpl extends SkyeyeBusinessServiceImpl saveAttrDefinition(skyeyeClassServiceBeanApi.getAppId(), classNameList); } + private String getKey(SkyeyeClassServiceBean bean) { + return String.format(Locale.ROOT, "%s_%s_%s", bean.getClassName(), bean.getManageShow(), bean.getTenant()); + } + private void saveAttrDefinition(String appId, List classNameList) { List attrDefinitionList = classNameList.stream() .filter(className -> CollectionUtil.isNotEmpty(className.getAttrDefinitionList()))