From 70976bdaa1e0fb770f9dd380cc919334e4970400 Mon Sep 17 00:00:00 2001 From: zhangli <2235006734@qq.com> Date: Tue, 24 Oct 2023 16:02:53 +0800 Subject: [PATCH] 1 --- .../module/wms/service/rule/RuleServiceImpl.java | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/rule/RuleServiceImpl.java b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/rule/RuleServiceImpl.java index 3881e034..1289ea3c 100644 --- a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/rule/RuleServiceImpl.java +++ b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/rule/RuleServiceImpl.java @@ -84,7 +84,7 @@ public class RuleServiceImpl implements RuleService { DataPermissionUtils.executeIgnore(() -> { validateRuleExists(id); // 校验code唯一 - validateCodeExists(id,code); + validateCode(code); validateStrategyCode(strategyCode); validatePriority(priority); }); @@ -100,24 +100,13 @@ public class RuleServiceImpl implements RuleService { } @VisibleForTesting - private void validateCodeExists(Long id,String code) { + private void validateCode(String code) { if (code.isEmpty()) { throw exception(RULE_CODE_NOT_EXISTS); } if (StrUtil.isBlank(code)) { return; } - RuleDO rule = ruleMapper.selectByCode(code); - if (rule == null) { - return; - } - // 如果 id 为空,说明不用比较是否为相同 id 的用户 - if (id == null) { - throw exception(RULE_CODE_EXISTS); - } - if (!rule.getId().equals(id)) { - throw exception(RULE_CODE_EXISTS); - } } @VisibleForTesting private void validateStrategyCode(String strategyCode) {