From cd11bc80579a629e8ab6f9ee9e1cd982f4396408 Mon Sep 17 00:00:00 2001
From: shiyunteng <shiyunteng@example.com>
Date: 星期三, 12 八月 2026 10:02:07 +0800
Subject: [PATCH] feat:银行流水绑定合同问题 出库单据查看 历史当前逾期新增删除去掉 完成开票隐藏开票按钮  出库业务单据文件类型

---
 platformx-business-finance-biz/src/main/resources/mapper/ContractMapper.xml |  683 +++++++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 641 insertions(+), 42 deletions(-)

diff --git a/platformx-business-finance-biz/src/main/resources/mapper/ContractMapper.xml b/platformx-business-finance-biz/src/main/resources/mapper/ContractMapper.xml
index 765f216..5936e13 100644
--- a/platformx-business-finance-biz/src/main/resources/mapper/ContractMapper.xml
+++ b/platformx-business-finance-biz/src/main/resources/mapper/ContractMapper.xml
@@ -57,6 +57,7 @@
 		) - IFNULL( t.billing_amout, 0 )) creditAmount
 		FROM
 		contract t
+		LEFT JOIN business_customer t1 ON ( t1.id = t.bus_guest_id AND t1.del_flag = '0' )
 		WHERE
 		(
 		IFNULL( t.billing_amout, 0 )&lt;(
@@ -72,6 +73,28 @@
 		</if>
 		<if test="queryDTO.partyA !=null and queryDTO.partyA !=''">
 			and t.party_a LIKE CONCAT('%', #{queryDTO.partyA}, '%')
+		</if>
+		<if test="queryDTO.queryArea !=null and queryDTO.queryArea !=''">
+			AND t1.class_id =  #{queryDTO.queryArea}
+		</if>
+		<if test="queryDTO.queryServiceAttr !=null and queryDTO.queryServiceAttr !=''">
+			AND t1.export_service_attr =  #{queryDTO.queryServiceAttr}
+		</if>
+		<if test="queryDTO.queryType !=null and queryDTO.queryType !='' and queryDTO.queryType =='1'.toString()">
+			AND  t.payment_time &gt;= CURDATE()
+			AND  t.payment_time &lt; DATE_ADD( CURDATE(), INTERVAL 1 DAY )
+		</if>
+		<if test="queryDTO.queryType !=null and queryDTO.queryType !='' and queryDTO.queryType =='2'.toString()">
+			AND  t.payment_time &gt;= DATE_FORMAT( CURDATE(), '%Y-01-01' )
+			AND  t.payment_time &lt; DATE_FORMAT( DATE_ADD( CURDATE(), INTERVAL 1 YEAR ), '%Y-01-01' )
+		</if>
+		<if test="queryDTO.queryType !=null and queryDTO.queryType !='' and queryDTO.queryType =='3'.toString()">
+			AND  t.payment_time &gt;= DATE_FORMAT( CURDATE(), '%Y-01-01' )
+			AND  t.payment_time &lt; DATE_FORMAT( DATE_ADD( CURDATE(), INTERVAL 1 YEAR ), '%Y-01-01' )
+		</if>
+		<if test="queryDTO.startTime !=null and queryDTO.endTime !=null">
+			AND  t.payment_time &gt;=  #{queryDTO.startTime}
+			AND  t.payment_time &lt;=  #{queryDTO.endTime}
 		</if>
 		<if test="queryDTO.productNames !=null and queryDTO.productNames !=''">
 			and (SELECT GROUP_CONCAT(DISTINCT t1.material_internal_name) from contract_subject_matter t1 WHERE t1.contract_id = t.id) LIKE CONCAT('%', #{queryDTO.productNames}, '%')
@@ -315,6 +338,7 @@
 							and c.del_flag = '0'
 							and bc.del_flag = '0'
 							and bc.area_id = b.area_id
+							AND YEAR( c.sign_date ) = #{queryDTO.year}
 							and party_b_id IN
 							<foreach collection="compIds" item="id" open="(" close=")" separator=",">
 								#{id}
@@ -334,6 +358,7 @@
 								and c.del_flag = '0'
 								and bc.del_flag = '0'
 								and bc.area_id = b.area_id
+								AND YEAR( c.sign_date ) = #{queryDTO.year}
 								and party_b_id IN
 								<foreach collection="compIds" item="id" open="(" close=")" separator=",">
 									#{id}
@@ -353,6 +378,7 @@
 								and c.del_flag = '0'
 								and bc.del_flag = '0'
 								and bc.area_id = b.area_id
+								AND YEAR( c.sign_date ) = #{queryDTO.year}
 								and party_b_id IN
 								<foreach collection="compIds" item="id" open="(" close=")" separator=",">
 									#{id}
@@ -372,6 +398,7 @@
 							and c.del_flag = '0'
 							and bc.del_flag = '0'
 							and bc.area_id = b.area_id
+							AND YEAR( c.sign_date ) = #{queryDTO.year}
 							and party_b_id IN
 							<foreach collection="compIds" item="id" open="(" close=")" separator=",">
 								#{id}
@@ -391,6 +418,7 @@
 		and c.del_flag = '0'
 		and bc.del_flag = '0'
 		and bc.area_id = b.area_id
+		AND YEAR( c.sign_date ) = #{queryDTO.year}
 		and party_b_id IN
 		<foreach collection="compIds" item="id" open="(" close=")" separator=",">
 			#{id}
@@ -402,7 +430,8 @@
 			contract c
 				JOIN business_customer b ON c.party_a_id = b.id
 		WHERE
-			b.area_id IS NOT NULL
+		c.del_flag='0'
+		AND b.area_id IS NOT NULL
 		AND YEAR ( sign_date ) = #{queryDTO.year}
 		GROUP BY
 			b.area_id
@@ -411,19 +440,18 @@
 	<select id="contractAmountAnalysisByIndustry"
 			resultType="com.by4cloud.platformx.business.vo.ContractIncomeAnalysisAreaVo">
 		SELECT
-		b.industry_id area_id,
+		c.industry_code area_id,
 		SUM( CASE WHEN c.party_b_id = #{sgbCompId} THEN c.amount ELSE 0 END ) AS sgbze,
 		ROUND(
 		SUM( CASE WHEN c.party_b_id = #{sgbCompId} THEN c.amount ELSE 0 END ) / (
 		SELECT
 		SUM( amount )
 		FROM
-		contract c, business_customer bc
-		WHERE
-		bc.id = c.party_a_id
-		and c.del_flag = '0'
-		and bc.del_flag = '0'
-		and bc.industry_id = b.industry_id
+		contract c1
+		where
+		c1.del_flag = '0'
+		and c1.industry_code = c.industry_code
+		AND YEAR( sign_date ) = #{queryDTO.year}
 		and party_b_id IN
 		<foreach collection="compIds" item="id" open="(" close=")" separator=",">
 			#{id}
@@ -437,12 +465,11 @@
 		SELECT
 		SUM( amount )
 		FROM
-		contract c, business_customer bc
-		WHERE
-		bc.id = c.party_a_id
-		and c.del_flag = '0'
-		and bc.del_flag = '0'
-		and bc.industry_id = b.industry_id
+		contract c1
+		where
+		c1.del_flag = '0'
+		and c1.industry_code = c.industry_code
+		AND YEAR( sign_date ) = #{queryDTO.year}
 		and party_b_id IN
 		<foreach collection="compIds" item="id" open="(" close=")" separator=",">
 			#{id}
@@ -456,12 +483,11 @@
 		SELECT
 		SUM( amount )
 		FROM
-		contract c, business_customer bc
-		WHERE
-		bc.id = c.party_a_id
-		and c.del_flag = '0'
-		and bc.del_flag = '0'
-		and bc.industry_id = b.industry_id
+		contract c1
+		where
+		c1.del_flag = '0'
+		and c1.industry_code = c.industry_code
+		AND YEAR( sign_date ) = #{queryDTO.year}
 		and party_b_id IN
 		<foreach collection="compIds" item="id" open="(" close=")" separator=",">
 			#{id}
@@ -475,12 +501,11 @@
 		SELECT
 		SUM( amount )
 		FROM
-		contract c, business_customer bc
-		WHERE
-		bc.id = c.party_a_id
-		and c.del_flag = '0'
-		and bc.del_flag = '0'
-		and bc.industry_id = b.industry_id
+		contract c1
+		where
+		c1.del_flag = '0'
+		and c1.industry_code = c.industry_code
+		AND YEAR( sign_date ) = #{queryDTO.year}
 		and party_b_id IN
 		<foreach collection="compIds" item="id" open="(" close=")" separator=",">
 			#{id}
@@ -494,12 +519,11 @@
 		SELECT
 		SUM( amount )
 		FROM
-		contract c, business_customer bc
-		WHERE
-		bc.id = c.party_a_id
-		and c.del_flag = '0'
-		and bc.del_flag = '0'
-		and bc.industry_id = b.industry_id
+		contract c1
+		where
+		      c1.del_flag = '0'
+		and c1.industry_code = c.industry_code
+		AND YEAR( sign_date ) = #{queryDTO.year}
 		and party_b_id IN
 		<foreach collection="compIds" item="id" open="(" close=")" separator=",">
 			#{id}
@@ -509,12 +533,12 @@
 		) AS tfzb
 		FROM
 		contract c
-		JOIN business_customer b ON c.party_a_id = b.id
-		WHERE
-		b.industry_id IS NOT NULL
+		where
+		c.del_flag='0'
+		AND c.industry_code  is not null
 		AND YEAR ( sign_date ) = #{queryDTO.year}
 		GROUP BY
-		b.industry_id
+		c.industry_code
 
 	</select>
 	<select id="contractAmountAnalysisByMarket"
@@ -533,6 +557,7 @@
 		and c.del_flag = '0'
 		and bc.del_flag = '0'
 		and bc.class_id = b.class_id
+		AND YEAR( c.sign_date ) = #{queryDTO.year}
 		and party_b_id IN
 		<foreach collection="compIds" item="id" open="(" close=")" separator=",">
 			#{id}
@@ -552,6 +577,7 @@
 		and c.del_flag = '0'
 		and bc.del_flag = '0'
 		and bc.class_id = b.class_id
+		AND YEAR( c.sign_date ) = #{queryDTO.year}
 		and party_b_id IN
 		<foreach collection="compIds" item="id" open="(" close=")" separator=",">
 			#{id}
@@ -571,6 +597,7 @@
 		and c.del_flag = '0'
 		and bc.del_flag = '0'
 		and bc.class_id = b.class_id
+		AND YEAR( c.sign_date ) = #{queryDTO.year}
 		and party_b_id IN
 		<foreach collection="compIds" item="id" open="(" close=")" separator=",">
 			#{id}
@@ -590,6 +617,7 @@
 		and c.del_flag = '0'
 		and bc.del_flag = '0'
 		and bc.class_id = b.class_id
+		AND YEAR( c.sign_date ) = #{queryDTO.year}
 		and party_b_id IN
 		<foreach collection="compIds" item="id" open="(" close=")" separator=",">
 			#{id}
@@ -609,6 +637,7 @@
 		and c.del_flag = '0'
 		and bc.del_flag = '0'
 		and bc.class_id = b.class_id
+		AND YEAR( c.sign_date ) = #{queryDTO.year}
 		and party_b_id IN
 		<foreach collection="compIds" item="id" open="(" close=")" separator=",">
 			#{id}
@@ -620,7 +649,8 @@
 		contract c
 		JOIN business_customer b ON c.party_a_id = b.id
 		WHERE
-		b.class_id IS NOT NULL
+		c.del_flag='0'
+		AND b.class_id IS NOT NULL
 		AND YEAR ( sign_date ) = #{queryDTO.year}
 		GROUP BY
 		b.class_id
@@ -643,6 +673,7 @@
 		and c.del_flag = '0'
 		and bc.del_flag = '0'
 		and bc.export_service_attr = b.export_service_attr
+		AND YEAR( c.sign_date ) = #{queryDTO.year}
 		and party_b_id IN
 		<foreach collection="compIds" item="id" open="(" close=")" separator=",">
 			#{id}
@@ -662,6 +693,7 @@
 		and c.del_flag = '0'
 		and bc.del_flag = '0'
 		and bc.export_service_attr = b.export_service_attr
+		AND YEAR( c.sign_date ) = #{queryDTO.year}
 		and party_b_id IN
 		<foreach collection="compIds" item="id" open="(" close=")" separator=",">
 			#{id}
@@ -681,6 +713,7 @@
 		and c.del_flag = '0'
 		and bc.del_flag = '0'
 		and bc.export_service_attr = b.export_service_attr
+		AND YEAR( c.sign_date ) = #{queryDTO.year}
 		and party_b_id IN
 		<foreach collection="compIds" item="id" open="(" close=")" separator=",">
 			#{id}
@@ -700,6 +733,7 @@
 		and c.del_flag = '0'
 		and bc.del_flag = '0'
 		and bc.export_service_attr = b.export_service_attr
+		AND YEAR( c.sign_date ) = #{queryDTO.year}
 		and party_b_id IN
 		<foreach collection="compIds" item="id" open="(" close=")" separator=",">
 			#{id}
@@ -719,6 +753,7 @@
 		and c.del_flag = '0'
 		and bc.del_flag = '0'
 		and bc.export_service_attr = b.export_service_attr
+		AND YEAR( c.sign_date ) = #{queryDTO.year}
 		and party_b_id IN
 		<foreach collection="compIds" item="id" open="(" close=")" separator=",">
 			#{id}
@@ -730,7 +765,8 @@
 		contract c
 		JOIN business_customer b ON c.party_a_id = b.id
 		WHERE
-		b.export_service_attr IS NOT NULL
+		c.del_flag='0'
+		AND b.export_service_attr IS NOT NULL
 		AND YEAR ( sign_date ) = #{queryDTO.year}
 		GROUP BY
 		b.export_service_attr
@@ -750,6 +786,7 @@
 		WHERE
 		      ct.del_flag = '0'
 		and  ct.supply_attribute = c.supply_attribute
+		AND YEAR ( sign_date ) = #{queryDTO.year}
 		and ct.party_b_id IN
 		<foreach collection="compIds" item="id" open="(" close=")" separator=",">
 			#{id}
@@ -767,6 +804,7 @@
 		WHERE
 		ct.del_flag = '0'
 		and  ct.supply_attribute = c.supply_attribute
+		AND YEAR ( sign_date ) = #{queryDTO.year}
 		and ct.party_b_id IN
 		<foreach collection="compIds" item="id" open="(" close=")" separator=",">
 			#{id}
@@ -784,6 +822,7 @@
 		WHERE
 		ct.del_flag = '0'
 		and  ct.supply_attribute = c.supply_attribute
+		AND YEAR ( sign_date ) = #{queryDTO.year}
 		and ct.party_b_id IN
 		<foreach collection="compIds" item="id" open="(" close=")" separator=",">
 			#{id}
@@ -801,6 +840,7 @@
 		WHERE
 		ct.del_flag = '0'
 		and  ct.supply_attribute = c.supply_attribute
+		AND YEAR ( sign_date ) = #{queryDTO.year}
 		and ct.party_b_id IN
 		<foreach collection="compIds" item="id" open="(" close=")" separator=",">
 			#{id}
@@ -818,6 +858,7 @@
 		WHERE
 		ct.del_flag = '0'
 		and  ct.supply_attribute = c.supply_attribute
+		AND YEAR ( sign_date ) = #{queryDTO.year}
 		and ct.party_b_id IN
 		<foreach collection="compIds" item="id" open="(" close=")" separator=",">
 			#{id}
@@ -873,7 +914,9 @@
 				DATE_FORMAT(sign_date, '%Y-%m') AS stat_month,
 				SUM(amount) AS total_amount
 			FROM contract
-			WHERE YEAR(sign_date) = #{queryDTO.year}
+			WHERE
+				del_flag='0'
+				AND YEAR(sign_date) = #{queryDTO.year}
 				 AND party_b_id = #{compId}
 			GROUP BY DATE_FORMAT(sign_date, '%Y-%m')
 		) curr ON m.stat_month = curr.stat_month
@@ -883,7 +926,8 @@
 				MONTH(sign_date) AS month_num,
 				SUM(amount) AS total_amount
 			FROM contract
-			WHERE YEAR(sign_date) = YEAR(CURDATE())
+			WHERE del_flag='0'
+			AND YEAR(sign_date) = YEAR(CURDATE())
 	  		AND party_b_id = #{compId}
 			GROUP BY DATE_FORMAT(sign_date, '%Y-%m'), MONTH(sign_date)
 		) prev ON m.month_num = prev.month_num + 1
@@ -892,7 +936,8 @@
 				MONTH(sign_date) AS month_num,
 				SUM(amount) AS total_amount
 			FROM contract
-			WHERE YEAR(sign_date) = YEAR(CURDATE()) - 1
+			WHERE del_flag='0'
+			AND YEAR(sign_date) = YEAR(CURDATE()) - 1
 			AND party_b_id = #{compId}
 			GROUP BY MONTH(sign_date)
 		) last_year ON m.month_num = last_year.month_num
@@ -915,6 +960,7 @@
 		and c.del_flag = '0'
 		and bc.del_flag = '0'
 		and bc.sales_model = b.sales_model
+		AND YEAR( c.sign_date ) = #{queryDTO.year}
 		and party_b_id IN
 		<foreach collection="compIds" item="id" open="(" close=")" separator=",">
 			#{id}
@@ -934,6 +980,7 @@
 		and c.del_flag = '0'
 		and bc.del_flag = '0'
 		and bc.sales_model = b.sales_model
+		AND YEAR( c.sign_date ) = #{queryDTO.year}
 		and party_b_id IN
 		<foreach collection="compIds" item="id" open="(" close=")" separator=",">
 			#{id}
@@ -953,6 +1000,7 @@
 		and c.del_flag = '0'
 		and bc.del_flag = '0'
 		and bc.sales_model = b.sales_model
+		AND YEAR( c.sign_date ) = #{queryDTO.year}
 		and party_b_id IN
 		<foreach collection="compIds" item="id" open="(" close=")" separator=",">
 			#{id}
@@ -972,6 +1020,7 @@
 		and c.del_flag = '0'
 		and bc.del_flag = '0'
 		and bc.sales_model = b.sales_model
+		AND YEAR( c.sign_date ) = #{queryDTO.year}
 		and party_b_id IN
 		<foreach collection="compIds" item="id" open="(" close=")" separator=",">
 			#{id}
@@ -991,6 +1040,7 @@
 		and c.del_flag = '0'
 		and bc.del_flag = '0'
 		and bc.sales_model = b.sales_model
+		AND YEAR( c.sign_date ) = #{queryDTO.year}
 		and party_b_id IN
 		<foreach collection="compIds" item="id" open="(" close=")" separator=",">
 			#{id}
@@ -1002,10 +1052,559 @@
 		contract c
 		JOIN business_customer b ON c.party_a_id = b.id
 		WHERE
-		b.sales_model IS NOT NULL
+		c.del_flag='0'
+		AND b.sales_model IS NOT NULL
 		AND YEAR ( sign_date ) = #{queryDTO.year}
 		GROUP BY
 		b.sales_model
 
 	</select>
+    <select id="pageScope" resultType="com.by4cloud.platformx.business.vo.ContractPageVo">
+		SELECT
+			c.id,
+			c.contract_no,
+			c.contract_name,
+			c.party_a_id,
+			c.party_a,
+			c.party_b_id,
+			c.party_b,
+			c.amount,
+			c.contract_type,
+			c.supply_attribute,
+			c.contract_status,
+			c.contract_attribute,
+			c.sign_date,
+			c.sign_place,
+			c.effective_date,
+			c.delivery_cycle,
+			c.expiration_date,
+			c.attachment_url,
+			c.remark,
+			c.parent_id,
+			c.approve_time,
+			c.arrival_schedule_id,
+			c.accept_schedule_id,
+			c.billing_status,
+			c.billing_amout,
+			c.template_id,
+			c.sales_model,
+			c.paid_amount,
+			c.contract_category,
+			c.exec_frequency,
+		   	c.next_schedule_name,
+		    c.warranty_schedule_id,
+			c.comp_id,
+			(select sum(delivered_quantity*unit_price) from contract_subject_matter csm where csm.contract_id = c.id) outAmount
+			FROM
+		contract c,
+		business_customer bc
+		WHERE
+		c.del_flag = '0'
+		AND bc.del_flag = '0'
+		AND bc.id = c.party_a_id
+		<if test="queryDTO.contractName !=null and queryDTO.contractName !=''">
+			AND contract_name LIKE CONCAT('%', #{queryDTO.contractName}, '%')
+		</if>
+		<if test="queryDTO.partyA !=null and queryDTO.partyA !=''">
+			AND party_a LIKE CONCAT('%', #{queryDTO.partyA}, '%')
+		</if>
+		<if test="queryDTO.contractStatus !=null and queryDTO.contractStatus !=''">
+			AND contract_status =  #{queryDTO.contractStatus}
+		</if>
+		<if test="queryDTO.queryCompId !=null and queryDTO.queryCompId !=''">
+			AND c.comp_id =  #{queryDTO.queryCompId}
+		</if>
+		<if test="queryDTO.queryArea !=null and queryDTO.queryArea !=''">
+			AND bc.class_id =  #{queryDTO.queryArea}
+		</if>
+		<if test="queryDTO.queryServiceAttr !=null and queryDTO.queryServiceAttr !=''">
+			AND bc.export_service_attr =  #{queryDTO.queryServiceAttr}
+		</if>
+		<if test="queryDTO.queryType !=null and queryDTO.queryType !='' and queryDTO.queryType =='1'.toString()">
+			AND c.sign_date &gt;= CURDATE()
+			AND c.sign_date &lt; DATE_ADD( CURDATE(), INTERVAL 1 DAY )
+		</if>
+		<if test="queryDTO.queryType !=null and queryDTO.queryType !='' and queryDTO.queryType =='2'.toString()">
+			AND c.sign_date &gt;= DATE_FORMAT( CURDATE(), '%Y-01-01' )
+			AND c.sign_date &lt; DATE_FORMAT( DATE_ADD( CURDATE(), INTERVAL 1 YEAR ), '%Y-01-01' )
+		</if>
+		<if test="queryDTO.queryType !=null and queryDTO.queryType !='' and queryDTO.queryType =='3'.toString()">
+			AND c.sign_date &gt;= DATE_FORMAT( CURDATE(), '%Y-01-01' )
+			AND c.sign_date &lt; DATE_FORMAT( DATE_ADD( CURDATE(), INTERVAL 1 YEAR ), '%Y-01-01' )
+		</if>
+		<if test="queryDTO.startTime !=null and queryDTO.endTime !=null">
+			AND c.sign_date &gt;=  #{queryDTO.startTime}
+			AND c.sign_date &lt;=  #{queryDTO.endTime}
+		</if>
+		ORDER BY
+			c.create_time DESC
+	</select>
+    <select id="homeZbjt" resultType="com.by4cloud.platformx.business.vo.HomeZbjtVo">
+		SELECT
+		(
+		SELECT
+		sum( c.amount )
+		FROM
+		contract c
+		WHERE
+		c.del_flag = '0'
+		AND comp_id = 2056556196124250113
+		AND c.sign_date &gt;= CURDATE()
+		AND c.sign_date &lt; DATE_ADD( CURDATE(), INTERVAL 1 DAY )) sgbbr,
+		(
+		SELECT
+		sum( c.amount )
+		FROM
+		contract c
+		WHERE
+		c.del_flag = '0'
+		AND comp_id = 2056556196124250113
+		AND c.sign_date &gt;= DATE_FORMAT( CURDATE(), '%Y-%m-01' )
+		AND c.sign_date &lt; DATE_FORMAT( DATE_ADD( CURDATE(), INTERVAL 1 MONTH ), '%Y-%m-01' )) sgbby,
+		(
+		SELECT
+		sum( c.amount )
+		FROM
+		contract c
+		WHERE
+		c.del_flag = '0'
+		AND comp_id = 2056556196124250113
+		AND c.sign_date &gt;= DATE_FORMAT( CURDATE(), '%Y-01-01' )
+		AND c.sign_date &lt; DATE_FORMAT( DATE_ADD( CURDATE(), INTERVAL 1 YEAR ), '%Y-01-01' )) sgbbn,
+		(
+		SELECT
+		sum( c.amount )
+		FROM
+		contract c
+		WHERE
+		c.del_flag = '0'
+		AND comp_id = 2056555602756063234
+		AND c.sign_date &gt;= CURDATE()
+		AND c.sign_date &lt; DATE_ADD( CURDATE(), INTERVAL 1 DAY )) smjbr,
+		(
+		SELECT
+		sum( c.amount )
+		FROM
+		contract c
+		WHERE
+		c.del_flag = '0'
+		AND comp_id = 2056555602756063234
+		AND c.sign_date &gt;=DATE_FORMAT( CURDATE(), '%Y-%m-01' )
+		AND c.sign_date &lt; DATE_FORMAT( DATE_ADD( CURDATE(), INTERVAL 1 MONTH ), '%Y-%m-01' )) smjby,
+		(
+		SELECT
+		sum( c.amount )
+		FROM
+		contract c
+		WHERE
+		c.del_flag = '0'
+		AND comp_id = 2056555602756063234
+		AND c.sign_date &gt;=DATE_FORMAT( CURDATE(), '%Y-01-01' )
+		AND c.sign_date &lt; DATE_FORMAT( DATE_ADD( CURDATE(), INTERVAL 1 YEAR ), '%Y-01-01' )) smjbn,
+		(
+		SELECT
+		sum( c.amount )
+		FROM
+		contract c
+		WHERE
+		c.del_flag = '0'
+		AND comp_id = 2056556317461270529
+		AND c.sign_date &gt;=CURDATE()
+		AND c.sign_date &lt; DATE_ADD( CURDATE(), INTERVAL 1 DAY )) jxcbr,
+		(
+		SELECT
+		sum( c.amount )
+		FROM
+		contract c
+		WHERE
+		c.del_flag = '0'
+		AND comp_id = 2056556317461270529
+		AND c.sign_date &gt;=DATE_FORMAT( CURDATE(), '%Y-%m-01' )
+		AND c.sign_date &lt; DATE_FORMAT( DATE_ADD( CURDATE(), INTERVAL 1 MONTH ), '%Y-%m-01' )) jxcby,
+		(
+		SELECT
+		sum( c.amount )
+		FROM
+		contract c
+		WHERE
+		c.del_flag = '0'
+		AND comp_id = 2056556317461270529
+		AND c.sign_date &gt;=DATE_FORMAT( CURDATE(), '%Y-01-01' )
+		AND c.sign_date &lt; DATE_FORMAT( DATE_ADD( CURDATE(), INTERVAL 1 YEAR ), '%Y-01-01' )) jxcbn,
+		(
+		SELECT
+		sum( c.amount )
+		FROM
+		contract c
+		WHERE
+		c.del_flag = '0'
+		AND comp_id = 2056556421857497090
+		AND c.sign_date &gt;=CURDATE()
+		AND c.sign_date &lt; DATE_ADD( CURDATE(), INTERVAL 1 DAY )) tfbr,
+		(
+		SELECT
+		sum( c.amount )
+		FROM
+		contract c
+		WHERE
+		c.del_flag = '0'
+		AND comp_id = 2056556421857497090
+		AND c.sign_date &gt;=DATE_FORMAT( CURDATE(), '%Y-%m-01' )
+		AND c.sign_date &lt; DATE_FORMAT( DATE_ADD( CURDATE(), INTERVAL 1 MONTH ), '%Y-%m-01' )) tfby,
+		(
+		SELECT
+		sum( c.amount )
+		FROM
+		contract c
+		WHERE
+		c.del_flag = '0'
+		AND comp_id = 2056556421857497090
+		AND c.sign_date &gt;=DATE_FORMAT( CURDATE(), '%Y-01-01' )
+		AND c.sign_date &lt; DATE_FORMAT( DATE_ADD( CURDATE(), INTERVAL 1 YEAR ), '%Y-01-01' )) tfbn,
+		(
+		SELECT
+		sum( c.amount )
+		FROM
+		contract c
+		WHERE
+		c.del_flag = '0'
+		AND comp_id = 2056556535640576002
+		AND c.sign_date &gt;=CURDATE()
+		AND c.sign_date &lt; DATE_ADD( CURDATE(), INTERVAL 1 DAY )) ymjbr,
+		(
+		SELECT
+		sum( c.amount )
+		FROM
+		contract c
+		WHERE
+		c.del_flag = '0'
+		AND comp_id = 2056556535640576002
+		AND c.sign_date &gt;=DATE_FORMAT( CURDATE(), '%Y-%m-01' )
+		AND c.sign_date &lt; DATE_FORMAT( DATE_ADD( CURDATE(), INTERVAL 1 MONTH ), '%Y-%m-01' )) ymjby,
+		(
+		SELECT
+		sum( c.amount )
+		FROM
+		contract c
+		WHERE
+		c.del_flag = '0'
+		AND comp_id = 2056556535640576002
+		AND c.sign_date &gt;=DATE_FORMAT( CURDATE(), '%Y-01-01' )
+		AND c.sign_date &lt; DATE_FORMAT( DATE_ADD( CURDATE(), INTERVAL 1 YEAR ), '%Y-01-01' )) ymjbn
+	</select>
+    <select id="homeZgs" resultType="com.by4cloud.platformx.business.vo.HomeZgsVo">
+		SELECT
+		(
+		SELECT
+		sum(c.amount)
+		FROM
+		contract c,
+		business_customer bc
+		WHERE
+		c.del_flag = '0'
+		AND bc.del_flag = '0'
+		AND bc.id = c.party_a_id
+		AND bc.area_id = '2'
+		AND c.comp_id = #{compId}
+		AND c.sign_date &gt;= CURDATE()
+		AND c.sign_date &lt; DATE_ADD( CURDATE(), INTERVAL 1 DAY )) hbbr,
+		(
+		SELECT
+		sum(c.amount)
+		FROM
+		contract c,
+		business_customer bc
+		WHERE
+		c.del_flag = '0'
+		AND bc.del_flag = '0'
+		AND bc.id = c.party_a_id
+		AND bc.area_id = '2'
+	  	AND c.comp_id = #{compId}
+		AND c.sign_date &gt;= DATE_FORMAT( CURDATE(), '%Y-%m-01' )
+		AND c.sign_date &lt; DATE_FORMAT( DATE_ADD( CURDATE(), INTERVAL 1 MONTH ), '%Y-%m-01' )) hbby,
+		(
+		SELECT
+		sum(c.amount)
+		FROM
+		contract c,
+		business_customer bc
+		WHERE
+		c.del_flag = '0'
+		AND bc.del_flag = '0'
+		AND bc.id = c.party_a_id
+		AND bc.area_id = '2'
+	  	AND c.comp_id = #{compId}
+		AND c.sign_date &gt;= DATE_FORMAT( CURDATE(), '%Y-01-01' )
+		AND c.sign_date &lt; DATE_FORMAT( DATE_ADD( CURDATE(), INTERVAL 1 YEAR ), '%Y-01-01' )) hbbn,
+		(
+		SELECT
+		sum(c.amount)
+		FROM
+		contract c,
+		business_customer bc
+		WHERE
+		c.del_flag = '0'
+		AND bc.del_flag = '0'
+		AND bc.id = c.party_a_id
+		AND bc.area_id = '6'
+	  	AND c.comp_id = #{compId}
+		AND c.sign_date &gt;= CURDATE()
+		AND c.sign_date &lt; DATE_ADD( CURDATE(), INTERVAL 1 DAY )) xbbr,
+		(
+		SELECT
+		sum(c.amount)
+		FROM
+		contract c,
+		business_customer bc
+		WHERE
+		c.del_flag = '0'
+		AND bc.del_flag = '0'
+		AND bc.id = c.party_a_id
+		AND bc.area_id = '6'
+	  	AND c.comp_id = #{compId}
+		AND c.sign_date &gt;= DATE_FORMAT( CURDATE(), '%Y-%m-01' )
+		AND c.sign_date &lt; DATE_FORMAT( DATE_ADD( CURDATE(), INTERVAL 1 MONTH ), '%Y-%m-01' )) xbby,
+		(
+		SELECT
+		sum(c.amount)
+		FROM
+		contract c,
+		business_customer bc
+		WHERE
+		c.del_flag = '0'
+		AND bc.del_flag = '0'
+		AND bc.id = c.party_a_id
+		AND bc.area_id = '6'
+	  	AND c.comp_id = #{compId}
+		AND c.sign_date &gt;= DATE_FORMAT( CURDATE(), '%Y-01-01' )
+		AND c.sign_date &lt; DATE_FORMAT( DATE_ADD( CURDATE(), INTERVAL 1 YEAR ), '%Y-01-01' )) xbbn,
+		(
+		SELECT
+		sum(c.amount)
+		FROM
+		contract c,
+		business_customer bc
+		WHERE
+		c.del_flag = '0'
+		AND bc.del_flag = '0'
+		AND bc.id = c.party_a_id
+		AND bc.area_id = '1'
+	  	AND c.comp_id = #{compId}
+		AND c.sign_date &gt;= CURDATE()
+		AND c.sign_date &lt; DATE_ADD( CURDATE(), INTERVAL 1 DAY )) dbbr,
+		(
+		SELECT
+		sum(c.amount)
+		FROM
+		contract c,
+		business_customer bc
+		WHERE
+		c.del_flag = '0'
+		AND bc.del_flag = '0'
+		AND bc.id = c.party_a_id
+		AND bc.area_id = '1'
+	  	AND c.comp_id = #{compId}
+		AND c.sign_date &gt;= DATE_FORMAT( CURDATE(), '%Y-%m-01' )
+		AND c.sign_date &lt; DATE_FORMAT( DATE_ADD( CURDATE(), INTERVAL 1 MONTH ), '%Y-%m-01' )) dbby,
+		(
+		SELECT
+		sum(c.amount)
+		FROM
+		contract c,
+		business_customer bc
+		WHERE
+		c.del_flag = '0'
+		AND bc.del_flag = '0'
+		AND bc.id = c.party_a_id
+		AND bc.area_id = '1'
+	  	AND c.comp_id = #{compId}
+		AND c.sign_date &gt;= DATE_FORMAT( CURDATE(), '%Y-01-01' )
+		AND c.sign_date &lt; DATE_FORMAT( DATE_ADD( CURDATE(), INTERVAL 1 YEAR ), '%Y-01-01' )) dbbn,
+		(
+			SELECT
+				sum(c.amount)
+			FROM
+				contract c,
+				business_customer bc
+			WHERE
+				c.del_flag = '0'
+			  AND bc.del_flag = '0'
+			  AND bc.id = c.party_a_id
+			  AND bc.area_id = '5'
+			  AND c.comp_id = #{compId}
+			  AND c.sign_date &gt;= CURDATE()
+			  AND c.sign_date &lt; DATE_ADD( CURDATE(), INTERVAL 1 DAY )) xnbr,
+		(
+			SELECT
+				sum(c.amount)
+			FROM
+				contract c,
+				business_customer bc
+			WHERE
+				c.del_flag = '0'
+			  AND bc.del_flag = '0'
+			  AND bc.id = c.party_a_id
+			  AND bc.area_id = '5'
+			  AND c.comp_id = #{compId}
+			  AND c.sign_date &gt;= DATE_FORMAT( CURDATE(), '%Y-%m-01' )
+			  AND c.sign_date &lt; DATE_FORMAT( DATE_ADD( CURDATE(), INTERVAL 1 MONTH ), '%Y-%m-01' )) xnby,
+		(
+			SELECT
+				sum(c.amount)
+			FROM
+				contract c,
+				business_customer bc
+			WHERE
+				c.del_flag = '0'
+			  AND bc.del_flag = '0'
+			  AND bc.id = c.party_a_id
+			  AND bc.area_id = '5'
+			  AND c.comp_id = #{compId}
+			  AND c.sign_date &gt;= DATE_FORMAT( CURDATE(), '%Y-01-01' )
+			  AND c.sign_date &lt; DATE_FORMAT( DATE_ADD( CURDATE(), INTERVAL 1 YEAR ), '%Y-01-01' )) xnbn,
+		(
+			SELECT
+				sum(c.amount)
+			FROM
+				contract c,
+				business_customer bc
+			WHERE
+				c.del_flag = '0'
+			  AND bc.del_flag = '0'
+			  AND bc.id = c.party_a_id
+			  AND bc.area_id = '4'
+			  AND c.comp_id = #{compId}
+			  AND c.sign_date &gt;= CURDATE()
+			  AND c.sign_date &lt; DATE_ADD( CURDATE(), INTERVAL 1 DAY )) znbr,
+		(
+			SELECT
+				sum(c.amount)
+			FROM
+				contract c,
+				business_customer bc
+			WHERE
+				c.del_flag = '0'
+			  AND bc.del_flag = '0'
+			  AND bc.id = c.party_a_id
+			  AND bc.area_id = '4'
+			  AND c.comp_id = #{compId}
+			  AND c.sign_date &gt;= DATE_FORMAT( CURDATE(), '%Y-%m-01' )
+			  AND c.sign_date &lt; DATE_FORMAT( DATE_ADD( CURDATE(), INTERVAL 1 MONTH ), '%Y-%m-01' )) znby,
+		(
+			SELECT
+				sum(c.amount)
+			FROM
+				contract c,
+				business_customer bc
+			WHERE
+				c.del_flag = '0'
+			  AND bc.del_flag = '0'
+			  AND bc.id = c.party_a_id
+			  AND bc.area_id = '4'
+			  AND c.comp_id = #{compId}
+			  AND c.sign_date &gt;= DATE_FORMAT( CURDATE(), '%Y-01-01' )
+			  AND c.sign_date &lt; DATE_FORMAT( DATE_ADD( CURDATE(), INTERVAL 1 YEAR ), '%Y-01-01' )) znbn,
+		(
+			SELECT
+				sum(c.amount)
+			FROM
+				contract c,
+				business_customer bc
+			WHERE
+				c.del_flag = '0'
+			  AND bc.del_flag = '0'
+			  AND bc.id = c.party_a_id
+			  AND bc.area_id = '3'
+			  AND c.comp_id = #{compId}
+			  AND c.sign_date &gt;= CURDATE()
+			  AND c.sign_date &lt; DATE_ADD( CURDATE(), INTERVAL 1 DAY )) hdbr,
+		(
+			SELECT
+				sum(c.amount)
+			FROM
+				contract c,
+				business_customer bc
+			WHERE
+				c.del_flag = '0'
+			  AND bc.del_flag = '0'
+			  AND bc.id = c.party_a_id
+			  AND bc.area_id = '3'
+			  AND c.comp_id = #{compId}
+			  AND c.sign_date &gt;= DATE_FORMAT( CURDATE(), '%Y-%m-01' )
+			  AND c.sign_date &lt; DATE_FORMAT( DATE_ADD( CURDATE(), INTERVAL 1 MONTH ), '%Y-%m-01' )) hdby,
+		(
+			SELECT
+				sum(c.amount)
+			FROM
+				contract c,
+				business_customer bc
+			WHERE
+				c.del_flag = '0'
+			  AND bc.del_flag = '0'
+			  AND bc.id = c.party_a_id
+			  AND bc.area_id = '3'
+			  AND c.comp_id = #{compId}
+			  AND c.sign_date &gt;= DATE_FORMAT( CURDATE(), '%Y-01-01' )
+			  AND c.sign_date &lt; DATE_FORMAT( DATE_ADD( CURDATE(), INTERVAL 1 YEAR ), '%Y-01-01' )) hdbn,
+		(
+		SELECT
+		sum(c.amount)
+		FROM
+		contract c,
+		business_customer bc
+		WHERE
+		c.del_flag = '0'
+		AND bc.del_flag = '0'
+		AND bc.id = c.party_a_id
+		AND bc.export_service_attr = '2'
+	  	AND c.comp_id = #{compId}
+		AND c.sign_date &gt;= CURDATE()
+		AND c.sign_date &lt; DATE_ADD( CURDATE(), INTERVAL 1 DAY )) hwbr,
+		(
+		SELECT
+		sum(c.amount)
+		FROM
+		contract c,
+		business_customer bc
+		WHERE
+		c.del_flag = '0'
+		AND bc.del_flag = '0'
+		AND bc.id = c.party_a_id
+		AND bc.export_service_attr = '2'
+	  	AND c.comp_id = #{compId}
+		AND c.sign_date &gt;= DATE_FORMAT( CURDATE(), '%Y-%m-01' )
+		AND c.sign_date &lt; DATE_FORMAT( DATE_ADD( CURDATE(), INTERVAL 1 MONTH ), '%Y-%m-01' )) hwby,
+		(
+		SELECT
+		sum(c.amount)
+		FROM
+		contract c,
+		business_customer bc
+		WHERE
+		c.del_flag = '0'
+		AND bc.del_flag = '0'
+		AND bc.id = c.party_a_id
+		AND bc.export_service_attr = '2'
+	  	AND c.comp_id = #{compId}
+		AND c.sign_date &gt;= DATE_FORMAT( CURDATE(), '%Y-01-01' )
+		AND c.sign_date &lt; DATE_FORMAT( DATE_ADD( CURDATE(), INTERVAL 1 YEAR ), '%Y-01-01' )) hwbn
+	</select>
+	<select id="fourAssociation" resultType="com.by4cloud.platformx.business.vo.FourAssociationPageVo">
+		SELECT
+			c.id,
+			c.contract_no,
+			c.sign_date,
+		    c.amount,
+		    c.paid_amount,
+			c.billing_amout,
+			c.comp_id
+		FROM
+			contract c
+		where
+			c.del_flag = '0'
+		and c.contract_status = 2
+		order by
+			c.create_time
+
+	</select>
 </mapper>
\ No newline at end of file

--
Gitblit v1.9.1