|
@@ -391,29 +391,31 @@
|
|
|
</select>
|
|
|
|
|
|
<select id="listByTrain" resultMap="ExamTrainDtoResult" parameterType="ExamTrainDto">
|
|
|
- SELECT
|
|
|
- a.id,a.NAME,a.start_time,a.end_time,a.minute_len,a.create_user_id,a.role_ids,
|
|
|
- b.NAME username,0 AS 'role_id','' AS 'roleName',a.create_time,a.type,
|
|
|
- a.STATUS,a.train_practical_result_id,a.train_practical_step_result_id
|
|
|
- FROM
|
|
|
- exam a
|
|
|
- LEFT JOIN userinfo b ON a.create_user_id = b.id
|
|
|
- <if test="trainPracticalResultId != null">WHERE a.train_practical_result_id = #{trainPracticalResultId}</if>
|
|
|
- UNION
|
|
|
- SELECT
|
|
|
- a.id,a.NAME,a.start_time,a.end_time,a.minute_len,a.create_user_id,a.role_ids,
|
|
|
- b.NAME username,c.role_id, d.NAME roleName,a.create_time,a.type,
|
|
|
- a.STATUS,a.train_practical_result_id, a.train_practical_step_result_id
|
|
|
- FROM
|
|
|
- train_task_step_question c
|
|
|
- LEFT JOIN exam a ON a.id = c.question_id
|
|
|
- LEFT JOIN userinfo b ON a.create_user_id = b.id
|
|
|
- LEFT JOIN train_role d ON c.role_id = d.id
|
|
|
- <if test="stepIdList != null">WHERE c.step_id in
|
|
|
- <foreach item="id" collection="stepIdList" open="(" separator="," close=")">
|
|
|
- #{id}
|
|
|
- </foreach>
|
|
|
- </if>
|
|
|
+ SELECT a.* from (
|
|
|
+ SELECT
|
|
|
+ a.id,a.NAME,a.start_time,a.end_time,a.minute_len,a.create_user_id,a.role_ids,
|
|
|
+ b.NAME username,0 AS 'role_id','' AS 'roleName',a.create_time,a.type,
|
|
|
+ a.STATUS,a.train_practical_result_id,a.train_practical_step_result_id
|
|
|
+ FROM
|
|
|
+ exam a
|
|
|
+ LEFT JOIN userinfo b ON a.create_user_id = b.id
|
|
|
+ <if test="trainPracticalResultId != null">WHERE a.train_practical_result_id = #{trainPracticalResultId}</if>
|
|
|
+ UNION
|
|
|
+ SELECT
|
|
|
+ a.id,a.NAME,a.start_time,a.end_time,a.minute_len,a.create_user_id,a.role_ids,
|
|
|
+ b.NAME username,c.role_id, d.NAME roleName,a.create_time,a.type,
|
|
|
+ a.STATUS,a.train_practical_result_id, a.train_practical_step_result_id
|
|
|
+ FROM
|
|
|
+ train_task_step_question c
|
|
|
+ LEFT JOIN exam a ON a.id = c.question_id
|
|
|
+ LEFT JOIN userinfo b ON a.create_user_id = b.id
|
|
|
+ LEFT JOIN train_role d ON c.role_id = d.id
|
|
|
+ <if test="stepIdList != null">WHERE c.step_id in
|
|
|
+ <foreach item="id" collection="stepIdList" open="(" separator="," close=")">
|
|
|
+ #{id}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ ) a where a.id is not null
|
|
|
</select>
|
|
|
|
|
|
</mapper>
|