|
@@ -397,24 +397,37 @@
|
|
|
<select id="countRenewStudentNum" resultType="java.lang.Integer">
|
|
|
SELECT COUNT(cssp.user_id_) FROM (
|
|
|
<if test="groupType == 'VIP'">
|
|
|
- SELECT cssp.user_id_,MIN(vg.create_time_) first_order_time_,MAX(vg.create_time_) last_order_time_ FROM course_schedule_student_payment cssp
|
|
|
- LEFT JOIN vip_group vg ON CONVERT(vg.id_ , CHAR) = cssp.music_group_id_
|
|
|
- LEFT JOIN vip_group_category vgc ON vgc.id_ = vg.vip_group_category_id_
|
|
|
- WHERE cssp.actual_price_ > 0 AND cssp.group_type_ = 'VIP' AND vgc.music_theory_ = 0 AND DATE_FORMAT(vg.create_time_, '%Y-%m-%d') BETWEEN #{startDate} AND #{endDate}
|
|
|
- GROUP BY cssp.user_id_
|
|
|
+ select aum.user_id_,MIN(aum.create_time_) first_order_time_,MAX(aum.create_time_) last_order_time_ from activity_user_mapper aum
|
|
|
+ where aum.vip_flag_ != 0 and aum.category_id_ != 16 AND DATE_FORMAT(aum.create_time_, '%Y-%m-%d') BETWEEN #{startDate} AND #{endDate}
|
|
|
+ <if test="organIdList != null and organIdList.size > 0">
|
|
|
+ AND aum.organ_id_ IN
|
|
|
+ <foreach collection="organIdList" item="organId" open="(" close=")" separator=",">
|
|
|
+ #{organId}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ group by aum.user_id_
|
|
|
</if>
|
|
|
<if test="groupType == 'THEORY'">
|
|
|
- SELECT cssp.user_id_,MIN(vg.create_time_) first_order_time_,MAX(vg.create_time_) last_order_time_ FROM course_schedule_student_payment cssp
|
|
|
- LEFT JOIN vip_group vg ON CONVERT(vg.id_ , CHAR) = cssp.music_group_id_
|
|
|
- LEFT JOIN vip_group_category vgc ON vgc.id_ = vg.vip_group_category_id_
|
|
|
- WHERE cssp.actual_price_ > 0 AND cssp.group_type_ = 'VIP' AND vgc.music_theory_ AND DATE_FORMAT(vg.create_time_, '%Y-%m-%d') BETWEEN #{startDate} AND #{endDate}
|
|
|
- GROUP BY cssp.user_id_
|
|
|
+ select aum.user_id_,MIN(aum.create_time_) first_order_time_,MAX(aum.create_time_) last_order_time_ from activity_user_mapper aum
|
|
|
+ where aum.vip_flag_ != 0 and aum.category_id_ = 16 AND DATE_FORMAT(aum.create_time_, '%Y-%m-%d') BETWEEN #{startDate} AND #{endDate}
|
|
|
+ <if test="organIdList != null and organIdList.size > 0">
|
|
|
+ AND aum.organ_id_ IN
|
|
|
+ <foreach collection="organIdList" item="organId" open="(" close=")" separator=",">
|
|
|
+ #{organId}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ group by aum.user_id_
|
|
|
</if>
|
|
|
<if test="groupType == 'PRACTICE'">
|
|
|
- SELECT cssp.user_id_,MIN(pg.create_time_) first_order_time_,MAX(pg.create_time_) last_order_time_ FROM course_schedule_student_payment cssp
|
|
|
- LEFT JOIN practice_group pg ON CONVERT(pg.id_ , CHAR) = cssp.music_group_id_
|
|
|
- WHERE cssp.actual_price_ > 0 AND cssp.group_type_ = 'PRACTICE' AND DATE_FORMAT(pg.create_time_, '%Y-%m-%d') BETWEEN #{startDate} AND #{endDate}
|
|
|
- GROUP BY cssp.user_id_
|
|
|
+ select aum.user_id_,MIN(aum.create_time_) first_order_time_,MAX(aum.create_time_) last_order_time_ from activity_user_mapper aum
|
|
|
+ where aum.practice_flag_ != 0 AND DATE_FORMAT(aum.create_time_, '%Y-%m-%d') BETWEEN #{startDate} AND #{endDate}
|
|
|
+ <if test="organIdList != null and organIdList.size > 0">
|
|
|
+ AND aum.organ_id_ IN
|
|
|
+ <foreach collection="organIdList" item="organId" open="(" close=")" separator=",">
|
|
|
+ #{organId}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ group by aum.user_id_
|
|
|
</if> ) cssp
|
|
|
LEFT JOIN student_statistics ss ON cssp.user_id_ = ss.user_id_
|
|
|
WHERE ss.group_type_ = #{groupType} AND (cssp.first_order_time_ != ss.first_order_time_ OR cssp.last_order_time_ != ss.first_order_time_)
|