|
@@ -24,8 +24,8 @@
|
|
|
, t.subject_id_ as `subjectId`
|
|
|
, t.current_grade_num_ as `currentGradeNum`
|
|
|
, t.member_rank_setting_id_ as `memberRankSettingId`
|
|
|
- , t.membership_start_time_ as `membershipStartTime`
|
|
|
- , t.membership_end_time_ as `membershipEndTime`
|
|
|
+<!-- , t.membership_start_time_ as `membershipStartTime`-->
|
|
|
+<!-- , t.membership_end_time_ as `membershipEndTime`-->
|
|
|
, t.cloud_study_sequence_days_ as `cloudStudySequenceDays`
|
|
|
, t.cloud_study_use_last_day_ as `cloudStudyUseLastDay`
|
|
|
, t.train_time_ as trainTime
|
|
@@ -103,7 +103,11 @@
|
|
|
u.phone_ as phone,
|
|
|
!isnull(birthdate_) as isReal,
|
|
|
u.real_name_ as realName,
|
|
|
- (!isnull(membership_end_time_) and membership_end_time_ > now()) as isVip,
|
|
|
+ ifnull(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.type_='PERPETUAL', null , vcr.end_time_)) svipEndTime,
|
|
|
+<!-- (!isnull(membership_end_time_) and membership_end_time_ > now()) as isVip,-->
|
|
|
(
|
|
|
SELECT GROUP_CONCAT(name_ ORDER by locate(id_,t.subject_id_)) FROM subject WHERE FIND_IN_SET(id_,t.subject_id_)
|
|
|
) as subjectName,
|
|
@@ -111,6 +115,8 @@
|
|
|
FROM student t
|
|
|
left join sys_user u on t.user_id_ = u.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 vcr.efficient_flag_ = 1 and (vcr.vip_type_ = 'VIP' or vcr.vip_type_ = 'SVIP') and 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 client_type_='STUDENT'
|
|
|
<where>
|
|
|
<if test="null != param.search and '' != param.search">
|
|
|
AND (
|
|
@@ -126,14 +132,22 @@
|
|
|
<if test="null != param.subjectId and '' != param.subjectId">
|
|
|
AND FIND_IN_SET(t.subject_id_, #{param.subjectId})
|
|
|
</if>
|
|
|
- <if test="null != param.isVip">
|
|
|
- <if test="1 == param.isVip.code">
|
|
|
- and t.membership_end_time_ > now()
|
|
|
+ <if test="param.vipType != null">
|
|
|
+ <if test="param.vipType == 'NORMAL'">
|
|
|
+ and vcr2.id_ is null
|
|
|
</if>
|
|
|
- <if test="0 == param.isVip.code">
|
|
|
- and (t.membership_end_time_ is null or t.membership_end_time_ <= now())
|
|
|
+ <if test="param.vipType != 'NORMAL'">
|
|
|
+ and vcr2.vip_type_ = #{param.vipType}
|
|
|
</if>
|
|
|
</if>
|
|
|
+<!-- <if test="null != param.isVip">-->
|
|
|
+<!-- <if test="1 == param.isVip.code">-->
|
|
|
+<!-- and t.membership_end_time_ > now()-->
|
|
|
+<!-- </if>-->
|
|
|
+<!-- <if test="0 == param.isVip.code">-->
|
|
|
+<!-- and (t.membership_end_time_ is null or t.membership_end_time_ <= now())-->
|
|
|
+<!-- </if>-->
|
|
|
+<!-- </if>-->
|
|
|
<if test="param.startTime !=null">
|
|
|
<![CDATA[AND t.create_time_ >= #{param.startTime} ]]>
|
|
|
</if>
|
|
@@ -146,12 +160,12 @@
|
|
|
<if test="null != param.delFlag">
|
|
|
and u.del_flag_ = #{param.delFlag}
|
|
|
</if>
|
|
|
- <if test="null != param.vipEndTime">
|
|
|
- and t.membership_end_time_ <= #{param.vipEndTime}
|
|
|
- </if>
|
|
|
- <if test="null != param.vipStartTime">
|
|
|
- and t.membership_end_time_ >= #{param.vipStartTime}
|
|
|
- </if>
|
|
|
+<!-- <if test="null != param.vipEndTime">-->
|
|
|
+<!-- and vcr.end_time_ <= #{param.vipEndTime}-->
|
|
|
+<!-- </if>-->
|
|
|
+<!-- <if test="null != param.vipStartTime">-->
|
|
|
+<!-- and vcr.end_time_ >= #{param.vipStartTime}-->
|
|
|
+<!-- </if>-->
|
|
|
<if test="param.trainFlag != null">
|
|
|
AND t.train_time_ > 0
|
|
|
</if>
|
|
@@ -183,6 +197,16 @@
|
|
|
AND FIND_IN_SET(t.tenant_group_id_, #{param.tenantGroupId})
|
|
|
</if>
|
|
|
</where>
|
|
|
+ group by t.user_id_
|
|
|
+ <if test="param.vipStartTime != null and param.vipEndTime != null">
|
|
|
+ having
|
|
|
+ <if test="param.vipType == 'VIP'">
|
|
|
+ and vipEndTime >= #{param.vipStartTime} and #{param.vipEndTime}> vipEndTime
|
|
|
+ </if>
|
|
|
+ <if test="param.vipType == 'SVIP'">
|
|
|
+ and svipEndTime >= #{param.vipStartTime} and #{param.vipEndTime}> svipEndTime
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
<choose>
|
|
|
<when test="param.orderBy != null and param.orderBy.trim() != ''">
|
|
|
order by ${param.orderBy}
|
|
@@ -373,4 +397,15 @@
|
|
|
</where>
|
|
|
group by tenant_group_id_
|
|
|
</select>
|
|
|
+
|
|
|
+ <select id="queryStudentVipInfo" resultType="com.yonge.cooleshow.biz.dal.wrapper.StudentWrapper$StudentVipInfo">
|
|
|
+ select t.user_id_ studentId
|
|
|
+ ,ifnull(vcr.vip_type_,'NORMAL') currentVipType
|
|
|
+ from student t
|
|
|
+ left join vip_card_record vcr on t.user_id_ = vcr.user_id_ and vcr.efficient_flag_ = 1 and vcr.end_time_>now() and now()>= vcr.start_time_ and vcr.client_type_= 'STUDENT'
|
|
|
+ where t.user_id_ in
|
|
|
+ <foreach collection="param.studentIdList" separator="," item="item" open="(" close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </select>
|
|
|
</mapper>
|