From 6bbed1ea6b36af4eb0b234bec9d6e42d56f0cd00 Mon Sep 17 00:00:00 2001
From: shiyunteng <shiyunteng@example.com>
Date: 星期三, 30 九月 2026 16:12:49 +0800
Subject: [PATCH] feat:合同新增关联单位  开票可根据甲方或关联单位选择开票单位  收款去掉强制确认 收款只关联合同甲方或关联单位

---
 platformx-business-finance-biz/src/main/resources/mapper/ProductMapper.xml |  223 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 221 insertions(+), 2 deletions(-)

diff --git a/platformx-business-finance-biz/src/main/resources/mapper/ProductMapper.xml b/platformx-business-finance-biz/src/main/resources/mapper/ProductMapper.xml
index aa2b472..b401af1 100644
--- a/platformx-business-finance-biz/src/main/resources/mapper/ProductMapper.xml
+++ b/platformx-business-finance-biz/src/main/resources/mapper/ProductMapper.xml
@@ -5,11 +5,9 @@
 
   <resultMap id="productMap" type="com.by4cloud.platformx.business.entity.Product">
         <id property="id" column="id"/>
-        <result property="categoryId" column="category_id"/>
         <result property="productName" column="product_name"/>
         <result property="erpCode" column="erp_code"/>
         <result property="mainCode" column="main_code"/>
-        <result property="price" column="price"/>
         <result property="taxRate" column="tax_rate"/>
         <result property="compId" column="comp_id"/>
         <result property="createBy" column="create_by"/>
@@ -18,4 +16,225 @@
         <result property="updateTime" column="update_time"/>
         <result property="delFlag" column="del_flag"/>
   </resultMap>
