|
@@ -10,13 +10,16 @@
|
|
|
<result column="id_" property="id" />
|
|
|
<result column="examination_basic_id_" property="examinationBasicId" />
|
|
|
<result column="student_id_" property="studentId" />
|
|
|
- <result column="result_" property="result" />
|
|
|
+ <result column="result_" property="result" typeHandler="com.keao.edu.common.dal.CustomEnumTypeHandler" />
|
|
|
+ <result column="avg_score_" property="avgScore"/>
|
|
|
<result column="confirm_status_" property="confirmStatus" />
|
|
|
+ <result column="is_finished_exam_" property="isFinishedExam" />
|
|
|
<result column="memo_" property="memo" />
|
|
|
<result column="operator_id_" property="operatorId" />
|
|
|
<result column="create_time_" property="createTime" />
|
|
|
<result column="update_time_" property="updateTime" />
|
|
|
<result column="tenant_id_" property="tenantId" />
|
|
|
+ <association property="examRegistration" columnPrefix="regist_" resultMap="com.keao.edu.user.dao.ExamRegistrationDao.ExamRegistration"/>
|
|
|
</resultMap>
|
|
|
|
|
|
<!-- 根据主键查询一条记录 -->
|
|
@@ -31,10 +34,19 @@
|
|
|
|
|
|
<!-- 向数据库增加一条记录 -->
|
|
|
<insert id="insert" parameterType="com.keao.edu.user.entity.StudentExamResult" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
|
|
|
- INSERT INTO student_exam_result (id_,examination_basic_id_,student_id_,result_,confirm_status_,memo_,operator_id_,create_time_,update_time_,tenant_id_)
|
|
|
- VALUES(#{id},#{examinationBasicId},#{studentId},#{result},#{confirmStatus},#{memo},#{operatorId},NOW(),NOW(),#{tenantId})
|
|
|
+ INSERT INTO student_exam_result (id_,examination_basic_id_,student_id_,result_,avg_score_,confirm_status_,memo_,operator_id_,is_finished_exam_,create_time_,update_time_,tenant_id_)
|
|
|
+ VALUES(#{id},#{examinationBasicId},#{studentId},#{result,typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler},#{avgScore},#{confirmStatus},#{memo},#{operatorId},#{isFinishedExam},NOW(),NOW(),#{tenantId})
|
|
|
</insert>
|
|
|
-
|
|
|
+
|
|
|
+ <insert id="batchInsert" parameterType="com.keao.edu.user.entity.StudentExamResult" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
|
|
|
+ INSERT INTO student_exam_result (examination_basic_id_,student_id_,result_,#{avg_score_},confirm_status_,memo_,operator_id_,is_finished_exam_,create_time_,update_time_,tenant_id_)
|
|
|
+ VALUES
|
|
|
+ <foreach collection="results" item="result" separator=",">
|
|
|
+ (#{result.examinationBasicId},#{result.studentId},#{result.result,typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler},
|
|
|
+ #{result.avgScore},#{result.confirmStatus},#{result.memo},#{result.operatorId},#{result.isFinishedExam},NOW(),NOW(),#{result.tenantId})
|
|
|
+ </foreach>
|
|
|
+ </insert>
|
|
|
+
|
|
|
<!-- 根据主键查询一条记录 -->
|
|
|
<update id="update" parameterType="com.keao.edu.user.entity.StudentExamResult">
|
|
|
UPDATE student_exam_result
|
|
@@ -45,9 +57,6 @@
|
|
|
<if test="operatorId != null">
|
|
|
operator_id_ = #{operatorId},
|
|
|
</if>
|
|
|
- <if test="id != null">
|
|
|
- id_ = #{id},
|
|
|
- </if>
|
|
|
<if test="tenantId != null">
|
|
|
tenant_id_ = #{tenantId},
|
|
|
</if>
|
|
@@ -58,11 +67,17 @@
|
|
|
student_id_ = #{studentId},
|
|
|
</if>
|
|
|
<if test="result != null">
|
|
|
- result_ = #{result},
|
|
|
+ result_ = #{result,typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler},
|
|
|
+ </if>
|
|
|
+ <if test="avgScore != null">
|
|
|
+ avg_score_ = #{avgScore},
|
|
|
</if>
|
|
|
<if test="memo != null">
|
|
|
memo_ = #{memo},
|
|
|
</if>
|
|
|
+ <if test="isFinishedExam != null">
|
|
|
+ is_finished_exam_ = #{isFinishedExam},
|
|
|
+ </if>
|
|
|
update_time_ = NOW()
|
|
|
</set> WHERE id_ = #{id}
|
|
|
</update>
|
|
@@ -81,4 +96,63 @@
|
|
|
<select id="queryCount" resultType="int">
|
|
|
SELECT COUNT(*) FROM student_exam_result
|
|
|
</select>
|
|
|
+
|
|
|
+ <sql id="queryStudentExamResultCondition">
|
|
|
+ <where>
|
|
|
+ er.organ_id_ IN
|
|
|
+ <foreach collection="organIds" item="organId" separator="," open="(" close=")">
|
|
|
+ #{organId}
|
|
|
+ </foreach>
|
|
|
+ <if test="examId!=null">
|
|
|
+ er.examination_basic_id_ = #{examId}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <select id="queryStudentExamResult" resultMap="StudentExamResult" parameterType="map">
|
|
|
+ SELECT
|
|
|
+ er.card_no_,
|
|
|
+ er.student_id_,
|
|
|
+ er.organ_id_,
|
|
|
+ er.subject_id_,
|
|
|
+ er.level_,
|
|
|
+ CASE WHEN ser.id_>0 THEN 1 ELSE 0 END,
|
|
|
+ ser.confirm_status_
|
|
|
+ FROM
|
|
|
+ exam_registration er
|
|
|
+ LEFT JOIN student_exam_result ser ON er.examination_basic_id_ = ser.examination_basic_id_
|
|
|
+ AND er.student_id_ = ser.student_id_
|
|
|
+ <include refid="queryStudentExamResultCondition"/>
|
|
|
+ ORDER BY id_ <include refid="global.limit"/>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="countStudentExamResult" resultType="int">
|
|
|
+ SELECT
|
|
|
+ COUNT(er.id_)
|
|
|
+ FROM
|
|
|
+ exam_registration er
|
|
|
+ LEFT JOIN student_exam_result ser ON er.examination_basic_id_ = ser.examination_basic_id_
|
|
|
+ AND er.student_id_ = ser.student_id_
|
|
|
+ <include refid="queryStudentExamResultCondition"/>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getStudentExamResultStatisticsInfo" resultType="com.keao.edu.user.dto.StudentExamResultStatisticsDto">
|
|
|
+ SELECT
|
|
|
+ COUNT( er.id_ ) totalRegistrationStudentNum,
|
|
|
+ SUM( CASE WHEN ser.id_ > 0 THEN 0 ELSE 1 END ) notExamStudentNum,
|
|
|
+ SUM( CASE WHEN ser.result_ = 'FAIL' THEN 1 ELSE 0 END ) examFailStudentNum,
|
|
|
+ SUM( CASE WHEN ser.id_ > 0 THEN 1 ELSE 0 END ) examStudentNum
|
|
|
+ FROM
|
|
|
+ exam_registration er
|
|
|
+ LEFT JOIN student_exam_result ser ON er.examination_basic_id_ = ser.examination_basic_id_
|
|
|
+ AND er.student_id_ = ser.student_id_
|
|
|
+ WHERE
|
|
|
+ er.examination_basic_id_ = #{examId}
|
|
|
+ AND er.organ_id_ IN
|
|
|
+ <foreach collection="organIds" item="organId" separator="," open="(" close=")">
|
|
|
+ #{organId}
|
|
|
+ </foreach>
|
|
|
+ GROUP BY
|
|
|
+ er.examination_basic_id_
|
|
|
+ </select>
|
|
|
</mapper>
|