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/SysVipInfoDao.xml | 74 ++++++++++++++++++++++--------------- 1 files changed, 44 insertions(+), 30 deletions(-) diff --git a/zq-erp/src/main/resources/mybatis/mapper/hive/SysVipInfoDao.xml b/zq-erp/src/main/resources/mybatis/mapper/hive/SysVipInfoDao.xml index dd2ef97..bbf480c 100644 --- a/zq-erp/src/main/resources/mybatis/mapper/hive/SysVipInfoDao.xml +++ b/zq-erp/src/main/resources/mybatis/mapper/hive/SysVipInfoDao.xml @@ -61,6 +61,7 @@ <result property="country" column="country" /> <result property="sessionKey" column="session_key" /> <result property="userIsAuthorize" column="user_is_authorize" /> + <result property="validFlag" column="valid_flag" /> <!-- 扩展属性 --> <result property="staffName" column="STAFF_NAME"/> @@ -124,6 +125,7 @@ <result property="country" column="country" /> <result property="sessionKey" column="session_key" /> <result property="userIsAuthorize" column="user_is_authorize" /> + <result property="validFlag" column="valid_flag" /> <!-- 扩展属性 --> <result property="staffName" column="STAFF_NAME"/> @@ -142,7 +144,7 @@ COMMISSION_ALL,IN_DATE,STAFF_ID,SHOP_ID,IS_DELETE,REMARK,PASSWORD, EMAIL,CREATE_TIME,UUID,BALANCE,blood,sfCard,link,marry,vocation,handleTime from sys_vip_info - WHERE company_id=#{companyId} + WHERE company_id=#{companyId} and (IS_DELETE is null or IS_DELETE = '') and (STAFF_ID = #{staffId} or BEATUY_ID = #{staffId}) AND datediff(date_add(concat( date_format(BIRTHDAY1, "%Y"), @@ -168,7 +170,7 @@ select count(*) from sys_vip_info WHERE - company_id=#{companyId} + company_id=#{companyId} and (IS_DELETE is null or IS_DELETE = '') AND (STAFF_ID = #{staffId} or BEATUY_ID = #{staffId}) AND datediff(date_add(concat( date_format(BIRTHDAY1, "%Y"), @@ -187,7 +189,7 @@ sys_vip_info a LEFT JOIN service_record b ON a.ID = b.vip_id - WHERE company_id=#{companyId} + WHERE company_id=#{companyId} and (a.IS_DELETE is null or a.IS_DELETE = '') and (a.STAFF_ID = #{staffId} or a.BEATUY_ID = #{staffId}) AND b.follow_time BETWEEN curdate() AND @@ -210,7 +212,7 @@ LEFT JOIN service_record b ON a.ID = b.vip_id WHERE - company_id=#{companyId} + company_id=#{companyId} and (a.IS_DELETE is null or a.IS_DELETE = '') and (a.STAFF_ID = #{staffId} or a.BEATUY_ID = #{staffId}) AND b.follow_time BETWEEN curdate() @@ -224,7 +226,7 @@ sys_vip_info a LEFT JOIN sys_proj_services b ON a.ID = b.VIP_ID WHERE - company_id=#{companyId} + company_id=#{companyId} and (a.IS_DELETE is null or a.IS_DELETE = '') and (a.STAFF_ID = #{staffId} or a.BEATUY_ID = #{staffId}) AND b.YY_TIME BETWEEN curdate() @@ -248,7 +250,7 @@ LEFT JOIN sys_proj_services b ON a.ID = b.VIP_ID WHERE - company_id=#{companyId} + company_id=#{companyId} and (a.IS_DELETE is null or a.IS_DELETE = '') and (a.STAFF_ID = #{staffId} or a.BEATUY_ID = #{staffId}) AND b.YY_TIME BETWEEN curdate() @@ -537,6 +539,9 @@ <if test="avatarUrl != null and avatarUrl != '' "> avatar_url = #{avatarUrl}, </if> + <if test="validFlag != null and validFlag != '' "> + valid_flag = #{validFlag}, + </if> </set> @@ -562,6 +567,14 @@ #{item} </foreach> </delete> + + <update id="deleteLogicByIds" parameterType="java.util.List"> + UPDATE sys_vip_info set IS_DELETE = '已删除' where ID in + <foreach collection="list" index="index" item="item" open="(" + separator="," close=")"> + #{item} + </foreach> + </update> <!-- 根据id删除 --> <delete id="deleteById"> @@ -611,7 +624,7 @@ <select id="findByOpenId" resultMap="SysVipInfoMap"> select * - from sys_vip_info where openid=#{openId} + from sys_vip_info where openid=#{openId} and (IS_DELETE is null or IS_DELETE = '') </select> <!-- 根据手机和密码查询 --> @@ -623,7 +636,7 @@ <!-- 判断是否为唯一 --> <select id="selectTotalByField" resultType="java.lang.Integer"> select count(*) from - sys_vip_info where ${field} = #{value} + sys_vip_info where ${field} = #{value} and (IS_DELETE is null or IS_DELETE = '') </select> <!-- 根据对象查询 --> @@ -703,7 +716,7 @@ COMMISSION_ALL,IN_DATE,STAFF_ID,SHOP_ID,IS_DELETE,REMARK,PASSWORD, EMAIL,CREATE_TIME,UUID,BALANCE from sys_vip_info where - company_id=#{companyId} + company_id=#{companyId} and (IS_DELETE is null or IS_DELETE = '') and PHONE like concat('%',#{keyWord},'%') limit 0,10 </select> @@ -716,7 +729,7 @@ COMMISSION_ALL,IN_DATE,STAFF_ID,SHOP_ID,IS_DELETE,REMARK,PASSWORD, EMAIL,CREATE_TIME,UUID,BALANCE,blood,sfCard,link,marry,vocation from sys_vip_info - where company_id=#{companyId} + where company_id=#{companyId} and (IS_DELETE is null or IS_DELETE = '') and (instr(PHONE,#{keyWord}) or instr(VIP_NAME ,#{keyWord}) or instr(zjm ,#{keyWord}) @@ -757,6 +770,7 @@ <sql id="whereVo"> <where> + and (a.IS_DELETE is null or a.IS_DELETE = '') <if test="record!=null"> <if test="record.keyWord != null and record.keyWord !='' "> and (a.VIP_NO like CONCAT('%',#{record.keyWord},'%') or @@ -787,7 +801,7 @@ </sql> <sql id="where"> - where 1=1 + where 1=1 and (a.IS_DELETE is null or a.IS_DELETE = '') <if test="record!=null"> <if test="record.id != null and record.id !='' "> and a.ID = #{record.id} @@ -1067,7 +1081,7 @@ (select a.id from sys_vip_info a - where 1=1 + where 1=1 and (a.IS_DELETE is null or a.IS_DELETE = '') <if test="record.parentId != null and record.parentId !='' "> and a.parent_id = #{record.parentId} </if> @@ -1080,7 +1094,7 @@ f.vip_name as name from sys_vip_info d LEFT JOIN sys_vip_info f on d.parent_id = f.id - where 1=1 + where 1=1 and (d.IS_DELETE is null or d.IS_DELETE = '') <if test="record.parentId != null and record.parentId !='' "> and d.parent_id = #{record.parentId} </if> @@ -1108,7 +1122,7 @@ (select a.id from sys_vip_info a - where 1=1 + where 1=1 and (a.IS_DELETE is null or a.IS_DELETE = '') <if test="record.parentId != null and record.parentId !='' "> and a.parent_id = #{record.parentId} </if> @@ -1121,7 +1135,7 @@ f.vip_name as name from sys_vip_info d LEFT JOIN sys_vip_info f on d.parent_id = f.id - where 1=1 + where 1=1 and (d.IS_DELETE is null or d.IS_DELETE = '') <if test="record.parentId != null and record.parentId !='' "> and d.parent_id = #{record.parentId} </if>)k @@ -1134,7 +1148,7 @@ f.vip_name as name from sys_vip_info d LEFT JOIN sys_vip_info f on d.parent_id = f.id - where 1=1 + where 1=1 and (d.IS_DELETE is null or d.IS_DELETE = '') <if test="record.parentId != null and record.parentId !='' "> and d.parent_id = #{record.parentId} </if> @@ -1156,7 +1170,7 @@ count(*) from sys_vip_info d LEFT JOIN sys_vip_info f on d.parent_id = f.id - where 1=1 + where 1=1 and (d.IS_DELETE is null or d.IS_DELETE = '') <if test="record.parentId != null and record.parentId !='' "> and d.parent_id = #{record.parentId} </if> @@ -1172,7 +1186,7 @@ (select a.id from sys_vip_info a - where 1=1 + where 1=1 and (a.IS_DELETE is null or a.IS_DELETE = '') <if test="record.parentId != null and record.parentId !='' "> and a.parent_id = #{record.parentId} </if> @@ -1198,7 +1212,7 @@ (select a.id from sys_vip_info a - where 1=1 + where 1=1 and (a.IS_DELETE is null or a.IS_DELETE = '') <if test="record.parentId != null and record.parentId !='' "> and a.parent_id = #{record.parentId} </if> @@ -1208,13 +1222,13 @@ <select id="selectByPhone" resultMap="SysVipInfoMapSimple"> - select * from sys_vip_info where PHONE = #{phone} and company_id=#{companyId} + select * from sys_vip_info where PHONE = #{phone} and company_id=#{companyId} and (IS_DELETE is null or IS_DELETE = '') </select> <select id="selectVipTelphoneByIds" resultType="java.lang.String"> select phone from sys_vip_info - where phone is not null and id in + where phone is not null and (IS_DELETE is null or IS_DELETE = '') and id in <foreach collection="list" index="index" item="item" open="(" separator="," close=")"> #{item} @@ -1224,18 +1238,18 @@ <select id="selectAllVipPhone" resultType="java.lang.String"> select phone from sys_vip_info where - company_id=#{companyId} + company_id=#{companyId} and (IS_DELETE is null or IS_DELETE = '') and phone is not null </select> <select id="selectVipPhoneWithShop" resultType="java.lang.String"> select phone from sys_vip_info - where phone is not null and shop_id=#{shopId} + where phone is not null and shop_id=#{shopId} and (IS_DELETE is null or IS_DELETE = '') </select> <select id="selectOldUserByTelphone" resultMap="SysVipInfoMap"> - select * from sys_vip_info where phone=#{telphone} and is_deal=1 + select * from sys_vip_info where phone=#{telphone} and is_deal=1 and (IS_DELETE is null or IS_DELETE = '') </select> @@ -1354,7 +1368,7 @@ </insert> <select id="selectVipInfoByVipNo" resultMap="SysVipInfoMapSimple"> - select * from sys_vip_info where company_id=#{companyId} and vip_no=#{vipNo} + select * from sys_vip_info where company_id=#{companyId} and vip_no=#{vipNo} and (IS_DELETE is null or IS_DELETE = '') </select> <select id="selectVipAddressBookByList" resultType="com.matrix.system.app.vo.VipInfoListVo"> @@ -1372,7 +1386,7 @@ select x.vip_id, count(1) arriveCnt from ( select vip_id, date_format(datatime, '%Y-%m-%d') from achieve_new - where 1=1 + where 1=1 and (a.IS_DELETE is null or a.IS_DELETE = '') <!-- 本月到店次数 --> <if test="record.sort == 'monthArrived'"> and date_format(curdate(), '%Y-%m') = date_format(datatime, '%Y-%m') @@ -1461,14 +1475,14 @@ c.LEVEL_NAME vipLevel, a.POINT_ALL integral, e.shop_short_name shopName, - sum(IFNULL(b.gift_money, 0)) totalBalance, + sum(IFNULL(b.real_money, 0)) totalBalance, sum(IFNULL(b.gift_money, 0)) giftBalance, (select sum(IFNULL(d.goods_cash, 0) + IFNULL(d.proj_cash, 0) + IFNULL(d.card_cash, 0)) from achieve_new d where d.vip_id=a.id) totalShopping from sys_vip_info a left join money_card_use b on a.ID = b.vip_id and b.status='有效' left join sys_vip_level c on a.LEVEL_ID = c.ID left join sys_shop_info e on a.SHOP_ID=e.ID - where a.ID=#{id} + where a.ID=#{id} and (a.IS_DELETE is null or a.IS_DELETE = '') </select> @@ -1485,7 +1499,7 @@ inner join sys_order b on a.ID=b.VIP_ID inner join sys_shop_info c on a.SHOP_ID=c.ID left join sys_users d on a.STAFF_ID=d.su_id - where b.STATU='欠款' and b.arrears!=0 + where b.STATU='欠款' and b.arrears!=0 and (a.IS_DELETE is null or a.IS_DELETE = '') <if test="record.companyId!=null"> and a.company_id=#{record.companyId} </if> @@ -1522,7 +1536,7 @@ inner join sys_order b on a.ID=b.VIP_ID inner join sys_shop_info c on a.SHOP_ID=c.ID left join sys_users d on a.STAFF_ID=d.su_id - where b.STATU='欠款' and b.arrears!=0 + where b.STATU='欠款' and b.arrears!=0 and (a.IS_DELETE is null or a.IS_DELETE = '') <if test="record.companyId!=null"> and a.company_id=#{record.companyId} </if> -- Gitblit v1.9.1