From c554c7ad5405bafa149dbb6429e8245f78b33ffc Mon Sep 17 00:00:00 2001
From: Helius <wangdoubleone@gmail.com>
Date: Wed, 23 Dec 2020 15:59:53 +0800
Subject: [PATCH] modify

---
 zq-erp/src/main/resources/mybatis/mapper/hive/SysVipInfoDao.xml |   75 +++++++++++++++++++++++++++++++++++--
 1 files changed, 71 insertions(+), 4 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 0a9189e..4e58387 100644
--- a/zq-erp/src/main/resources/mybatis/mapper/hive/SysVipInfoDao.xml
+++ b/zq-erp/src/main/resources/mybatis/mapper/hive/SysVipInfoDao.xml
@@ -35,6 +35,10 @@
         <result property="disease" column="disease"/>
         <result property="zjm" column="zjm"/>
         <result property="companyId" column="company_id"/>
+        <result property="province" column="province"/>
+        <result property="city" column="city"/>
+        <result property="area" column="area"/>
+        <result property="recommendId" column="recommend_id"/>
 
         <result property="statu" column="statu"/>
         <result property="birthdayType" column="birthdayType"/>
@@ -274,7 +278,11 @@
         disease,
         is_deal,
         zjm,
-        company_id
+        company_id,
+        province,
+        city,
+        area,
+        recommend_id
         )
 
 
@@ -318,7 +326,11 @@
         #{disease},
         #{isDeal},
         #{zjm},
-        #{companyId}
+        #{companyId},
+        #{province},
+        #{city},
+        #{area},
+        #{recommendId}
         )
 
     </insert>
@@ -444,6 +456,18 @@
             </if>
             <if test="isDeal != null  ">
                 is_deal = #{isDeal},
+            </if>
+            <if test="recommendId != null  ">
+                recommend_id = #{recommendId},
+            </if>
+            <if test="province != null and province !=''  ">
+                province = #{province},
+            </if>
+            <if test="city != null and city !=''  ">
+                city = #{city},
+            </if>
+            <if test="area != null and area !=''  ">
+                area = #{area},
             </if>
 
 
@@ -937,7 +961,11 @@
 		a.create_distribution_time,
 		a.birthdayType,
 		a.disease,
-		a.is_deal
+		a.is_deal,
+		a.province,
+		a.city,
+		a.area,
+		a.recommend_id
 	</sql>
     <sql id="from">
 		from sys_vip_info a
@@ -1226,7 +1254,8 @@
                a.VIP_NAME vipName,
                a.PHONE phone,
                a.photo photo,
-               b.arriveCnt arriveCnt
+               b.arriveCnt arriveCnt,
+               g.shop_short_name shopName
         from sys_vip_info a
         left join (
             select x.vip_id, count(1) arriveCnt from (
@@ -1268,6 +1297,8 @@
             select n.VIP_LEVEL vipLevel, n.ID from sys_vip_level n
             ) f on a.LEVEL_ID = f.ID
         </if>
+        left join sys_shop_info g on a.shop_id = g.id
+        left join sys_vip_level h on a.level_id=h.id
         where 1=1
         <if test="record.queryKey != null and record.queryKey != ''">
             and (instr(PHONE,#{record.queryKey})
@@ -1278,6 +1309,21 @@
         <if test="record.shopId != null">
             and a.shop_id=#{record.shopId}
         </if>
+        <if test='record.birthType=="1"'>
+            and a.BIRTHDAY1 between curdate() and DATE_ADD(CURDATE(), INTERVAL 3 DAY)
+        </if>
+        <if test='record.birthType=="2"'>
+            and date_format(a.BIRTHDAY1, '%Y-%m') = date_format(CURDATE(), '%Y-%m')
+        </if>
+        <if test='record.birthType=="3"'>
+            and PERIOD_DIFF(date_format(now() ,'%Y-%m') , date_format(a.BIRTHDAY1, '%Y-%m')) =1
+        </if>
+        <if test="record.vipType != null">
+            and a.level_id=#{record.vipType}
+        </if>
+        <if test="record.other != null and record.other!=''">
+            and a.is_deal=#{record.other}
+        </if>
 
         <if test="record.sort == 'monthArrived' or record.sort == 'yearArrived'">
             order by arriveCnt ${record.order}
@@ -1286,5 +1332,26 @@
             order by ${record.sort} ${record.order}
         </if>
     </select>
+
+    <select id="selectVipInfoById" resultType="com.matrix.system.app.vo.VipInfoVo">
+        select
+               a.ID id,
+               a.photo photo,
+               a.PHONE phone,
+               a.VIP_NAME vipName,
+               a.VIP_NO vipNo,
+               c.LEVEL_NAME vipLevel,
+               a.POINT_ALL integral,
+               e.shop_short_name shopName,
+               sum(IFNULL(b.gift_money, 0) + IFNULL(b.real_money, 0)) totalBalance,
+               sum(IFNULL(b.gift_money, 0)) giftBalance,
+               sum(IFNULL(d.goods_cash, 0) + IFNULL(d.proj_cash, 0) + IFNULL(d.card_cash, 0)) 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 achieve_new d on a.ID = d.vip_id
+        left join sys_shop_info e on a.SHOP_ID=e.ID
+        where a.ID=#{id}
+    </select>
 </mapper>
 	

--
Gitblit v1.9.1