+    <select id="getProductListByScope" resultType="com.by4cloud.platformx.business.vo.ProductSelectVo">
+		SELECT
+			t.id,
+			t.product_name,
+			t.main_code,
+			t.erp_code,
+			t.product_type,
+			t.tax_rate,
+			t.tax_class,
+			t.tax_code,
+			t.parent_id,
+			t.create_by,
+			t.update_by,
+			t.create_time,
+			t.update_time,
+			t.del_flag,
+			t.comp_id
+		FROM
+			product t
+		WHERE
+			del_flag = '0'
+		<if test="product.productName !=null and product.productName !=''">
+			and t.product_name LIKE CONCAT('%', #{product.productName}, '%')
+		</if>
+		  AND (
+			NOT EXISTS ( SELECT 1 FROM product t1 WHERE t1.parent_id = t.id ))
+	</select>
+	<select id="getProductListByParentId" resultType="com.by4cloud.platformx.business.vo.ProductSelectVo">
+		SELECT
+			t.id,
+			CONCAT(t.product_name,IFNULL(t.product_type,'')) product_name,
+			t.main_code,
+			t.erp_code,
+			t.product_type,
+			t.tax_rate,
+			t.tax_class,
+			t.tax_code,
+			t.parent_id,
+			t.create_by,
+			t.update_by,
+			t.create_time,
+			t.update_time,
+			t.del_flag,
+			t.comp_id ,
+			( SELECT count( 1 ) FROM product t1 WHERE t1.parent_id = t.id ) AS childNum
+		FROM
+			product t
+		WHERE
+			del_flag = '0'
+		<if test="queryDTO.productName !=null and queryDTO.productName !=''">
+			and ( t.product_name LIKE CONCAT('%', #{queryDTO.productName}, '%') or
+			t.erp_code LIKE CONCAT('%', #{queryDTO.productName}, '%')
+
+			<if test="queryDTO.productId != null and queryDTO.productId.size() > 0">
+				or t.id IN
+				<foreach collection="queryDTO.productId" item="id" open="(" separator="," close=")">
+					#{id}
+				</foreach>
+			</if>
+			)
+		</if>
+		<if test="queryDTO.parentId !=null ">
+			and (t.parent_id = #{queryDTO.parentId}
+			<if test="queryDTO.productId != null and queryDTO.productId.size() > 0">
+				or t.id IN
+				<foreach collection="queryDTO.productId" item="id" open="(" separator="," close=")">
+					#{id}
+				</foreach>
+			</if>
+			)
+		</if>
+
+		<choose>
+			<when test="queryDTO.contractCategory !=null and queryDTO.contractCategory !='' and queryDTO.contractCategory=='water_house'">
+				and t.erp_code in
+				<foreach collection="erpCodes" item="erp" open="(" separator="," close=")">
+					#{erp}
+				</foreach>
+			</when>
+			<otherwise>
+				and t.erp_code not in
+				<foreach collection="erpCodes" item="erp" open="(" separator="," close=")">
+					#{erp}
+				</foreach>
+			</otherwise>
+		</choose>
+
+	</select>
+	<select id="getProductSMJListByParentId" resultType="com.by4cloud.platformx.business.vo.ProductSelectVo">
+		SELECT
+		t.id,
+		CONCAT(t.product_name,IFNULL(t.product_type,'')) product_name,
+		t.main_code,
+		t.erp_code,
+		t.product_type,
+		t.tax_rate,
+		t.tax_class,
+		t.tax_code,
+		t.parent_id,
+		t.create_by,
+		t.update_by,
+		t.create_time,
+		t.update_time,
+		t.del_flag,
+		t.comp_id ,
+		( SELECT count( 1 ) FROM product t1 WHERE t1.parent_id = t.id ) AS childNum
+		FROM
+		product t
+		WHERE
+		del_flag = '0'
+		<if test="queryDTO.productName !=null and queryDTO.productName !=''">
+			and ( t.product_name LIKE CONCAT('%', #{queryDTO.productName}, '%') or
+			t.erp_code LIKE CONCAT('%', #{queryDTO.productName}, '%')
+
+			<if test="queryDTO.productId != null and queryDTO.productId.size() > 0">
+				or t.id IN
+				<foreach collection="queryDTO.productId" item="id" open="(" separator="," close=")">
+					#{id}
+				</foreach>
+			</if>
+			)
+		</if>
+		<if test="queryDTO.parentId !=null ">
+			and (t.parent_id = #{queryDTO.parentId}
+			<if test="queryDTO.productId != null and queryDTO.productId.size() > 0">
+				or t.id IN
+				<foreach collection="queryDTO.productId" item="id" open="(" separator="," close=")">
+					#{id}
+				</foreach>
+			</if>
+			)
+		</if>
+
+		<choose>
+			<when test="queryDTO.contractCategory !=null and queryDTO.contractCategory !='' and queryDTO.contractCategory=='water_house'">
+				and t.erp_code in
+				<foreach collection="erpCodes" item="erp" open="(" separator="," close=")">
+					#{erp}
+				</foreach>
+			</when>
+			<otherwise>
+				and t.erp_code not in
+				<foreach collection="erpCodes" item="erp" open="(" separator="," close=")">
+					#{erp}
+				</foreach>
+			</otherwise>
+		</choose>
+		and ( t.comp_id = 2089995177814495234  or t.comp_id = 2089996921978040321 or t.comp_id = 2089997578009128962)
+	</select>
+    <select id="pageScope" resultType="com.by4cloud.platformx.business.entity.Product">
+		SELECT
+			t.id,
+			t.product_name,
+			t.main_code,
+			t.erp_code,
+			t.product_type,
+			t.tax_rate,
+			t.tax_class,
+			t.tax_code,
+			t.parent_id,
+			t.create_by,
+			t.update_by,
+			t.create_time,
+			t.update_time,
+			t.del_flag,
+			t.comp_id,
+			ifnull((select product_name from product t1 where t1.id = t.parent_id),'鏍圭骇浜у搧') AS parentName
+		FROM
+			product t
+		WHERE
+			del_flag = '0'
+		<if test="queryDTO.productName !=null and queryDTO.productName !=''">
+			AND t.product_name LIKE CONCAT('%', #{queryDTO.productName}, '%')
+		</if>
+		<if test="queryDTO.mainCode !=null and queryDTO.mainCode !=''">
+			AND t.main_code LIKE CONCAT('%', #{queryDTO.mainCode}, '%')
+		</if>
+		<if test="queryDTO.erpCode !=null and queryDTO.erpCode !=''">
+			AND t.erp_code LIKE CONCAT('%', #{queryDTO.erpCode}, '%')
+		</if>
+			order by t.create_time desc
+	</select>
+	<select id="page" resultType="com.by4cloud.platformx.business.entity.Product">
+		SELECT
+		t.id,
+		t.product_name,
+		t.main_code,
+		t.erp_code,
+		t.product_type,
+		t.tax_rate,
+		t.tax_class,
+		t.tax_code,
+		t.parent_id,
+		t.create_by,
+		t.update_by,
+		t.create_time,
+		t.update_time,
+		t.del_flag,
+		t.comp_id,
+		ifnull((select product_name from product t1 where t1.id = t.parent_id),'鏍圭骇浜у搧') AS parentName
+		FROM
+		product t
+		WHERE
+		del_flag = '0'
+		<if test="queryDTO.productName !=null and queryDTO.productName !=''">
+			AND t.product_name LIKE CONCAT('%', #{queryDTO.productName}, '%')
+		</if>
+		<if test="queryDTO.mainCode !=null and queryDTO.mainCode !=''">
+			AND t.main_code LIKE CONCAT('%', #{queryDTO.mainCode}, '%')
+		</if>
+		<if test="queryDTO.erpCode !=null and queryDTO.erpCode !=''">
+			AND t.erp_code LIKE CONCAT('%', #{queryDTO.erpCode}, '%')
+		</if>
+		<if test="smjList != null and smjList.size() > 0">
+			AND t.comp_id IN
+			<foreach collection="smjList" item="id" open="(" separator="," close=")">
+				#{id}
+			</foreach>
+		</if>
+		order by t.create_time desc
+	</select>
 </mapper>
\ No newline at end of file

--
Gitblit v1.9.1