From 554de444b87aab5f93cb1593a8095612cf9479a7 Mon Sep 17 00:00:00 2001 From: yujian <yujian@163.com> Date: 星期二, 09 六月 2020 17:34:30 +0800 Subject: [PATCH] 订单 --- fanli/src/main/java/com/yeshi/fanli/mapping/user/UserSystemCouponMapper.xml | 57 ++++++++++++++++++++++++++++++++++++++++++--------------- 1 files changed, 42 insertions(+), 15 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/mapping/user/UserSystemCouponMapper.xml b/fanli/src/main/java/com/yeshi/fanli/mapping/user/UserSystemCouponMapper.xml index 72d8aac..5936161 100644 --- a/fanli/src/main/java/com/yeshi/fanli/mapping/user/UserSystemCouponMapper.xml +++ b/fanli/src/main/java/com/yeshi/fanli/mapping/user/UserSystemCouponMapper.xml @@ -19,7 +19,24 @@ javaType="com.yeshi.fanli.entity.system.SystemCoupon"> <id column="usc_coupon_id" property="id" jdbcType="BIGINT" /> </association> + </resultMap> + + + <resultMap id="AllResultMap" type="com.yeshi.fanli.entity.bus.user.UserSystemCoupon"> + <id column="usc_id" property="id" jdbcType="BIGINT"/> + <result column="usc_uid" property="uid" jdbcType="BIGINT"/> + <result column="usc_source" property="source" jdbcType="VARCHAR"/> + <result column="usc_give" property="give" jdbcType="VARCHAR"/> + <result column="usc_state" property="state" jdbcType="INTEGER"/> + <result column="usc_state_activate" property="stateActivated" jdbcType="INTEGER"/> + <result column="usc_start_time" property="startTime" jdbcType="TIMESTAMP"/> + <result column="usc_end_time" property="endTime" jdbcType="TIMESTAMP"/> + <result column="usc_use_time" property="useTime" jdbcType="TIMESTAMP"/> + <result column="usc_create_time" property="createTime" jdbcType="TIMESTAMP"/> + <result column="usc_update_time" property="updateTime" jdbcType="TIMESTAMP"/> + <association property="systemCoupon" column="usc_coupon_id" + resultMap="com.yeshi.fanli.dao.mybatis.SystemCouponMapper.BaseResultMap"/> </resultMap> <resultMap id="ResultVOMap" type="com.yeshi.fanli.vo.user.UserSystemCouponVO"> @@ -154,6 +171,15 @@ ORDER BY uc.usc_state_activate desc, uc.`usc_create_time` </select> + <select id="getValidByUidAndType" resultMap="ResultVOMap"> + SELECT * FROM `yeshi_ec_user_system_coupon` t + LEFT JOIN `yeshi_ec_system_coupon` c ON t.`usc_coupon_id` = c.`sc_id` + WHERE t.usc_state = 1 AND t.usc_state_activate = 1 AND t.usc_uid = #{uid} + AND c.`sc_type`= #{type} AND t.`usc_end_time` <![CDATA[>]]> NOW() + </select> + + + <select id="countUsableByUid" resultType="java.lang.Long"> SELECT IFNULL(count(cp.`usc_id`),0) FROM `yeshi_ec_user_system_coupon` cp WHERE cp.`usc_state` = 1 AND cp.usc_state_activate = 1 @@ -192,21 +218,6 @@ AND (usc_state_activate = 0 OR usc_state_activate is null) </select> - <select id="getIncludeExchange" resultMap="BaseResultMap"> - SELECT * FROM `yeshi_ec_user_system_coupon` t - LEFT JOIN `yeshi_ec_system_coupon` c ON t.`usc_coupon_id` = c.`sc_id` - WHERE t.usc_state = 1 AND t.usc_state_activate = 1 AND t.usc_uid = #{uid} - AND c.`sc_percent` = #{num} AND c.`sc_type`= #{type} - </select> - - <select id="getIncludeNotExchange" resultMap="ResultVOMap"> - SELECT * FROM `yeshi_ec_user_system_coupon` t - LEFT JOIN `yeshi_ec_system_coupon` c ON t.`usc_coupon_id` = c.`sc_id` - WHERE t.usc_state = 1 AND t.usc_state_activate = 1 AND t.usc_uid = #{uid} - AND c.`sc_percent` <![CDATA[<>]]> #{num} AND c.`sc_type`= #{type} - </select> - - <select id="getCouponByUsingTimeOut" resultMap="BaseResultMap"> SELECT * FROM `yeshi_ec_user_system_coupon` cp WHERE cp.`usc_uid` = #{uid} AND cp.`usc_state` = 2 AND (cp.usc_give = 0 or cp.usc_give is null) @@ -216,4 +227,20 @@ separator=",">#{item}</foreach> </select> + <select id="getFreeCouponByType" resultMap="BaseResultMap"> + SELECT * FROM `yeshi_ec_user_system_coupon` t + LEFT JOIN `yeshi_ec_system_coupon` c ON t.`usc_coupon_id` = c.`sc_id` + WHERE t.usc_uid = #{uid} AND c.`sc_type`= #{type} + </select> + + <select id="getNeedActivateCouponByType" resultMap="AllResultMap"> + SELECT * FROM `yeshi_ec_user_system_coupon` t + LEFT JOIN `yeshi_ec_system_coupon` c ON t.`usc_coupon_id` = c.`sc_id` + WHERE t.usc_uid = #{uid} AND c.`sc_type`= #{type} AND t.`usc_state` = 1 + AND (t.usc_state_activate = 0 OR t.usc_state_activate is null) + AND t.`usc_end_time` <![CDATA[>]]> NOW() + ORDER BY usc_id + LIMIT 1 + </select> + </mapper> -- Gitblit v1.8.0