From 6c235963d6fc46b38ea59d9b19c6519b892e080b Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Mon, 16 May 2022 09:42:06 +0800
Subject: [PATCH] 20220516  逻辑删除,更新字段IS_Delete字段为已删除,默认为空,删除后其余信息从查询中过滤了

---
 zq-erp/src/main/resources/mybatis/mapper/fenxiao/ShopSalesmanApplyDao.xml |   32 +++++++++++++++++++-------------
 1 files changed, 19 insertions(+), 13 deletions(-)

diff --git a/zq-erp/src/main/resources/mybatis/mapper/fenxiao/ShopSalesmanApplyDao.xml b/zq-erp/src/main/resources/mybatis/mapper/fenxiao/ShopSalesmanApplyDao.xml
index 1d001af..65dc27b 100644
--- a/zq-erp/src/main/resources/mybatis/mapper/fenxiao/ShopSalesmanApplyDao.xml
+++ b/zq-erp/src/main/resources/mybatis/mapper/fenxiao/ShopSalesmanApplyDao.xml
@@ -55,7 +55,7 @@
 			sys_vip_info a
 		WHERE
 			a.recommend_id = #{userId}
-		  AND a.is_sales = #{isSales}
+		  AND a.is_sales = #{isSales} and  (a.IS_DELETE is null or a.IS_DELETE = '')
 	</select>
 
 	<select id="findShopSalesmanApplyList" resultType="com.matrix.system.fenxiao.vo.ShopSalesmanApplyVo">
