From f9d4a8626e3f76c94d4f87a8ab3dba6c3afc5be9 Mon Sep 17 00:00:00 2001
From: liujie <1793218484@qq.com>
Date: 星期三, 20 八月 2025 15:20:21 +0800
Subject: [PATCH] 8.22后台

---
 UserOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/UserCouponRecordMapper.xml |   68 ++++++++++++++++++++++++++++-----
 1 files changed, 57 insertions(+), 11 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 1705663..11a15c3 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
@@ -41,9 +41,6 @@
         <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>
     </select>
 
     <select id="queryCoupon" resultType="map">
@@ -55,9 +52,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 a.expirationTime >= now()
         <if test="null != uid">
             and a.userId = #{uid}
@@ -71,13 +70,7 @@
         <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>
     
     
@@ -152,10 +145,63 @@
             limit #{pageNum}, #{size}
         </if>
     </select>
-
+    <select id="queryAvailable_" 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`
+        from t_user_coupon_record a
+        left join t_company b on (a.companyId = b.id)
+        where a.expirationTime >= now()
+        <if test="null != uid">
+            and a.userId = #{uid}
+        </if>
+        <if test="null != companyId">
+            and a.companyId = #{companyId}
+        </if>
+        <if test="null != state">
+            and a.state = #{state}
+        </if>
+        <if test="null != couponUseType">
+            and a.couponUseType = #{couponUseType}
+        </if>
+        order by a.insertTime desc
+    </select>
 
 
     <update id="updateTimeOut">
         update t_user_coupon_record set state = 3,endTime = now() where now() > expirationTime and state = 1
     </update>
+
+
+    <select id="queryCouponCrossCity" 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`
+        from t_user_coupon_record a
+        left join t_company b on (a.companyId = b.id)
+        <where>
+            <if test="ids != null and ids.size()>0">
+                and a.id in
+                <foreach collection="ids" item="id" index="index" open="(" close=")" separator=",">
+                    #{id}
+                </foreach>
+            </if>
+        </where>
+        order by a.insertTime desc
+        <if test="null != pageNum and null != size">
+            limit #{pageNum}, #{size}
+        </if>
+    </select>
 </mapper>
\ No newline at end of file

--
Gitblit v1.7.1