Browse Source

feat: [步骤管理] 步骤编号不能重复

master
memorylkf 1 month ago
parent
commit
36b2fe751f
1 changed files with 9 additions and 0 deletions
  1. +9
    -0
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/StepController.java

+ 9
- 0
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/StepController.java View File

@ -3,6 +3,7 @@ package com.hxhq.business.controller;
import java.util.Arrays;
import java.util.List;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.hxhq.common.security.annotation.Logical;
import com.hxhq.common.security.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
@ -56,6 +57,14 @@ public class StepController extends BaseController
@RequiresPermissions("business:step:list")
public AjaxResult save(@RequestBody Step step)
{
QueryWrapper<Step> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("sn",step.getSn());
if(step.getId()!=null){
queryWrapper.ne("id",step.getId());
}
if(stepService.count(queryWrapper)>0){
return AjaxResult.error("编号已存在");
}
return toAjax(stepService.saveOrUpdate(step));
}

Loading…
Cancel
Save