@@ -68,9 +68,9 @@
 		WHERE s.id = a.parent_user_id ) parentUser,
 		c.nick_name parentUserNow,
 		( SELECT COUNT(*) FROM sys_vip_info
-		WHERE recommend_id = a.user_id AND is_sales != 1 ) lowerLevelNum,
+		WHERE recommend_id = a.user_id AND is_sales != 1 and  (IS_DELETE is null or IS_DELETE = '')) lowerLevelNum,
 		( SELECT COUNT(*) FROM sys_vip_info
-		WHERE recommend_id = a.user_id AND is_sales = 1 ) invitedNum,
+		WHERE recommend_id = a.user_id AND is_sales = 1 and  (IS_DELETE is null or IS_DELETE = '')) invitedNum,
 		( SELECT IFNULL(sum(IFNULL(amount, 0)), 0) FROM shop_salesman_order
 		WHERE  order_status = 2 AND sales_user_id = a.user_id ) totalRevenue,
 		( SELECT IFNULL(sum(IFNULL(amount, 0)), 0) FROM shop_salesman_order
@@ -85,7 +85,7 @@
 		LEFT JOIN shop_salesman_grade g ON a.grade_id = g.id
 		LEFT JOIN sys_vip_info c ON c.id = b.recommend_id
 		<where>
-		 	a.company_id=#{record.companyId}
+		 	a.company_id=#{record.companyId} and  (b.IS_DELETE is null or b.IS_DELETE = '')
 			<if test="record.shenheState != null and record.shenheState != ''">
 				and a.apply_status=#{record.shenheState}
 			</if>
@@ -110,7 +110,7 @@
 		LEFT JOIN sys_vip_info b ON a.user_id = b.id
 		<where>
 			a.company_id = #{record.companyId}
-		    and a.apply_status = #{record.applyStatus}
+		    and a.apply_status = #{record.applyStatus} and  (b.IS_DELETE is null or b.IS_DELETE = '')
 			<if test="record.nickName != null and record.nickName != ''">
 				and b.nick_name like concat('%',#{record.nickName},'%')
 			</if>
@@ -132,6 +132,7 @@
 		<where>
 			a.company_id = #{record.companyId}
 			and a.is_sales != 1
+			and  (a.IS_DELETE is null or a.IS_DELETE = '')
 			<if test="record.nickName != null and record.nickName != ''">
 				and a.nick_name like concat('%',#{record.nickName},'%')
 			</if>
@@ -185,10 +186,12 @@
 
 	( SELECT count( * ) FROM shop_salesman_order c WHERE  c.sales_user_id = #{openId} and revenue_type =1 ) AS salesorderCount,
 	( SELECT count( * ) FROM shop_salesman_order c WHERE  c.sales_user_id = #{openId} and revenue_type =2 ) AS invitationOrderCount,
-	(select count(*) from sys_vip_info where recommend_id=#{openId} and is_sales=1) as invitationCount,
-	(select count(*) from sys_vip_info where recommend_id=#{openId} and is_sales=2) as customerCount
+	(select count(*) from sys_vip_info where recommend_id=#{openId} and is_sales=1
+										 and   (IS_DELETE is null or IS_DELETE = '')) as invitationCount,
+	(select count(*) from sys_vip_info where recommend_id=#{openId} and is_sales=2
+										 and   (IS_DELETE is null or IS_DELETE = '')) as customerCount
 	from sys_vip_info a where
-	a.id=#{id}
+	a.id=#{id}  and  (a.IS_DELETE is null or a.IS_DELETE = '')
 
 	</select>
 
@@ -202,9 +205,11 @@
 		(SELECT s.nick_name FROM sys_vip_info s
 		WHERE s.id = a.parent_user_id ) parentUser,
 		( SELECT COUNT(*) FROM sys_vip_info
-		WHERE recommend_id = a.user_id AND is_sales != 1 ) lowerLevelNum,
+		WHERE recommend_id = a.user_id AND is_sales != 1
+			and  (IS_DELETE is null or IS_DELETE = '')) lowerLevelNum,
 		( SELECT COUNT(*) FROM sys_vip_info
-		WHERE recommend_id = a.user_id AND is_sales = 1 ) invitedNum,
+		WHERE recommend_id = a.user_id AND is_sales = 1
+		  and   (IS_DELETE is null or IS_DELETE = '')) invitedNum,
 		( SELECT IFNULL(sum(IFNULL(amount, 0)), 0) FROM shop_salesman_order
 		WHERE order_status = 2 AND sales_user_id = a.user_id ) totalRevenue,
 		( SELECT IFNULL(sum(IFNULL(amount, 0)), 0) FROM shop_salesman_order
@@ -216,7 +221,7 @@
 		shop_salesman_apply a
 		LEFT JOIN sys_vip_info b ON a.user_id = b.id
 		LEFT JOIN shop_salesman_grade g ON a.grade_id = g.id
-		    where a.id = #{applyId}
+		    where a.id = #{applyId} and  (b.IS_DELETE is null or b.IS_DELETE = '')
 	</select>
 
 	<select id="findCustomDetail" resultType="com.matrix.system.fenxiao.vo.ShopCustomDetailVo">
@@ -230,7 +235,7 @@
 		<where>
 			b.company_id = #{record.companyId}
 			AND b.is_sales != 1
-			and b.recommend_id = #{record.userId}
+			and b.recommend_id = #{record.userId}  and  (b.IS_DELETE is null or b.IS_DELETE = '')
 			<if test="record.userName != null and record.userName != ''">
 				and b.nick_name like concat('%',#{record.userName},'%')
 			</if>
@@ -254,6 +259,7 @@
 			a.company_id = #{record.companyId}
 			AND b.is_sales = 1
 			and b.recommend_id = #{record.userId}
+			and  (b.IS_DELETE is null or b.IS_DELETE = '')
 			and a.apply_status = 2
 			<if test="record.userName != null and record.userName != ''">
 				and b.nick_name like concat('%',#{record.userName},'%')
@@ -283,7 +289,7 @@
 		left join shop_order c on a.order_id=c.id
 		LEFT JOIN sys_shop_info f on f.id = c.store_id
 		<where>
-			a.sales_user_id = #{record.userId}
+			a.sales_user_id = #{record.userId} and  (b.IS_DELETE is null or b.IS_DELETE = '')
 			<if test="record.orderType != null and record.orderType != ''">
 				and a.order_status = #{record.orderType}
 			</if>

--
Gitblit v1.9.1