diff --git a/skyeye-promote/skyeye-common/src/main/java/com/skyeye/eve/service/impl/SkyeyeClassCodeRuleServiceImpl.java b/skyeye-promote/skyeye-common/src/main/java/com/skyeye/eve/service/impl/SkyeyeClassCodeRuleServiceImpl.java index f2ab8005..c3a51a9a 100644 --- a/skyeye-promote/skyeye-common/src/main/java/com/skyeye/eve/service/impl/SkyeyeClassCodeRuleServiceImpl.java +++ b/skyeye-promote/skyeye-common/src/main/java/com/skyeye/eve/service/impl/SkyeyeClassCodeRuleServiceImpl.java @@ -57,6 +57,8 @@ public class SkyeyeClassCodeRuleServiceImpl extends ServiceImpl wrapper = new QueryWrapper<>(); wrapper.eq(MybatisPlusUtil.toColumns(SkyeyeClassCodeRuleMation::getAppId), skyeyeClassCodeRuleApiMation.getAppId()); List oldList = super.list(wrapper); + Map classNameToColeRuleId = oldList.stream() + .collect(Collectors.toMap(SkyeyeClassCodeRuleMation::getClassName, SkyeyeClassCodeRuleMation::getCodeRuleId)); List oldKeys = oldList.stream().map(bean -> bean.getClassName() + bean.getGroupName() + bean.getServiceName()).collect(Collectors.toList()); // 获取入参的数据 @@ -84,6 +86,9 @@ public class SkyeyeClassCodeRuleServiceImpl extends ServiceImpl addBeans = classNameList.stream() .filter(item -> !oldKeys.contains(item.getClassName() + item.getGroupName() + item.getServiceName())).collect(Collectors.toList()); if (!CollectionUtils.isEmpty(addBeans)) { + addBeans.forEach(bean -> { + bean.setCodeRuleId(classNameToColeRuleId.get(bean.getClassName())); + }); saveBatch(addBeans); }