<?xml version="1.0" encoding="UTF-8"?>
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<mapper namespace="com.ycl.jxkg.mapper.ExamSubmitTempMapper">
|
|
<!-- 通用查询映射结果 -->
|
<resultMap id="BaseResultMap" type="com.ycl.jxkg.domain.vo.ExamSubmitTempVO">
|
<result column="exam_id" property="examId" />
|
<result column="user_id" property="userId" />
|
<result column="do_time" property="doTime" />
|
<result column="exam_submit" property="examSubmit" />
|
<result column="create_time" property="createTime" />
|
<result column="status" property="status" />
|
</resultMap>
|
|
<select id="getById" resultMap="BaseResultMap">
|
SELECT
|
TEST.exam_id,
|
TEST.user_id,
|
TEST.do_time,
|
TEST.exam_submit,
|
TEST.create_time,
|
TEST.status,
|
TEST.id
|
FROM
|
t_exam_submit_temp TEST
|
WHERE
|
TEST.id = #{id} AND TEST.deleted = 0
|
</select>
|
|
<select id="getPage" resultMap="BaseResultMap">
|
SELECT
|
TEST.exam_id,
|
TEST.user_id,
|
TEST.do_time,
|
TEST.exam_submit,
|
TEST.create_time,
|
TEST.status,
|
TEST.id
|
FROM
|
t_exam_submit_temp TEST
|
WHERE
|
TEST.deleted = 0
|
</select>
|
|
<!-- <select id="monitorList" resultType="com.ycl.jxkg.domain.vo.ExamSubmitTempVO">-->
|
<!-- SELECT-->
|
<!-- TEST.exam_id,-->
|
<!-- TEST.user_id,-->
|
<!-- TEST.do_time,-->
|
<!-- TEST.exam_submit,-->
|
<!-- TEST.create_time,-->
|
<!-- TEST.status,-->
|
<!-- TEST.id,-->
|
<!-- TE.exam_name,-->
|
<!-- TU.real_name as userName-->
|
<!-- FROM-->
|
<!-- t_exam_submit_temp TEST-->
|
<!-- INNER JOIN t_user TU ON TU.id = TEST.user_id AND TU.deleted = 0-->
|
<!-- INNER JOIN t_exam TE ON TE.id = TEST.exam_id AND TE.deleted = 0-->
|
<!-- WHERE-->
|
<!-- TEST.deleted = 0-->
|
<!-- <if test="query.examId != null">-->
|
<!-- AND TEST.exam_id = #{query.examId}-->
|
<!-- </if>-->
|
<!-- <if test="query.keyword != null and query.keyword != ''">-->
|
<!-- AND (INSTR(TU.real_name, #{query.keyword}) OR INSTR(TE.exam_name, #{query.keyword}))-->
|
<!-- </if>-->
|
<!-- </select>-->
|
|
<select id="monitorList" resultType="com.ycl.jxkg.domain.vo.ExamSubmitTempVO">
|
SELECT
|
te.id as examId,
|
TU.id as userId,
|
TEST.do_time,
|
TEST.exam_submit,
|
TEST.create_time,
|
TEST.status,
|
TEST.id,
|
TE.exam_name,
|
TU.real_name as userName
|
FROM
|
t_exam TE
|
LEFT JOIN t_classes_user TCU ON TE.classes_id = TCU.classes_id AND TCU.deleted = 0
|
INNER JOIN t_user TU ON TU.id = TCU.user_id AND TU.deleted = 0
|
LEFT JOIN t_exam_submit_temp TEST ON TE.id = TEST.exam_id AND TCU.user_id = TEST.user_id AND (TEST.deleted = 0 or TEST.deleted is null)
|
WHERE
|
TE.deleted = 0
|
<if test="query.examId != null">
|
AND TE.id = #{query.examId}
|
</if>
|
<if test="query.keyword != null and query.keyword != ''">
|
AND (INSTR(TU.real_name, #{query.keyword}) OR INSTR(TE.exam_name, #{query.keyword}))
|
</if>
|
</select>
|
</mapper>
|