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/hive/SysProjServicesDao.xml |   99 ++++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 80 insertions(+), 19 deletions(-)

diff --git a/zq-erp/src/main/resources/mybatis/mapper/hive/SysProjServicesDao.xml b/zq-erp/src/main/resources/mybatis/mapper/hive/SysProjServicesDao.xml
index f5b7550..a85356b 100644
--- a/zq-erp/src/main/resources/mybatis/mapper/hive/SysProjServicesDao.xml
+++ b/zq-erp/src/main/resources/mybatis/mapper/hive/SysProjServicesDao.xml
@@ -40,6 +40,9 @@
 			<result property="companyId" column="company_id"/>
 			<result property="comment" column="comment"/>
 			<result property="reply" column="reply"/>
+			<result property="overtimeNotice" column="overtime_notice"/>
+			<result property="cashierId" column="cashier_id"/>
+			<result property="cashierName" column="cashierName"/>
 
 			
 			<result property="beautiName" column="beautiName"/>
@@ -47,6 +50,8 @@
 			<result property="shopName" column="shopName"/>
 			<result property="createStaffName" column="createStaffName"/>
 			<result property="bedName" column="bedName"/>
+			<result property="vipName" column="VIP_Name"/>
+
 
 			<association property="vipInfo"  resultMap="com.matrix.system.hive.dao.SysVipInfoDao.SysVipInfoMapSimple" ></association>
 
@@ -91,7 +96,9 @@
 			consume_time,
 			company_id,
 			comment,
-			reply
+			reply,
+			overtime_notice,
+			cashier_id
 		)
 	VALUES (
 			#{id},
@@ -128,15 +135,33 @@
 			#{consumeTime},
 			#{companyId},
 			#{comment},
-			#{reply}
+			#{reply},
+			#{overtimeNotice},
+			#{cashierId}
 	)
 		
 	</insert>
 
 	<!--  根据id更新 部分更新   -->
 	<update id="updateOrderTime">
-		UPDATE sys_proj_services set CREATE_TIME=#{createTime} WHERE id=#{id} 
+		UPDATE sys_proj_services set
+		consume_time=#{serviceOrderTimeDto.consumeTime},
+			yy_time=#{serviceOrderTimeDto.yyTime},
+			create_time=#{serviceOrderTimeDto.createTime}
+		WHERE id=#{serviceOrderTimeDto.id}
 	</update>
+
+	<!-- 设置服务单为已通知 -->
+	<update id="updateNoticeTimes" >
+		UPDATE sys_proj_services set overtime_notice=1
+		where  ID in
+		<foreach collection="list" index="index" item="item" open="("
+				 separator="," close=")">
+			#{item}
+		</foreach>
+	</update>
+
+
 	
 	<update id="update">
 		UPDATE sys_proj_services
@@ -229,24 +254,28 @@
 					CHANGE_ID = #{changeId},
 				</if>
 				<if test="oldShopId != null and oldShopId !='' ">
-					OLD_SHOP_ID = #{oldShopId}
+					OLD_SHOP_ID = #{oldShopId},
 				</if>
 				<if test="consumeTime != null  ">
-					consume_time = #{consumeTime}
+					consume_time = #{consumeTime},
 				</if>
 
 				<if test="reply != null  ">
-					reply = #{reply}
+					reply = #{reply},
 				</if>
 				<if test="comment != null  ">
-					comment = #{comment}
+					comment = #{comment},
+				</if>
+				<if test="overtimeNotice != null  ">
+					overtime_notice = #{overtimeNotice},
+				</if>
+				<if test="cashierId != null  ">
+					cashier_id = #{cashierId},
 				</if>
 		</set>
 		WHERE id=#{id} 
 	</update>
-	<update id="comment">
 
-	</update>
 
 	<!-- 批量删除 -->
 	<delete id="deleteByIds" parameterType="java.util.List">
@@ -272,12 +301,13 @@
 		(select  su_name from  sys_users f where  a.CREATE_STAFF_ID=f.su_id ) as  createStaffName,
 		(select  su_name from  sys_users j where  a.BEAUTICIAN_ID=j.su_id ) as  beautiName,
 		(select  su_name from  sys_users k where  a.devision_id=k.su_id ) as plsName,
