Joburgess vor 5 Jahren
Ursprung
Commit
87032f15a2

+ 8 - 0
edu-auth/edu-auth-api/src/main/java/com/keao/edu/auth/api/entity/SysUser.java

@@ -99,6 +99,14 @@ public class SysUser implements Serializable{
 
 	private String tenantId;
 
+	public SysUser() {
+	}
+
+	public SysUser(Integer id, String realName) {
+		this.id = id;
+		this.realName = realName;
+	}
+
 	public String getTenantId() {
 		return tenantId;
 	}

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

@@ -9,6 +9,8 @@ public class ExamRoom {
 
 	/**  */
 	private Long id;
+
+	private Integer examinationBasicId;
 	
 	/** 考试模式(线上/线下) */
 	private String examMode;
@@ -47,7 +49,15 @@ public class ExamRoom {
 	public Long getId(){
 		return this.id;
 	}
-			
+
+	public Integer getExaminationBasicId() {
+		return examinationBasicId;
+	}
+
+	public void setExaminationBasicId(Integer examinationBasicId) {
+		this.examinationBasicId = examinationBasicId;
+	}
+
 	public void setExamMode(String examMode){
 		this.examMode = examMode;
 	}

+ 22 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/controller/ExamRoomStudentRelationController.java

@@ -4,7 +4,9 @@ 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.ExamRoomStudentRelationDto;
 import com.keao.edu.user.entity.ExamRoomStudentRelation;
+import com.keao.edu.user.page.ExamRoomStudentRelationQueryInfo;
 import com.keao.edu.user.service.ExamRoomStudentRelationService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiModelProperty;
@@ -29,4 +31,24 @@ public class ExamRoomStudentRelationController extends BaseController {
         examRoomStudentRelationService.switchClassRoom(openFlag,examinationBasicId,studentId);
         return succeed();
     }
+
+    @ApiOperation("给教室分配学员")
+    @PostMapping(value = "/addStudentForRoom")
+    public HttpResponseResult addStudentForRoom(Long examRoomId, String studentIds){
+        examRoomStudentRelationService.addStudentForRoom(examRoomId, studentIds);
+        return succeed();
+    }
+
+    @ApiOperation("获取教室学员")
+    @GetMapping(value = "/findExamRoomStudents")
+    public HttpResponseResult<PageInfo<ExamRoomStudentRelationDto>> findExamRoomStudents(ExamRoomStudentRelationQueryInfo queryInfo){
+        return succeed(examRoomStudentRelationService.findExamRoomStudents(queryInfo));
+    }
+
+    @ApiOperation("删除指定教室学员")
+    @PostMapping(value = "/addStudentForRoom")
+    public HttpResponseResult deleteStudentFromRoom(Long examRoomId, String studentIds){
+        examRoomStudentRelationService.deleteStudentFromRoom(examRoomId, studentIds);
+        return succeed();
+    }
 }

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

@@ -1,11 +1,16 @@
 package com.keao.edu.user.dao;
 
 import com.keao.edu.common.dal.BaseDAO;
+import com.keao.edu.user.dto.ExamRoomStudentRelationDto;
 import com.keao.edu.user.entity.ExamRoomStudentRelation;
 import org.apache.ibatis.annotations.Param;
 
+import java.util.List;
+import java.util.Map;
+
 public interface ExamRoomStudentRelationDao extends BaseDAO<Long, ExamRoomStudentRelation> {
 
+    int batchInsert(@Param("roomStudents") List<ExamRoomStudentRelation> examRoomStudentRelations);
 
     /**
      * 开启/关闭教室
@@ -14,4 +19,28 @@ public interface ExamRoomStudentRelationDao extends BaseDAO<Long, ExamRoomStuden
      * @param studentId
      */
     void switchClassRoom(@Param("openFlag") Integer openFlag, @Param("examinationBasicId") Integer examinationBasicId, @Param("studentId") Integer studentId);
+
+    List<ExamRoomStudentRelationDto> findExamRoomStudents(Map<String, Object> params);
+    int countExamRoomStudents(Map<String, Object> params);
+
+    /**
+     * @describe 获取指定教室的学员
+     * @author Joburgess
+     * @date 2020.06.24
+     * @param examRoomId:
+     * @return java.util.List<com.keao.edu.user.entity.ExamRoomStudentRelation>
+     */
+    List<ExamRoomStudentRelation> findStudentsWithExamRoom(@Param("examRoomId") Long examRoomId);
+
+    /**
+     * @describe 删除指定教室的学员
+     * @author Joburgess
+     * @date 2020.06.24
+     * @param examRoomId:
+     * @param studentIds:
+     * @return int
+     */
+    int deleteStudentsFromExamRoom(@Param("examRoomId") Long examRoomId,
+                                    @Param("studentIds") List<Integer> studentIds);
+
 }

+ 47 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/dto/ExamRoomStudentRelationDto.java

@@ -0,0 +1,47 @@
+package com.keao.edu.user.dto;
+
+import com.keao.edu.auth.api.entity.SysUser;
+import com.keao.edu.user.entity.ExamRegistration;
+import com.keao.edu.user.entity.ExamRoomStudentRelation;
+import com.keao.edu.user.entity.Subject;
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * @Author Joburgess
+ * @Date 2020.06.24
+ */
+public class ExamRoomStudentRelationDto extends ExamRoomStudentRelation {
+
+    @ApiModelProperty(value = "学员详情")
+    private SysUser studentInfo;
+
+    @ApiModelProperty(value = "专业信息")
+    private Subject subject;
+
+    @ApiModelProperty(value = "报名信息")
+    private ExamRegistration examRegistration;
+
+    public SysUser getStudentInfo() {
+        return studentInfo;
+    }
+
+    public void setStudentInfo(SysUser studentInfo) {
+        this.studentInfo = studentInfo;
+    }
+
+    public Subject getSubject() {
+        return subject;
+    }
+
+    public void setSubject(Subject subject) {
+        this.subject = subject;
+    }
+
+    public ExamRegistration getExamRegistration() {
+        return examRegistration;
+    }
+
+    public void setExamRegistration(ExamRegistration examRegistration) {
+        this.examRegistration = examRegistration;
+    }
+}

+ 8 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/entity/Subject.java

@@ -38,6 +38,14 @@ public class Subject {
 
 	private String tenantId;
 
+	public Subject() {
+	}
+
+	public Subject(Integer id, String name) {
+		this.id = id;
+		this.name = name;
+	}
+
 	public String getTenantId() {
 		return tenantId;
 	}

+ 22 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/page/ExamRoomQueryInfo.java

@@ -8,6 +8,12 @@ import java.util.Date;
 
 public class ExamRoomQueryInfo extends QueryInfo {
 
+    @ApiModelProperty(value = "教室编号")
+    private Long examRoomId;
+
+    @ApiModelProperty(value = "考级项目编号")
+    private Date examId;
+
     @ApiModelProperty(value = "考试开始时间")
     private Date StartTime;
 
@@ -23,6 +29,22 @@ public class ExamRoomQueryInfo extends QueryInfo {
     @ApiModelProperty(value = "主考官")
     private Integer teacherId;
 
+    public Long getExamRoomId() {
+        return examRoomId;
+    }
+
+    public void setExamRoomId(Long examRoomId) {
+        this.examRoomId = examRoomId;
+    }
+
+    public Date getExamId() {
+        return examId;
+    }
+
+    public void setExamId(Date examId) {
+        this.examId = examId;
+    }
+
     public Date getStartTime() {
         return StartTime;
     }

+ 23 - 1
edu-user/edu-user-server/src/main/java/com/keao/edu/user/page/ExamRoomStudentRelationQueryInfo.java

@@ -9,9 +9,15 @@ import io.swagger.annotations.ApiModelProperty;
  */
 public class ExamRoomStudentRelationQueryInfo extends QueryInfo {
 
-    @ApiModelProperty(value = "教室编号")
+    @ApiModelProperty(value = "考级编号")
     private Long examId;
 
+    @ApiModelProperty(value = "教室编号")
+    private Long examRoomId;
+
+    @ApiModelProperty(value = "是否已经加入教室")
+    private Integer inRoom;
+
     public Long getExamId() {
         return examId;
     }
@@ -19,4 +25,20 @@ public class ExamRoomStudentRelationQueryInfo extends QueryInfo {
     public void setExamId(Long examId) {
         this.examId = examId;
     }
+
+    public Long getExamRoomId() {
+        return examRoomId;
+    }
+
+    public void setExamRoomId(Long examRoomId) {
+        this.examRoomId = examRoomId;
+    }
+
+    public Integer getInRoom() {
+        return inRoom;
+    }
+
+    public void setInRoom(Integer inRoom) {
+        this.inRoom = inRoom;
+    }
 }

+ 32 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/ExamRoomStudentRelationService.java

@@ -1,7 +1,10 @@
 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.ExamRoomStudentRelationDto;
 import com.keao.edu.user.entity.ExamRoomStudentRelation;
+import com.keao.edu.user.page.ExamRoomStudentRelationQueryInfo;
 
 public interface ExamRoomStudentRelationService extends BaseService<Long, ExamRoomStudentRelation> {
 
@@ -12,4 +15,33 @@ public interface ExamRoomStudentRelationService extends BaseService<Long, ExamRo
      * @param studentId
      */
     void switchClassRoom(Integer openFlag, Integer examinationBasicId, Integer studentId);
+
+    /**
+     * @describe 给教室分配学员
+     * @author Joburgess
+     * @date 2020.06.24
+     * @param examRoomId:
+     * @param studentIds:
+     * @return void
+     */
+    void addStudentForRoom(Long examRoomId, String studentIds);
+
+    /**
+     * @describe 获取教室学员
+     * @author Joburgess
+     * @date 2020.06.24
+     * @param queryInfo:
+     * @return com.keao.edu.common.page.PageInfo<com.keao.edu.user.dto.ExamRoomStudentRelationDto>
+     */
+    PageInfo<ExamRoomStudentRelationDto> findExamRoomStudents(ExamRoomStudentRelationQueryInfo queryInfo);
+
+    /**
+     * @describe 删除指定教室学员
+     * @author Joburgess
+     * @date 2020.06.24
+     * @param examRoomId:
+     * @param studentIds:
+     * @return void
+     */
+    void deleteStudentFromRoom(Long examRoomId, String studentIds);
 }

+ 86 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/ExamRoomStudentRelationServiceImpl.java

@@ -1,18 +1,35 @@
 package com.keao.edu.user.service.impl;
 
+import com.keao.edu.auth.api.entity.SysUser;
 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.dao.ExamRoomDao;
 import com.keao.edu.user.dao.ExamRoomStudentRelationDao;
+import com.keao.edu.user.dto.ExamRoomStudentRelationDto;
 import com.keao.edu.user.entity.ExamRoomStudentRelation;
+import com.keao.edu.user.entity.Subject;
+import com.keao.edu.user.page.ExamRoomStudentRelationQueryInfo;
 import com.keao.edu.user.service.ExamRoomStudentRelationService;
+import com.keao.edu.util.collection.MapUtil;
+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.util.*;
+import java.util.stream.Collectors;
 
 @Service
 public class ExamRoomStudentRelationServiceImpl extends BaseServiceImpl<Long, ExamRoomStudentRelation> implements ExamRoomStudentRelationService {
 	
 	@Autowired
 	private ExamRoomStudentRelationDao examRoomStudentRelationDao;
+	@Autowired
+	private ExamRoomDao examRoomDao;
 
 	@Override
 	public BaseDAO<Long, ExamRoomStudentRelation> getDAO() {
@@ -23,4 +40,73 @@ public class ExamRoomStudentRelationServiceImpl extends BaseServiceImpl<Long, Ex
 	public void switchClassRoom(Integer openFlag, Integer examinationBasicId, Integer studentId) {
 		examRoomStudentRelationDao.switchClassRoom(openFlag,examinationBasicId,studentId);
 	}
+
+	@Override
+	public void addStudentForRoom(Long examRoomId, String studentIdsStr) {
+		if(Objects.isNull(examRoomId)){
+			throw new BizException("请指定教室");
+		}
+		if(StringUtils.isBlank(studentIdsStr)){
+			throw new BizException("请指定学员");
+		}
+		ExamRoom examRoom = examRoomDao.get(examRoomId);
+		if(Objects.isNull(examRoom)){
+			throw new BizException("教室不存在");
+		}
+		List<ExamRoomStudentRelation> studentsWithExamRoom = examRoomStudentRelationDao.findStudentsWithExamRoom(examRoomId);
+		Set<Integer> existStudentIds = studentsWithExamRoom.stream().map(ExamRoomStudentRelation::getStudentId).collect(Collectors.toSet());
+		String[] studentIds = studentIdsStr.split(",");
+		List<ExamRoomStudentRelation> examRoomStudentRelations=new ArrayList<>();
+		for (String studentId : studentIds) {
+			if(existStudentIds.contains(Integer.valueOf(studentId))){
+				continue;
+			}
+			ExamRoomStudentRelation e=new ExamRoomStudentRelation();
+			e.setExaminationBasicId(examRoom.getExaminationBasicId());
+			e.setExamRoomId(examRoom.getId());
+			e.setStudentId(Integer.valueOf(studentId));
+			e.setTenantId(TenantContextHolder.getTenantId().toString());
+			examRoomStudentRelations.add(e);
+		}
+		if(!CollectionUtils.isEmpty(examRoomStudentRelations)){
+			examRoomStudentRelationDao.batchInsert(examRoomStudentRelations);
+		}
+	}
+
+	@Override
+	public PageInfo<ExamRoomStudentRelationDto> findExamRoomStudents(ExamRoomStudentRelationQueryInfo queryInfo) {
+		PageInfo<ExamRoomStudentRelationDto> pageInfo = new PageInfo<>(queryInfo.getPage(), queryInfo.getRows());
+		Map<String, Object> params = new HashMap<String, Object>();
+		MapUtil.populateMap(params, queryInfo);
+
+		List<ExamRoomStudentRelationDto> dataList = new ArrayList<>();
+		int count = this.findCount(params);
+		if (count > 0) {
+			pageInfo.setTotal(count);
+			params.put("offset", pageInfo.getOffset());
+			dataList = examRoomStudentRelationDao.findExamRoomStudents(params);
+			List<Integer> studentIds = dataList.stream().map(ExamRoomStudentRelationDto::getStudentId).collect(Collectors.toList());
+			List<Integer> subjectIds = dataList.stream().map(e->e.getExamRegistration().getSubjectId()).collect(Collectors.toList());
+			Map<Integer, String> studentIdNameMap = this.getMap("sys_user", "id_", "real_name_", studentIds, Integer.class, String.class);
+			Map<Integer, String> subjectIdNameMap = this.getMap("subject", "id_", "name_", subjectIds, Integer.class, String.class);
+			for (ExamRoomStudentRelationDto e : dataList) {
+				e.setStudentInfo(new SysUser(e.getStudentId(),studentIdNameMap.get(e.getStudentId())));
+				e.setSubject(new Subject(e.getExamRegistration().getSubjectId(), subjectIdNameMap.get(e.getExamRegistration().getSubjectId())));
+			}
+		}
+		pageInfo.setRows(dataList);
+		return pageInfo;
+	}
+
+	@Override
+	public void deleteStudentFromRoom(Long examRoomId, String studentIdsStr) {
+		if(Objects.isNull(examRoomId)){
+			throw new BizException("请指定教室");
+		}
+		if(StringUtils.isBlank(studentIdsStr)){
+			return;
+		}
+		List<Integer> studentIds = Arrays.asList(studentIdsStr.split(",")).stream().map(e -> Integer.valueOf(e)).collect(Collectors.toList());
+		examRoomStudentRelationDao.deleteStudentsFromExamRoom(examRoomId, studentIds);
+	}
 }

+ 40 - 31
edu-user/edu-user-server/src/main/resources/config/mybatis/ExamRoomMapper.xml

@@ -8,6 +8,7 @@
 	
 	<resultMap type="com.keao.edu.user.api.entity.ExamRoom" id="ExamRoom">
 		<result column="id_" property="id" />
+		<result column="examination_basic_id_" property="examinationBasicId"/>
 		<result column="exam_mode_" property="examMode" />
 		<result column="exam_location_id_" property="examLocationId" />
 		<result column="subject_id_list_" property="subjectIdList" />
@@ -32,42 +33,44 @@
 	
 	<!-- 向数据库增加一条记录 -->
 	<insert id="insert" parameterType="com.keao.edu.user.api.entity.ExamRoom" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
-		INSERT INTO exam_room (id_,exam_mode_,exam_location_id_,subject_id_list_,main_teacher_user_id_,
+		INSERT INTO exam_room (id_,examination_basic_id_,exam_mode_,exam_location_id_,subject_id_list_,main_teacher_user_id_,
 		assistant_teacher_user_id_list_,exam_time_json_,del_flag_,create_time_,update_time_,tenant_id_)
-		VALUES(#{id},#{examMode},#{examLocationId},#{subjectIdList},#{mainTeacherUserId},#{assistantTeacherUserIdList},
+		VALUES(#{id},#{examinationBasicId},#{examMode},#{examLocationId},#{subjectIdList},#{mainTeacherUserId},#{assistantTeacherUserIdList},
 		#{examTimeJson},#{delFlag},NOW(),NOW(),#{tenantId})
 	</insert>
 	
 	<!-- 根据主键查询一条记录 -->
 	<update id="update" parameterType="com.keao.edu.user.api.entity.ExamRoom">
-		UPDATE exam_room <set>
-		<if test="delFlag != null">
-		del_flag_ = #{delFlag},
-		</if>
-		<if test="examTimeJson != null">
-		exam_time_json_ = #{examTimeJson},
-		</if>
-		<if test="subjectIdList != null">
-		subject_id_list_ = #{subjectIdList},
-		</if>
-		<if test="tenantId != null">
-		tenant_id_ = #{tenantId},
-		</if>
-		<if test="updateTime != null">
-		update_time_ = #{updateTime},
-		</if>
-		<if test="examMode != null">
-		exam_mode_ = #{examMode},
-		</if>
-		<if test="examLocationId != null">
-		exam_location_id_ = #{examLocationId},
-		</if>
-		<if test="mainTeacherUserId != null">
-		main_teacher_user_id_ = #{mainTeacherUserId},
-		</if>
-		<if test="assistantTeacherUserIdList != null">
-		assistant_teacher_user_id_list_ = #{assistantTeacherUserIdList},
-		</if>
+		UPDATE exam_room
+		<set>
+			<if test="delFlag != null">
+				del_flag_ = #{delFlag},
+			</if>
+			<if test="examinationBasicId != null">
+				examination_basic_id_ = #{examinationBasicId},
+			</if>
+			<if test="examTimeJson != null">
+				exam_time_json_ = #{examTimeJson},
+			</if>
+			<if test="subjectIdList != null">
+				subject_id_list_ = #{subjectIdList},
+			</if>
+			<if test="tenantId != null">
+				tenant_id_ = #{tenantId},
+			</if>
+			<if test="examMode != null">
+				exam_mode_ = #{examMode},
+			</if>
+			<if test="examLocationId != null">
+				exam_location_id_ = #{examLocationId},
+			</if>
+			<if test="mainTeacherUserId != null">
+				main_teacher_user_id_ = #{mainTeacherUserId},
+			</if>
+			<if test="assistantTeacherUserIdList != null">
+				assistant_teacher_user_id_list_ = #{assistantTeacherUserIdList},
+			</if>
+				update_time_ = NOW()
 		</set> WHERE id_ = #{id}
 	</update>
 	
@@ -88,8 +91,14 @@
 
 	<sql id="queryExamRoomPageSql">
 		<where>
+			<if test="examRoomId!=null">
+				er.id_=#{examRoomId}
+			</if>
+			<if test="examId!=null">
+				AND er.examination_basic_id_ = #{examId}
+			</if>
 			<if test="tenantId != null">
-				er.tenant_id_ = #{tenantId}
+				AND er.tenant_id_ = #{tenantId}
 			</if>
 			<if test="startTime != null">
 				AND eb.expect_exam_start_time_ >= #{startTime}

+ 69 - 1
edu-user/edu-user-server/src/main/resources/config/mybatis/ExamRoomStudentRelationMapper.xml

@@ -16,6 +16,12 @@
 		<result column="update_time_" property="updateTime" />
 		<result column="tenant_id_" property="tenantId" />
 	</resultMap>
+
+	<resultMap id="ExamRoomStudentRelationDto" type="com.keao.edu.user.dto.ExamRoomStudentRelationDto" extends="ExamRoomStudentRelation">
+		<association property="studentInfo" columnPrefix="sys_user_" resultMap="com.keao.edu.user.dao.SysUserDao.SysUser"/>
+		<association property="subject" columnPrefix="subject_" resultMap="com.keao.edu.user.dao.SubjectDao.Subject"/>
+		<association property="examRegistration" columnPrefix="regist_" resultMap="com.keao.edu.user.dao.ExamRegistrationDao.ExamRegistration"/>
+	</resultMap>
 	
 	<!-- 根据主键查询一条记录 -->
 	<select id="get" resultMap="ExamRoomStudentRelation" >
@@ -32,6 +38,14 @@
 		INSERT INTO exam_room_student_relation (id_,examination_basic_id_,exam_room_id_,student_id_,create_time_,update_time_,tenant_id_)
 		VALUES(#{id},#{examinationBasicId},#{examRoomId},#{studentId},NOW(),NOW(),#{tenantId})
 	</insert>
+
+	<insert id="batchInsert" parameterType="com.keao.edu.user.entity.ExamRoomStudentRelation" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
+		INSERT INTO exam_room_student_relation (examination_basic_id_,exam_room_id_,student_id_,create_time_,update_time_,tenant_id_)
+		VALUES
+		<foreach collection="roomStudents" item="roomStudent" separator=",">
+			(#{roomStudent.examinationBasicId},#{roomStudent.examRoomId},#{roomStudent.studentId},NOW(),NOW(),#{roomStudent.tenantId})
+		</foreach>
+	</insert>
 	
 	<!-- 根据主键查询一条记录 -->
 	<update id="update" parameterType="com.keao.edu.user.entity.ExamRoomStudentRelation">
@@ -66,7 +80,14 @@
 	<delete id="delete" >
 		DELETE FROM exam_room_student_relation WHERE id_ = #{id} 
 	</delete>
-	
+	<delete id="deleteStudentsFromExamRoom">
+		DELETE FROM exam_room_student_relation WHERE exam_room_id_=#{examRoomId}
+		AND student_id_ IN
+		<foreach collection="studentIds" item="studentId" separator="," open="(" close=")">
+			#{studentId}
+		</foreach>
+	</delete>
+
 	<!-- 分页查询 -->
 	<select id="queryPage" resultMap="ExamRoomStudentRelation" parameterType="map">
 		SELECT * FROM exam_room_student_relation ORDER BY id_ <include refid="global.limit"/>
@@ -76,4 +97,51 @@
 	<select id="queryCount" resultType="int">
 		SELECT COUNT(*) FROM exam_room_student_relation
 	</select>
+
+
+
+	<sql id="queryCondition">
+		<where>
+			<if test="examId!=null">
+				AND er.examination_basic_id_ = 1
+			</if>
+			<if test="inRoom!=null and inRoom=0">
+				AND ersr.id_ IS NULL
+			</if>
+			<if test="inRoom!=null and inRoom=1">
+				AND ersr.exam_room_id_ =1
+			</if>
+		</where>
+	</sql>
+
+	<select id="findExamRoomStudents" resultMap="ExamRoomStudentRelationDto" parameterType="map">
+		SELECT
+		ersr.id_,
+		ersr.student_id_,
+		er.subject_id_ regist_subject_id_,
+		er.level_ regist_level_,
+		er.create_time_ regist_create_time_
+		FROM
+		exam_registration er
+		LEFT JOIN exam_room_student_relation ersr ON ersr.student_id_ = er.student_id_ ON ersr.examination_basic_id_=er.examination_basic_id_
+		<include refid="queryCondition"/>
+		ORDER BY id_ <include refid="global.limit"/>
+	</select>
+
+	<select id="countExamRoomStudents" resultType="int">
+		SELECT
+		ersr.id_,
+		ersr.student_id_,
+		er.subject_id_,
+		er.level_,
+		er.create_time_
+		FROM
+		exam_registration er
+		LEFT JOIN exam_room_student_relation ersr ON ersr.student_id_ = er.student_id_
+		<include refid="queryCondition"/>
+	</select>
+
+	<select id="findStudentsWithExamRoom" resultMap="ExamRoomStudentRelation">
+		SELECT id_, examination_basic_id_, exam_room_id_, student_id_ FROM exam_room_student_relation WHERE exam_room_id_=#{examRoomId}
+	</select>
 </mapper>