From f4e12a183070e9fc1db174dfb7f1c9a59f7763a1 Mon Sep 17 00:00:00 2001
From: Pu Zhibing <393733352@qq.com>
Date: 星期四, 17 四月 2025 09:08:23 +0800
Subject: [PATCH] 新增加功能

---
 UserOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/UserCouponRecordMapper.xml |   46 ++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 42 insertions(+), 4 deletions(-)

diff --git a/UserOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/UserCouponRecordMapper.xml b/UserOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/UserCouponRecordMapper.xml
index b253b6d..64ad6a2 100644
--- a/UserOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/UserCouponRecordMapper.xml
+++ b/UserOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/UserCouponRecordMapper.xml
@@ -79,9 +79,45 @@
             limit #{pageNum}, #{size}
         </if>
     </select>
-
-
-
+    
+    
+    
+    
+    <select id="queryCoupon1" resultType="map">
+        select
+        a.id as id,
+        a.money as money,
+        a.couponUseType as userType,
+        DATE_FORMAT(a.expirationTime, '%Y-%m-%d') as time,
+        a.couponType as `type`,
+        a.fullMoney as fullMoney,
+        a.state as state,
+        b.`name` as `name`,
+        c.citys
+        from t_user_coupon_record a
+        left join t_company b on (a.companyId = b.id)
+        left join t_sys_coupon_record c on (a.couponId = c.id)
+        where a.expirationTime >= now()
+        <if test="null != uid">
+            and a.userId = #{uid}
+        </if>
+        <if test="null != cityCode and '' != cityCode">
+            and JSON_CONTAINS(c.citys, #{cityCode})
+        </if>
+        <if test="null != state">
+            and a.state = #{state}
+        </if>
+        <if test="null != couponUseType">
+            and a.couponUseType = #{couponUseType}
+        </if>
+        <if test="null != money">
+            and if(a.couponType = 1, a.money &lt;= #{money}, a.fullMoney &lt;= #{money})
+        </if>
+        order by a.insertTime desc
+        <if test="null != pageNum and null != size">
+            limit #{pageNum}, #{size}
+        </if>
+    </select>
 
 
 
@@ -94,9 +130,11 @@
         a.couponType as `type`,
         a.fullMoney as fullMoney,
         a.state as state,
-        b.`name` as `name`
+        b.`name` as `name`,
+        c.citys
         from t_user_coupon_record a
         left join t_company b on (a.companyId = b.id)
+        left join t_sys_coupon_record c on (a.couponId = c.id)
         where 1 = 1
         <if test="null != uid">
             and a.userId = #{uid}

--
Gitblit v1.7.1