|
@@ -84,18 +84,18 @@
|
|
|
</select>
|
|
|
<select id="initShareProfit" resultMap="CooperationShareProfit">
|
|
|
select spo.organ_id_,mg.cooperation_organ_id_ cooperation_id_,sr.music_group_id_,spod.price_,COUNT(distinct spod.id_) musical_num_,
|
|
|
- SUM(CASE WHEN spod.price_ IS NULL THEN 0 ELSE spod.price_ END) total_amount_
|
|
|
- from (select sr.music_group_id_,max(sr.music_group_payment_calender_id_) music_group_payment_calender_id_ from student_registration sr
|
|
|
+ SUM(CASE WHEN spod.price_ IS NULL THEN 0 ELSE spod.price_ END) total_amount_ from student_registration sr
|
|
|
+ left join music_group mg ON mg.id_ = sr.music_group_id_
|
|
|
+ left join music_group_payment_calender mgpc ON mgpc.id_ = sr.music_group_payment_calender_id_
|
|
|
+ left join student_payment_order spo ON spo.calender_id_ = sr.music_group_payment_calender_id_ and sr.user_id_ = spo.user_id_
|
|
|
+ left join student_payment_order_detail spod ON spod.payment_order_id_ = spo.id_
|
|
|
where sr.music_group_id_ IN
|
|
|
<foreach collection="musicGroupIds" item="id" open="(" close=")">
|
|
|
#{id}
|
|
|
</foreach>
|
|
|
- AND sr.music_group_status_ = 'NORMAL' group by sr.music_group_id_) sr
|
|
|
- left join music_group mg ON mg.id_ = sr.music_group_id_
|
|
|
- left join music_group_payment_calender mgpc ON mgpc.id_ = sr.music_group_payment_calender_id_
|
|
|
- left join student_payment_order spo ON spo.calender_id_ = sr.music_group_payment_calender_id_
|
|
|
- left join student_payment_order_detail spod ON spod.payment_order_id_ = spo.id_
|
|
|
- where mgpc.payment_type_ = 'MUSIC_APPLY' AND spo.type_ = 'APPLY' AND spo.status_ = 'SUCCESS' AND spod.type_ = 'ORGAN_SHARE_PROFIT'
|
|
|
+ AND sr.music_group_status_ = 'NORMAL'
|
|
|
+ AND mgpc.payment_type_ = 'MUSIC_APPLY' AND spo.type_ = 'APPLY' AND spo.status_ = 'SUCCESS' AND spod.type_ = 'ORGAN_SHARE_PROFIT'
|
|
|
+ group by sr.music_group_id_
|
|
|
</select>
|
|
|
<resultMap id="CooperationShareProfitDto" type="com.ym.mec.biz.dal.entity.CooperationShareProfitDto" extends="CooperationShareProfit">
|
|
|
<result property="educationUserId" column="education_user_id_"/>
|