|
@@ -1650,38 +1650,34 @@
|
|
|
</select>
|
|
|
|
|
|
<select id="getOrganOtherAmountDataWithTimelyDetails" resultMap="IndexBaseMonthData">
|
|
|
- SELECT
|
|
|
- o.id_ organ_id_,o.name_ organ_name_,COALESCE(SUM(c.total_num_), 0) percent_
|
|
|
- FROM organization o
|
|
|
+ SELECT o.id_ organ_id_,o.name_ organ_name_,SUM(c.total_num_) percent_ FROM organization o
|
|
|
LEFT JOIN (
|
|
|
- SELECT organ_id_, type_, SUM(total_num_) total_num_
|
|
|
- FROM (
|
|
|
- SELECT spo.organ_id_, spo.type_, (COALESCE(spo.actual_amount_, 0) + COALESCE(spo.balance_payment_amount_, 0)) total_num_
|
|
|
+ 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_,spo.type_
|
|
|
FROM student_payment_order spo
|
|
|
- WHERE spo.status_ = 'SUCCESS' AND spo.tenant_id_ = #{tenantId}
|
|
|
- AND spo.type_ NOT IN ('APPLY', 'ADD_STUDENT', 'RENEW', 'PRACTICE_GROUP_BUY', 'PRACTICE_GROUP_RENEW', 'SMALL_CLASS_TO_BUY', 'DEGREE')
|
|
|
+ WHERE spo.status_ = 'SUCCESS' AND spo.pay_time_ BETWEEN #{startDate} AND #{endDate} and spo.tenant_id_ = #{tenantId}
|
|
|
+ AND spo.type_ NOT IN ('APPLY','ADD_STUDENT','RENEW','PRACTICE_GROUP_BUY','PRACTICE_GROUP_RENEW','SMALL_CLASS_TO_BUY','DEGREE')
|
|
|
<if test="organIds!=null and organIds.size()>0">
|
|
|
AND spo.organ_id_ IN
|
|
|
<foreach collection="organIds" item="organId" open="(" close=")" separator=",">
|
|
|
#{organId}
|
|
|
</foreach>
|
|
|
</if>
|
|
|
- AND spo.pay_time_ BETWEEN #{startDate} AND #{endDate}
|
|
|
+ GROUP BY spo.organ_id_,spo.type_
|
|
|
UNION ALL
|
|
|
- SELECT spo.organ_id_, spo.type_, COALESCE(spod.price_, 0) total_num_
|
|
|
+ SELECT spo.organ_id_,SUM(CASE WHEN spod.price_ IS NULL THEN 0 ELSE spod.price_ END) total_num_,spo.type_
|
|
|
FROM student_payment_order spo
|
|
|
LEFT JOIN student_payment_order_detail spod ON spo.id_ = spod.payment_order_id_
|
|
|
- WHERE spo.status_ = 'SUCCESS' AND spo.tenant_id_ = #{tenantId} AND spo.type_ = 'DEGREE' AND spod.type_ = 'DEGREE_REGISTRATION'
|
|
|
+ WHERE spo.status_ = 'SUCCESS' AND spo.pay_time_ BETWEEN #{startDate} AND #{endDate}
|
|
|
+ AND spo.type_ = 'DEGREE' AND spod.type_ = 'DEGREE_REGISTRATION'
|
|
|
<if test="organIds!=null and organIds.size()>0">
|
|
|
AND spo.organ_id_ IN
|
|
|
<foreach collection="organIds" item="organId" open="(" close=")" separator=",">
|
|
|
#{organId}
|
|
|
</foreach>
|
|
|
</if>
|
|
|
- AND spo.pay_time_ BETWEEN #{startDate} AND #{endDate}
|
|
|
- ) t
|
|
|
- GROUP BY organ_id_, type_
|
|
|
- ) c ON o.id_ = c.organ_id_
|
|
|
+ GROUP BY spo.organ_id_,spo.type_
|
|
|
+ )c ON c.organ_id_ = o.id_
|
|
|
WHERE o.tenant_id_ = #{tenantId}
|
|
|
<if test="organIds!=null and organIds.size()>0">
|
|
|
AND o.id_ IN
|
|
@@ -1689,8 +1685,7 @@
|
|
|
#{organId}
|
|
|
</foreach>
|
|
|
</if>
|
|
|
- GROUP BY o.id_,o.name_
|
|
|
- ORDER BY percent_ DESC
|
|
|
+ GROUP BY o.id_ ORDER BY percent_ DESC
|
|
|
</select>
|
|
|
|
|
|
<sql id="queryTeacherServeInfoCondition">
|