Commit 380e734d authored by hanbing's avatar hanbing

[update] 策略管理,参数校验

parent f6bffb09
......@@ -45,7 +45,6 @@ public class AddOrUpdateSceneDTO {
private String strategyName;
@ApiModelProperty(value = "优先级",required = true,notes = "")
@NotNull(message = "优先级不可为空")
@Pattern(regexp = "^[0-9]{1,2}$",message="优先级为整数,且最多两位")
private Integer priority;
@ApiModelProperty(value = "优化方法",required = true,notes = "")
@NotEmpty(message = "方法不可为空")
......
......@@ -114,6 +114,9 @@ public class SceneServiceImpl implements SceneService {
Integer strategyId = strategy.getId();
sceneStrategyPO.setStrategyId(strategyId);
Integer priority = strategy.getPriority();
if (priority > 99 || priority < 1) {
throw new RuntimeException("优先级为1至99数字");
}
sceneStrategyPO.setSceneStrategyPriority(priority);
sceneStrategyMapper.insertOne(sceneStrategyPO);
// 插入场景-策略-方法关系表
......
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