Просмотр исходного кода

账户监测查询判断sql里面金额值为null的情况

LiFei 4 лет назад
Родитель
Сommit
58e3b7f8a5

+ 9 - 9
happy-cloud-wisdom/happy-cloud-wisdom-biz/src/main/java/org/jeecg/modules/hlwaccount/mapper/xml/HlwCompanyAccountCalculationMapper.xml

@@ -36,9 +36,9 @@
 		a.application_id AS "applicationId",
 		a.company_code AS "companyCode",
 		a.company_name AS "companyName",
-		(select sum(hcas.total_deposit) from hlw_company_account hcas where hcas.company_id=a.id and hcas.application_id=a.application_id and total_deposit>0.00) as "sumDeposit",
-		sum(hcad.amount) as "sumAmountIn",
-		sum(hcads.amount) as "sumAmountOut"
+		ifnull((select sum(hcas.total_deposit) from hlw_company_account hcas where hcas.company_id=a.id and hcas.application_id=a.application_id and total_deposit>0.00),0) as "sumDeposit",
+		ifnull(sum(hcad.amount),0) as "sumAmountIn",
+		ifnull(sum(hcads.amount),0) as "sumAmountOut"
 		FROM hlw_company a
 		left join hlw_company_account hca on hca.company_id=a.id and hca.application_id=a.application_id and total_deposit>0.00
         left join hlw_company_account_detail hcad on hcad.company_account_id=hca.id and hcad.type=0
@@ -55,9 +55,9 @@
 		a.application_id AS "applicationId",
 		a.company_code AS "companyCode",
 		a.company_name AS "companyName",
-		(select sum(hcas.total_deposit) from hlw_company_account hcas where hcas.company_id=a.id and hcas.application_id=a.application_id and total_deposit>0.00) as "sumDeposit",
-		sum(hcas.total_payment) as "sumTotalPayment",
-		sum(hcas.balance) as "sumBalance"
+		ifnull((select sum(hcas.total_deposit) from hlw_company_account hcas where hcas.company_id=a.id and hcas.application_id=a.application_id and total_deposit>0.00),0) as "sumDeposit",
+		ifnull(sum(hcas.total_payment),0) as "sumTotalPayment",
+		ifnull(sum(hcas.balance),0) as "sumBalance"
 		FROM hlw_company a
 		left join hlw_company_account hca on hca.company_id=a.id and hca.application_id=a.application_id and total_deposit>0.00
 		left join hlw_company_account hcas on hcas.company_id=a.id and hcas.application_id=a.application_id and hcas.total_payment>0.00
@@ -73,9 +73,9 @@
 		a.application_id AS "applicationId",
 		a.company_code AS "companyCode",
 		a.company_name AS "companyName",
-		(select sum(hcas.total_payment) from hlw_company_account hcas where hcas.company_id=a.id and hcas.application_id=a.application_id and total_deposit>0.00) as "sumTotalPayment",
-		sum(hcad.amount) as "sumAmount",
-		sum(hcad.service_fee) as "sumServiceFee"
+		ifnull((select sum(hcas.total_payment) from hlw_company_account hcas where hcas.company_id=a.id and hcas.application_id=a.application_id and total_deposit>0.00),0) as "sumTotalPayment",
+		ifnull(sum(hcad.amount),0) as "sumAmount",
+		ifnull(sum(hcad.service_fee),0) as "sumServiceFee"
 		FROM hlw_company a
 		left join hlw_company_account hcas on hcas.company_id=a.id and hcas.application_id=a.application_id and total_payment>0.00
         left join hlw_company_account_detail hcad on hcas.id=hcad.company_account_id and hcad.type=1