From eaa20cb58afc80e3612fd6e93d6f27e181a027e7 Mon Sep 17 00:00:00 2001 From: puzhibing <393733352@qq.com> Date: 星期五, 07 四月 2023 17:38:29 +0800 Subject: [PATCH] 提交用户端开发版本 --- user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/dao/mapping/UserToCouponMapper.xml | 43 ++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 42 insertions(+), 1 deletions(-) diff --git a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/dao/mapping/UserToCouponMapper.xml b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/dao/mapping/UserToCouponMapper.xml index 99a190f..f11bea7 100644 --- a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/dao/mapping/UserToCouponMapper.xml +++ b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/dao/mapping/UserToCouponMapper.xml @@ -19,7 +19,20 @@ <select id="queryCoupon" resultType="com.supersavedriving.user.modular.system.model.Coupon"> select b.id, - a.* + a.agent_id as agentId, + a.branch_office_id as branchOfficeId, + a.create_time as createTime, + a.coupon_name as couponName, + a.coupon_type as couponType, + a.coupon_code as couponCode, + a.coupon_service_type as couponServiceType, + a.coupon_conditional_amount as couponConditionalAmount, + a.coupon_preferential_amount as couponPreferentialAmount, + a.coupon_validity as couponValidity, + a.coupon_send_quantity as couponSendQuantity, + a.coupon_state as couponState, + a.coupon_count as couponCount, + a.remaining_quantity as remainingQuantity from t_coupon a left join t_user_to_coupon b on (a.id = b.couponId) where b.status = 1 and b.expireTime > now() and b.validCount > 0 @@ -41,4 +54,32 @@ where b.userId = #{uid} and b.validCount > 0 and b.expireTime > now() and a.coupon_conditional_amount <= #{price} and a.coupon_preferential_amount < #{price} order by b.createTime </select> + + + <select id="queryMyCoupons" resultType="com.supersavedriving.user.modular.system.warpper.CouponsWarpper"> + select + a.id, + b.coupon_name as `name`, + b.coupon_conditional_amount as preferentialTerms, + b.coupon_preferential_amount as discountAmount, + UNIX_TIMESTAMP(a.expireTime) * 1000 as endTime + from t_user_to_coupon a + left join t_coupon b on (a.couponId = b.id) + where a.`status` = 1 and a.userId = #{uid} + <if test="null != state and 1 == state"> + and a.couponTotal = a.validCount and now() < a.expireTime + </if> + <if test="null != state and 2 == state"> + and a.couponTotal != a.validCount and now() < a.expireTime + </if> + <if test="null != state and 3 == state"> + and now() >= a.expireTime + </if> + order by a.createTime desc limit #{pageNum}, #{pageSize} + </select> + + + <select id="queryUsedCouponNum" resultType="int"> + select sum(couponTotal - validCount) from t_user_to_coupon where `status` = 1 and userId = #{uid} + </select> </mapper> \ No newline at end of file -- Gitblit v1.7.1