zouxuan 5 år sedan
förälder
incheckning
e3846c285f

+ 5 - 11
edu-user/edu-user-server/src/main/java/com/keao/edu/user/controller/ExamCertificationController.java

@@ -2,22 +2,16 @@ 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.common.page.QueryInfo;
 import com.keao.edu.user.dto.ExamCertificationDto;
 import com.keao.edu.user.dto.NeedCheckingDetailDto;
-import com.keao.edu.user.entity.ExamCertification;
-import com.keao.edu.user.entity.ExamLocation;
-import com.keao.edu.user.page.ExamCertificationQueryInfo;
 import com.keao.edu.user.service.ExamCertificationService;
-import com.keao.edu.user.service.ExamLocationService;
 import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
 
-import java.util.Date;
 import java.util.List;
 
 @RestController
@@ -42,7 +36,7 @@ public class ExamCertificationController extends BaseController {
 
     @ApiOperation("学生端待考详情")
     @GetMapping(value = "needCheckingDetail")
-    public HttpResponseResult<NeedCheckingDetailDto> needCheckingDetail(Long examRegistrationId,Integer recordFlag) {
-        return succeed(examCertificationService.needCheckingDetail(examRegistrationId,recordFlag));
+    public HttpResponseResult<NeedCheckingDetailDto> needCheckingDetail(Long examRegistrationId) {
+        return succeed(examCertificationService.needCheckingDetail(examRegistrationId));
     }
 }

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

@@ -7,9 +7,11 @@ import com.keao.edu.common.entity.HttpResponseResult;
 import com.keao.edu.common.page.PageInfo;
 import com.keao.edu.user.api.entity.ExamRoom;
 import com.keao.edu.user.dto.ExamRoomDto;
+import com.keao.edu.user.dto.ExamRoomListDto;
 import com.keao.edu.user.dto.ExamRoomStatisticsDto;
 import com.keao.edu.user.entity.Employee;
 import com.keao.edu.user.entity.Teacher;
+import com.keao.edu.user.page.ExamRoomListQueryInfo;
 import com.keao.edu.user.page.ExamRoomQueryInfo;
 import com.keao.edu.user.service.EmployeeService;
 import com.keao.edu.user.service.ExamRoomService;
@@ -38,7 +40,7 @@ public class ExamRoomController extends BaseController {
 
     @ApiOperation("分页查询监考列表")
     @GetMapping(value = "/list")
-    public HttpResponseResult<PageInfo<ExamRoomDto>> getList(ExamRoomQueryInfo queryInfo) {
+    public HttpResponseResult<PageInfo<ExamRoomListDto>> getList(ExamRoomListQueryInfo queryInfo) {
         SysUser sysUser = sysUserFeignService.queryUserInfo();
         if(!sysUser.getIsSuperAdmin() && Objects.isNull(queryInfo.getOrganId())){
             Teacher teacher = teacherService.get(sysUser.getId());

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

@@ -4,6 +4,7 @@ package com.keao.edu.user.dao;
 import com.keao.edu.common.dal.BaseDAO;
 import com.keao.edu.user.api.entity.ExamRoom;
 import com.keao.edu.user.dto.ExamRoomDto;
+import com.keao.edu.user.dto.ExamRoomListDto;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
@@ -27,7 +28,7 @@ public interface ExamRoomDao extends BaseDAO<Long, ExamRoom> {
      * @param params
      * @return
      */
-    List<ExamRoomDto> queryExamRoomPage(Map<String, Object> params);
+    List<ExamRoomListDto> queryExamRoomPage(Map<String, Object> params);
 
     /**
      * @describe 获取考级教师列表

+ 8 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/dao/ExamRoomStudentRelationDao.java

@@ -8,6 +8,7 @@ import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 
 public interface ExamRoomStudentRelationDao extends BaseDAO<Long, ExamRoomStudentRelation> {
 
@@ -156,4 +157,11 @@ public interface ExamRoomStudentRelationDao extends BaseDAO<Long, ExamRoomStuden
      * @return
      */
     List<Map<Integer, String>> getStuRegistrationMap(Long examRoomId);
+
+    /**
+     * 获取房间学员数
+     * @param roomIds
+     * @return
+     */
+    List<Map<Long,Integer>> getStudentNumMap(@Param("roomIds") Set<Long> roomIds);
 }

+ 138 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/dto/ExamRoomListDto.java

@@ -0,0 +1,138 @@
+package com.keao.edu.user.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+
+public class ExamRoomListDto{
+
+    @ApiModelProperty(value = "考试名称")
+    private String examName;
+
+    @ApiModelProperty(value = "结束时间")
+    private String examEndTime;
+
+    @ApiModelProperty(value = "开始时间")
+    private String examStartTime;
+
+    @ApiModelProperty(value = "教室编号")
+    private Long examRoomId;
+
+    @ApiModelProperty(value = "专业")
+    private String subjectNameList;
+
+    @ApiModelProperty(value = "考生人数")
+    private Integer studentNum;
+
+    @ApiModelProperty(value = "主考老师")
+    private  String mainTeacherUserName;
+
+    @ApiModelProperty(value = "主考老师编号")
+    private String getMainTeacherUserId;
+
+    @ApiModelProperty(value = "助教老师")
+    private String assistantTeacherUserIdList;
+
+    @ApiModelProperty(value = "助教老师编号")
+    private String assistantTeacherUserNameList;
+
+    @ApiModelProperty(value = "考试状态")
+    private String examBaseStatus;
+
+    @ApiModelProperty(value = "考场状态")
+    private Integer openFlag;
+
+    public String getExamName() {
+        return examName;
+    }
+
+    public void setExamName(String examName) {
+        this.examName = examName;
+    }
+
+    public String getExamEndTime() {
+        return examEndTime;
+    }
+
+    public void setExamEndTime(String examEndTime) {
+        this.examEndTime = examEndTime;
+    }
+
+    public String getExamStartTime() {
+        return examStartTime;
+    }
+
+    public void setExamStartTime(String examStartTime) {
+        this.examStartTime = examStartTime;
+    }
+
+    public Long getExamRoomId() {
+        return examRoomId;
+    }
+
+    public void setExamRoomId(Long examRoomId) {
+        this.examRoomId = examRoomId;
+    }
+
+    public String getSubjectNameList() {
+        return subjectNameList;
+    }
+
+    public void setSubjectNameList(String subjectNameList) {
+        this.subjectNameList = subjectNameList;
+    }
+
+    public Integer getStudentNum() {
+        return studentNum;
+    }
+
+    public void setStudentNum(Integer studentNum) {
+        this.studentNum = studentNum;
+    }
+
+    public String getMainTeacherUserName() {
+        return mainTeacherUserName;
+    }
+
+    public void setMainTeacherUserName(String mainTeacherUserName) {
+        this.mainTeacherUserName = mainTeacherUserName;
+    }
+
+    public String getGetMainTeacherUserId() {
+        return getMainTeacherUserId;
+    }
+
+    public void setGetMainTeacherUserId(String getMainTeacherUserId) {
+        this.getMainTeacherUserId = getMainTeacherUserId;
+    }
+
+    public String getAssistantTeacherUserIdList() {
+        return assistantTeacherUserIdList;
+    }
+
+    public void setAssistantTeacherUserIdList(String assistantTeacherUserIdList) {
+        this.assistantTeacherUserIdList = assistantTeacherUserIdList;
+    }
+
+    public String getAssistantTeacherUserNameList() {
+        return assistantTeacherUserNameList;
+    }
+
+    public void setAssistantTeacherUserNameList(String assistantTeacherUserNameList) {
+        this.assistantTeacherUserNameList = assistantTeacherUserNameList;
+    }
+
+    public String getExamBaseStatus() {
+        return examBaseStatus;
+    }
+
+    public void setExamBaseStatus(String examBaseStatus) {
+        this.examBaseStatus = examBaseStatus;
+    }
+
+    public Integer getOpenFlag() {
+        return openFlag;
+    }
+
+    public void setOpenFlag(Integer openFlag) {
+        this.openFlag = openFlag;
+    }
+}

+ 42 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/page/ExamRoomListQueryInfo.java

@@ -0,0 +1,42 @@
+package com.keao.edu.user.page;
+
+import com.keao.edu.common.page.QueryInfo;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.util.Date;
+
+public class ExamRoomListQueryInfo extends QueryInfo {
+
+    @ApiModelProperty(value = "开始时间")
+    private String startTime;
+
+    @ApiModelProperty(value = "结束时间")
+    private String endTime;
+
+    @ApiModelProperty(value = "考试状态")
+    private String examBaseStatus;
+
+    public String getStartTime() {
+        return startTime;
+    }
+
+    public void setStartTime(String startTime) {
+        this.startTime = startTime;
+    }
+
+    public String getEndTime() {
+        return endTime;
+    }
+
+    public void setEndTime(String endTime) {
+        this.endTime = endTime;
+    }
+
+    public String getExamBaseStatus() {
+        return examBaseStatus;
+    }
+
+    public void setExamBaseStatus(String examBaseStatus) {
+        this.examBaseStatus = examBaseStatus;
+    }
+}

+ 1 - 1
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/ExamCertificationService.java

@@ -32,7 +32,7 @@ public interface ExamCertificationService extends BaseService<Long, ExamCertific
      * @param examRegistrationId
      * @return
      */
-    NeedCheckingDetailDto needCheckingDetail(Long examRegistrationId,Integer recordFlag);
+    NeedCheckingDetailDto needCheckingDetail(Long examRegistrationId);
 
     /**
      * 获取后台准考证详情

+ 3 - 1
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/ExamRoomService.java

@@ -5,7 +5,9 @@ import com.keao.edu.common.page.PageInfo;
 import com.keao.edu.common.service.BaseService;
 import com.keao.edu.user.api.entity.ExamRoom;
 import com.keao.edu.user.dto.ExamRoomDto;
+import com.keao.edu.user.dto.ExamRoomListDto;
 import com.keao.edu.user.dto.ExamRoomStatisticsDto;
+import com.keao.edu.user.page.ExamRoomListQueryInfo;
 import com.keao.edu.user.page.ExamRoomQueryInfo;
 
 import java.util.List;
@@ -17,7 +19,7 @@ public interface ExamRoomService extends BaseService<Long, ExamRoom> {
      * @param queryInfo
      * @return
      */
-    PageInfo<ExamRoomDto> queryExamRoomPage(ExamRoomQueryInfo queryInfo);
+    PageInfo<ExamRoomListDto> queryExamRoomPage(ExamRoomListQueryInfo queryInfo);
 
     /**
      * @describe 获取考级项目教室列表

+ 1 - 11
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/ExamCertificationServiceImpl.java

@@ -8,12 +8,10 @@ import com.keao.edu.common.service.impl.BaseServiceImpl;
 import com.keao.edu.user.api.entity.Student;
 import com.keao.edu.user.dao.ExamCertificationDao;
 import com.keao.edu.user.dao.ExamRoomStudentRelationDao;
-import com.keao.edu.user.dao.StudentExamResultDao;
 import com.keao.edu.user.dao.SubjectDao;
 import com.keao.edu.user.dto.ExamCertificationDto;
 import com.keao.edu.user.dto.NeedCheckingDetailDto;
 import com.keao.edu.user.entity.ExamCertification;
-import com.keao.edu.user.entity.StudentExamResult;
 import com.keao.edu.user.entity.Subject;
 import com.keao.edu.user.service.ExamCertificationService;
 import com.keao.edu.user.service.StudentService;
@@ -38,8 +36,6 @@ public class ExamCertificationServiceImpl extends BaseServiceImpl<Long, ExamCert
 	private SysUserFeignService sysUserFeignService;
 	@Autowired
 	private StudentService studentService;
-	@Autowired
-	private StudentExamResultDao studentExamResultDao;
 
 	@Override
 	public BaseDAO<Long, ExamCertification> getDAO() {
@@ -72,13 +68,7 @@ public class ExamCertificationServiceImpl extends BaseServiceImpl<Long, ExamCert
 
 	@Override
 	@Transactional(rollbackFor = Exception.class)
-	public NeedCheckingDetailDto needCheckingDetail(Long examRegistrationId,Integer recordFlag) {
-		if(recordFlag != null && recordFlag == 1){
-			StudentExamResult studentExamResult = studentExamResultDao.findByRegistrationId(examRegistrationId);
-			studentExamResult.setRecordFlag(recordFlag);
-			studentExamResultDao.update(studentExamResult);
-		}
-
+	public NeedCheckingDetailDto needCheckingDetail(Long examRegistrationId) {
 		NeedCheckingDetailDto needCheckingDetailDto = examCertificationDao.needCheckingDetail(examRegistrationId);
 		//等待学员数
 		String signInTime = needCheckingDetailDto.getSignInTime();

+ 15 - 5
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/ExamRoomServiceImpl.java

@@ -20,11 +20,13 @@ import com.keao.edu.user.api.entity.ExamRoomStudentRelation;
 import com.keao.edu.user.api.enums.ExamModeEnum;
 import com.keao.edu.user.dao.*;
 import com.keao.edu.user.dto.ExamRoomDto;
+import com.keao.edu.user.dto.ExamRoomListDto;
 import com.keao.edu.user.dto.ExamRoomStatisticsDto;
 import com.keao.edu.user.entity.ExamLifecycleLog;
 import com.keao.edu.user.entity.ExamOrganizationRelation;
 import com.keao.edu.user.entity.ExamRegistration;
 import com.keao.edu.user.entity.ExaminationBasic;
+import com.keao.edu.user.page.ExamRoomListQueryInfo;
 import com.keao.edu.user.page.ExamRoomQueryInfo;
 import com.keao.edu.user.service.ExamRoomService;
 import com.keao.edu.user.service.ExamRoomStudentRelationService;
@@ -85,20 +87,28 @@ public class ExamRoomServiceImpl extends BaseServiceImpl<Long, ExamRoom> impleme
 	}
 
 	@Override
-	public PageInfo<ExamRoomDto> queryExamRoomPage(ExamRoomQueryInfo queryInfo) {
-		PageInfo<ExamRoomDto> pageInfo = new PageInfo<>(queryInfo.getPage(), queryInfo.getRows());
+	public PageInfo<ExamRoomListDto> queryExamRoomPage(ExamRoomListQueryInfo queryInfo) {
+		PageInfo<ExamRoomListDto> pageInfo = new PageInfo<>(queryInfo.getPage(), queryInfo.getRows());
 		Map<String, Object> params = new HashMap<>();
 		MapUtil.populateMap(params, queryInfo);
 
-		List<Integer> childOrganIds = organizationService.getChildOrganIds(queryInfo.getOrganId(), true);
-		params.put("organIds", childOrganIds);
+//		List<Integer> childOrganIds = organizationService.getChildOrganIds(queryInfo.getOrganId(), true);
+//		params.put("organIds", childOrganIds);
+		SysUser sysUser = sysUserFeignService.queryUserInfo();
+		params.put("teacherId",sysUser.getId());
 
-		List<ExamRoomDto> dataList = null;
+		List<ExamRoomListDto> dataList = null;
 		int count = examRoomDao.countExamRoomPage(params);
 		if (count > 0) {
 			pageInfo.setTotal(count);
 			params.put("offset", pageInfo.getOffset());
 			dataList = examRoomDao.queryExamRoomPage(params);
+			//获取考试学员数
+			Set<Long> roomIds = dataList.stream().map(e -> e.getExamRoomId()).collect(Collectors.toSet());
+			Map<Long, Integer> convertMybatisMap = MapUtil.convertMybatisMap(examRoomStudentRelationDao.getStudentNumMap(roomIds), Long.class, Integer.class);
+			dataList.forEach(e->{
+				e.setStudentNum(convertMybatisMap.get(e.getExamRoomId()));
+			});
 		}
 		if (count == 0) {
 			dataList = new ArrayList<>();

+ 9 - 7
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/ExamRoomStudentRelationServiceImpl.java

@@ -271,13 +271,15 @@ public class ExamRoomStudentRelationServiceImpl extends BaseServiceImpl<Long, Ex
 	}
 
 	@Override
+	@Transactional(rollbackFor = Exception.class)
 	public void recorded(Long nextExamRoomStudentRelationId, Long examRoomStudentRelationId, Long roomId) {
 		if(examRoomStudentRelationId != null){
 			ExamRoomStudentRelation examRoomStudentRelation = examRoomStudentRelationDao.get(examRoomStudentRelationId);
-			//将当前学员退出教室并添加参考状态,如果考试未完成,清除签到时间,重新签到
-			//关闭学员房间入口
 			examRoomStudentRelation.setClassroomSwitch(0);
 			examRoomStudentRelationDao.update(examRoomStudentRelation);
+			StudentExamResult byRegistrationId = studentExamResultDao.findByRegistrationId(examRoomStudentRelation.getExamRegistrationId());
+			byRegistrationId.setRecordFlag(1);
+			studentExamResultDao.update(byRegistrationId);
 			publishMessage(examRoomStudentRelation,MemberChangedMessage.Action_Recorded,true);
 		}
 		nextStudent(nextExamRoomStudentRelationId,false);
@@ -292,7 +294,7 @@ public class ExamRoomStudentRelationServiceImpl extends BaseServiceImpl<Long, Ex
 		studentExamResult.setRecordStartTime(new Date());
 		studentExamResultDao.update(studentExamResult);*/
 		//返回详情数据
-		return examCertificationService.needCheckingDetail(examRegistrationId,1);
+		return examCertificationService.needCheckingDetail(examRegistrationId);
 	}
 
 	@Override
@@ -301,7 +303,7 @@ public class ExamRoomStudentRelationServiceImpl extends BaseServiceImpl<Long, Ex
 		//清除排队状态
 		examRoomStudentRelationDao.cleanSignInTime(examRegistrationId);
 		//返回详情数据
-		return examCertificationService.needCheckingDetail(examRegistrationId,null);
+		return examCertificationService.needCheckingDetail(examRegistrationId);
 	}
 
 	@Override
@@ -427,7 +429,7 @@ public class ExamRoomStudentRelationServiceImpl extends BaseServiceImpl<Long, Ex
 		publishMessageDto.setRoomId(examRoomStudentRelation.getExamRoomId().toString());
 		MemberChangedMessage msg = new MemberChangedMessage(action, userId,3);
 //		String jsonString = JSONObject.toJSONString(examCertificationService.needCheckingDetail(examRoomStudentRelation.getExamRegistrationId()));
-		NeedCheckingDetailDto needCheckingDetailDto = examCertificationService.needCheckingDetail(examRoomStudentRelation.getExamRegistrationId(),null);
+		NeedCheckingDetailDto needCheckingDetailDto = examCertificationService.needCheckingDetail(examRoomStudentRelation.getExamRegistrationId());
 		msg.setWaitNum(needCheckingDetailDto.getWaitNum());
 		msg.setClassroomSwitch(needCheckingDetailDto.getClassroomSwitch());
 //		msg.setAppParamJson(jsonString);
@@ -449,7 +451,7 @@ public class ExamRoomStudentRelationServiceImpl extends BaseServiceImpl<Long, Ex
 		MemberChangedMessage msg = new MemberChangedMessage(MemberChangedMessage.Student_Queue, userId,3);
 //		String jsonString = JSONObject.toJSONString(examCertificationService.needCheckingDetail(examRoomStudentRelation.getExamRegistrationId()));
 //		msg.setAppParamJson(jsonString);
-		NeedCheckingDetailDto needCheckingDetailDto = examCertificationService.needCheckingDetail(examRoomStudentRelation.getExamRegistrationId(),null);
+		NeedCheckingDetailDto needCheckingDetailDto = examCertificationService.needCheckingDetail(examRoomStudentRelation.getExamRegistrationId());
 		msg.setWaitNum(needCheckingDetailDto.getWaitNum());
 		msg.setClassroomSwitch(needCheckingDetailDto.getClassroomSwitch());
 		Map<String,Object> paramMap = new HashMap<>(2);
@@ -493,7 +495,7 @@ public class ExamRoomStudentRelationServiceImpl extends BaseServiceImpl<Long, Ex
 		publishMessageDto.setRoomId(studentExamRoom.getExamRoomId().toString());
 		MemberChangedMessage msg = new MemberChangedMessage(MemberChangedMessage.Student_Queue, userId,3);
 //		String jsonString = JSONObject.toJSONString(examCertificationService.needCheckingDetail(examRegistrationId));
-		NeedCheckingDetailDto needCheckingDetailDto = examCertificationService.needCheckingDetail(examRegistrationId,null);
+		NeedCheckingDetailDto needCheckingDetailDto = examCertificationService.needCheckingDetail(examRegistrationId);
 //		msg.setAppParamJson(needCheckingDetailDto.getWaitNum());
 		msg.setWaitNum(needCheckingDetailDto.getWaitNum());
 		publishMessageDto.setMemberChangedMessage(msg);

+ 1 - 1
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/OrganizationServiceImpl.java

@@ -144,7 +144,7 @@ public class OrganizationServiceImpl extends BaseServiceImpl<Integer, Organizati
 				employee.setTenantId(organ.getTenantId());
 				employee.setEmployeeType("ORGAN");
 				employeeDao.update(employee);
-				organ.setParentOrganIdTag(currentOrganization.getParentOrganIdTag() + "," + organ.getId());
+				organ.setParentOrganIdTag(currentOrganization.getParentOrganIdTag() + "," + organization.getId());
 				organ.setDelFlag(YesOrNoEnum.NO);
 				organ.setId(organization.getId());
 				organDao.update(organ);

+ 37 - 17
edu-user/edu-user-server/src/main/resources/config/mybatis/ExamRoomMapper.xml

@@ -293,25 +293,45 @@
 		<association property="examLocation" columnPrefix="el_" resultMap="com.keao.edu.user.dao.ExamLocationDao.ExamLocation"/>
 		<association property="examinationBasic" columnPrefix="exam_" resultMap="com.keao.edu.user.dao.ExaminationBasicDao.ExaminationBasic"/>
 	</resultMap>
-	
-    <select id="countExamRoomPage" resultType="java.lang.Integer">
-		SELECT COUNT(er.id_) FROM exam_room er
-		LEFT JOIN exam_location el ON er.exam_location_id_ = el.id_ AND er.tenant_id_ = el.tenant_id_
-		LEFT JOIN examination_basic eb ON FIND_IN_SET(er.exam_location_id_,eb.exam_location_id_list_) AND er.tenant_id_ = eb.tenant_id_
-		<include refid="queryExamRoomPageSql"/>
+
+	<resultMap id="ExamRoomListDtoMap" type="com.keao.edu.user.dto.ExamRoomListDto">
+		<result property="examEndTime" column="exam_end_time_"/>
+		<result property="examStartTime" column="exam_start_time_"/>
+		<result property="openFlag" column="open_flag_"/>
+		<result property="examRoomId" column="exam_room_id_"/>
+		<result property="assistantTeacherUserIdList" column="assistant_teacher_user_id_list_"/>
+		<result property="assistantTeacherUserNameList" column="assistant_teacher_user_name_list_"/>
+		<result property="examBaseStatus" column="exam_base_status_"/>
+		<result property="examName" column="exam_name_"/>
+		<result property="getMainTeacherUserId" column="main_teacher_user_id_"/>
+		<result property="mainTeacherUserName" column="main_teacher_user_name_"/>
+		<result property="subjectNameList" column="subject_name_list_"/>
+	</resultMap>
+	<sql id="queryExamRoomPageListSql">
+		<where>
+			(er.main_teacher_user_id_ = #{teacherId} OR FIND_IN_SET(#{teacherId},er.assistant_teacher_user_id_list_))
+			<if test="startTime != null and startTime != ''">
+				AND DATE_FORMAT(er.exam_end_time_,'%Y-%m-%d') BETWEEN #{startTime} AND #{endTime}
+			</if>
+			<if test="examBaseStatus != null and examBaseStatus != ''">
+				AND eb.status_ = #{examBaseStatus}
+			</if>
+		</where>
+	</sql>
+	<select id="countExamRoomPage" resultType="java.lang.Integer">
+		SELECT COUNT(er.id_)
+		FROM exam_room er
+		LEFT JOIN examination_basic eb ON er.examination_basic_id_ = eb.id_
+		<include refid="queryExamRoomPageListSql"/>
 	</select>
-	
-	<select id="queryExamRoomPage" resultMap="ExamRoomDto">
-		SELECT
-			er.*,
-			el.id_ el_id_,
-			el.name_ el_name_,
-			eb.name_ exam_name_
+	<select id="queryExamRoomPage" resultMap="ExamRoomListDtoMap">
+		SELECT eb.name_ exam_name_,er.exam_end_time_,er.exam_start_time_,
+		er.id_ exam_room_id_,er.subject_name_list_,er.main_teacher_user_name_,er.main_teacher_user_id_,
+		er.assistant_teacher_user_id_list_,er.assistant_teacher_user_name_list_,eb.status_ exam_base_status_,er.open_flag_
 		FROM exam_room er
-		LEFT JOIN exam_location el ON er.exam_location_id_ = el.id_ AND er.tenant_id_ = el.tenant_id_
-		LEFT JOIN examination_basic eb ON FIND_IN_SET(er.exam_location_id_,eb.exam_location_id_list_) AND er.tenant_id_ = eb.tenant_id_
-		<include refid="queryExamRoomPageSql"/>
-		ORDER BY eb.expect_exam_start_time_ DESC
+		LEFT JOIN examination_basic eb ON er.examination_basic_id_ = eb.id_
+		<include refid="queryExamRoomPageListSql"/>
+		ORDER BY eb.exam_start_time_ DESC
 		<include refid="global.limit"/>
 	</select>
 

+ 9 - 0
edu-user/edu-user-server/src/main/resources/config/mybatis/ExamRoomStudentRelationMapper.xml

@@ -274,4 +274,13 @@
 			LEFT JOIN exam_room er ON ersr.exam_room_id_ = er.id_
 		WHERE DATE_FORMAT(er.exam_start_time_,'%Y-%m-%d') = #{day}
 	</select>
+    <select id="getStudentNumMap" resultType="java.util.Map">
+		SELECT ersr.exam_room_id_ 'key',COUNT(DISTINCT ersr.student_id_) 'value'
+		FROM exam_room_student_relation ersr
+		WHERE ersr.exam_room_id_ IN
+		<foreach collection="roomIds" open="(" close=")" separator="," item="item">
+			#{item}
+		</foreach>
+		GROUP BY ersr.exam_room_id_
+	</select>
 </mapper>