diff --git a/src/main/java/cn/com/tenlion/service/apply/impl/ApplyServiceImpl.java b/src/main/java/cn/com/tenlion/service/apply/impl/ApplyServiceImpl.java index 256a81c..902d5d0 100644 --- a/src/main/java/cn/com/tenlion/service/apply/impl/ApplyServiceImpl.java +++ b/src/main/java/cn/com/tenlion/service/apply/impl/ApplyServiceImpl.java @@ -181,7 +181,7 @@ public class ApplyServiceImpl extends DefaultBaseService implements IApplyServic begin.setTime(df.parse(planStartTime)); end.setTime(df.parse(planEndTime)); if (!(date.after(begin) && date.before(end))) { - throw new ParamsException("该计划已截止报名"); + throw new ParamsException("未在该计划的报名时间段"); } } catch (ParseException e) { e.printStackTrace(); @@ -309,7 +309,7 @@ public class ApplyServiceImpl extends DefaultBaseService implements IApplyServic } /** - * 统计证件号码 报名培训计划的次数(不包括撤回) + * 统计证件号码 报名的培训计划的次数(不包括撤回) */ public Integer countApplyCardNumber(String applyCardNumber,String applyClassId){ Map params = new HashMap<>(); diff --git a/src/main/java/cn/com/tenlion/service/worktype/impl/WorkTypeServiceImpl.java b/src/main/java/cn/com/tenlion/service/worktype/impl/WorkTypeServiceImpl.java index 1d6671c..ad47dcf 100644 --- a/src/main/java/cn/com/tenlion/service/worktype/impl/WorkTypeServiceImpl.java +++ b/src/main/java/cn/com/tenlion/service/worktype/impl/WorkTypeServiceImpl.java @@ -2,6 +2,7 @@ package cn.com.tenlion.service.worktype.impl; import cn.com.tenlion.pojo.dtos.worktype.WorkTypeZTreeDTO; import ink.wgink.common.base.DefaultBaseService; +import ink.wgink.exceptions.ParamsException; import ink.wgink.pojo.ListPage; import ink.wgink.pojo.result.SuccessResult; import ink.wgink.pojo.result.SuccessResultList; @@ -78,6 +79,7 @@ public class WorkTypeServiceImpl extends DefaultBaseService implements IWorkType @Override public String saveReturnId(String token, WorkTypeVO workTypeVO) { + checkCode(workTypeVO.getWorkTypeCode()); String workTypeId = UUIDUtil.getUUID(); Map params = HashMapUtil.beanToMap(workTypeVO); params.put("workTypeId", workTypeId); @@ -121,6 +123,7 @@ public class WorkTypeServiceImpl extends DefaultBaseService implements IWorkType @Override public void update(String token, String workTypeId, WorkTypeVO workTypeVO) { + checkCode(workTypeVO.getWorkTypeCode()); Map params = HashMapUtil.beanToMap(workTypeVO); params.put("workTypeId", workTypeId); if (StringUtils.isBlank(token)) { @@ -194,6 +197,17 @@ public class WorkTypeServiceImpl extends DefaultBaseService implements IWorkType return new SuccessResultList<>(workTypeDTOs, pageInfo.getPageNum(), pageInfo.getTotal()); } + + private void checkCode(String code) { + Map params = new HashMap<>(); + params.put("workTypeCode",code); + int count = this.count(params); + if(count != 0){ + throw new ParamsException("编码已存在"); + } + } + + @Override public Integer count(Map params) { Integer count = workTypeDao.count(params); diff --git a/src/main/resources/mybatis/mapper/worktype/work-type-mapper.xml b/src/main/resources/mybatis/mapper/worktype/work-type-mapper.xml index b91591e..a6979e1 100644 --- a/src/main/resources/mybatis/mapper/worktype/work-type-mapper.xml +++ b/src/main/resources/mybatis/mapper/worktype/work-type-mapper.xml @@ -356,6 +356,9 @@ AND work_type_parent_id = #{workTypeParentId} + + AND work_type_code = #{workTypeCode} + \ No newline at end of file