diff --git a/op-modules/op-wms/src/main/java/com/op/wms/controller/BaseShiftsTController.java b/op-modules/op-wms/src/main/java/com/op/wms/controller/BaseShiftsTController.java index b152bf1d..9d1d906f 100644 --- a/op-modules/op-wms/src/main/java/com/op/wms/controller/BaseShiftsTController.java +++ b/op-modules/op-wms/src/main/java/com/op/wms/controller/BaseShiftsTController.java @@ -72,7 +72,13 @@ public class BaseShiftsTController extends BaseController { @Log(title = "班次管理", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody BaseShiftsT baseShiftsT) { - return toAjax(baseShiftsTService.insertBaseShiftsT(baseShiftsT)); + if (baseShiftsTService.checkCodeUnique(baseShiftsT)) { + return AjaxResult.error("班次编码已存在!"); + }else if(baseShiftsTService.checkNameUnique(baseShiftsT)){ + return AjaxResult.error("班次名称已存在!"); + }else{ + return toAjax(baseShiftsTService.insertBaseShiftsT(baseShiftsT)); + } } /** diff --git a/op-modules/op-wms/src/main/java/com/op/wms/mapper/BaseShiftsTMapper.java b/op-modules/op-wms/src/main/java/com/op/wms/mapper/BaseShiftsTMapper.java index 2ef733e4..eef0eed6 100644 --- a/op-modules/op-wms/src/main/java/com/op/wms/mapper/BaseShiftsTMapper.java +++ b/op-modules/op-wms/src/main/java/com/op/wms/mapper/BaseShiftsTMapper.java @@ -63,4 +63,7 @@ public interface BaseShiftsTMapper { List queryAllStartTime(BaseShiftsT baseShiftsT); List queryAllEndTime(BaseShiftsT baseShiftsT); + + String checkCodeUnique(BaseShiftsT baseShiftsT); + String checkNameUnique(BaseShiftsT baseShiftsT); } diff --git a/op-modules/op-wms/src/main/java/com/op/wms/service/IBaseShiftsTService.java b/op-modules/op-wms/src/main/java/com/op/wms/service/IBaseShiftsTService.java index 8ee77d95..576dd5c9 100644 --- a/op-modules/op-wms/src/main/java/com/op/wms/service/IBaseShiftsTService.java +++ b/op-modules/op-wms/src/main/java/com/op/wms/service/IBaseShiftsTService.java @@ -57,4 +57,7 @@ public interface IBaseShiftsTService { * @return 结果 */ public int deleteBaseShiftsTByShiftId(String shiftId); + + boolean checkCodeUnique(BaseShiftsT baseShiftsT); + boolean checkNameUnique(BaseShiftsT baseShiftsT); } diff --git a/op-modules/op-wms/src/main/java/com/op/wms/service/impl/BaseShiftsTServiceImpl.java b/op-modules/op-wms/src/main/java/com/op/wms/service/impl/BaseShiftsTServiceImpl.java index a312497e..6635148d 100644 --- a/op-modules/op-wms/src/main/java/com/op/wms/service/impl/BaseShiftsTServiceImpl.java +++ b/op-modules/op-wms/src/main/java/com/op/wms/service/impl/BaseShiftsTServiceImpl.java @@ -142,4 +142,36 @@ public class BaseShiftsTServiceImpl implements IBaseShiftsTService { public int deleteBaseShiftsTByShiftId(String shiftId) { return baseShiftsTMapper.deleteBaseShiftsTByShiftId(shiftId); } + + /** + * 判断班次信息 + * + * @return 结果 + */ + @Override + @DS("#header.poolName") + public boolean checkCodeUnique(BaseShiftsT baseShiftsT) { + String code = baseShiftsTMapper.checkCodeUnique(baseShiftsT); + if(code == null){ + return false; + }else{ + return true; + } + } + + /** + * 判断班次信息 + * + * @return 结果 + */ + @Override + @DS("#header.poolName") + public boolean checkNameUnique(BaseShiftsT baseShiftsT) { + String name = baseShiftsTMapper.checkNameUnique(baseShiftsT); + if(name == null){ + return false; + }else{ + return true; + } + } } diff --git a/op-modules/op-wms/src/main/resources/mapper/wms/BaseShiftsTMapper.xml b/op-modules/op-wms/src/main/resources/mapper/wms/BaseShiftsTMapper.xml index 5bb98947..7bcf0988 100644 --- a/op-modules/op-wms/src/main/resources/mapper/wms/BaseShiftsTMapper.xml +++ b/op-modules/op-wms/src/main/resources/mapper/wms/BaseShiftsTMapper.xml @@ -30,8 +30,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - select + + + + + + + \ No newline at end of file