+		(select  su_name from  sys_users l where  a.cashier_id=l.su_id ) as cashierName,
 		(select  shop_name from  sys_shop_info h where  a.SHOP_ID=h.ID ) as shopName,
 		(select  bed_name from  sys_bed_info i where  a.BED_ID=i.ID ) as bedName
 		FROM sys_proj_services a
 		LEFT JOIN sys_vip_info b on b.ID=a.VIP_ID
 		left join sys_beautician_state c on a.id=c.SERVICES_ID
-		WHERE 1 = 1
+		WHERE 1 = 1 and (b.IS_DELETE is null or b.IS_DELETE = '')
 		<if test="record!=null">
 			<if test="record.queryStaffId != null and record.queryStaffId !='' ">
 				and (a.CREATE_STAFF_ID  = #{record.queryStaffId}  or c.STAFF_ID=#{record.queryStaffId}  )
@@ -304,15 +334,16 @@
 			<if test="record.state != null and record.state !='' ">
 				and a.STATE  = #{record.state}
 			</if>
+			<if test="record.cashierId != null and record.cashierId !='' ">
+				and a.cashier_id = #{record.cashierId}
+			</if>
 			<if test="record.shopId != null and record.shopId !='' ">
 				AND a.SHOP_ID = #{record.shopId}
 			</if>
 			<if test="record.vipId != null and record.vipId !='' ">
 				and a.VIP_ID   = #{record.vipId}
 			</if>
-			<if test="record.isOverTime != null  and record.serviceNo !=''   ">
-				and a.IS_OVERTIME  > #{record.isOverTime}
-			</if>
+
 			<if test="record.serviceNo != null and record.serviceNo !='' ">
 				and a.SERVICE_NO  like CONCAT('%',#{record.serviceNo},'%')
 			</if>
@@ -343,7 +374,7 @@
 		FROM sys_proj_services a
 		LEFT JOIN sys_vip_info b on b.ID=a.VIP_ID
 		left join sys_beautician_state c on a.id=c.SERVICES_ID
-		WHERE 1 = 1
+		WHERE 1 = 1 and (b.IS_DELETE is null or b.IS_DELETE = '')
 		<if test="record!=null">
 			<if test="record.queryStaffId != null and record.queryStaffId !='' ">
 				and (a.CREATE_STAFF_ID  = #{record.queryStaffId}  or c.STAFF_ID=#{record.queryStaffId}  )
@@ -367,6 +398,9 @@
 				and a.STATE  = #{record.state}
 			</if>
 
+			<if test="record.cashierId != null and record.cashierId !='' ">
+				and a.cashier_id = #{record.cashierId}
+			</if>
 			<if test="(record.companyId!=null and record.companyId!='') ">
 				and a.company_id = #{record.companyId}
 			</if>
@@ -403,14 +437,29 @@
 		(select  su_name from  sys_users f where  a.CREATE_STAFF_ID=f.su_id ) as  createStaffName,
 		(select  su_name from  sys_users j where  a.BEAUTICIAN_ID=j.su_id ) as  beautiName,
 		(select  su_name from  sys_users k where  a.devision_id=k.su_id ) as plsName,
+		(select  su_name from  sys_users l where  a.cashier_id=l.su_id ) as cashierName,
 		(select  shop_name from  sys_shop_info h where  a.SHOP_ID=h.ID ) as shopName,
 		(select  bed_name from  sys_bed_info i where  a.BED_ID=i.ID ) as bedName
 		FROM sys_proj_services a
 		LEFT JOIN sys_vip_info b on b.ID=a.VIP_ID
 		left join sys_beautician_state c on a.id=c.SERVICES_ID
-		where  a.ID=#{id}
+		where  a.ID=#{id} and (b.IS_DELETE is null or b.IS_DELETE = '')
 	</select>
-	
+
+	<select id="selectNeedNoticeService" resultMap="SysProjServicesMap">
+	select
+		a.id,
+		a.company_id,
+		b.VIP_Name
+		FROM sys_proj_services a
+		LEFT JOIN sys_vip_info b on b.ID=a.VIP_ID
+		where   a.YY_TIME > now()
+		and DATE_ADD(now(),INTERVAL 1 HOUR) > a.YY_TIME
+		and overtime_notice is null  and (b.IS_DELETE is null or b.IS_DELETE = '')
+	</select>
+
+
+
 	<!-- 根据对象查询-->
 	<select id="selectByModel" resultMap="SysProjServicesMap">
 		select	distinct
@@ -421,12 +470,13 @@
 		(select  su_name from  sys_users f where  a.CREATE_STAFF_ID=f.su_id ) as  createStaffName,
 		(select  su_name from  sys_users j where  a.BEAUTICIAN_ID=j.su_id ) as  beautiName,
 		(select  su_name from  sys_users k where  a.devision_id=k.su_id ) as plsName,
+		(select  su_name from  sys_users l where  a.cashier_id=l.su_id ) as cashierName,
 		(select  shop_name from  sys_shop_info h where  a.SHOP_ID=h.ID ) as shopName,
 		(select  bed_name from  sys_bed_info i where  a.BED_ID=i.ID ) as bedName
 		FROM sys_proj_services a
 		LEFT JOIN sys_vip_info b on b.ID=a.VIP_ID
 		left join sys_beautician_state c on a.id=c.SERVICES_ID
-		WHERE 1 = 1
+		WHERE 1 = 1 and (b.IS_DELETE is null or b.IS_DELETE = '')
 		<if test="record!=null">
 			<if test="record.queryStaffId != null and record.queryStaffId !='' ">
 				and (a.CREATE_STAFF_ID  = #{record.queryStaffId}  or c.STAFF_ID=#{record.queryStaffId}  )
@@ -448,6 +498,9 @@
 			</if>
 			<if test="record.state != null and record.state !='' ">
 				and a.STATE  = #{record.state}
+			</if>
+			<if test="record.cashierId != null and record.cashierId !='' ">
+				and a.cashier_id = #{record.cashierId}
 			</if>
 			<if test="record.shopId != null and record.shopId !='' ">
 				AND a.SHOP_ID = #{record.shopId}
@@ -517,6 +570,7 @@
 		left join sys_proj_use g on b.puse_id=g.ID
 		left join sys_shop_info h on a.SHOP_ID=h.ID
 		<where>
+			and a.company_id=#{record.companyId} and (e.IS_DELETE is null or e.IS_DELETE = '')
 			<if test="record.queryKey != null and record.queryKey != ''">
 				and (instr(a.SERVICE_NO, #{record.queryKey}) or instr(e.phone, #{record.queryKey}) or instr(e.vip_name, #{record.queryKey}) )
 			</if>
@@ -553,6 +607,7 @@
 		left join sys_users f on f.su_id=b.STAFF_ID
 		left join sys_proj_use g on b.puse_id=g.ID
 		<where>
+			and a.company_id=#{record.companyId} and (e.IS_DELETE is null or e.IS_DELETE = '')
 			<if test="record.queryKey != null and record.queryKey != ''">
 				and (instr(a.SERVICE_NO, #{record.queryKey}) or instr(e.phone, #{record.queryKey}) or instr(e.vip_name, #{record.queryKey}) )
 			</if>
@@ -611,6 +666,7 @@
 		left join sys_shop_info h on a.SHOP_ID=h.ID
 		left join shopping_goods m on g.proj_id=m.id
 		<where>
+			and (e.IS_DELETE is null or e.IS_DELETE = '')
 			<if test="queryKey != null and queryKey != ''">
 				and instr(a.SERVICE_NO, #{queryKey})
 			</if>
@@ -662,9 +718,14 @@
 		left join sys_proj_use g on b.puse_id=g.ID
 		left join sys_shop_info h on a.SHOP_ID=h.ID
 		left join shopping_goods m on g.proj_id=m.id
-		where a.id=#{id}
+		where a.id=#{id} and (e.IS_DELETE is null or e.IS_DELETE = '')
 	</select>
 
 
-
+	<select id="selectProjServicesByOrderItemId" resultMap="SysProjServicesMap">
+		select a.* from sys_proj_services a
+		  inner join sys_beautician_state b on a.id=b.SERVICES_ID
+		  inner join sys_proj_use c on c.id=b.puse_id
+		where ORDER_ITEM_ID=#{itemId} and a.STATE!='预约取消'
+	</select>
 </mapper>

--
Gitblit v1.9.1