|
@@ -145,10 +145,7 @@
|
|
|
</foreach>
|
|
|
</if>
|
|
|
<if test="startMonth!=null and startMonth!=''">
|
|
|
- AND month_>=#{startMonth}
|
|
|
- </if>
|
|
|
- <if test="endMonth!=null and endMonth!=''">
|
|
|
- AND month_<=#{endMonth}
|
|
|
+ AND month_ BETWEEN #{startMonth} AND #{endMonth}
|
|
|
</if>
|
|
|
</where>
|
|
|
GROUP BY month_,data_type_
|
|
@@ -204,10 +201,7 @@
|
|
|
</foreach>
|
|
|
</if>
|
|
|
<if test="startMonth!=null and startMonth!=''">
|
|
|
- AND month_>=#{startMonth}
|
|
|
- </if>
|
|
|
- <if test="endMonth!=null and endMonth!=''">
|
|
|
- AND month_<=#{endMonth}
|
|
|
+ AND month_ BETWEEN #{startMonth} AND #{endMonth}
|
|
|
</if>
|
|
|
AND extend_info_ IS NOT NULL
|
|
|
</where>
|
|
@@ -1405,7 +1399,7 @@
|
|
|
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
|
|
|
- WHERE spo.status_ = 'SUCCESS' AND DATE_FORMAT(spo.pay_time_,'%Y-%m-%d') BETWEEN #{startDate} AND #{endDate} and spo.tenant_id_ = #{tenantId}
|
|
|
+ WHERE spo.status_ = 'SUCCESS' AND spo.pay_time_ BETWEEN #{startDate} AND #{endDate} and spo.tenant_id_ = #{tenantId}
|
|
|
<if test="organIds!=null and organIds.size()>0">
|
|
|
AND spo.organ_id_ IN
|
|
|
<foreach collection="organIds" item="organId" open="(" close=")" separator=",">
|
|
@@ -1420,7 +1414,7 @@
|
|
|
o.id_ organ_id_,o.name_ organ_name_
|
|
|
FROM organization o
|
|
|
LEFT JOIN student_payment_order spo ON o.id_ = spo.organ_id_ AND o.tenant_id_ = spo.tenant_id_
|
|
|
- AND spo.status_ = 'SUCCESS' AND DATE_FORMAT(spo.pay_time_,'%Y-%m-%d') BETWEEN #{startDate} AND #{endDate}
|
|
|
+ AND spo.status_ = 'SUCCESS' AND spo.pay_time_ BETWEEN #{startDate} AND #{endDate}
|
|
|
WHERE o.tenant_id_ = #{tenantId}
|
|
|
<if test="organIds!=null and organIds.size() > 0">
|
|
|
AND o.id_ IN
|
|
@@ -1436,7 +1430,7 @@
|
|
|
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
|
|
|
- WHERE spo.status_ = 'SUCCESS' AND DATE_FORMAT(spo.pay_time_,'%Y-%m-%d') BETWEEN #{startDate} AND #{endDate} and spo.tenant_id_ = #{tenantId}
|
|
|
+ WHERE spo.status_ = 'SUCCESS' AND spo.pay_time_ BETWEEN #{startDate} AND #{endDate} and spo.tenant_id_ = #{tenantId}
|
|
|
<if test="organIds!=null and organIds.size()>0">
|
|
|
AND spo.organ_id_ IN
|
|
|
<foreach collection="organIds" item="organId" open="(" close=")" separator=",">
|
|
@@ -1450,7 +1444,7 @@
|
|
|
SELECT SUM(spo.actual_amount_) percent_,o.id_ organ_id_,o.name_ organ_name_
|
|
|
FROM organization o
|
|
|
LEFT JOIN student_payment_order spo ON o.id_ = spo.organ_id_ AND o.tenant_id_ = spo.tenant_id_
|
|
|
- AND spo.status_ = 'SUCCESS' AND DATE_FORMAT(spo.pay_time_,'%Y-%m-%d') BETWEEN #{startDate} AND #{endDate}
|
|
|
+ AND spo.status_ = 'SUCCESS' AND spo.pay_time_ BETWEEN #{startDate} AND #{endDate}
|
|
|
WHERE o.tenant_id_ = #{tenantId}
|
|
|
<if test="organIds!=null and organIds.size()>0">
|
|
|
AND o.id_ IN
|
|
@@ -1469,7 +1463,7 @@
|
|
|
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
|
|
|
- WHERE spo.status_ = 'SUCCESS' AND DATE_FORMAT(spo.pay_time_,'%Y-%m-%d') BETWEEN #{startDate} AND #{endDate} and spo.tenant_id_ = #{tenantId}
|
|
|
+ WHERE spo.status_ = 'SUCCESS' AND spo.pay_time_ BETWEEN #{startDate} AND #{endDate} and spo.tenant_id_ = #{tenantId}
|
|
|
<if test="organIds!=null and organIds.size()>0">
|
|
|
AND spo.organ_id_ IN
|
|
|
<foreach collection="organIds" item="organId" open="(" close=")" separator=",">
|
|
@@ -1485,7 +1479,7 @@
|
|
|
o.id_ organ_id_,o.name_ organ_name_
|
|
|
FROM organization o
|
|
|
LEFT JOIN student_payment_order spo ON o.id_ = spo.organ_id_ AND o.tenant_id_ = spo.tenant_id_
|
|
|
- AND spo.status_ = 'SUCCESS' AND DATE_FORMAT(spo.pay_time_,'%Y-%m-%d') BETWEEN #{startDate} AND #{endDate}
|
|
|
+ AND spo.status_ = 'SUCCESS' AND spo.pay_time_ BETWEEN #{startDate} AND #{endDate}
|
|
|
WHERE o.tenant_id_ = #{tenantId}
|
|
|
<if test="organIds!=null and organIds.size()>0">
|
|
|
AND o.id_ IN
|
|
@@ -1504,7 +1498,7 @@
|
|
|
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
|
|
|
- WHERE spo.status_ = 'SUCCESS' AND DATE_FORMAT(spo.pay_time_,'%Y-%m-%d') BETWEEN #{startDate} AND #{endDate} and spo.tenant_id_ = #{tenantId}
|
|
|
+ WHERE spo.status_ = 'SUCCESS' AND spo.pay_time_ BETWEEN #{startDate} AND #{endDate} and spo.tenant_id_ = #{tenantId}
|
|
|
<if test="orderType != null">
|
|
|
AND FIND_IN_SET(spo.type_,#{orderType})
|
|
|
</if>
|
|
@@ -1529,7 +1523,7 @@
|
|
|
o.id_ organ_id_,o.name_ organ_name_
|
|
|
FROM organization o
|
|
|
LEFT JOIN student_payment_order spo ON o.id_ = spo.organ_id_ AND o.tenant_id_ = spo.tenant_id_
|
|
|
- AND spo.status_ = 'SUCCESS' AND DATE_FORMAT(spo.pay_time_,'%Y-%m-%d') BETWEEN #{startDate} AND #{endDate}
|
|
|
+ AND spo.status_ = 'SUCCESS' AND spo.pay_time_ BETWEEN #{startDate} AND #{endDate}
|
|
|
<if test="orderType != null">
|
|
|
AND FIND_IN_SET(spo.type_,#{orderType})
|
|
|
</if>
|
|
@@ -1560,7 +1554,7 @@
|
|
|
SELECT spo.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
|
|
|
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.tenant_id_ = #{tenantId}
|
|
|
+ WHERE spo.status_ = 'SUCCESS' AND spo.pay_time_ BETWEEN #{startDate} AND #{endDate} and spo.tenant_id_ = #{tenantId}
|
|
|
AND spo.type_ = 'DEGREE' AND spod.type_ IN ('THEORY_COURSE','VIP')
|
|
|
<if test="organIds!=null and organIds.size()>0">
|
|
|
AND spo.organ_id_ IN
|
|
@@ -1574,7 +1568,7 @@
|
|
|
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
|
|
|
- WHERE spo.status_ = 'SUCCESS' AND DATE_FORMAT(spo.pay_time_,'%Y-%m-%d') BETWEEN #{startDate} AND #{endDate}
|
|
|
+ WHERE spo.status_ = 'SUCCESS' AND spo.pay_time_ BETWEEN #{startDate} AND #{endDate}
|
|
|
AND spo.type_ = 'SMALL_CLASS_TO_BUY'
|
|
|
<if test="organIds!=null and organIds.size()>0">
|
|
|
AND spo.organ_id_ IN
|
|
@@ -1591,7 +1585,7 @@
|
|
|
LEFT JOIN (SELECT spo.organ_id_,SUM(CASE WHEN spod.price_ IS NULL THEN 0 ELSE spod.price_ END) total_num_
|
|
|
FROM student_payment_order spo
|
|
|
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.tenant_id_ = #{tenantId}
|
|
|
+ WHERE spo.status_ = 'SUCCESS' AND spo.pay_time_ BETWEEN #{startDate} AND #{endDate} and spo.tenant_id_ = #{tenantId}
|
|
|
AND spo.type_ = 'DEGREE' AND spod.type_ IN ('THEORY_COURSE','VIP')
|
|
|
<if test="organIds!=null and organIds.size()>0">
|
|
|
AND spo.organ_id_ IN
|
|
@@ -1604,7 +1598,7 @@
|
|
|
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_
|
|
|
FROM student_payment_order spo
|
|
|
- WHERE spo.status_ = 'SUCCESS' AND DATE_FORMAT(spo.pay_time_,'%Y-%m-%d') BETWEEN #{startDate} AND #{endDate}
|
|
|
+ WHERE spo.status_ = 'SUCCESS' AND spo.pay_time_ BETWEEN #{startDate} AND #{endDate}
|
|
|
AND spo.type_ = 'SMALL_CLASS_TO_BUY'
|
|
|
<if test="organIds!=null and organIds.size()>0">
|
|
|
AND spo.organ_id_ IN
|
|
@@ -1630,7 +1624,7 @@
|
|
|
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
|
|
|
- WHERE spo.status_ = 'SUCCESS' AND DATE_FORMAT(spo.pay_time_,'%Y-%m-%d') BETWEEN #{startDate} AND #{endDate} and spo.tenant_id_ = #{tenantId}
|
|
|
+ WHERE spo.status_ = 'SUCCESS' AND spo.pay_time_ BETWEEN #{startDate} AND #{endDate} and spo.tenant_id_ = #{tenantId}
|
|
|
AND spo.type_ NOT IN ('APPLY','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
|
|
@@ -1643,7 +1637,7 @@
|
|
|
SELECT spo.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
|
|
|
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}
|
|
|
+ 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
|
|
@@ -1656,34 +1650,38 @@
|
|
|
</select>
|
|
|
|
|
|
<select id="getOrganOtherAmountDataWithTimelyDetails" resultMap="IndexBaseMonthData">
|
|
|
- SELECT o.id_ organ_id_,o.name_ organ_name_,SUM(c.total_num_) percent_ FROM organization o
|
|
|
+ SELECT
|
|
|
+ o.id_ organ_id_,o.name_ organ_name_,COALESCE(SUM(c.total_num_), 0) percent_
|
|
|
+ FROM organization o
|
|
|
LEFT JOIN (
|
|
|
- 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_
|
|
|
+ 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_
|
|
|
FROM student_payment_order spo
|
|
|
- WHERE spo.status_ = 'SUCCESS' AND DATE_FORMAT(spo.pay_time_,'%Y-%m-%d') 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')
|
|
|
+ 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')
|
|
|
<if test="organIds!=null and organIds.size()>0">
|
|
|
AND spo.organ_id_ IN
|
|
|
<foreach collection="organIds" item="organId" open="(" close=")" separator=",">
|
|
|
#{organId}
|
|
|
</foreach>
|
|
|
</if>
|
|
|
- GROUP BY spo.organ_id_,spo.type_
|
|
|
+ AND spo.pay_time_ BETWEEN #{startDate} AND #{endDate}
|
|
|
UNION ALL
|
|
|
- SELECT spo.organ_id_,SUM(CASE WHEN spod.price_ IS NULL THEN 0 ELSE spod.price_ END) total_num_,spo.type_
|
|
|
+ SELECT spo.organ_id_, spo.type_, COALESCE(spod.price_, 0) total_num_
|
|
|
FROM student_payment_order spo
|
|
|
- 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'
|
|
|
+ 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'
|
|
|
<if test="organIds!=null and organIds.size()>0">
|
|
|
AND spo.organ_id_ IN
|
|
|
<foreach collection="organIds" item="organId" open="(" close=")" separator=",">
|
|
|
#{organId}
|
|
|
</foreach>
|
|
|
</if>
|
|
|
- GROUP BY spo.organ_id_,spo.type_
|
|
|
- )c ON c.organ_id_ = o.id_
|
|
|
+ AND spo.pay_time_ BETWEEN #{startDate} AND #{endDate}
|
|
|
+ ) t
|
|
|
+ GROUP BY organ_id_, type_
|
|
|
+ ) c ON o.id_ = c.organ_id_
|
|
|
WHERE o.tenant_id_ = #{tenantId}
|
|
|
<if test="organIds!=null and organIds.size()>0">
|
|
|
AND o.id_ IN
|
|
@@ -1691,7 +1689,8 @@
|
|
|
#{organId}
|
|
|
</foreach>
|
|
|
</if>
|
|
|
- GROUP BY o.id_ ORDER BY percent_ DESC
|
|
|
+ GROUP BY o.id_,o.name_
|
|
|
+ ORDER BY percent_ DESC
|
|
|
</select>
|
|
|
|
|
|
<sql id="queryTeacherServeInfoCondition">
|