添加同工种下不可以存在相同身份证号的讲师的校验规则
This commit is contained in:
parent
798372dda8
commit
69c7102b59
@ -91,16 +91,25 @@ public class TeacherServiceImpl extends DefaultBaseService implements ITeacherSe
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SuccessResultData save(String token, TeacherVO teacherVO) throws Exception {
|
public SuccessResultData save(String token, TeacherVO teacherVO) throws Exception {
|
||||||
// 同机构下讲师不可重复
|
|
||||||
String idCardNumber = teacherVO.getIdCardNumber();
|
String idCardNumber = teacherVO.getIdCardNumber();
|
||||||
if(idCardNumber == null || "".equals(idCardNumber)){
|
if(idCardNumber == null || "".equals(idCardNumber)){
|
||||||
throw new SaveException("讲师证件号码不允许为空值");
|
throw new SaveException("讲师证件号码不允许为空值");
|
||||||
}
|
}
|
||||||
|
if(teacherVO.getWorkerCategoryId() == null || "".equals(teacherVO.getWorkerCategoryId())){
|
||||||
|
throw new SaveException("讲师授课工种不能为空值");
|
||||||
|
}
|
||||||
Map<String, Object> queryMap = getHashMap(8);
|
Map<String, Object> queryMap = getHashMap(8);
|
||||||
|
// 同工种下讲师不可重复,跨工种可以重复
|
||||||
|
String WorkerCategoryIds[] = teacherVO.getWorkerCategoryId().split(",");
|
||||||
queryMap.put("idCardNumber",idCardNumber);
|
queryMap.put("idCardNumber",idCardNumber);
|
||||||
TeacherDTO teacherDTO = teacherDao.get(queryMap);
|
for(int i = 0; i < WorkerCategoryIds.length;i++){
|
||||||
if(teacherDTO != null && !"".equals(teacherDTO.getTeacherId())){
|
queryMap.put("workerCategoryId",WorkerCategoryIds[i]);
|
||||||
throw new SaveException("您不能添加证件号码相同的讲师");
|
TeacherDTO teacherDTO = teacherDao.get(queryMap);
|
||||||
|
if(teacherDTO != null && !"".equals(teacherDTO.getTeacherId())){
|
||||||
|
throw new SaveException("该证件号码已在 【"
|
||||||
|
+ teacherDTO.getWorkerCategoryName().split(",")[i]
|
||||||
|
+ "】 工种中注册讲师");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
String teacherId = UUIDUtil.getUUID();
|
String teacherId = UUIDUtil.getUUID();
|
||||||
Map<String, Object> params = HashMapUtil.beanToMap(teacherVO);
|
Map<String, Object> params = HashMapUtil.beanToMap(teacherVO);
|
||||||
|
@ -162,6 +162,9 @@
|
|||||||
<if test="orgId != null and orgId != ''">
|
<if test="orgId != null and orgId != ''">
|
||||||
AND t1.org_id = #{orgId}
|
AND t1.org_id = #{orgId}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="workerCategoryId != null and workerCategoryId != ''">
|
||||||
|
AND FIND_IN_SET( #{workerCategoryId},t1.worker_category_id)
|
||||||
|
</if>
|
||||||
<if test="idCardNumber != null and idCardNumber != ''">
|
<if test="idCardNumber != null and idCardNumber != ''">
|
||||||
AND t1.id_card_number = #{idCardNumber}
|
AND t1.id_card_number = #{idCardNumber}
|
||||||
</if>
|
</if>
|
||||||
|
Loading…
Reference in New Issue
Block a user