zouxuan 5 years ago
parent
commit
6560d3dff8

+ 32 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/controller/ExamCertificationController.java

@@ -0,0 +1,32 @@
+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.entity.ExamCertification;
+import com.keao.edu.user.entity.ExamLocation;
+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 java.util.Date;
+
+@RestController
+@RequestMapping("examCertification")
+@Api(tags = "准考证服务")
+public class ExamCertificationController extends BaseController {
+
+    @Autowired
+    private ExamCertificationService examCertificationService;
+
+    @ApiOperation("分页查询")
+    @GetMapping(value = "findByStuAndBasicId")
+    public HttpResponseResult<ExamCertification> findByStuAndBasicId(Integer studentId,Integer basicId) {
+        return succeed(examCertificationService.findByStuAndBasicId(studentId,basicId));
+    }
+}

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

@@ -3,13 +3,10 @@ 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.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;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -26,7 +23,7 @@ public class ExamRoomStudentRelationController extends BaseController {
     private ExamRoomStudentRelationService examRoomStudentRelationService;
 
     @ApiOperation("开启/关闭教室")
-    @GetMapping(value = "/list")
+    @GetMapping(value = "/switchClassRoom")
     public HttpResponseResult switchClassRoom(Integer openFlag,Integer examinationBasicId,Integer studentId) {
         examRoomStudentRelationService.switchClassRoom(openFlag,examinationBasicId,studentId);
         return succeed();

+ 9 - 1
edu-user/edu-user-server/src/main/java/com/keao/edu/user/dao/ExamCertificationDao.java

@@ -2,8 +2,16 @@ package com.keao.edu.user.dao;
 
 import com.keao.edu.common.dal.BaseDAO;
 import com.keao.edu.user.entity.ExamCertification;
+import org.apache.ibatis.annotations.Param;
 
 public interface ExamCertificationDao extends BaseDAO<Long, ExamCertification> {
 
-	
+
+    /**
+     * 获取学员准考证
+     * @param studentId
+     * @param basicId
+     * @return
+     */
+    ExamCertification findByStuAndBasicId(@Param("studentId") Integer studentId, @Param("basicId") Integer basicId);
 }

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

@@ -0,0 +1,16 @@
+package com.keao.edu.user.service;
+
+
+import com.keao.edu.common.service.BaseService;
+import com.keao.edu.user.entity.ExamCertification;
+
+public interface ExamCertificationService extends BaseService<Long, ExamCertification> {
+
+    /**
+     * 获取学员准考证
+     * @param studentId
+     * @param basicId
+     * @return
+     */
+    ExamCertification findByStuAndBasicId(Integer studentId, Integer basicId);
+}

+ 27 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/ExamCertificationServiceImpl.java

@@ -0,0 +1,27 @@
+package com.keao.edu.user.service.impl;
+
+
+import com.keao.edu.common.dal.BaseDAO;
+import com.keao.edu.common.service.impl.BaseServiceImpl;
+import com.keao.edu.user.dao.ExamCertificationDao;
+import com.keao.edu.user.entity.ExamCertification;
+import com.keao.edu.user.service.ExamCertificationService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+public class ExamCertificationServiceImpl extends BaseServiceImpl<Long, ExamCertification> implements ExamCertificationService {
+	
+	@Autowired
+	private ExamCertificationDao examCertificationDao;
+
+	@Override
+	public BaseDAO<Long, ExamCertification> getDAO() {
+		return examCertificationDao;
+	}
+
+	@Override
+	public ExamCertification findByStuAndBasicId(Integer studentId, Integer basicId) {
+		return examCertificationDao.findByStuAndBasicId(studentId,basicId);
+	}
+}

+ 3 - 0
edu-user/edu-user-server/src/main/resources/config/mybatis/ExamCertificationMapper.xml

@@ -94,4 +94,7 @@
 	<select id="queryCount" resultType="int">
 		SELECT COUNT(*) FROM exam_certification
 	</select>
+    <select id="findByStuAndBasicId" resultMap="ExamCertification">
+		SELECT * FROM exam_certification WHERE examination_basic_id_ = #{basicId} AND student_id_ = #{studentId} LIMIT 1
+	</select>
 </mapper>

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

@@ -73,7 +73,8 @@
 		</set> WHERE id_ = #{id}
 	</update>
     <update id="switchClassRoom">
-
+		UPDATE exam_room_student_relation SET classroom_switch_ = #{openFlag},update_time_ = NOW()
+		WHERE examination_basic_id_ = #{examinationBasicId} AND student_id_ = #{studentId}
 	</update>
 
     <!-- 根据主键删除一条记录 -->
@@ -144,4 +145,7 @@
 	<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>
+	<select id="findByBasicIdAndStudentId">
+
+	</select>
 </mapper>