|
@@ -118,25 +118,17 @@ public class MktMgmtRuleServiceImpl implements MktMgmtRuleService {
|
|
|
}
|
|
|
}
|
|
|
else {
|
|
|
- Long ruleId = reqDto.getId();
|
|
|
+ // 修改规则
|
|
|
+ // 1. 更新主规则信息
|
|
|
+ MktMgmtRule mktMgmtRule = mktMgmtRuleMapper.selectById(reqDto.getId());
|
|
|
+ if (mktMgmtRule == null) {
|
|
|
+ throw new BusinessException("规则不存在");
|
|
|
+ }
|
|
|
MktMgmtRule rule = new MktMgmtRule();
|
|
|
BeanUtils.copyProperties(reqDto, rule);
|
|
|
- // 是否是全局配置
|
|
|
- if (ruleId == 0L){
|
|
|
- MktMgmtRule globalRule = mktMgmtRuleMapper.selectById(reqDto.getId());
|
|
|
- if (globalRule == null) {
|
|
|
- int insert = mktMgmtRuleMapper.insert(rule);
|
|
|
- }else {
|
|
|
- mktMgmtRuleMapper.updateById(rule);
|
|
|
- }
|
|
|
- }else {
|
|
|
- // 1. 更新主规则信息
|
|
|
- MktMgmtRule mktMgmtRule = mktMgmtRuleMapper.selectById(reqDto.getId());
|
|
|
- if (mktMgmtRule == null) {
|
|
|
- throw new BusinessException("规则不存在");
|
|
|
- }
|
|
|
- mktMgmtRuleMapper.updateById(rule);
|
|
|
- }
|
|
|
+ mktMgmtRuleMapper.updateById(rule);
|
|
|
+
|
|
|
+ Long ruleId = reqDto.getId();
|
|
|
|
|
|
// 2. 处理IP列表
|
|
|
updateIpList(ipList, ruleId);
|