|
@@ -1399,6 +1399,7 @@
|
|
|
</if>
|
|
|
GROUP BY o.id_ ORDER BY percent_ DESC
|
|
|
</select>
|
|
|
+
|
|
|
<select id="getFinanceBalanceDataWithTimely" resultMap="IndexBaseMonthData">
|
|
|
SELECT spo.organ_id_,SUM(CASE WHEN spo.balance_payment_amount_ IS NULL THEN 0 ELSE spo.balance_payment_amount_ END) total_num_,
|
|
|
SUM(CASE WHEN spo.balance_payment_amount_ IS NULL THEN 0 ELSE spo.balance_payment_amount_ END) activate_num_,
|
|
@@ -1413,6 +1414,7 @@
|
|
|
</if>
|
|
|
GROUP BY DATE_FORMAT(spo.pay_time_,'%Y-%m-%d')
|
|
|
</select>
|
|
|
+
|
|
|
<select id="getOrganFinanceBalanceDataWithTimely" resultMap="IndexBaseMonthData">
|
|
|
SELECT SUM(CASE WHEN spo.balance_payment_amount_ IS NULL THEN 0 ELSE spo.balance_payment_amount_ END) percent_,
|
|
|
o.id_ organ_id_,o.name_ organ_name_
|
|
@@ -1428,6 +1430,7 @@
|
|
|
</if>
|
|
|
GROUP BY o.id_ ORDER BY percent_ DESC
|
|
|
</select>
|
|
|
+
|
|
|
<select id="getFinanceActualDataWithTimely" resultMap="IndexBaseMonthData">
|
|
|
SELECT spo.organ_id_,SUM(spo.actual_amount_) total_num_,
|
|
|
SUM(spo.actual_amount_) activate_num_,
|
|
@@ -1442,6 +1445,7 @@
|
|
|
</if>
|
|
|
GROUP BY DATE_FORMAT(spo.pay_time_,'%Y-%m-%d')
|
|
|
</select>
|
|
|
+
|
|
|
<select id="getOrganFinanceActualDataWithTimely" resultMap="IndexBaseMonthData">
|
|
|
SELECT SUM(spo.actual_amount_) percent_,o.id_ organ_id_,o.name_ organ_name_
|
|
|
FROM organization o
|
|
@@ -1456,6 +1460,7 @@
|
|
|
</if>
|
|
|
GROUP BY o.id_ ORDER BY percent_ DESC
|
|
|
</select>
|
|
|
+
|
|
|
<select id="getTotalAmountDataWithTimely" resultMap="IndexBaseMonthData">
|
|
|
SELECT spo.organ_id_,SUM(CASE WHEN spo.actual_amount_ IS NULL THEN 0 ELSE spo.actual_amount_ END +
|
|
|
CASE WHEN spo.balance_payment_amount_ IS NULL THEN 0 ELSE spo.balance_payment_amount_ END) total_num_,
|
|
@@ -1473,6 +1478,7 @@
|
|
|
</if>
|
|
|
GROUP BY DATE_FORMAT(spo.pay_time_,'%Y-%m-%d')
|
|
|
</select>
|
|
|
+
|
|
|
<select id="getOrganTotalAmountDataWithTimely" resultMap="IndexBaseMonthData">
|
|
|
SELECT SUM(CASE WHEN spo.actual_amount_ IS NULL THEN 0 ELSE spo.actual_amount_ END +
|
|
|
CASE WHEN spo.balance_payment_amount_ IS NULL THEN 0 ELSE spo.balance_payment_amount_ END) percent_,
|
|
@@ -1489,6 +1495,7 @@
|
|
|
</if>
|
|
|
GROUP BY o.id_ ORDER BY percent_ DESC
|
|
|
</select>
|
|
|
+
|
|
|
<select id="getTotalAmountDataWithTimelyDetails" resultMap="IndexBaseMonthData">
|
|
|
SELECT spo.organ_id_,SUM(CASE WHEN spo.actual_amount_ IS NULL THEN 0 ELSE spo.actual_amount_ END +
|
|
|
CASE WHEN spo.balance_payment_amount_ IS NULL THEN 0 ELSE spo.balance_payment_amount_ END) total_num_,
|
|
@@ -1687,6 +1694,231 @@
|
|
|
GROUP BY o.id_ ORDER BY percent_ DESC
|
|
|
</select>
|
|
|
|
|
|
+ <select id="getFinancePayDataWithTimelyByCoop" resultMap="IndexBaseMonthData">
|
|
|
+ SELECT SUM(fe.amount_) total_num_,SUM(fe.amount_) activate_num_,SUM(fe.amount_) percent_,cop.organ_id_,DATE_FORMAT(fe.create_time_,'%Y-%m-%d') month_
|
|
|
+ FROM financial_expenditure fe
|
|
|
+ left join (select sr.user_id_,mg.cooperation_organ_id_ organ_id_,co.name_ organ_name_ from
|
|
|
+ (select * from student_registration where id_ IN (select MAX(id_) from student_registration group by user_id_)) sr
|
|
|
+ left join music_group mg ON mg.id_ = sr.music_group_id_
|
|
|
+ left join cooperation_organ co ON co.id_ = mg.cooperation_organ_id_
|
|
|
+ where mg.organ_id_ = #{organId} group by sr.user_id_,mg.cooperation_organ_id_) cop ON cop.user_id_ = fe.apply_user_id_
|
|
|
+ WHERE DATE_FORMAT(fe.create_time_,'%Y-%m-%d') BETWEEN #{startDate} AND #{endDate}
|
|
|
+ AND del_flag_ = 0 AND fe.apply_user_id_ = cop.user_id_
|
|
|
+ GROUP BY DATE_FORMAT(fe.create_time_,'%Y-%m-%d')
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getOrganFinancePayDataWithTimelyByCoop" resultMap="IndexBaseMonthData">
|
|
|
+ SELECT SUM(fe.amount_) percent_,cop.organ_id_,cop.organ_name_
|
|
|
+ FROM financial_expenditure fe
|
|
|
+ left join (select sr.user_id_,mg.cooperation_organ_id_ organ_id_,co.name_ organ_name_ from
|
|
|
+ (select * from student_registration where id_ IN (select MAX(id_) from student_registration group by user_id_)) sr
|
|
|
+ left join music_group mg ON mg.id_ = sr.music_group_id_
|
|
|
+ left join cooperation_organ co ON co.id_ = mg.cooperation_organ_id_
|
|
|
+ where mg.organ_id_ = #{organId} group by sr.user_id_,mg.cooperation_organ_id_) cop ON cop.user_id_ = fe.apply_user_id_
|
|
|
+ WHERE DATE_FORMAT(fe.create_time_,'%Y-%m-%d') BETWEEN #{startDate} AND #{endDate} AND fe.del_flag_ = 0
|
|
|
+ AND fe.apply_user_id_ = cop.user_id_
|
|
|
+ GROUP BY cop.organ_id_ ORDER BY percent_ DESC
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getFinanceBalanceDataWithTimelyByCoop" resultMap="IndexBaseMonthData">
|
|
|
+ SELECT cop.organ_id_,SUM(CASE WHEN spo.balance_payment_amount_ IS NULL THEN 0 ELSE spo.balance_payment_amount_ END) total_num_,
|
|
|
+ SUM(CASE WHEN spo.balance_payment_amount_ IS NULL THEN 0 ELSE spo.balance_payment_amount_ END) activate_num_,
|
|
|
+ SUM(CASE WHEN spo.balance_payment_amount_ IS NULL THEN 0 ELSE spo.balance_payment_amount_ END) percent_,DATE_FORMAT(spo.pay_time_,'%Y-%m-%d') month_
|
|
|
+ FROM student_payment_order spo
|
|
|
+ <include refid="cooperationSql"/>
|
|
|
+ WHERE spo.status_ = 'SUCCESS' AND DATE_FORMAT(spo.pay_time_,'%Y-%m-%d') BETWEEN #{startDate} AND #{endDate}
|
|
|
+ AND cop.user_id_ = spo.user_id_
|
|
|
+ GROUP BY DATE_FORMAT(spo.pay_time_,'%Y-%m-%d')
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getOrganFinanceBalanceDataWithTimelyByCoop" resultMap="IndexBaseMonthData">
|
|
|
+ SELECT SUM(CASE WHEN spo.balance_payment_amount_ IS NULL THEN 0 ELSE spo.balance_payment_amount_ END) percent_,
|
|
|
+ cop.organ_id_,cop.organ_name_
|
|
|
+ FROM student_payment_order spo
|
|
|
+ <include refid="cooperationSql"/>
|
|
|
+ WHERE spo.status_ = 'SUCCESS' AND DATE_FORMAT(spo.pay_time_,'%Y-%m-%d') BETWEEN #{startDate} AND #{endDate}
|
|
|
+ AND cop.user_id_ = spo.user_id_
|
|
|
+ GROUP BY cop.organ_id_ ORDER BY percent_ DESC
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getFinanceActualDataWithTimelyByCoop" resultMap="IndexBaseMonthData">
|
|
|
+ SELECT cop.organ_id_,SUM(spo.actual_amount_) total_num_,
|
|
|
+ SUM(spo.actual_amount_) activate_num_,
|
|
|
+ SUM(spo.actual_amount_) percent_,DATE_FORMAT(spo.pay_time_,'%Y-%m-%d') month_
|
|
|
+ FROM student_payment_order spo
|
|
|
+ <include refid="cooperationSql"/>
|
|
|
+ WHERE spo.status_ = 'SUCCESS' AND DATE_FORMAT(spo.pay_time_,'%Y-%m-%d') BETWEEN #{startDate} AND #{endDate}
|
|
|
+ AND cop.user_id_ = spo.user_id_
|
|
|
+ GROUP BY DATE_FORMAT(spo.pay_time_,'%Y-%m-%d')
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getOrganFinanceActualDataWithTimelyByCoop" resultMap="IndexBaseMonthData">
|
|
|
+ SELECT SUM(spo.actual_amount_) percent_,cop.organ_id_,cop.organ_name_
|
|
|
+ FROM student_payment_order spo
|
|
|
+ <include refid="cooperationSql"/>
|
|
|
+ WHERE spo.status_ = 'SUCCESS' AND DATE_FORMAT(spo.pay_time_,'%Y-%m-%d') BETWEEN #{startDate} AND #{endDate}
|
|
|
+ AND cop.user_id_ = spo.user_id_
|
|
|
+ GROUP BY cop.organ_id_ ORDER BY percent_ DESC
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <sql id="cooperationSql">
|
|
|
+ left join (select sr.user_id_,mg.cooperation_organ_id_ organ_id_,co.name_ organ_name_ from
|
|
|
+ (select * from student_registration where id_ IN (select MAX(id_) from student_registration group by user_id_)) sr
|
|
|
+ left join music_group mg ON mg.id_ = sr.music_group_id_
|
|
|
+ left join cooperation_organ co ON co.id_ = mg.cooperation_organ_id_
|
|
|
+ where mg.organ_id_ = #{organId} group by sr.user_id_,mg.cooperation_organ_id_) cop ON cop.user_id_ = spo.user_id_
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <select id="getTotalAmountDataWithTimelyByCoop" resultMap="IndexBaseMonthData">
|
|
|
+ SELECT cop.organ_id_,SUM(CASE WHEN spo.actual_amount_ IS NULL THEN 0 ELSE spo.actual_amount_ END +
|
|
|
+ CASE WHEN spo.balance_payment_amount_ IS NULL THEN 0 ELSE spo.balance_payment_amount_ END) total_num_,
|
|
|
+ SUM(CASE WHEN spo.actual_amount_ IS NULL THEN 0 ELSE spo.actual_amount_ END +
|
|
|
+ CASE WHEN spo.balance_payment_amount_ IS NULL THEN 0 ELSE spo.balance_payment_amount_ END) activate_num_,
|
|
|
+ SUM(CASE WHEN spo.actual_amount_ IS NULL THEN 0 ELSE spo.actual_amount_ END +
|
|
|
+ CASE WHEN spo.balance_payment_amount_ IS NULL THEN 0 ELSE spo.balance_payment_amount_ END) percent_,DATE_FORMAT(spo.pay_time_,'%Y-%m-%d') month_
|
|
|
+ FROM student_payment_order spo
|
|
|
+ <include refid="cooperationSql"/>
|
|
|
+ WHERE spo.status_ = 'SUCCESS' AND DATE_FORMAT(spo.pay_time_,'%Y-%m-%d') BETWEEN #{startDate} AND #{endDate}
|
|
|
+ AND cop.user_id_ = spo.user_id_
|
|
|
+ GROUP BY DATE_FORMAT(spo.pay_time_,'%Y-%m-%d')
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getOrganTotalAmountDataWithTimelyByCoop" resultMap="IndexBaseMonthData">
|
|
|
+ SELECT SUM(CASE WHEN spo.actual_amount_ IS NULL THEN 0 ELSE spo.actual_amount_ END +
|
|
|
+ CASE WHEN spo.balance_payment_amount_ IS NULL THEN 0 ELSE spo.balance_payment_amount_ END) percent_,
|
|
|
+ cop.organ_id_,cop.organ_name_
|
|
|
+ FROM student_payment_order spo
|
|
|
+ <include refid="cooperationSql"/>
|
|
|
+ WHERE spo.status_ = 'SUCCESS' AND DATE_FORMAT(spo.pay_time_,'%Y-%m-%d') BETWEEN #{startDate} AND #{endDate}
|
|
|
+ GROUP BY cop.organ_id_ ORDER BY percent_ DESC
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getTotalAmountDataWithTimelyDetailsByCoop" resultMap="IndexBaseMonthData">
|
|
|
+ SELECT spo.organ_id_,SUM(CASE WHEN spo.actual_amount_ IS NULL THEN 0 ELSE spo.actual_amount_ END +
|
|
|
+ CASE WHEN spo.balance_payment_amount_ IS NULL THEN 0 ELSE spo.balance_payment_amount_ END) total_num_,
|
|
|
+ SUM(CASE WHEN spo.actual_amount_ IS NULL THEN 0 ELSE spo.actual_amount_ END +
|
|
|
+ CASE WHEN spo.balance_payment_amount_ IS NULL THEN 0 ELSE spo.balance_payment_amount_ END) activate_num_,
|
|
|
+ SUM(CASE WHEN spo.actual_amount_ IS NULL THEN 0 ELSE spo.actual_amount_ END +
|
|
|
+ CASE WHEN spo.balance_payment_amount_ IS NULL THEN 0 ELSE spo.balance_payment_amount_ END) percent_,DATE_FORMAT(spo.pay_time_,'%Y-%m-%d') month_
|
|
|
+ FROM student_payment_order spo
|
|
|
+ <include refid="cooperationSql"/>
|
|
|
+ WHERE spo.status_ = 'SUCCESS' AND DATE_FORMAT(spo.pay_time_,'%Y-%m-%d') BETWEEN #{startDate} AND #{endDate}
|
|
|
+ <if test="orderType != null">
|
|
|
+ AND FIND_IN_SET(spo.type_,#{orderType})
|
|
|
+ </if>
|
|
|
+ <if test="notOrderType != null">
|
|
|
+ AND spo.type_ NOT IN
|
|
|
+ <foreach collection="notOrderType" open="(" close=")" item="item" separator=",">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ GROUP BY DATE_FORMAT(spo.pay_time_,'%Y-%m-%d')
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getOrganTotalAmountDataWithTimelyDetailsByCoop" resultMap="IndexBaseMonthData">
|
|
|
+ SELECT SUM(CASE WHEN spo.actual_amount_ IS NULL THEN 0 ELSE spo.actual_amount_ END +
|
|
|
+ CASE WHEN spo.balance_payment_amount_ IS NULL THEN 0 ELSE spo.balance_payment_amount_ END) percent_,
|
|
|
+ cop.organ_id_,cop.organ_name_
|
|
|
+ FROM student_payment_order spo
|
|
|
+ <include refid="cooperationSql"/>
|
|
|
+ AND spo.status_ = 'SUCCESS' AND DATE_FORMAT(spo.pay_time_,'%Y-%m-%d') BETWEEN #{startDate} AND #{endDate}
|
|
|
+ <if test="orderType != null">
|
|
|
+ AND FIND_IN_SET(spo.type_,#{orderType})
|
|
|
+ </if>
|
|
|
+ <if test="notOrderType != null">
|
|
|
+ AND spo.type_ NOT IN
|
|
|
+ <foreach collection="notOrderType" open="(" close=")" item="item" separator=",">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ GROUP BY cop.organ_id_ ORDER BY percent_ DESC
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getVipAmountDataWithTimelyDetailsByCoop" resultMap="IndexBaseMonthData">
|
|
|
+ SELECT c.organ_id_,SUM(c.total_num_) total_num_,SUM(c.total_num_) activate_num_,SUM(c.total_num_) percent_,month_ FROM (
|
|
|
+ SELECT cop.organ_id_,SUM(CASE WHEN spod.price_ IS NULL THEN 0 ELSE spod.price_ END) total_num_,DATE_FORMAT(spo.pay_time_,'%Y-%m-%d') month_
|
|
|
+ FROM student_payment_order spo
|
|
|
+ <include refid="cooperationSql"/>
|
|
|
+ LEFT JOIN student_payment_order_detail spod ON spo.id_ = spod.payment_order_id_
|
|
|
+ WHERE spo.status_ = 'SUCCESS' AND DATE_FORMAT(spo.pay_time_,'%Y-%m-%d') BETWEEN #{startDate} AND #{endDate}
|
|
|
+ AND spo.type_ = 'DEGREE' AND spod.type_ IN ('THEORY_COURSE','VIP')
|
|
|
+ GROUP BY DATE_FORMAT(spo.pay_time_,'%Y-%m-%d')
|
|
|
+ UNION ALL
|
|
|
+ SELECT cop.organ_id_,SUM(CASE WHEN spo.actual_amount_ IS NULL THEN 0 ELSE spo.actual_amount_ END +
|
|
|
+ CASE WHEN spo.balance_payment_amount_ IS NULL THEN 0 ELSE spo.balance_payment_amount_ END) total_num_
|
|
|
+ ,DATE_FORMAT(spo.pay_time_,'%Y-%m-%d') month_
|
|
|
+ FROM student_payment_order spo
|
|
|
+ <include refid="cooperationSql"/>
|
|
|
+ WHERE spo.status_ = 'SUCCESS' AND DATE_FORMAT(spo.pay_time_,'%Y-%m-%d') BETWEEN #{startDate} AND #{endDate}
|
|
|
+ AND spo.type_ = 'SMALL_CLASS_TO_BUY'
|
|
|
+ GROUP BY DATE_FORMAT(spo.pay_time_,'%Y-%m-%d')
|
|
|
+ )c GROUP BY DATE_FORMAT(c.month_,'%Y-%m-%d')
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getOrganVipAmountDataWithTimelyDetailsByCoop" resultMap="IndexBaseMonthData">
|
|
|
+ SELECT c.organ_id_,c.organ_name_,SUM(c.total_num_) percent_ FROM
|
|
|
+ (SELECT cop.organ_id_,cop.organ_name_,SUM(CASE WHEN spod.price_ IS NULL THEN 0 ELSE spod.price_ END) total_num_
|
|
|
+ FROM student_payment_order spo
|
|
|
+ <include refid="cooperationSql"/>
|
|
|
+ LEFT JOIN student_payment_order_detail spod ON spo.id_ = spod.payment_order_id_
|
|
|
+ WHERE spo.status_ = 'SUCCESS' AND DATE_FORMAT(spo.pay_time_,'%Y-%m-%d') BETWEEN #{startDate} AND #{endDate}
|
|
|
+ AND spo.type_ = 'DEGREE' AND spod.type_ IN ('THEORY_COURSE','VIP')
|
|
|
+ GROUP BY cop.organ_id_
|
|
|
+ UNION ALL
|
|
|
+ SELECT cop.organ_id_,cop.organ_name_,SUM(CASE WHEN spo.actual_amount_ IS NULL THEN 0 ELSE spo.actual_amount_ END +
|
|
|
+ CASE WHEN spo.balance_payment_amount_ IS NULL THEN 0 ELSE spo.balance_payment_amount_ END) total_num_
|
|
|
+ FROM student_payment_order spo
|
|
|
+ <include refid="cooperationSql"/>
|
|
|
+ WHERE spo.status_ = 'SUCCESS' AND DATE_FORMAT(spo.pay_time_,'%Y-%m-%d') BETWEEN #{startDate} AND #{endDate}
|
|
|
+ AND spo.type_ = 'SMALL_CLASS_TO_BUY'
|
|
|
+ GROUP BY cop.organ_id_
|
|
|
+ )c
|
|
|
+ GROUP BY c.organ_id_ ORDER BY percent_ DESC
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getOtherAmountDataWithTimelyDetailsByCoop" resultMap="IndexBaseMonthData">
|
|
|
+ SELECT c.organ_id_,SUM(c.total_num_) total_num_,SUM(c.total_num_) activate_num_,SUM(c.total_num_) percent_,month_,c.type_ order_type_ FROM (
|
|
|
+ SELECT cop.organ_id_,SUM(CASE WHEN spo.actual_amount_ IS NULL THEN 0 ELSE spo.actual_amount_ END +
|
|
|
+ CASE WHEN spo.balance_payment_amount_ IS NULL THEN 0 ELSE spo.balance_payment_amount_ END) total_num_
|
|
|
+ ,DATE_FORMAT(spo.pay_time_,'%Y-%m-%d') month_,spo.type_
|
|
|
+ FROM student_payment_order spo
|
|
|
+ <include refid="cooperationSql"/>
|
|
|
+ WHERE spo.status_ = 'SUCCESS' AND DATE_FORMAT(spo.pay_time_,'%Y-%m-%d') BETWEEN #{startDate} AND #{endDate}
|
|
|
+ AND spo.type_ NOT IN ('APPLY','RENEW','PRACTICE_GROUP_BUY','PRACTICE_GROUP_RENEW','SMALL_CLASS_TO_BUY','DEGREE')
|
|
|
+ GROUP BY DATE_FORMAT(spo.pay_time_,'%Y-%m-%d'),spo.type_
|
|
|
+ UNION ALL
|
|
|
+ SELECT cop.organ_id_,SUM(CASE WHEN spod.price_ IS NULL THEN 0 ELSE spod.price_ END) total_num_,DATE_FORMAT(spo.pay_time_,'%Y-%m-%d') month_,spo.type_
|
|
|
+ FROM student_payment_order spo
|
|
|
+ <include refid="cooperationSql"/>
|
|
|
+ LEFT JOIN student_payment_order_detail spod ON spo.id_ = spod.payment_order_id_
|
|
|
+ WHERE spo.status_ = 'SUCCESS' AND DATE_FORMAT(spo.pay_time_,'%Y-%m-%d') BETWEEN #{startDate} AND #{endDate}
|
|
|
+ AND spo.type_ = 'DEGREE' AND spod.type_ = 'DEGREE_REGISTRATION'
|
|
|
+ GROUP BY DATE_FORMAT(spo.pay_time_,'%Y-%m-%d'),spo.type_
|
|
|
+ )c GROUP BY DATE_FORMAT(c.month_,'%Y-%m-%d'),c.type_
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getOrganOtherAmountDataWithTimelyDetailsByCoop" resultMap="IndexBaseMonthData">
|
|
|
+ SELECT c.organ_id_,c.organ_name_,SUM(c.total_num_) percent_ FROM
|
|
|
+ (
|
|
|
+ SELECT cop.organ_id_,cop.organ_name_,SUM(CASE WHEN spo.actual_amount_ IS NULL THEN 0 ELSE spo.actual_amount_ END +
|
|
|
+ CASE WHEN spo.balance_payment_amount_ IS NULL THEN 0 ELSE spo.balance_payment_amount_ END) total_num_,spo.type_
|
|
|
+ FROM student_payment_order spo
|
|
|
+ <include refid="cooperationSql"/>
|
|
|
+ WHERE spo.status_ = 'SUCCESS' AND DATE_FORMAT(spo.pay_time_,'%Y-%m-%d') BETWEEN #{startDate} AND #{endDate}
|
|
|
+ AND spo.type_ NOT IN ('APPLY','RENEW','PRACTICE_GROUP_BUY','PRACTICE_GROUP_RENEW','SMALL_CLASS_TO_BUY','DEGREE')
|
|
|
+ GROUP BY cop.organ_id_,spo.type_
|
|
|
+ UNION ALL
|
|
|
+ SELECT cop.organ_id_,cop.organ_name_,SUM(CASE WHEN spod.price_ IS NULL THEN 0 ELSE spod.price_ END) total_num_,spo.type_
|
|
|
+ FROM student_payment_order spo
|
|
|
+ <include refid="cooperationSql"/>
|
|
|
+ LEFT JOIN student_payment_order_detail spod ON spo.id_ = spod.payment_order_id_
|
|
|
+ WHERE spo.status_ = 'SUCCESS' AND DATE_FORMAT(spo.pay_time_,'%Y-%m-%d') BETWEEN #{startDate} AND #{endDate}
|
|
|
+ AND spo.type_ = 'DEGREE' AND spod.type_ = 'DEGREE_REGISTRATION'
|
|
|
+ GROUP BY cop.organ_id_,spo.type_
|
|
|
+ )c
|
|
|
+ GROUP BY c.organ_id_ ORDER BY percent_ DESC
|
|
|
+ </select>
|
|
|
+
|
|
|
<sql id="queryTeacherServeInfoCondition">
|
|
|
<where>
|
|
|
sees.tenant_id_ = #{tenantId}
|