diff --git a/bonus-modules/bonus-bmw/src/main/java/com/bonus/bmw/controller/PmPostTypeController.java b/bonus-modules/bonus-bmw/src/main/java/com/bonus/bmw/controller/PmPostTypeController.java index 242328a..1188eb5 100644 --- a/bonus-modules/bonus-bmw/src/main/java/com/bonus/bmw/controller/PmPostTypeController.java +++ b/bonus-modules/bonus-bmw/src/main/java/com/bonus/bmw/controller/PmPostTypeController.java @@ -78,7 +78,12 @@ public class PmPostTypeController extends BaseController{ @SysLog(title = "工种类型管理", businessType = OperaType.UPDATE, logType = 0, module = "工种类型管理->工种类型删除") public AjaxResult delPostType(@Validated @RequestBody PmPostType pmPostType) { try { - return toAjax(pmPostTypeService.delPostType(pmPostType)); + int res = pmPostTypeService.delPostType(pmPostType); + if (res>0){ + return toAjax(res); + }else { + return error("工种已绑定人员"); + } } catch (Exception e) { logger.error(e.toString(), e); } diff --git a/bonus-modules/bonus-bmw/src/main/java/com/bonus/bmw/controller/PmSubComController.java b/bonus-modules/bonus-bmw/src/main/java/com/bonus/bmw/controller/PmSubComController.java index 6697180..b441430 100644 --- a/bonus-modules/bonus-bmw/src/main/java/com/bonus/bmw/controller/PmSubComController.java +++ b/bonus-modules/bonus-bmw/src/main/java/com/bonus/bmw/controller/PmSubComController.java @@ -80,7 +80,7 @@ public class PmSubComController extends BaseController { if (res>0){ return toAjax(res); }else { - return error("公司下面存在未删除的分公司"); + return error("分公司下面存在未删除的项目部"); } } catch (Exception e) { diff --git a/bonus-modules/bonus-bmw/src/main/java/com/bonus/bmw/mapper/PmPostTypeMapper.java b/bonus-modules/bonus-bmw/src/main/java/com/bonus/bmw/mapper/PmPostTypeMapper.java index 38b03d0..6f561c9 100644 --- a/bonus-modules/bonus-bmw/src/main/java/com/bonus/bmw/mapper/PmPostTypeMapper.java +++ b/bonus-modules/bonus-bmw/src/main/java/com/bonus/bmw/mapper/PmPostTypeMapper.java @@ -37,4 +37,11 @@ public interface PmPostTypeMapper { * @return */ List selectPostTypeListAll(PmPostType pmPostType); + + /** + * 查看是否绑定人员 + * @param pmPostType + * @return + */ + int countNumByTypeId(PmPostType pmPostType); } diff --git a/bonus-modules/bonus-bmw/src/main/java/com/bonus/bmw/service/impl/PmPostTypeServiceImpl.java b/bonus-modules/bonus-bmw/src/main/java/com/bonus/bmw/service/impl/PmPostTypeServiceImpl.java index 8d7bc3f..bd7638f 100644 --- a/bonus-modules/bonus-bmw/src/main/java/com/bonus/bmw/service/impl/PmPostTypeServiceImpl.java +++ b/bonus-modules/bonus-bmw/src/main/java/com/bonus/bmw/service/impl/PmPostTypeServiceImpl.java @@ -62,6 +62,11 @@ public class PmPostTypeServiceImpl implements PmPostTypeService { */ @Override public int delPostType(PmPostType pmPostType) { + //查询是否绑定人员 + int count = pmPostTypeMapper.countNumByTypeId(pmPostType); + if (count>0){ + return 0; + } return pmPostTypeMapper.delPostType(pmPostType); } diff --git a/bonus-modules/bonus-bmw/src/main/resources/mapper/bmw/PmPostTypeMapper.xml b/bonus-modules/bonus-bmw/src/main/resources/mapper/bmw/PmPostTypeMapper.xml index e3cc2e6..c5a9e7e 100644 --- a/bonus-modules/bonus-bmw/src/main/resources/mapper/bmw/PmPostTypeMapper.xml +++ b/bonus-modules/bonus-bmw/src/main/resources/mapper/bmw/PmPostTypeMapper.xml @@ -48,4 +48,7 @@ AND post_name LIKE CONCAT('%', #{postName}, '%') +