From 9bbcd9f08c311e5082271d9eb4db8dd19de87b0e Mon Sep 17 00:00:00 2001
From: Helius <wangdoubleone@gmail.com>
Date: Thu, 11 Nov 2021 14:46:37 +0800
Subject: [PATCH] fix

---
 zq-erp/src/main/resources/mybatis/mapper/hive/AchieveNewDao.xml |   52 +++++++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 43 insertions(+), 9 deletions(-)

diff --git a/zq-erp/src/main/resources/mybatis/mapper/hive/AchieveNewDao.xml b/zq-erp/src/main/resources/mybatis/mapper/hive/AchieveNewDao.xml
index 762117a..091ac7f 100644
--- a/zq-erp/src/main/resources/mybatis/mapper/hive/AchieveNewDao.xml
+++ b/zq-erp/src/main/resources/mybatis/mapper/hive/AchieveNewDao.xml
@@ -1294,13 +1294,27 @@
 						 ) x group by x.vip_id
 		) d on c.id=d.vip_id
 		where 1=1
-		 <if test="record.companyId != null">
-			 and a.company_id=#{record.companyId}
-		 </if>
-		  <if test="record.shopId != null">
-			  and a.shop_id=#{record.shopId}
-		  </if>
-		and date_format(b.datatime, '%Y-%m')=date_format(now(), '%Y-%m')
+		<if test="record.companyId != null">
+		 and a.company_id=#{record.companyId}
+		</if>
+		<if test="record.shopId != null">
+		  and a.shop_id=#{record.shopId}
+		</if>
+		<if test="record.beginTime != null">
+			and date_format(b.datatime, '%Y-%m-%d') > date_format(#{record.beginTime}, '%Y-%m-%d')
+		</if>
+		<if test="record.endTime != null">
+			and date_format(#{record.endTime}, '%Y-%m-%d') > date_format(b.datatime, '%Y-%m-%d')
+		</if>
+		<if test="record.beaultId != null">
+			and a.su_id=#{record.beaultId}
+		</if>
+		<if test="record.vipQueryKey != null and record.vipQueryKey != ''">
+			and c.vip_name like concat('%', #{record.vipQueryKey}, '%')
+		</if>
+		<if test="record.beginTime == null and record.endTime == null">
+			and date_format(b.datatime, '%Y-%m') = date_format(now(), '%Y-%m')
+		</if>
 		group by date_format(b.datatime, '%Y-%m-%d'), a.su_id, c.ID
 		<if test="pageVo !=null"><!-- 判断pageVo对象是否为空 -->
 			order by date_format(b.datatime, '%Y-%m-%d') desc, a.su_id
@@ -1325,8 +1339,28 @@
 			 from sys_users a
 					  left join achieve_new b on a.su_id=b.beault_id
 					  left join sys_vip_info c on b.vip_id=c.ID
-			 where a.company_id=#{record.companyId} and a.shop_id=#{record.shopId}
-			   and date_format(b.datatime, '%Y-%m')=date_format(now(), '%Y-%m')
+			where 1=1
+			<if test="record.companyId != null">
+				and a.company_id=#{record.companyId}
+			</if>
+			<if test="record.shopId != null">
+				and a.shop_id=#{record.shopId}
+			</if>
+			<if test="record.beginTime != null">
+				and date_format(b.datatime, '%Y-%m-%d') > date_format(#{record.beginTime}, '%Y-%m-%d')
+			</if>
+			<if test="record.endTime != null">
+				and date_format(#{record.endTime}, '%Y-%m-%d') > date_format(b.datatime, '%Y-%m-%d')
+			</if>
+			<if test="record.beaultId != null">
+				and a.su_id=#{record.beaultId}
+			</if>
+			<if test="record.vipQueryKey != null and record.vipQueryKey != ''">
+				and c.vip_name like concat('%', #{record.vipQueryKey}, '%')
+			</if>
+			<if test="record.beginTime == null and record.endTime == null">
+				and date_format(b.datatime, '%Y-%m') = date_format(now(), '%Y-%m')
+			</if>
 			 group by date_format(b.datatime, '%Y-%m-%d'), a.su_id, c.ID
 		) a
 	</select>

--
Gitblit v1.9.1