|
@@ -35,15 +35,15 @@
|
|
|
COUNT(CASE WHEN cs.create_time_ <= CONCAT(#{month},'-31 23:59:59') AND cs.class_date_ > CONCAT(#{month},'-31') AND cs.merge_flag_ != 2 THEN cs.id_ ELSE NULL END) surplusCourse,
|
|
|
SUM(CASE WHEN cs.create_time_ <= CONCAT(#{month},'-31 23:59:59') AND cs.class_date_ > CONCAT(#{month},'-31') AND cs.merge_flag_ != 2
|
|
|
THEN IF(csts.settlement_time_ IS NULL,csts.expect_salary_ + IF(csts.subsidy_ IS NULL,0,csts.subsidy_),csts.actual_salary_) ELSE 0 END) surplusCourseReward,
|
|
|
- COUNT(CASE WHEN cs.merge_time_ <= CONCAT(#{month},'-31 23:59:59') AND cs.class_date_ > CONCAT(#{month},'-31') AND cs.merge_flag_ = 2 THEN cs.id_ ELSE NULL END) surplusMergeCourse,
|
|
|
+ COUNT(CASE WHEN cs.merge_time_ <= CONCAT(#{month},'-31 23:59:59') AND cs.class_date_ > CONCAT(#{month},'-31') AND cs.merge_flag_ = 2 THEN cs.id_ ELSE NULL END) surplusMergedCourse,
|
|
|
SUM(CASE WHEN cs.merge_time_ <= CONCAT(#{month},'-31 23:59:59') AND cs.class_date_ > CONCAT(#{month},'-31') AND cs.merge_flag_ = 2
|
|
|
- THEN IF(csts.settlement_time_ IS NULL,csts.expect_salary_ + IF(csts.subsidy_ IS NULL,0,csts.subsidy_),csts.actual_salary_) ELSE 0 END) surplusMergeCourseReward,
|
|
|
+ THEN IF(csts.settlement_time_ IS NULL,csts.expect_salary_ + IF(csts.subsidy_ IS NULL,0,csts.subsidy_),csts.actual_salary_) ELSE 0 END) surplusMergedCourseReward,
|
|
|
COUNT(CASE WHEN cs.create_time_ <= CONCAT(#{month},'-31 23:59:59') AND cs.class_date_ <= CONCAT(#{month},'-31') AND cs.merge_flag_ != 2 THEN cs.id_ ELSE NULL END) alreadyCourse,
|
|
|
SUM(CASE WHEN cs.create_time_ <= CONCAT(#{month},'-31 23:59:59') AND cs.class_date_ <= CONCAT(#{month},'-31') AND cs.merge_flag_ != 2
|
|
|
THEN IF(csts.settlement_time_ IS NULL,csts.expect_salary_ + IF(csts.subsidy_ IS NULL,0,csts.subsidy_),csts.actual_salary_) ELSE 0 END) alreadyCourseReward,
|
|
|
- COUNT(CASE WHEN cs.merge_time_ <= CONCAT(#{month},'-31 23:59:59') AND cs.class_date_ <= CONCAT(#{month},'-31') AND cs.merge_flag_ = 2 THEN cs.id_ ELSE NULL END) alreadyMergeCourse,
|
|
|
+ COUNT(CASE WHEN cs.merge_time_ <= CONCAT(#{month},'-31 23:59:59') AND cs.class_date_ <= CONCAT(#{month},'-31') AND cs.merge_flag_ = 2 THEN cs.id_ ELSE NULL END) alreadyMergedCourse,
|
|
|
SUM(CASE WHEN cs.merge_time_ <= CONCAT(#{month},'-31 23:59:59') AND cs.class_date_ <= CONCAT(#{month},'-31') AND cs.merge_flag_ = 2
|
|
|
- THEN IF(csts.settlement_time_ IS NULL,csts.expect_salary_ + IF(csts.subsidy_ IS NULL,0,csts.subsidy_),csts.actual_salary_) ELSE 0 END) alreadyMergeCourseReward,
|
|
|
+ THEN IF(csts.settlement_time_ IS NULL,csts.expect_salary_ + IF(csts.subsidy_ IS NULL,0,csts.subsidy_),csts.actual_salary_) ELSE 0 END) alreadyMergedCourseReward,
|
|
|
COUNT(CASE WHEN cs.create_time_ BETWEEN CONCAT(#{month},'-01 00:00:00') AND CONCAT(#{month},'-31 23:59:59') AND cs.merge_flag_ != 2 THEN cs.id_ ELSE NULL END) currentMonthAdd,
|
|
|
SUM(CASE WHEN cs.create_time_ BETWEEN CONCAT(#{month},'-01 00:00:00') AND CONCAT(#{month},'-31 23:59:59') AND cs.merge_flag_ != 2
|
|
|
THEN IF(csts.settlement_time_ IS NULL,csts.expect_salary_ + IF(csts.subsidy_ IS NULL,0,csts.subsidy_),csts.actual_salary_) ELSE 0 END) currentMonthAddReward,
|
|
@@ -125,13 +125,14 @@
|
|
|
<select id="exportBalancedRelationshipStudentInfo"
|
|
|
resultType="com.ym.mec.biz.dal.dto.ExportWrapper$ExportBalancedRelationshipStudentInfo">
|
|
|
select o.name_ 'organName',COUNT(distinct CASE WHEN mg.status_ = 'PROGRESS' THEN mg.id_ END) 'musicGroupCount',
|
|
|
- ibmd.MUSIC_GROUP_STUDENT 'currentMonthStudentCount',ibmd.NEWLY_STUDENT_NUM 'currentMonthAddStudentCount',
|
|
|
+ CASE WHEN ibmd.MUSIC_GROUP_STUDENT IS NULL THEN 0 ELSE ibmd.MUSIC_GROUP_STUDENT END 'currentMonthStudentCount',
|
|
|
+ CASE WHEN ibmd.NEWLY_STUDENT_NUM IS NULL THEN 0 ELSE ibmd.NEWLY_STUDENT_NUM END 'currentMonthAddStudentCount',
|
|
|
COUNT(DISTINCT mgq.user_id_) 'currentMonthQuitStudentCount'
|
|
|
from organization o
|
|
|
left join music_group mg ON o.id_ = mg.organ_id_
|
|
|
- left join music_group_quit mgq ON mgq.music_group_id_ = mg.id_ AND mgq.status_ = 'APPROVED' AND DATE_FORMAT(mgq.create_time_,'%Y-%m-%d') BETWEEN CONCAT(#{month},'-01') AND CONCAT(#{month},'-31')
|
|
|
- left join (select ibmd.organ_id_,SUM(CASE WHEN ibmd.data_type_ = 'MUSIC_GROUP_STUDENT' AND ibmd.month_ = last_day(CONCAT(#{month},'-01')) THEN ibmd.total_num_ ELSE 0 END) 'MUSIC_GROUP_STUDENT',
|
|
|
- SUM(CASE WHEN ibmd.data_type_ = 'NEWLY_STUDENT_NUM' THEN ibmd.total_num_ END) 'NEWLY_STUDENT_NUM'
|
|
|
+ left join music_group_quit mgq ON mgq.music_group_id_ = mg.id_ AND mgq.status_ = 'APPROVED' AND DATE_FORMAT(mgq.create_time_,'%Y-%m-%d') BETWEEN CONCAT('2024-02','-01') AND CONCAT('2024-02','-31')
|
|
|
+ left join (select ibmd.organ_id_,SUM(CASE WHEN ibmd.data_type_ = 'MUSIC_GROUP_STUDENT' AND ibmd.month_ = last_day(CONCAT('2024-02','-01')) THEN ibmd.total_num_ ELSE 0 END) 'MUSIC_GROUP_STUDENT',
|
|
|
+ SUM(CASE WHEN ibmd.data_type_ = 'NEWLY_STUDENT_NUM' THEN ibmd.total_num_ ELSE 0 END) 'NEWLY_STUDENT_NUM'
|
|
|
from index_base_month_data ibmd
|
|
|
where ibmd.tenant_id_ = 1 AND ibmd.month_ BETWEEN CONCAT(#{month},'-01') AND CONCAT(#{month},'-31')
|
|
|
group by ibmd.organ_id_) ibmd ON ibmd.organ_id_ = o.id_
|