Joburgess 5 years ago
parent
commit
9d04332657

+ 12 - 1
edu-user/edu-user-client-api/src/main/java/com/keao/edu/user/api/entity/ExamRoom.java

@@ -31,6 +31,9 @@ public class ExamRoom {
 	
 	@ApiModelProperty(value = "助考老师(多个用逗号分隔)")
 	private String assistantTeacherUserIdList;
+
+	@ApiModelProperty(value = "考试时间:[{'examStartTime':'','examEndTime':''}]")
+	private String examTimeJson;
 	
 	@ApiModelProperty(value = "考试开始时间")
 	private Date examStartTime;
@@ -135,7 +138,15 @@ public class ExamRoom {
 	public java.util.Date getCreateTime(){
 		return this.createTime;
 	}
-			
+
+	public String getExamTimeJson() {
+		return examTimeJson;
+	}
+
+	public void setExamTimeJson(String examTimeJson) {
+		this.examTimeJson = examTimeJson;
+	}
+
 	public void setUpdateTime(java.util.Date updateTime){
 		this.updateTime = updateTime;
 	}

+ 1 - 1
edu-user/edu-user-server/src/main/java/com/keao/edu/user/controller/ExamSubjectController.java

@@ -16,7 +16,7 @@ import java.util.List;
 
 @RestController
 @RequestMapping("examSubject")
-@Api(tags = "考级项目考级专业服务")
+@Api(tags = "考级专业服务")
 public class ExamSubjectController extends BaseController {
 
     @Autowired

+ 23 - 1
edu-user/edu-user-server/src/main/java/com/keao/edu/user/controller/ExamTeacherSalaryController.java

@@ -3,6 +3,8 @@ package com.keao.edu.user.controller;
 import com.keao.edu.common.controller.BaseController;
 import com.keao.edu.common.entity.HttpResponseResult;
 import com.keao.edu.common.page.PageInfo;
+import com.keao.edu.user.dto.BaseUserInfoDto;
+import com.keao.edu.user.dto.TeacherDto;
 import com.keao.edu.user.entity.ExamTeacherSalary;
 import com.keao.edu.user.page.ExamTeacherSalaryQueryInfo;
 import com.keao.edu.user.service.ExamTeacherSalaryService;
@@ -13,6 +15,7 @@ import org.springframework.web.bind.annotation.*;
 
 import java.math.BigDecimal;
 import java.util.Date;
+import java.util.List;
 
 /**
  * @Author Joburgess
@@ -20,7 +23,7 @@ import java.util.Date;
  */
 @RestController
 @RequestMapping("examTeacherSalary")
-@Api(tags = "考级项目评审教室分润")
+@Api(tags = "考级项目教师服务")
 public class ExamTeacherSalaryController extends BaseController {
 
     @Autowired
@@ -42,6 +45,19 @@ public class ExamTeacherSalaryController extends BaseController {
         return succeed();
     }
 
+    @ApiOperation("新增考级教师")
+    @PostMapping(value = "/addExamTeacherSalary")
+    public HttpResponseResult addExamTeacherSalary(Integer examId, String teacherIdsStr) {
+        examTeacherSalaryService.addExamTeacherSalary(examId, teacherIdsStr);
+        return succeed();
+    }
+
+    @ApiOperation("获取指定考级项目可排考教师")
+    @GetMapping(value = "/getExamTeachers")
+    public HttpResponseResult<List<BaseUserInfoDto>> getExamTeachers(Integer examId){
+        return succeed(examTeacherSalaryService.getExamTeachers(examId));
+    }
+
     @ApiOperation("更新")
     @PostMapping(value = "/update")
     public HttpResponseResult update(ExamTeacherSalary examTeacherSalary) {
@@ -57,4 +73,10 @@ public class ExamTeacherSalaryController extends BaseController {
         return succeed();
     }
 
+    @ApiOperation("获取与考级项目无关的教师")
+    @GetMapping(value = "/getUnRelatedWithExamTeachers")
+    public HttpResponseResult<PageInfo<TeacherDto>> getUnRelatedWithExamTeachers(ExamTeacherSalaryQueryInfo queryInfo){
+        return succeed(examTeacherSalaryService.getUnRelatedWithExamTeachers(queryInfo));
+    }
+
 }

+ 1 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/dao/ExamRoomDao.java

@@ -11,6 +11,7 @@ import java.util.Map;
 
 public interface ExamRoomDao extends BaseDAO<Long, ExamRoom> {
 
+    int batchInsert(@Param("examRooms") List<ExamRoom> examRooms);
 
     /**
      * COUNT教师考试列表

+ 35 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/dao/ExamTeacherSalaryDao.java

@@ -2,13 +2,19 @@ package com.keao.edu.user.dao;
 
 
 import com.keao.edu.common.dal.BaseDAO;
+import com.keao.edu.user.dto.BaseUserInfoDto;
+import com.keao.edu.user.dto.TeacherDto;
 import com.keao.edu.user.entity.ExamTeacherSalary;
+import com.keao.edu.user.entity.Teacher;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
+import java.util.Map;
 
 public interface ExamTeacherSalaryDao extends BaseDAO<Long, ExamTeacherSalary> {
 
+    int batchInsert(@Param("examTeacherSalaries") List<ExamTeacherSalary> examTeacherSalaries);
+
     int batchUpdate(@Param("teacherSalaries") List<ExamTeacherSalary> teacherSalaries);
 
     /**
@@ -20,4 +26,33 @@ public interface ExamTeacherSalaryDao extends BaseDAO<Long, ExamTeacherSalary> {
      */
     List<ExamTeacherSalary> queryWithExam(@Param("examId") Integer examId);
 
+    /**
+     * @describe 获取指定考级项目下教师的基本信息
+     * @author Joburgess
+     * @date 2020.07.02
+     * @param examId:
+     * @return java.util.List<com.keao.edu.user.dto.BaseUserInfoDto>
+     */
+    List<BaseUserInfoDto> getTeachersWithExam(@Param("examId") Integer examId);
+
+    /**
+     * @describe 获取指定考级项目下指定老师的分润设置
+     * @author Joburgess
+     * @date 2020.07.02
+     * @param examId:
+     * @param teacherIds:
+     * @return java.util.List<com.keao.edu.user.entity.ExamTeacherSalary>
+     */
+    List<ExamTeacherSalary> getWithExamAndTeacher(@Param("examId") Integer examId,
+                                                  @Param("teacherIds") List<Integer> teacherIds);
+
+    /**
+     * @describe 获取与考级项目无关的教师
+     * @author Joburgess
+     * @date 2020.07.02
+     * @param params:
+     * @return java.util.List<com.keao.edu.user.entity.Teacher>
+     */
+    List<TeacherDto> queryUnRelatedWithExamTeachers(Map<String, Object> params);
+    int countUnRelatedWithExamTeachers(Map<String, Object> params);
 }

+ 6 - 1
edu-user/edu-user-server/src/main/java/com/keao/edu/user/dao/TeacherDao.java

@@ -3,7 +3,12 @@ package com.keao.edu.user.dao;
 
 import com.keao.edu.common.dal.BaseDAO;
 import com.keao.edu.user.entity.Teacher;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 public interface TeacherDao extends BaseDAO<Integer, Teacher> {
 
-}
+    List<Teacher> getWithTeachers(@Param("teacherIds") List<Integer> teacherIds);
+
+}

+ 63 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/dto/BaseUserInfoDto.java

@@ -0,0 +1,63 @@
+package com.keao.edu.user.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * @Author Joburgess
+ * @Date 2020.07.02
+ */
+public class BaseUserInfoDto {
+
+    /** 主键ID */
+    private Integer id;
+
+    @ApiModelProperty(value = "手机号",required = false)
+    private String phone;
+
+    /** 头像 */
+    @ApiModelProperty(value = "头像",required = false)
+    private String avatar;
+
+    @ApiModelProperty(value = "真实姓名",required = false)
+    private String realName;
+
+    public BaseUserInfoDto() {
+    }
+
+    public BaseUserInfoDto(Integer id, String realName) {
+        this.id = id;
+        this.realName = realName;
+    }
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public String getPhone() {
+        return phone;
+    }
+
+    public void setPhone(String phone) {
+        this.phone = phone;
+    }
+
+    public String getAvatar() {
+        return avatar;
+    }
+
+    public void setAvatar(String avatar) {
+        this.avatar = avatar;
+    }
+
+    public String getRealName() {
+        return realName;
+    }
+
+    public void setRealName(String realName) {
+        this.realName = realName;
+    }
+}

+ 20 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/dto/TeacherDto.java

@@ -0,0 +1,20 @@
+package com.keao.edu.user.dto;
+
+import com.keao.edu.user.entity.Teacher;
+
+/**
+ * @Author Joburgess
+ * @Date 2020.07.02
+ */
+public class TeacherDto extends Teacher {
+
+    private String subjectNames;
+
+    public String getSubjectNames() {
+        return subjectNames;
+    }
+
+    public void setSubjectNames(String subjectNames) {
+        this.subjectNames = subjectNames;
+    }
+}

+ 35 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/ExamTeacherSalaryService.java

@@ -1,7 +1,15 @@
 package com.keao.edu.user.service;
 
+import com.keao.edu.common.page.PageInfo;
 import com.keao.edu.common.service.BaseService;
+import com.keao.edu.user.dto.BaseUserInfoDto;
+import com.keao.edu.user.dto.TeacherDto;
 import com.keao.edu.user.entity.ExamTeacherSalary;
+import com.keao.edu.user.entity.Teacher;
+import com.keao.edu.user.page.ExamTeacherSalaryQueryInfo;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 public interface ExamTeacherSalaryService extends BaseService<Long, ExamTeacherSalary> {
 
@@ -23,4 +31,31 @@ public interface ExamTeacherSalaryService extends BaseService<Long, ExamTeacherS
      */
     void deleteExamTeacherSalary(Long examTeacherSalaryId);
 
+    /**
+     * @describe 新增考级项目教师
+     * @author Joburgess
+     * @date 2020.07.02
+     * @param examId:
+     * @param teacherIdsStr:
+     * @return void
+     */
+    void addExamTeacherSalary(Integer examId, String teacherIdsStr);
+
+    /**
+     * @describe 获取指定考级项目可排考教师
+     * @author Joburgess
+     * @date 2020.07.02
+     * @param examId:
+     * @return java.util.List<com.keao.edu.user.dto.BaseUserInfoDto>
+     */
+    List<BaseUserInfoDto> getExamTeachers(Integer examId);
+
+    /**
+     * @describe 获取与考级项目无关的教师
+     * @author Joburgess
+     * @date 2020.07.02
+     * @param queryInfo:
+     * @return java.util.List<com.keao.edu.user.entity.Teacher>
+     */
+    PageInfo<TeacherDto> getUnRelatedWithExamTeachers(ExamTeacherSalaryQueryInfo queryInfo);
 }

+ 39 - 3
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/ExamRoomServiceImpl.java

@@ -1,6 +1,9 @@
 package com.keao.edu.user.service.impl;
 
 
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
 import com.keao.edu.common.dal.BaseDAO;
 import com.keao.edu.common.enums.YesOrNoEnum;
 import com.keao.edu.common.exception.BizException;
@@ -11,24 +14,28 @@ import com.keao.edu.user.api.entity.ExamRoom;
 import com.keao.edu.user.dao.ExamRegistrationDao;
 import com.keao.edu.user.dao.ExamRoomDao;
 import com.keao.edu.user.dao.ExamRoomStudentRelationDao;
+import com.keao.edu.user.dao.ExaminationBasicDao;
 import com.keao.edu.user.dto.ExamRoomDto;
 import com.keao.edu.user.dto.ExamRoomStatisticsDto;
 import com.keao.edu.user.api.enums.ExamModeEnum;
+import com.keao.edu.user.entity.ExaminationBasic;
 import com.keao.edu.user.page.ExamRoomQueryInfo;
 import com.keao.edu.user.service.ExamRoomService;
 import com.keao.edu.user.service.OrganizationService;
 import com.keao.edu.util.collection.MapUtil;
+import org.apache.commons.beanutils.BeanUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.util.CollectionUtils;
 
+import java.lang.reflect.InvocationTargetException;
 import java.util.*;
 import java.util.stream.Collectors;
 
 @Service
 public class ExamRoomServiceImpl extends BaseServiceImpl<Long, ExamRoom> implements ExamRoomService {
-	
+
 	@Autowired
 	private ExamRoomDao examRoomDao;
 	@Autowired
@@ -37,6 +44,8 @@ public class ExamRoomServiceImpl extends BaseServiceImpl<Long, ExamRoom> impleme
 	private OrganizationService organizationService;
 	@Autowired
 	private ExamRegistrationDao examRegistrationDao;
+	@Autowired
+	private ExaminationBasicDao examinationBasicDao;
 
 	@Override
 	public BaseDAO<Long, ExamRoom> getDAO() {
@@ -68,6 +77,13 @@ public class ExamRoomServiceImpl extends BaseServiceImpl<Long, ExamRoom> impleme
 
 	@Override
 	public void createExamRoom(ExamRoom examRoom) {
+		if(Objects.isNull(examRoom.getExaminationBasicId())){
+			throw new BizException("请指定考级项目");
+		}
+		ExaminationBasic examinationBasic = examinationBasicDao.get(examRoom.getExaminationBasicId().longValue());
+		if(Objects.isNull(examinationBasic)){
+			throw new BizException("考级项目不存在");
+		}
 		if(Objects.isNull(examRoom.getExamMode())){
 			throw new BizException("请指定考试类型");
 		}
@@ -80,12 +96,32 @@ public class ExamRoomServiceImpl extends BaseServiceImpl<Long, ExamRoom> impleme
 		if(Objects.isNull(examRoom.getMainTeacherUserId())){
 			throw new BizException("请指定主考老师");
 		}
-		if(Objects.isNull(examRoom.getExamStartTime())){
+		if(StringUtils.isBlank(examRoom.getExamTimeJson())){
 			throw new BizException("请指定考试时间");
 		}
 		examRoom.setTenantId(TenantContextHolder.getTenantId().toString());
 		examRoom.setExamPlanPushFlag(YesOrNoEnum.NO);
-		examRoomDao.insert(examRoom);
+		if(StringUtils.isBlank(examRoom.getExamTimeJson())){
+			examRoomDao.insert(examRoom);
+			return;
+		}
+		List<ExamRoom> examRooms=new ArrayList<>();
+		List<JSONObject> examTimes = JSON.parseArray(examRoom.getExamTimeJson(), JSONObject.class);
+		for (JSONObject examTime : examTimes) {
+			ExamRoom er;
+			try {
+				er= (ExamRoom) BeanUtils.cloneBean(examRoom);
+			} catch (Exception e) {
+				throw new BizException("教室创建失败");
+			}
+			er.setExamStartTime(examTime.getDate("examStartTime"));
+			er.setExamEndTime(examTime.getDate("examEndTime"));
+			if(Objects.isNull(er.getExamStartTime())||Objects.isNull(er.getExamEndTime())){
+				throw new BizException("请指定考试时间");
+			}
+			examRooms.add(er);
+		}
+		examRoomDao.batchInsert(examRooms);
 	}
 
 	@Override

+ 101 - 4
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/ExamTeacherSalaryServiceImpl.java

@@ -2,19 +2,24 @@ package com.keao.edu.user.service.impl;
 
 import com.keao.edu.common.dal.BaseDAO;
 import com.keao.edu.common.exception.BizException;
+import com.keao.edu.common.page.PageInfo;
 import com.keao.edu.common.service.impl.BaseServiceImpl;
+import com.keao.edu.common.tenant.TenantContextHolder;
 import com.keao.edu.user.api.entity.ExamRoom;
 import com.keao.edu.user.api.entity.ExamRoomStudentRelation;
-import com.keao.edu.user.dao.ExamRoomDao;
-import com.keao.edu.user.dao.ExamRoomStudentRelationDao;
-import com.keao.edu.user.dao.ExamTeacherSalaryDao;
-import com.keao.edu.user.dao.ExaminationBasicDao;
+import com.keao.edu.user.dao.*;
+import com.keao.edu.user.dto.BaseUserInfoDto;
+import com.keao.edu.user.dto.TeacherDto;
 import com.keao.edu.user.entity.ExamTeacherSalary;
+import com.keao.edu.user.entity.Teacher;
 import com.keao.edu.user.enums.SettlementTypeEnum;
 import com.keao.edu.user.enums.TeacherSettlementTypeEnum;
+import com.keao.edu.user.page.ExamTeacherSalaryQueryInfo;
 import com.keao.edu.user.service.ExamTeacherSalaryService;
 import com.keao.edu.user.service.ExaminationBasicService;
+import com.keao.edu.util.collection.MapUtil;
 import org.apache.commons.lang3.StringUtils;
+import org.apache.poi.ss.formula.functions.T;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.util.CollectionUtils;
@@ -33,6 +38,8 @@ public class ExamTeacherSalaryServiceImpl extends BaseServiceImpl<Long, ExamTeac
 	private ExamRoomStudentRelationDao examRoomStudentRelationDao;
 	@Autowired
 	private ExamTeacherSalaryDao examTeacherSalaryDao;
+	@Autowired
+	private TeacherDao teacherDao;
 
 	@Override
 	public BaseDAO<Long, ExamTeacherSalary> getDAO() {
@@ -94,4 +101,94 @@ public class ExamTeacherSalaryServiceImpl extends BaseServiceImpl<Long, ExamTeac
 		}
 		examTeacherSalaryDao.delete(examTeacherSalaryId);
 	}
+
+	@Override
+	public void addExamTeacherSalary(Integer examId, String teacherIdsStr) {
+		if(Objects.isNull(examId)){
+			throw new BizException("请指定考级项目");
+		}
+		if(StringUtils.isBlank(teacherIdsStr)){
+			throw new BizException("请指定教师");
+		}
+		List<Integer> teacherIds = Arrays.stream(teacherIdsStr.split(",")).map(e -> Integer.valueOf(e)).collect(Collectors.toList());
+		List<ExamTeacherSalary> withExamAndTeacher = examTeacherSalaryDao.getWithExamAndTeacher(examId, teacherIds);
+		if(!CollectionUtils.isEmpty(withExamAndTeacher)){
+			List<String> teacherNames = withExamAndTeacher.stream().map(e -> e.getTeacher().getRealName()).collect(Collectors.toList());
+			throw new BizException("{}教师已存在", teacherNames);
+		}
+		List<Teacher> teachers = teacherDao.getWithTeachers(teacherIds);
+		Map<Integer, Teacher> idTeacherMap = teachers.stream().collect(Collectors.toMap(Teacher::getUserId, t -> t));
+
+		List<ExamTeacherSalary> examTeacherSalaries=new ArrayList<>();
+		for (Integer teacherId : teacherIds) {
+			Teacher teacher = idTeacherMap.get(teacherId);
+			if(Objects.isNull(teacher)){
+				throw new BizException("教师信息异常");
+			}
+			ExamTeacherSalary ets=new ExamTeacherSalary();
+			ets.setExaminationBasicId(examId);
+			ets.setTeacherId(teacherId);
+			ets.setSettlementType(teacher.getSalarySettlementType());
+			ets.setShareProfitAmount(teacher.getSalary());
+			ets.setTotalSettlementCost(BigDecimal.ZERO);
+			ets.setTotalInvigilationStudentNum(0);
+			ets.setTotalInvigilationNum(0);
+			ets.setTenantId(TenantContextHolder.getTenantId().toString());
+			examTeacherSalaries.add(ets);
+		}
+		examTeacherSalaryDao.batchInsert(examTeacherSalaries);
+	}
+
+	@Override
+	public List<BaseUserInfoDto> getExamTeachers(Integer examId) {
+		if(Objects.isNull(examId)){
+			throw new BizException("请指定考级项目");
+		}
+		return examTeacherSalaryDao.getTeachersWithExam(examId);
+	}
+
+	@Override
+	public PageInfo<TeacherDto> getUnRelatedWithExamTeachers(ExamTeacherSalaryQueryInfo queryInfo) {
+		PageInfo<TeacherDto> pageInfo = new PageInfo<>(queryInfo.getPage(), queryInfo.getRows());
+		Map<String, Object> params = new HashMap<String, Object>();
+		MapUtil.populateMap(params, queryInfo);
+
+		List<TeacherDto> dataList = new ArrayList<>();
+		int count = examTeacherSalaryDao.countUnRelatedWithExamTeachers(params);
+		if (count > 0) {
+			pageInfo.setTotal(count);
+			params.put("offset", pageInfo.getOffset());
+			dataList = examTeacherSalaryDao.queryUnRelatedWithExamTeachers(params);
+			List<Integer> subjectIds=new ArrayList<>();
+			for (TeacherDto teacher : dataList) {
+				if(StringUtils.isBlank(teacher.getSubjectIdList())){
+					continue;
+				}
+				for (String subjectId : teacher.getSubjectIdList().split(",")) {
+					if(!subjectIds.contains(Integer.valueOf(subjectId))){
+						subjectIds.add(Integer.valueOf(subjectId));
+					}
+				}
+			}
+			if(!CollectionUtils.isEmpty(subjectIds)){
+				Map<Integer, String> subjectIdNameMap = this.getMap("subject", "id_", "name_", subjectIds, Integer.class, String.class);
+				for (TeacherDto teacher : dataList) {
+					if(StringUtils.isBlank(teacher.getSubjectIdList())){
+						continue;
+					}
+					List<String> subjectNames=new ArrayList<>();
+					for (String subjectId : teacher.getSubjectIdList().split(",")) {
+						String subjectName = subjectIdNameMap.get(Integer.valueOf(subjectId));
+						if(StringUtils.isNotBlank(subjectName)){
+							subjectNames.add(subjectName);
+						}
+					}
+					teacher.setSubjectNames(StringUtils.join(subjectNames, ","));
+				}
+			}
+		}
+
+		pageInfo.setRows(dataList);
+		return pageInfo;
+	}
 }

+ 13 - 0
edu-user/edu-user-server/src/main/resources/config/mybatis/ExamRoomMapper.xml

@@ -45,6 +45,19 @@
 		#{examStartTime},#{examEndTime},#{delFlag},#{organId},#{examPlanPushFlag,typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler},
 		#{examRoomStudentNum},NOW(),NOW(),#{tenantId})
 	</insert>
+
+	<insert id="batchInsert" parameterType="com.keao.edu.user.api.entity.ExamRoom" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
+		INSERT INTO exam_room (examination_basic_id_,exam_mode_,exam_location_id_,subject_id_list_,main_teacher_user_id_,
+		assistant_teacher_user_id_list_,exam_start_time_,exam_end_time_,del_flag_,organ_id_,exam_plan_push_flag_,
+		exam_room_student_num_,create_time_,update_time_,tenant_id_)
+		VALUES
+		<foreach collection="examRooms" item="examRoom" separator=",">
+			(#{examRoom.examinationBasicId},#{examRoom.examMode,typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler},#{examRoom.examLocationId},
+			#{examRoom.subjectIdList},#{examRoom.mainTeacherUserId},#{examRoom.assistantTeacherUserIdList},
+			#{examRoom.examStartTime},#{examRoom.examEndTime},#{examRoom.delFlag},#{examRoom.organId},#{examRoom.examPlanPushFlag,typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler},
+			#{examRoom.examRoomStudentNum},NOW(),NOW(),#{examRoom.tenantId})
+		</foreach>
+	</insert>
 	
 	<!-- 根据主键查询一条记录 -->
 	<update id="update" parameterType="com.keao.edu.user.api.entity.ExamRoom">

+ 59 - 2
edu-user/edu-user-server/src/main/resources/config/mybatis/ExamTeacherSalaryMapper.xml

@@ -19,7 +19,7 @@
 		<result column="create_time_" property="createTime" />
 		<result column="update_time_" property="updateTime" />
 		<result column="tenant_id_" property="tenantId" />
-		<association property="teacher" columnPrefix="teacher_" resultMap="com.keao.edu.auth.dal.dao.SysUserDao.SysUser"/>
+		<association property="teacher" columnPrefix="teacher_" resultMap="com.keao.edu.user.dao.SysUserDao.SysUser"/>
  	</resultMap>
 	
 	<!-- 根据主键查询一条记录 -->
@@ -39,6 +39,17 @@
 		VALUES(#{id},#{examinationBasicId},#{examMode,typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler},#{teacherId},#{settlementType,typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler},#{shareProfitAmount},
 		#{totalInvigilationNum},#{totalInvigilationStudentNum},#{totalSettlementCost},NOW(),NOW(),#{tenantId})
 	</insert>
+
+	<insert id="batchInsert" parameterType="com.keao.edu.user.entity.ExamTeacherSalary" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
+		INSERT INTO exam_teacher_salary (examination_basic_id_,exam_mode_,teacher_id_,settlement_type_,share_profit_amount_,
+		total_invigilation_num_,total_invigilation_student_num_,total_settlement_fee_,create_time_,update_time_,tenant_id_)
+		VALUES
+		<foreach collection="examTeacherSalaries" item="ets" separator=",">
+			(#{ets.examinationBasicId},#{ets.examMode,typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler},#{ets.teacherId},
+			#{ets.settlementType,typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler},#{ets.shareProfitAmount},
+			#{ets.totalInvigilationNum},#{ets.totalInvigilationStudentNum},#{ets.totalSettlementCost},NOW(),NOW(),#{ets.tenantId})
+		</foreach>
+	</insert>
 	
 	<!-- 根据主键查询一条记录 -->
 	<update id="update" parameterType="com.keao.edu.user.entity.ExamTeacherSalary">
@@ -118,7 +129,7 @@
 
 	<sql id="queryPageCondition">
 		<where>
-			examination_basic_id_ = #{examinationBasicId}
+			examination_basic_id_ = #{examId}
 		</where>
 	</sql>
 	
@@ -135,7 +146,53 @@
 		SELECT COUNT(*) FROM exam_teacher_salary ets
 		<include refid="queryPageCondition"/>
 	</select>
+
     <select id="queryWithExam" resultMap="ExamTeacherSalary">
 		SELECT * FROM exam_teacher_salary WHERE examination_basic_id_=#{examId}
 	</select>
+
+    <select id="getTeachersWithExam" resultMap="com.keao.edu.user.dao.SysUserDao.BaseUserInfoDto">
+		SELECT <include refid="com.keao.edu.user.dao.SysUserDao.BaseUserColumns"/>
+		FROM exam_teacher_salary ets
+		LEFT JOIN sys_user sys_user ON ets.teacher_id_=sys_user.id_
+		WHERE ets.examination_basic_id_=#{examId}
+	</select>
+
+	<select id="getWithExamAndTeacher" resultMap="ExamTeacherSalary">
+		SELECT ets.*,su.real_name_ teacher_real_name_ FROM exam_teacher_salary ets
+		LEFT JOIN sys_user su ON ets.teacher_id_=su.id_
+		WHERE ets.examination_basic_id_=#{examId} AND ets.teacher_id_ IN
+		<foreach collection="teacherIds" item="teacherId" separator="," open="(" close=")">
+			#{teacherId}
+		</foreach>
+	</select>
+
+	<sql id="queryUnRelatedWithExamTeachersCondition">
+		<where>
+			t.tenant_id_=#{tenantId}
+			AND NOT EXISTS ( SELECT teacher_id_ FROM exam_teacher_salary WHERE teacher_id_ = t.user_id_ AND examination_basic_id_ = #{examId} )
+		</where>
+	</sql>
+
+	<select id="queryUnRelatedWithExamTeachers" resultMap="com.keao.edu.user.dao.TeacherDao.TeacherDto">
+		SELECT
+			t.*,
+			su.real_name_ teacher_real_name_
+		FROM
+			teacher t
+			LEFT JOIN sys_user su ON t.user_id_ = su.id_
+		<include refid="queryUnRelatedWithExamTeachersCondition"/>
+		ORDER BY t.user_id_
+		<include refid="global.limit"/>
+	</select>
+
+	<select id="countUnRelatedWithExamTeachers" resultType="int">
+		SELECT
+			COUNT(t.user_id_)
+		FROM
+			teacher t
+			LEFT JOIN sys_user su ON t.user_id_ = su.id_
+		<include refid="queryUnRelatedWithExamTeachersCondition"/>
+	</select>
+
 </mapper>

+ 11 - 0
edu-user/edu-user-server/src/main/resources/config/mybatis/SysUserMapper.xml

@@ -32,6 +32,17 @@
         <result column="tenant_id_" property="tenantId"/>
     </resultMap>
 
+    <resultMap id="BaseUserInfoDto" type="com.keao.edu.user.dto.BaseUserInfoDto">
+        <result column="id_" property="id"/>
+        <result column="real_name_" property="realName"/>
+        <result column="phone_" property="phone"/>
+        <result column="avatar_" property="avatar"/>
+    </resultMap>
+
+    <sql id="BaseUserColumns">
+        sys_user.id_,sys_user.real_name_,sys_user.phone_,sys_user.avatar_
+    </sql>
+
     <!-- 查询条件 -->
     <sql id="queryCondition">
         tenant_id_ = #{tenantId}

+ 12 - 1
edu-user/edu-user-server/src/main/resources/config/mybatis/TeacherMapper.xml

@@ -19,7 +19,11 @@
 		<result column="create_time_" property="createTime" />
 		<result column="update_time_" property="updateTime" />
 		<result column="tenant_id_" property="tenantId" />
-		<association property="sysUser" resultMap="com.keao.edu.user.dao.SysUserDao.SysUser"/>
+		<association property="sysUser" columnPrefix="teacher_" resultMap="com.keao.edu.user.dao.SysUserDao.SysUser"/>
+	</resultMap>
+
+	<resultMap id="TeacherDto" type="com.keao.edu.user.dto.TeacherDto" extends="Teacher">
+		<result property="subjectNames" column="subject_names_"/>
 	</resultMap>
 
 	<select id="get" resultMap="Teacher">
@@ -105,4 +109,11 @@
 		LEFT JOIN sys_user su ON t.user_id_ = su.id_
 		<include refid="teacherQueryPage"/>
 	</select>
+
+    <select id="getWithTeachers" resultMap="Teacher">
+		SELECT * FROM teacher WHERE user_id_ IN
+		<foreach collection="teacherIds" item="teacherId" separator=",">
+			(#{teacherId})
+		</foreach>
+	</select>
 </mapper>