Explorar o código

update 更新获取报名信息

周箭河 %!s(int64=5) %!d(string=hai) anos
pai
achega
bdcce0d8ee

+ 24 - 3
edu-user/edu-user-server/src/main/resources/config/mybatis/ExamRegistrationMapper.xml

@@ -432,7 +432,28 @@
 		WHERE er.id_ = #{id}
 	</select>
 
-	<select id="getRegistration" resultMap="ExamRegistration">
-		SELECT * FROM exam_registration WHERE examination_basic_id_ = #{examId}  AND student_id_ =#{studentId} AND subject_id_=#{subjectId} AND level_ = #{level} LIMIT 1
-	</select>
+    <select id="getRegistration" resultMap="ExamRegistration">
+        SELECT * FROM exam_registration
+        <where>
+            <if test="examId != null">
+                AND examination_basic_id_ = #{examId}
+            </if>
+            <if test="studentId != null">
+                AND student_id_ =#{studentId}
+            </if>
+            <if test="subjectId != null">
+                AND subject_id_=#{subjectId}
+            </if>
+            <if test="level != null">
+                AND level_ = #{level}
+            </if>
+            <if test="statusEnumList != null">
+                AND status_ IN
+                <foreach collection="statusEnumList" item="status" open="(" close=")" separator=",">
+                    #{status}
+                </foreach>
+            </if>
+        </where>
+        LIMIT 1
+    </select>
 </mapper>