|
@@ -107,8 +107,10 @@
|
|
|
<!-- (case when t.membership_end_time_ >= now() then 1 else 0 end) isVip,-->
|
|
|
<!-- t.tag_ tag,-->
|
|
|
u.del_flag_ as delFlag,
|
|
|
- ifnull(vcr.vip_type_,'NORMAL') as vipType,
|
|
|
- if(vcr.type_ = 'PERMANENT',null,vcr.end_time_) as membershipEndTime,
|
|
|
+ ifnull(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' and vcr.type_ != 'PERPETUAL', vcr.end_time_, null)) svipEndTime,
|
|
|
(case when isnull(u.id_card_no_) then 0 else 1 end) as isReal,
|
|
|
(case when isnull(b.user_id_) then 0 else 1 end) as isBank,
|
|
|
(case when t.tenant_id_ = -1 then '平台' else ti.name_ end) as tenantName
|
|
@@ -118,8 +120,8 @@
|
|
|
select distinct user_id_ from user_bank_card where del_flag_ = 0
|
|
|
) b on t.user_id_ = b.user_id_
|
|
|
left join tenant_info ti on t.tenant_id_ = ti.id_
|
|
|
- left join vip_card_record vcr on t.user_id_ = vcr.user_id_ and cvr.client_type_ = 'TEACHER'
|
|
|
- and vcr.efficient_flag_ = 1 and vcr.end_time_ >= now() and now() > vcr.start_time_ and (vcr.vip_type_ = 'VIP' or vcr.vip_type_ = 'SVIP')
|
|
|
+ left join vip_card_record vcr on t.user_id_ = vcr.user_id_ and vcr.efficient_flag_ = 1 and (vcr.vip_type_ = 'VIP' or vcr.vip_type_ = 'SVIP') and vcr.client_type_='STUDENT'
|
|
|
+ left join vip_card_record vcr2 on t.user_id_ = vcr2.user_id_ and vcr2.efficient_flag_ = 1 and vcr2.end_time_ > now() and now() >= vcr2.start_time_ and vcr2.client_type_='STUDENT'
|
|
|
<where>
|
|
|
<if test="null != param.search and '' != param.search">
|
|
|
AND (
|
|
@@ -144,11 +146,11 @@
|
|
|
)
|
|
|
</if>
|
|
|
<if test="param.vipType != null">
|
|
|
- <if test="param.vipType == 'NORMAL'">
|
|
|
- and vcr.id_ is null
|
|
|
+ <if test="param.vipType.code == 'NORMAL'">
|
|
|
+ and vcr2.id_ is null
|
|
|
</if>
|
|
|
- <if test="param.vipType != 'NORMAL'">
|
|
|
- and vcr.vip_type_ = #{param.vipType}
|
|
|
+ <if test="param.vipType.code != 'NORMAL'">
|
|
|
+ and vcr2.vip_type_ = #{param.vipType}
|
|
|
</if>
|
|
|
</if>
|
|
|
<!-- <if test="param.isVip != null">-->
|
|
@@ -205,6 +207,16 @@
|
|
|
and ti.name_ like concat('%',#{param.tenantName},'%')
|
|
|
</if>
|
|
|
</where>
|
|
|
+ group by t.user_id_
|
|
|
+ <if test="param.vipStartTime != null and param.vipEndTime != null and param.vipType != null">
|
|
|
+ having
|
|
|
+ <if test="param.vipType.code == 'VIP'">
|
|
|
+ vipEndTime >= #{param.vipStartTime} and #{param.vipEndTime}> vipEndTime
|
|
|
+ </if>
|
|
|
+ <if test="param.vipType.code == 'SVIP'">
|
|
|
+ svipEndTime >= #{param.vipStartTime} and #{param.vipEndTime}> svipEndTime
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
<choose>
|
|
|
<when test="param.orderBy != null and param.orderBy.trim() != ''">
|
|
|
order by ${param.orderBy}
|