|
@@ -122,6 +122,24 @@
|
|
|
<include refid="queryChildrenStatisticsSql"/>
|
|
|
GROUP BY cdr.music_group_id_) c
|
|
|
</select>
|
|
|
+
|
|
|
+ <select id="childrenStatistics" resultMap="ChildrenStatisticsDtoMap">
|
|
|
+ SELECT SUM(CASE WHEN cdd.grade_price_ > 0 THEN 1 ELSE NULL END) 'instrumental_music_num_',
|
|
|
+ SUM(CASE WHEN cdd.theory_price_ > 0 THEN 1 ELSE NULL END) 'music_theory_num_',
|
|
|
+ SUM(CASE WHEN cdd.vip_1v1_price_ > 0 THEN 1 ELSE NULL END) 'buy_vip1_num_',
|
|
|
+ SUM(cdd.vip_1v1_price_) 'buy_vip1_amount_',
|
|
|
+ SUM(CASE WHEN cdd.vip_1v2_price_ > 0 THEN 1 ELSE NULL END) 'buy_vip2_num_',
|
|
|
+ SUM(cdd.vip_1v2_price_) 'buy_vip2_amount_',
|
|
|
+ SUM(CASE WHEN cdd.theory_course_price_ > 0 THEN 1 ELSE NULL END) 'buy_music_theory_num_',
|
|
|
+ SUM(cdd.theory_course_price_) 'buy_music_theory_amount_',
|
|
|
+ SUM(cdd.total_amount_) 'total_amount_'
|
|
|
+ FROM children_day_reserve cdr
|
|
|
+ LEFT JOIN children_day_degree_info cdd ON cdr.id_ = cdd.reserve_id_
|
|
|
+ LEFT JOIN music_group mg ON mg.id_ = cdr.music_group_id_
|
|
|
+ LEFT JOIN cooperation_organ co ON co.id_ = cdr.cooperation_organ_id_
|
|
|
+ LEFT JOIN organization o ON o.id_ = cdr.organ_id_
|
|
|
+ <include refid="queryChildrenStatisticsSql"/>
|
|
|
+ </select>
|
|
|
<sql id="queryChildrenStatisticsSql">
|
|
|
<where>
|
|
|
<if test="cooperationId != null">
|
|
@@ -147,16 +165,29 @@
|
|
|
<result property="userId" column="user_id_"/>
|
|
|
<result property="isReserve" column="is_reserve_"/>
|
|
|
<result property="phone" column="phone_"/>
|
|
|
+ <result property="subjectName" column="subject_name_"/>
|
|
|
+ <result property="gradeLeave" column="grade_level_"/>
|
|
|
+ <result property="theoryLevel" column="theory_level_"/>
|
|
|
+ <result property="buyVip1v1Flag" column="buy_vip_1v1_flag_"/>
|
|
|
+ <result property="buyVip1v2Flag" column="buy_vip_1v2_flag_"/>
|
|
|
+ <result property="buyTheoryCourseFlag" column="buy_theory_course_flag_"/>
|
|
|
+ <result property="totalAmount" column="total_amount_"/>
|
|
|
</resultMap>
|
|
|
<select id="countChildrenStatisticsDetail" resultType="int">
|
|
|
SELECT COUNT(cdr.id_) FROM children_day_reserve cdr
|
|
|
LEFT JOIN sys_user su ON su.id_ = cdr.user_id_
|
|
|
+ LEFT JOIN children_day_degree_info cdd ON cdr.id_ = cdd.reserve_id_
|
|
|
<include refid="queryChildrenStatisticsDetailSql"/>
|
|
|
</select>
|
|
|
<select id="queryChildrenStatisticsDetail" resultMap="ChildrenStatisticsDetailDtoMap">
|
|
|
- SELECT su.username_,su.phone_,cdr.user_id_,cdr.is_reserve_
|
|
|
+ SELECT su.username_,su.phone_,cdr.user_id_,cdr.is_reserve_,s.name_ subject_name_,cdd.grade_level_,cdd.theory_level_,
|
|
|
+ CASE WHEN cdd.vip_1v1_price_ > 0 THEN 1 ELSE 0 END buy_vip_1v1_flag_,
|
|
|
+ CASE WHEN cdd.vip_1v2_price_ > 0 THEN 1 ELSE 0 END buy_vip_1v2_flag_,
|
|
|
+ CASE WHEN cdd.theory_course_price_ > 0 THEN 1 ELSE 0 END buy_theory_course_flag_,cdd.total_amount_
|
|
|
FROM children_day_reserve cdr
|
|
|
+ LEFT JOIN children_day_degree_info cdd ON cdr.id_ = cdd.reserve_id_
|
|
|
LEFT JOIN sys_user su ON su.id_ = cdr.user_id_
|
|
|
+ LEFT JOIN `subject` s ON s.id_ = cdd.subject_id_
|
|
|
<include refid="queryChildrenStatisticsDetailSql"/>
|
|
|
ORDER BY cdr.create_time_ DESC
|
|
|
<include refid="global.limit"/>
|
|
@@ -175,6 +206,41 @@
|
|
|
<if test="musicGroupId == null">
|
|
|
AND cdr.music_group_id_ IS NULL
|
|
|
</if>
|
|
|
+ <if test="subjectId != null">
|
|
|
+ AND cdd.subject_id_ = #{subjectId}
|
|
|
+ </if>
|
|
|
+ <if test="gradeFlag != null">
|
|
|
+ <if test="gradeFlag == 'true'">
|
|
|
+ AND cdd.grade_level_ IS NOT NULL
|
|
|
+ </if>
|
|
|
+ <if test="gradeFlag != 'false'">
|
|
|
+ AND cdd.grade_level_ IS NULL
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ <if test="theoryFlag != null">
|
|
|
+ <if test="theoryFlag == 'true'">
|
|
|
+ AND cdd.theory_level_ IS NOT NULL
|
|
|
+ </if>
|
|
|
+ <if test="theoryFlag != 'false'">
|
|
|
+ AND cdd.theory_level_ IS NULL
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ <if test="vipFlag != null">
|
|
|
+ <if test="vipFlag == 'true'">
|
|
|
+ AND (cdd.vip_1v1_price_ > 0 OR cdd.vip_1v2_price_ > 0)
|
|
|
+ </if>
|
|
|
+ <if test="vipFlag != 'false'">
|
|
|
+ AND (cdd.vip_1v1_price_ <= 0 OR cdd.vip_1v2_price_ <= 0)
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ <if test="theoryPriceFlag != null">
|
|
|
+ <if test="theoryPriceFlag == 'true'">
|
|
|
+ AND cdd.theory_course_price_ > 0
|
|
|
+ </if>
|
|
|
+ <if test="theoryPriceFlag != 'false'">
|
|
|
+ AND cdd.theory_course_price_ <= 0
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
</where>
|
|
|
</sql>
|
|
|
</mapper>
|