zouxuan 2 年 前
コミット
f3a4afb6f4

+ 3 - 2
mec-biz/src/main/resources/config/mybatis/OperatingReportNewMapper.xml

@@ -207,7 +207,7 @@
 	<select id="sumGroupCloudAmount" resultType="java.util.Map">
 		select orc.organ_id_ 'key',TRUNCATE(SUM(orc.cloud_price_ / TIMESTAMPDIFF(DAY,orc.start_date_,orc.end_date_) *
 		TIMESTAMPDIFF(DAY,CASE WHEN orc.start_date_ &lt; #{firstDay} THEN #{firstDay} ELSE orc.start_date_ END,
-		CASE WHEN orc.end_date_ > #{month} THEN #{lastDay} ELSE orc.end_date_ END)),2) 'value' from operating_report_cloud orc
+		CASE WHEN DATE_FORMAT(orc.end_date_,'%Y-%m') > #{month} THEN #{lastDay} ELSE orc.end_date_ END)),2) 'value' from operating_report_cloud orc
 		where #{month} BETWEEN DATE_FORMAT(orc.start_date_,'%Y-%m') AND DATE_FORMAT(orc.end_date_,'%Y-%m') AND orc.start_date_  IS NOT NULL;
 	</select>
 	<select id="sumRefundAmount" resultType="java.util.Map">
@@ -223,7 +223,8 @@
 		where DATE_FORMAT(fe.create_time_,'%Y-%m') = #{month} AND fee_project_ IN (1,2,4,5) AND process_id_ = 28 group by fe.organ_id_;
 	</select>
 	<select id="sumCloudPreAmount" resultType="java.util.Map">
-		select orc.organ_id_ 'key',TRUNCATE(SUM(operating_amount_ / TIMESTAMPDIFF(DAY,start_time_,end_time_) * TIMESTAMPDIFF(DAY,#{lastDay},end_time_)),2) 'value'
+		select orc.organ_id_ 'key',TRUNCATE(SUM(operating_amount_ / TIMESTAMPDIFF(DAY,start_time_,end_time_) *
+		TIMESTAMPDIFF(DAY,CASE WHEN start_time_ &lt; #{lastDay} THEN #{lastDay} ELSE start_time_ END,end_time_)),2) 'value'
 		from cloud_teacher_order orc
 		where operating_amount_ > 0 AND DATE_FORMAT(end_time_,'%Y-%m') > #{month} group by orc.organ_id_;
 	</select>