Преглед на файлове

修改判断当前VIP类型错误

yuanliang преди 1 година
родител
ревизия
138e2981b9

+ 1 - 1
cooleshow-user/user-biz/src/main/resources/config/mybatis/StudentMapper.xml

@@ -103,7 +103,7 @@
             u.phone_ as phone,
             !isnull(birthdate_) as isReal,
             u.real_name_ as realName,
-            ifnull(vcr2.vip_type_,'NORMAL') as vipType,
+            ifnull(group_concat(vcr2.vip_type_),'NORMAL') as vipType,
 <!--            if(vcr.type_ = 'PERMANENT',null,vcr.end_time_) as membershipEndTime,-->
             max(if(vcr.vip_type_ = 'VIP', vcr.end_time_, null)) vipEndTime,
             max(if(vcr.vip_type_ = 'SVIP' and vcr.type_ = 'PERPETUAL', vcr.end_time_ , null)) perSvipEndTime,

+ 1 - 1
cooleshow-user/user-biz/src/main/resources/config/mybatis/TeacherMapper.xml

@@ -107,7 +107,7 @@
 <!--        (case when t.membership_end_time_ &gt;= now() then 1 else 0 end) isVip,-->
         <!--            t.tag_ tag,-->
         u.del_flag_ as delFlag,
-        ifnull(vcr2.vip_type_,'NORMAL') as vipType,
+        ifnull(group_concat(vcr2.vip_type_),'NORMAL') as vipType,
         max(if(vcr.vip_type_ = 'VIP', vcr.end_time_, null)) vipEndTime,
         max(if(vcr.vip_type_ = 'SVIP' and vcr.type_ = 'PERPETUAL', vcr.end_time_ , null)) perSvipEndTime,
         max(if(vcr.vip_type_ = 'SVIP', vcr.end_time_, null)) svipEndTime,

+ 9 - 8
cooleshow-user/user-biz/src/main/resources/config/mybatis/VipCardRecordMapper.xml

@@ -146,19 +146,20 @@
     </select>
 
     <select id="queryUserVipInfo" resultType="com.yonge.cooleshow.biz.dal.wrapper.VipCardRecordWrapper$UserVipInfo">
-        select t.user_id_ userId
-        ,ifnull(vcr.vip_type_,'NORMAL') currentVipType
-        ,max(if(t.vip_type_ = 'VIP', t.end_time_, null)) vipEndTime
-        ,max(if(t.vip_type_ = 'SVIP' and t.type_ = 'PERPETUAL', t.end_time_ , null)) perSvipEndTime
-        ,max(if(t.vip_type_ = 'SVIP' , t.end_time_, null)) svipEndTime
+        select m.*
+        , ifnull(group_concat(vcr.vip_type_), 'NORMAL') currentVipType
+        from (select t.user_id_ userId
+        , max(if(t.vip_type_ = 'VIP', t.end_time_, null)) vipEndTime
+        , max(if(t.vip_type_ = 'SVIP' and t.type_ = 'PERPETUAL', t.end_time_, null)) perSvipEndTime
+        , max(if(t.vip_type_ = 'SVIP', t.end_time_, null)) svipEndTime
         from vip_card_record t
-        left join vip_card_record vcr on t.id_ = vcr.id_ and vcr.end_time_>now() and now()>= vcr.start_time_
         where t.user_id_ in
         <foreach collection="userIdList" separator="," item="item" open="(" close=")">
             #{item}
         </foreach>
-        and t.client_type_ = #{clientType}
+        and t.client_type_ = 'STUDENT'
         and t.efficient_flag_ = 1
-        group by t.user_id_
+        group by t.user_id_) m
+        left join vip_card_record vcr on m.userId = vcr.user_id_ and vcr.end_time_ > now() and now() >= vcr.start_time_ and efficient_flag_ = 1
     </select>
 </mapper>