|
@@ -105,6 +105,7 @@
|
|
|
</resultMap>
|
|
|
<sql id="queryCoopRefundSql">
|
|
|
<where>
|
|
|
+ mgpc.status_ IN ('OPEN','OVER','PAID')
|
|
|
<if test="errorType != null and errorType != ''">
|
|
|
<if test="errorType == 'COOPERATION_PAYMENT_ERROR'">
|
|
|
AND TIMESTAMPDIFF(DAY,crp.refund_date_,DATE_FORMAT(NOW(),'%Y-%m-%d')) >= 1
|
|
@@ -125,6 +126,7 @@
|
|
|
select COUNT(DISTINCT crp.cooperation_organ_id_)
|
|
|
from music_group_calender_refund_period crp
|
|
|
left join cooperation_organ co ON co.id_ = crp.cooperation_organ_id_
|
|
|
+ left join music_group_payment_calender mgpc ON mgpc.id_ = crp.calender_id_
|
|
|
<include refid="queryCoopRefundSql"/>
|
|
|
</select>
|
|
|
<select id="queryCoopRefund" resultMap="CooperationRefundDto">
|
|
@@ -132,6 +134,7 @@
|
|
|
SUM(refund_amount_) receivable_,SUM(sub_refund_amount_) prepaidFee,co.education_user_id_
|
|
|
from music_group_calender_refund_period crp
|
|
|
left join cooperation_organ co ON co.id_ = crp.cooperation_organ_id_
|
|
|
+ left join music_group_payment_calender mgpc ON mgpc.id_ = crp.calender_id_
|
|
|
<include refid="queryCoopRefundSql"/>
|
|
|
group by crp.cooperation_organ_id_
|
|
|
order by crp.id_ DESC
|
|
@@ -145,12 +148,14 @@
|
|
|
<result property="calenderFeeType" column="calender_fee_type_"/>
|
|
|
<result property="receivable" column="receivable_"/>
|
|
|
<result property="prepaidFee" column="prepaidFee"/>
|
|
|
+ <result property="income" column="income_"/>
|
|
|
<result property="nextRefundDate" column="nextRefundDate"/>
|
|
|
<result property="refundStatus" column="refundStatus"/>
|
|
|
<result property="contractUrl" column="contract_url_"/>
|
|
|
</resultMap>
|
|
|
<sql id="queryCoopCalenderSql">
|
|
|
<where>
|
|
|
+ mgpc.status_ IN ('OPEN','OVER','PAID')
|
|
|
<if test="cooperationId != null">
|
|
|
AND crp.cooperation_organ_id_ = #{cooperationId}
|
|
|
</if>
|
|
@@ -167,21 +172,21 @@
|
|
|
</sql>
|
|
|
<sql id="queryCoopCalenderHavingSql">
|
|
|
<if test="refundStatus != null and refundStatus != ''">
|
|
|
- <if test="refundStatus = 'ING'">
|
|
|
+ <if test="refundStatus == 'ING'">
|
|
|
HAVING SUM(crp.sub_refund_amount_) > 0
|
|
|
</if>
|
|
|
- <if test="refundStatus = 'END'">
|
|
|
+ <if test="refundStatus == 'END'">
|
|
|
HAVING SUM(crp.sub_refund_amount_) = 0
|
|
|
</if>
|
|
|
</if>
|
|
|
</sql>
|
|
|
<select id="queryCoopCalender" resultMap="CooperationCalenderRefundDto">
|
|
|
select crp.calender_id_,mgpc.music_group_id_,mg.name_ music_group_name_,mgpc.batch_no_,mgpc.payment_type_,mgpc.calender_fee_type_,
|
|
|
- SUM(crp.refund_amount_) receivable_,SUM(crp.sub_refund_amount_) prepaidFee,
|
|
|
+ SUM(crp.refund_amount_) receivable_,SUM(crp.sub_refund_amount_) prepaidFee,SUM(crp.income_) income_,
|
|
|
MIN(CASE WHEN crp.refund_flag_ = 0 THEN crp.refund_date_ ELSE NULL END) nextRefundDate,crp.organ_id_,mgpc.contract_url_
|
|
|
from music_group_calender_refund_period crp
|
|
|
- left join music_group_payment_calender mgpc ON mgpc.id_ = crp.calender_id_
|
|
|
- left join music_group mg ON mg.id_ = mgpc.music_group_id_
|
|
|
+ left join music_group_payment_calender mgpc ON mgpc.id_ = crp.calender_id_
|
|
|
+ left join music_group mg ON mg.id_ = mgpc.music_group_id_
|
|
|
<include refid="queryCoopCalenderSql"/>
|
|
|
group by crp.calender_id_
|
|
|
<include refid="queryCoopCalenderHavingSql"/>
|
|
@@ -198,6 +203,7 @@
|
|
|
<select id="sumCoopRefund" resultType="java.math.BigDecimal">
|
|
|
select CASE WHEN crp.id_ IS NULL THEN 0 ELSE SUM(sub_refund_amount_) END from music_group_calender_refund_period crp
|
|
|
left join cooperation_organ co ON co.id_ = crp.cooperation_organ_id_
|
|
|
+ left join music_group_payment_calender mgpc ON mgpc.id_ = crp.calender_id_
|
|
|
<include refid="queryCoopRefundSql"/>
|
|
|
</select>
|
|
|
</mapper>
|