zouxuan преди 2 години
родител
ревизия
9af69b3cfe
променени са 1 файла, в които са добавени 3 реда и са изтрити 1 реда
  1. 3 1
      mec-biz/src/main/resources/config/mybatis/OperatingReportNewMapper.xml

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

@@ -277,7 +277,9 @@
 	</select>
 	<select id="sumSchoolAmount" resultType="java.util.Map">
 		select mg.organ_id_ 'key',SUM(mg.amount_) 'value' from (
-		select mgpc.organ_id_,mgpc.current_total_amount_ - SUM(spro.service_amount_) - SUM(spro.sale_amount_) amount_ from (
+		select mgpc.organ_id_,mgpc.current_total_amount_ -
+		CASE WHEN SUM(spro.service_amount_) IS NULL THEN 0 ELSE SUM(spro.service_amount_) END
+			- CASE WHEN SUM(spro.sale_amount_) IS NULL THEN 0 ELSE SUM(spro.sale_amount_) END amount_ from (
 		select mgpc.* from music_group_payment_calender mgpc
 		left join music_group_payment_calender_detail mgpcd ON mgpc.id_ = mgpcd.music_group_payment_calender_id_
 		where mgpcd.id_ IS NOT NULL AND mgpc.pay_user_type_ = 'SCHOOL'