Commit 354681b3 authored by duanruiming's avatar duanruiming

[add] 策略库修改添加策略编号唯一校验

parent db66455c
...@@ -1135,15 +1135,15 @@ public class StrategyControlServiceImpl implements StrategyControlService { ...@@ -1135,15 +1135,15 @@ public class StrategyControlServiceImpl implements StrategyControlService {
public JsonViewObject strategyFactorySave(StrategyFactoryEntity entity) throws Exception { public JsonViewObject strategyFactorySave(StrategyFactoryEntity entity) throws Exception {
JsonViewObject jsonViewObject = JsonViewObject.newInstance(); JsonViewObject jsonViewObject = JsonViewObject.newInstance();
try { try {
if (Objects.nonNull(entity.getId())) {
strategyFactoryMapper.updateById(entity);
} else {
LambdaQueryWrapper<StrategyFactoryEntity> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<StrategyFactoryEntity> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(StrategyFactoryEntity::getStrategyNo, entity.getStrategyNo()); queryWrapper.eq(StrategyFactoryEntity::getStrategyNo, entity.getStrategyNo());
List<StrategyFactoryEntity> entities = strategyFactoryMapper.selectList(queryWrapper); List<StrategyFactoryEntity> entities = strategyFactoryMapper.selectList(queryWrapper);
if (Objects.nonNull(entities) && entities.size() > 0) { if (Objects.nonNull(entities) && entities.size() > 0) {
return jsonViewObject.success("策略编号重复, 请修改策略编号"); return jsonViewObject.success("策略编号重复, 请修改策略编号");
} }
if (Objects.nonNull(entity.getId())) {
strategyFactoryMapper.updateById(entity);
} else {
strategyFactoryMapper.insert(entity); strategyFactoryMapper.insert(entity);
} }
} catch (Exception e) { } catch (Exception e) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment