添加同机构讲师信息重复的问题
This commit is contained in:
parent
8bcaf4a982
commit
110729d9ab
@ -62,13 +62,6 @@ public interface ITeacherDao {
|
||||
*/
|
||||
Map<String, Object> count(Map<String, Object> params);
|
||||
|
||||
/**
|
||||
* 根据身份证查询讲师授课列表
|
||||
* @param idCardNumber
|
||||
* @return
|
||||
*/
|
||||
List<Map<String, Object>> listTeacherLessonsTime(String idCardNumber);
|
||||
|
||||
/**
|
||||
* 保存讲师授课记录
|
||||
* @param params
|
||||
@ -81,4 +74,11 @@ public interface ITeacherDao {
|
||||
* @return
|
||||
*/
|
||||
List<TeacherLessonsTimeDTO> listTeacherLessonsTimeDTO(Map<String, Object> params);
|
||||
|
||||
/**
|
||||
* 查询将是信息
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
TeacherDTO get(Map<String, Object> params);
|
||||
}
|
||||
|
@ -18,6 +18,7 @@ import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import ink.wgink.common.base.DefaultBaseService;
|
||||
import ink.wgink.exceptions.RemoveException;
|
||||
import ink.wgink.exceptions.SaveException;
|
||||
import ink.wgink.exceptions.SearchException;
|
||||
import ink.wgink.module.dictionary.pojo.dtos.DataDTO;
|
||||
import ink.wgink.module.dictionary.service.IDataService;
|
||||
@ -68,11 +69,15 @@ public class TeacherServiceImpl extends DefaultBaseService implements ITeacherSe
|
||||
List<TeacherDTO> dtos = teacherDao.list(page.getParams());
|
||||
for (TeacherDTO item : dtos){
|
||||
//处理性别
|
||||
DataDTO gender = dataService.get(item.getGender());
|
||||
item.setGenderName(gender.getDataName());
|
||||
if(item.getGender() != null && !"".equals(item.getGender())){
|
||||
DataDTO gender = dataService.get(item.getGender());
|
||||
item.setGenderName(gender.getDataName());
|
||||
}
|
||||
//处理学历
|
||||
DataDTO education = dataService.get(item.getEducation());
|
||||
item.setEducationName(education.getDataName());
|
||||
if(item.getEducation() != null && !"".equals(item.getEducation())){
|
||||
DataDTO education = dataService.get(item.getEducation());
|
||||
item.setEducationName(education.getDataName());
|
||||
}
|
||||
}
|
||||
PageInfo<TeacherDTO> pageInfo = new PageInfo<>(dtos);
|
||||
return new SuccessResultList<>(dtos, pageInfo.getPageNum(), pageInfo.getTotal());
|
||||
@ -86,6 +91,22 @@ public class TeacherServiceImpl extends DefaultBaseService implements ITeacherSe
|
||||
|
||||
@Override
|
||||
public SuccessResultData save(String token, TeacherVO teacherVO) throws Exception {
|
||||
// 同机构下讲师不可重复
|
||||
String orgId = teacherVO.getOrgId();
|
||||
String idCardNumber = teacherVO.getIdCardNumber();
|
||||
if(orgId == null || "".equals(orgId)){
|
||||
throw new SaveException("机构ID缺失无法关联到所属机构");
|
||||
}
|
||||
if(idCardNumber == null || "".equals(idCardNumber)){
|
||||
throw new SaveException("讲师证件号码不允许为空值");
|
||||
}
|
||||
Map<String, Object> queryMap = getHashMap(8);
|
||||
queryMap.put("orgId",orgId);
|
||||
queryMap.put("idCardNumber",idCardNumber);
|
||||
TeacherDTO teacherDTO = teacherDao.get(queryMap);
|
||||
if(teacherDTO != null && !"".equals(teacherDTO.getTeacherId())){
|
||||
throw new SaveException("您不能添加证件号码相同的讲师");
|
||||
}
|
||||
String teacherId = UUIDUtil.getUUID();
|
||||
Map<String, Object> params = HashMapUtil.beanToMap(teacherVO);
|
||||
params.put("teacherId", teacherId);
|
||||
|
@ -129,6 +129,38 @@
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="get" parameterType="map" resultMap="teacherDTO">
|
||||
SELECT
|
||||
t1.teacher_id,
|
||||
t1.org_id,
|
||||
t1.certificate_no,
|
||||
t1.teacher_name,
|
||||
t1.telephone,
|
||||
t1.teacher_catalog,
|
||||
t1.id_card_number,
|
||||
t1.political_status,
|
||||
t1.gender,
|
||||
t1.education,
|
||||
t1.nation,
|
||||
t1.graduate_school,
|
||||
t1.major,
|
||||
t1.place_of_work
|
||||
FROM
|
||||
e_teacher t1
|
||||
WHERE
|
||||
t1.is_delete = 0
|
||||
<if test="teacherId != null and teacherId != ''">
|
||||
AND t1.teacher_id = #{teacherId}
|
||||
</if>
|
||||
<if test="orgId != null and orgId != ''">
|
||||
AND t1.org_id = #{orgId}
|
||||
</if>
|
||||
<if test="idCardNumber != null and idCardNumber != ''">
|
||||
AND t1.id_card_number = #{idCardNumber}
|
||||
</if>
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
<update id="update" parameterType="map">
|
||||
UPDATE
|
||||
e_teacher
|
||||
|
Loading…
Reference in New Issue
Block a user