<if test="timeType != null and timeType == 1 and isSort == 1">
order by a.PUBLIC_TIME desc
</if>
<if test="timeType != null and timeType == 1 and isSort == 2">
order by a.PUBLIC_TIME asc
</if>
<if test="timeType != null and timeType == 2 and isSort == 1">
order by b.TURN_TIME desc
</if>
<if test="timeType != null and timeType == 2 and isSort == 2">
order by b.TURN_TIME asc
</if>
timeType 1. 发布时间,,2 提交时间 isSort 1, 升序,2降序
<select id="query" resultMap="GhaExMyExamQueryVOMap">
select
a.EXAM_NAME ,a.PUBLIC_PEOPLE, a.PUBLIC_TIME, a.CANCEL_TIME,
b.ID_,b.ISDELETED,b.TENANTID,b.OPTIME,b.OPER,b.UPDATETIME,b.UPDATOR,b.EXAMINE_ID,b.EXAM_STATUS,b.TURN_TIME,b.OPEN_TIME,b.EXAM_ID,b.SOURCE_INFORMATION,
c.ID_ as id_, c.QUESTION_ID, c.MY_EXAM_ID,c.MY_ANSWER,c.QUESTION_TYPE,c.GAIN_SCORE as gainScore
from gha_ex_my_exam b inner join gha_ex_exam a on a.ID_ = b.EXAM_ID
left join gha_ex_answer_situation c on b.ID_ = c.MY_EXAM_ID and c.ISDELETED = '0'
<where>
a.ISDELETED = '0' and b.ISDELETED = '0'
<if test="userid != null">
and b.EXAMINE_ID = #{userid}
</if>
<if test="nameAndId != null and nameAndId != ''">
and (a.EXAM_NAME like concat('%',#{nameAndId},'%') or a.ID_ = #{nameAndId})
</if>
<if test="condition != null">
and b.EXAM_STATUS = #{condition}
</if>
<if test="userId != null">
and a.PUBLIC_PEOPLE = #{userId}
</if>
</where>
<if test="timeType != null and timeType == 1 and isSort == 1">
order by a.PUBLIC_TIME desc
</if>
<if test="timeType != null and timeType == 1 and isSort == 2">
order by a.PUBLIC_TIME asc
</if>
<if test="timeType != null and timeType == 2 and isSort == 1">
order by b.TURN_TIME desc
</if>
<if test="timeType != null and timeType == 2 and isSort == 2">
order by b.TURN_TIME asc
</if>
</select>