|
@@ -22,21 +22,31 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
</sql>
|
|
</sql>
|
|
|
|
|
|
<select id="selectExamInfoList" parameterType="com.miaxis.exam.dto.ExamInfoDto" resultType="com.miaxis.exam.vo.ExamInfoVipVo">
|
|
<select id="selectExamInfoList" parameterType="com.miaxis.exam.dto.ExamInfoDto" resultType="com.miaxis.exam.vo.ExamInfoVipVo">
|
|
- select *,(select count(1) from vip_exam_video v where v.exam_id = e.id) as video_count,
|
|
|
|
- (case
|
|
|
|
- when now() <![CDATA[<=]]> v.expiration_time then 1
|
|
|
|
- when now()>v.expiration_time then 0
|
|
|
|
- end) as is_vip,
|
|
|
|
- v.expiration_time,v.user_id
|
|
|
|
- from exam_info e left JOIN vip_user_exam v on e.id = v.exam_id
|
|
|
|
|
|
+ SELECT e.*,
|
|
|
|
+ (SELECT COUNT(1) FROM vip_exam_video v WHERE v.exam_id = e.id) AS video_count,
|
|
|
|
+ (SELECT expiration_time FROM vip_user_exam WHERE e.id = exam_id AND user_id = #{userId} AND NOW() <![CDATA[<=]]> expiration_time) AS expiration_time,
|
|
|
|
+ (CASE WHEN NOW() <![CDATA[<=]]> (SELECT expiration_time FROM vip_user_exam WHERE e.id = exam_id AND user_id = #{userId}) THEN 1 ELSE 0 END) AS is_vip
|
|
|
|
+ FROM exam_info e
|
|
<where>
|
|
<where>
|
|
- <if test="userId != null"> and v.user_id = #{userId}</if>
|
|
|
|
|
|
+ <if test="cityId != null and cityId != ''" > AND e.city_id = #{cityId}</if>
|
|
<if test="name != null and name != ''"> and e.name like concat('%', #{name}, '%')</if>
|
|
<if test="name != null and name != ''"> and e.name like concat('%', #{name}, '%')</if>
|
|
- <if test="cityId != null and cityId != ''"> and e.city_id = #{cityId}</if>
|
|
|
|
</where>
|
|
</where>
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
+<!--
|
|
|
|
+ select *,(select count(1) from vip_exam_video v where v.exam_id = e.id) as video_count,
|
|
|
|
+ (case
|
|
|
|
+ when now() <![CDATA[<=]]> v.expiration_time then 1
|
|
|
|
+ when now()>v.expiration_time then 0
|
|
|
|
+ end) as is_vip,
|
|
|
|
+ v.expiration_time,v.user_id
|
|
|
|
+ from exam_info e left JOIN vip_user_exam v on e.id = v.exam_id
|
|
|
|
+ <where>
|
|
|
|
+ <if test="userId != null"> and v.user_id = #{userId}</if>
|
|
|
|
+ <if test="name != null and name != ''"> and e.name like concat('%', #{name}, '%')</if>
|
|
|
|
+ <if test="cityId != null and cityId != ''"> and e.city_id = #{cityId}</if>
|
|
|
|
+ </where>
|
|
|
|
+-->
|
|
|
|
|
|
</mapper>
|
|
</mapper>
|