From 2e5c6b46697f7b96460ad0c356740df52bf056d2 Mon Sep 17 00:00:00 2001
From: yujian <yujian@123.com>
Date: 星期三, 14 八月 2019 09:51:07 +0800
Subject: [PATCH] 金币兑换

---
 fanli/src/main/java/com/yeshi/fanli/mapping/user/UserSystemCouponMapper.xml |  313 ++++++++++++++++++++++++++-------------------------
 1 files changed, 159 insertions(+), 154 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 5a1f6c8..07d9719 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
@@ -1,154 +1,159 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-
-<mapper namespace="com.yeshi.fanli.dao.mybatis.user.UserSystemCouponMapper">
-  <resultMap id="BaseResultMap" 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_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 column="usc_coupon_id" property="systemCoupon" 
-    	javaType="com.yeshi.fanli.entity.system.SystemCoupon">
-		<id column="usc_coupon_id" property="id" jdbcType="BIGINT" />	
-    </association>
-	
-  </resultMap>
-  
-   <resultMap id="ResultVOMap" type="com.yeshi.fanli.vo.user.UserSystemCouponVO">
-    <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_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 column="usc_coupon_id" property="systemCoupon" 
-    	javaType="com.yeshi.fanli.entity.system.SystemCoupon">
-		<id column="usc_coupon_id" property="id" jdbcType="BIGINT" />	
-    </association>
-	
-  </resultMap>
-  
-  <sql id="Base_Column_List">usc_id,usc_uid,usc_coupon_id,usc_source,usc_state,usc_state_activate,usc_start_time,usc_end_time,usc_use_time,usc_create_time,usc_update_time</sql>
-  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select
-    <include refid="Base_Column_List"/>from yeshi_ec_user_system_coupon where usc_id = #{id,jdbcType=BIGINT}
-  </select>
-  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_user_system_coupon where usc_id = #{id,jdbcType=BIGINT}</delete>
-  <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.user.UserSystemCoupon" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_user_system_coupon (usc_id,usc_uid,usc_coupon_id,usc_source,usc_state,usc_state_activate,usc_start_time,usc_end_time,usc_use_time,usc_create_time,usc_update_time) values (#{id,jdbcType=BIGINT},#{uid,jdbcType=BIGINT},#{systemCoupon.id,jdbcType=BIGINT},#{source,jdbcType=VARCHAR},#{state,jdbcType=INTEGER},#{stateActivated,jdbcType=INTEGER},#{startTime,jdbcType=TIMESTAMP},#{endTime,jdbcType=TIMESTAMP},#{useTime,jdbcType=TIMESTAMP},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})</insert>
-  <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.user.UserSystemCoupon" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_user_system_coupon
-    <trim prefix="(" suffix=")" suffixOverrides=",">
-      <if test="id != null">usc_id,</if>
-      <if test="uid != null">usc_uid,</if>
-      <if test="systemCoupon != null">usc_coupon_id,</if>
-      <if test="source != null">usc_source,</if>
-      <if test="state != null">usc_state,</if>
-      <if test="stateActivated != null">usc_state_activate,</if>
-      <if test="startTime != null">usc_start_time,</if>
-      <if test="endTime != null">usc_end_time,</if>
-      <if test="useTime != null">usc_use_time,</if>
-      <if test="createTime != null">usc_create_time,</if>
-      <if test="updateTime != null">usc_update_time,</if>
-    </trim>values
-    <trim prefix="(" suffix=")" suffixOverrides=",">
-      <if test="id != null">#{id,jdbcType=BIGINT},</if>
-      <if test="uid != null">#{uid,jdbcType=BIGINT},</if>
-      <if test="systemCoupon != null">#{systemCoupon.id,jdbcType=BIGINT},</if>
-      <if test="source != null">#{source,jdbcType=VARCHAR},</if>
-      <if test="state != null">#{state,jdbcType=INTEGER},</if>
-      <if test="stateActivated != null">#{stateActivated,jdbcType=INTEGER},</if>
-      <if test="startTime != null">#{startTime,jdbcType=TIMESTAMP},</if>
-      <if test="endTime != null">#{endTime,jdbcType=TIMESTAMP},</if>
-      <if test="useTime != null">#{useTime,jdbcType=TIMESTAMP},</if>
-      <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
-      <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if>
-    </trim>
-  </insert>
-  <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.user.UserSystemCoupon">update yeshi_ec_user_system_coupon set usc_uid = #{uid,jdbcType=BIGINT},usc_coupon_id = #{systemCoupon.id,jdbcType=BIGINT},usc_source = #{source,jdbcType=VARCHAR},usc_state = #{state,jdbcType=INTEGER},usc_state_activate = #{stateActivated,jdbcType=INTEGER},usc_start_time = #{startTime,jdbcType=TIMESTAMP},usc_end_time = #{endTime,jdbcType=TIMESTAMP},usc_use_time = #{useTime,jdbcType=TIMESTAMP},usc_create_time = #{createTime,jdbcType=TIMESTAMP},usc_update_time = #{updateTime,jdbcType=TIMESTAMP} where usc_id = #{id,jdbcType=BIGINT}</update>
-  <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.user.UserSystemCoupon">update yeshi_ec_user_system_coupon
-    <set>
-      <if test="uid != null">usc_uid=#{uid,jdbcType=BIGINT},</if>
-      <if test="systemCoupon != null">usc_coupon_id=#{systemCoupon.id,jdbcType=BIGINT},</if>
-      <if test="source != null">usc_source=#{source,jdbcType=VARCHAR},</if>
-      <if test="state != null">usc_state=#{state,jdbcType=INTEGER},</if>
-      <if test="stateActivated != null">usc_state_activate=#{stateActivated,jdbcType=INTEGER},</if>
-      <if test="startTime != null">usc_start_time=#{startTime,jdbcType=TIMESTAMP},</if>
-      <if test="endTime != null">usc_end_time=#{endTime,jdbcType=TIMESTAMP},</if>
-      <if test="useTime != null">usc_use_time=#{useTime,jdbcType=TIMESTAMP},</if>
-      <if test="createTime != null">usc_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
-      <if test="updateTime != null">usc_update_time=#{updateTime,jdbcType=TIMESTAMP},</if>
-    </set> where usc_id = #{id,jdbcType=BIGINT}
-  </update>
-  
-  <select id="getUserCouponList" resultMap="BaseResultMap">
-	SELECT * FROM `yeshi_ec_user_system_coupon` uc
-	WHERE uc.`usc_uid`= #{uid}
-	ORDER BY uc.`usc_state`,uc.`usc_create_time` DESC
-    LIMIT #{start},#{count}
-  </select>
-  
-  <select id="getUserCouponBySource" resultMap="BaseResultMap">
-	SELECT * FROM `yeshi_ec_user_system_coupon` uc
-	WHERE uc.`usc_uid`= #{uid} AND usc_source = #{source}
-  </select>
-  
-  <select id="countTodatyUserCouponBySource" resultType="java.lang.Integer">
-	SELECT IFNULL(COUNT(uc.`usc_id`),0) FROM `yeshi_ec_user_system_coupon` uc
-	WHERE uc.`usc_uid`= #{uid} AND usc_source = #{source}
-		 AND TO_DAYS(uc.`usc_create_time`) = TO_DAYS(NOW())
-  </select>
-  
-  <select id="getUserCouponVOList" resultMap="ResultVOMap">
-	SELECT * FROM `yeshi_ec_user_system_coupon` uc
-	WHERE uc.`usc_uid`= #{uid}
-	ORDER BY uc.`usc_state`,uc.`usc_create_time` DESC
-	LIMIT #{start},#{count}
-  </select>
-  
-  <select id="countUserCouponList" resultType="java.lang.Long">
-	SELECT IFNULL(count(uc.`usc_id`),0) FROM `yeshi_ec_user_system_coupon` uc
-	WHERE uc.`usc_uid`= #{uid}
-  </select>
-  
-  <select id="getEnableListByCouponId" resultMap="ResultVOMap">
-	SELECT * FROM `yeshi_ec_user_system_coupon` uc
-	WHERE uc.`usc_uid`= #{uid} AND uc.usc_state = 1 
-	    AND DATE_FORMAT(CURDATE(),'%Y%m%d') <![CDATA[ >= ]]>DATE_FORMAT(uc.`usc_start_time`,'%Y%m%d')
-		<if test="activated != null">AND uc.usc_state_activate = #{activated}</if>
-		AND uc.usc_coupon_id in
-		<foreach collection="list" item="item" open="(" close=")"
-			separator=",">#{item}</foreach>
-	ORDER BY uc.usc_state_activate desc, uc.`usc_create_time`
-  </select>
-  
-  <select id="getCounponNowInvalid" resultMap="BaseResultMap">
-  	SELECT * FROM `yeshi_ec_user_system_coupon` cp
-	WHERE cp.`usc_uid` = #{uid} AND cp.`usc_state` = 1
-		AND DATE_FORMAT(CURDATE(),'%Y%m%d') <![CDATA[ > ]]>DATE_FORMAT(cp.`usc_end_time`,'%Y%m%d');
-  </select>
-  
-  <select id="getCouponByState" resultMap="BaseResultMap">
-  	SELECT * FROM `yeshi_ec_user_system_coupon` cp
-	WHERE cp.`usc_uid` = #{uid}
-		<if test="state != null">
-			 AND cp.`usc_state` = #{state}
-		</if>
-  </select>
-  
-  <select id="getCouponByTypeAndNotActivated" resultMap="BaseResultMap">
-	SELECT * FROM yeshi_ec_user_system_coupon 
-	WHERE usc_uid = #{uid} AND usc_coupon_id = #{couponId} 
-		AND (usc_state_activate = 0 OR usc_state_activate is null)
-  </select>
-  
-</mapper>
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+
+<mapper namespace="com.yeshi.fanli.dao.mybatis.user.UserSystemCouponMapper">
+  <resultMap id="BaseResultMap" 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 column="usc_coupon_id" property="systemCoupon" 
+    	javaType="com.yeshi.fanli.entity.system.SystemCoupon">
+		<id column="usc_coupon_id" property="id" jdbcType="BIGINT" />	
+    </association>
+	
+  </resultMap>
+  
+   <resultMap id="ResultVOMap" type="com.yeshi.fanli.vo.user.UserSystemCouponVO">
+    <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 column="usc_coupon_id" property="systemCoupon" 
+    	javaType="com.yeshi.fanli.entity.system.SystemCoupon">
+		<id column="usc_coupon_id" property="id" jdbcType="BIGINT" />	
+    </association>
+	
+  </resultMap>
+  
+  <sql id="Base_Column_List">usc_id,usc_uid,usc_coupon_id,usc_source,usc_give,usc_state,usc_state_activate,usc_start_time,usc_end_time,usc_use_time,usc_create_time,usc_update_time</sql>
+  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select
+    <include refid="Base_Column_List"/>from yeshi_ec_user_system_coupon where usc_id = #{id,jdbcType=BIGINT}
+  </select>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_user_system_coupon where usc_id = #{id,jdbcType=BIGINT}</delete>
+  <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.user.UserSystemCoupon" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_user_system_coupon (usc_id,usc_uid,usc_coupon_id,usc_source,usc_give,usc_state,usc_state_activate,usc_start_time,usc_end_time,usc_use_time,usc_create_time,usc_update_time) values (#{id,jdbcType=BIGINT},#{uid,jdbcType=BIGINT},#{systemCoupon.id,jdbcType=BIGINT},#{source,jdbcType=VARCHAR},#{give,jdbcType=VARCHAR},#{state,jdbcType=INTEGER},#{stateActivated,jdbcType=INTEGER},#{startTime,jdbcType=TIMESTAMP},#{endTime,jdbcType=TIMESTAMP},#{useTime,jdbcType=TIMESTAMP},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})</insert>
+  <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.user.UserSystemCoupon" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_user_system_coupon
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="id != null">usc_id,</if>
+      <if test="uid != null">usc_uid,</if>
+      <if test="systemCoupon != null">usc_coupon_id,</if>
+      <if test="source != null">usc_source,</if>
+      <if test="give != null">usc_give,</if>
+      <if test="state != null">usc_state,</if>
+      <if test="stateActivated != null">usc_state_activate,</if>
+      <if test="startTime != null">usc_start_time,</if>
+      <if test="endTime != null">usc_end_time,</if>
+      <if test="useTime != null">usc_use_time,</if>
+      <if test="createTime != null">usc_create_time,</if>
+      <if test="updateTime != null">usc_update_time,</if>
+    </trim>values
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="id != null">#{id,jdbcType=BIGINT},</if>
+      <if test="uid != null">#{uid,jdbcType=BIGINT},</if>
+      <if test="systemCoupon != null">#{systemCoupon.id,jdbcType=BIGINT},</if>
+      <if test="source != null">#{source,jdbcType=VARCHAR},</if>
+      <if test="give != null">#{give,jdbcType=VARCHAR},</if>
+      <if test="state != null">#{state,jdbcType=INTEGER},</if>
+      <if test="stateActivated != null">#{stateActivated,jdbcType=INTEGER},</if>
+      <if test="startTime != null">#{startTime,jdbcType=TIMESTAMP},</if>
+      <if test="endTime != null">#{endTime,jdbcType=TIMESTAMP},</if>
+      <if test="useTime != null">#{useTime,jdbcType=TIMESTAMP},</if>
+      <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
+      <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if>
+    </trim>
+  </insert>
+  <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.user.UserSystemCoupon">update yeshi_ec_user_system_coupon set usc_uid = #{uid,jdbcType=BIGINT},usc_coupon_id = #{systemCoupon.id,jdbcType=BIGINT},usc_source = #{source,jdbcType=VARCHAR},usc_give = #{give,jdbcType=VARCHAR},usc_state = #{state,jdbcType=INTEGER},usc_state_activate = #{stateActivated,jdbcType=INTEGER},usc_start_time = #{startTime,jdbcType=TIMESTAMP},usc_end_time = #{endTime,jdbcType=TIMESTAMP},usc_use_time = #{useTime,jdbcType=TIMESTAMP},usc_create_time = #{createTime,jdbcType=TIMESTAMP},usc_update_time = #{updateTime,jdbcType=TIMESTAMP} where usc_id = #{id,jdbcType=BIGINT}</update>
+  <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.user.UserSystemCoupon">update yeshi_ec_user_system_coupon
+    <set>
+      <if test="uid != null">usc_uid=#{uid,jdbcType=BIGINT},</if>
+      <if test="systemCoupon != null">usc_coupon_id=#{systemCoupon.id,jdbcType=BIGINT},</if>
+      <if test="source != null">usc_source=#{source,jdbcType=VARCHAR},</if>
+      <if test="give != null">usc_give=#{give,jdbcType=VARCHAR},</if>
+      <if test="state != null">usc_state=#{state,jdbcType=INTEGER},</if>
+      <if test="stateActivated != null">usc_state_activate=#{stateActivated,jdbcType=INTEGER},</if>
+      <if test="startTime != null">usc_start_time=#{startTime,jdbcType=TIMESTAMP},</if>
+      <if test="endTime != null">usc_end_time=#{endTime,jdbcType=TIMESTAMP},</if>
+      <if test="useTime != null">usc_use_time=#{useTime,jdbcType=TIMESTAMP},</if>
+      <if test="createTime != null">usc_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
+      <if test="updateTime != null">usc_update_time=#{updateTime,jdbcType=TIMESTAMP},</if>
+    </set> where usc_id = #{id,jdbcType=BIGINT}
+  </update>
+  
+  <select id="getUserCouponList" resultMap="BaseResultMap">
+	SELECT * FROM `yeshi_ec_user_system_coupon` uc
+	WHERE uc.`usc_uid`= #{uid}
+	ORDER BY uc.`usc_state`,uc.`usc_create_time` DESC
+    LIMIT #{start},#{count}
+  </select>
+  
+  <select id="getUserCouponBySource" resultMap="BaseResultMap">
+	SELECT * FROM `yeshi_ec_user_system_coupon` uc
+	WHERE uc.`usc_uid`= #{uid} AND usc_source = #{source}
+  </select>
+  
+  <select id="countTodatyUserCouponBySource" resultType="java.lang.Integer">
+	SELECT IFNULL(COUNT(uc.`usc_id`),0) FROM `yeshi_ec_user_system_coupon` uc
+	WHERE uc.`usc_uid`= #{uid} AND usc_source = #{source}
+		 AND TO_DAYS(uc.`usc_create_time`) = TO_DAYS(NOW())
+  </select>
+  
+  <select id="getUserCouponVOList" resultMap="ResultVOMap">
+	SELECT * FROM `yeshi_ec_user_system_coupon` uc
+	WHERE uc.`usc_uid`= #{uid}
+	ORDER BY uc.`usc_state`,uc.`usc_create_time` DESC
+	LIMIT #{start},#{count}
+  </select>
+  
+  <select id="countUserCouponList" resultType="java.lang.Long">
+	SELECT IFNULL(count(uc.`usc_id`),0) FROM `yeshi_ec_user_system_coupon` uc
+	WHERE uc.`usc_uid`= #{uid}
+  </select>
+  
+  <select id="getEnableListByCouponId" resultMap="ResultVOMap">
+	SELECT * FROM `yeshi_ec_user_system_coupon` uc
+	WHERE uc.`usc_uid`= #{uid} AND uc.usc_state = 1 
+	    AND DATE_FORMAT(CURDATE(),'%Y%m%d') <![CDATA[ >= ]]>DATE_FORMAT(uc.`usc_start_time`,'%Y%m%d')
+		<if test="activated != null">AND uc.usc_state_activate = #{activated}</if>
+		AND uc.usc_coupon_id in
+		<foreach collection="list" item="item" open="(" close=")"
+			separator=",">#{item}</foreach>
+	ORDER BY uc.usc_state_activate desc, uc.`usc_create_time`
+  </select>
+  
+  <select id="getCounponNowInvalid" resultMap="BaseResultMap">
+  	SELECT * FROM `yeshi_ec_user_system_coupon` cp
+	WHERE cp.`usc_uid` = #{uid} AND cp.`usc_state` = 1
+		AND DATE_FORMAT(CURDATE(),'%Y%m%d') <![CDATA[ > ]]>DATE_FORMAT(cp.`usc_end_time`,'%Y%m%d');
+  </select>
+  
+  <select id="getCouponByState" resultMap="BaseResultMap">
+  	SELECT * FROM `yeshi_ec_user_system_coupon` cp
+	WHERE cp.`usc_uid` = #{uid}
+		<if test="state != null">
+			 AND cp.`usc_state` = #{state}
+		</if>
+  </select>
+  
+  <select id="getCouponByTypeAndNotActivated" resultMap="BaseResultMap">
+	SELECT * FROM yeshi_ec_user_system_coupon 
+	WHERE usc_uid = #{uid} AND usc_coupon_id = #{couponId} 
+		AND (usc_state_activate = 0 OR usc_state_activate is null)
+  </select>
+  
+</mapper>

--
Gitblit v1.8.0