|  | @@ -148,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>
 | 
	
	
		
			
				|  | @@ -180,11 +182,11 @@
 | 
	
		
			
				|  |  |  	</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"/>
 |