Browse Source

考场列表包含VIP 接口修改2

小么熊🐻 2 năm trước cách đây
mục cha
commit
9ab4308fbd
1 tập tin đã thay đổi với 20 bổ sung10 xóa
  1. 20 10
      jsjp-service/src/main/resources/mapper/exam/ExamInfoMapper.xml

+ 20 - 10
jsjp-service/src/main/resources/mapper/exam/ExamInfoMapper.xml

@@ -22,21 +22,31 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </sql>
 
     <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>
-            <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="cityId != null  and cityId != ''"> and e.city_id = #{cityId}</if>
         </where>
     </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>