|
@@ -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>
|