CouponMapper.xml 3.65 KB
<?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.yohoufo.dal.promotion.CouponMapper">
  <resultMap id="BaseResultMap" type="com.yohoufo.dal.promotion.model.Coupon">
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="coupon_token" jdbcType="VARCHAR" property="couponToken" />
    <result column="coupon_name" jdbcType="VARCHAR" property="couponName" />
    <result column="coupon_amount" jdbcType="DECIMAL" property="couponAmount" />
    <result column="user_type" jdbcType="INTEGER" property="userType" />
    <result column="coupon_type" jdbcType="INTEGER" property="couponType" />
    <result column="coupon_num" jdbcType="INTEGER" property="couponNum" />
    <result column="use_num" jdbcType="SMALLINT" property="useNum" />
    <result column="send_num" jdbcType="INTEGER" property="sendNum" />
    <result column="use_limit_type" jdbcType="TINYINT" property="useLimitType" />
    <result column="use_limit_value" jdbcType="SMALLINT" property="useLimitValue" />
    <result column="product_limit_type" jdbcType="TINYINT" property="productLimitType" />
    <result column="product_limit_value" jdbcType="VARCHAR" property="productLimitValue" />
    <result column="start_time" jdbcType="INTEGER" property="startTime" />
    <result column="end_time" jdbcType="INTEGER" property="endTime" />
    <result column="status" jdbcType="TINYINT" property="status" />
    <result column="create_time" jdbcType="INTEGER" property="createTime" />
    <result column="pid" jdbcType="INTEGER" property="pid" />
    <result column="remark" jdbcType="VARCHAR" property="remark" />
    <result column="skup_forbid_type" jdbcType="VARCHAR" property="skupForbidType" />
    <result column="skup_allow_type" jdbcType="VARCHAR" property="skupAllowType" />
    <result column="business_client" jdbcType="VARCHAR" property="businessClient" />
    <result column="receive_start_time" property="receiveStartTime" jdbcType="INTEGER" />
    <result column="receive_end_time" property="receiveEndTime" jdbcType="INTEGER" />
    <result column="receive_channels" property="receiveChannels" jdbcType="VARCHAR" />
    <result column="check_required" property="checkRequired" jdbcType="INTEGER" />
  </resultMap>
  <sql id="Base_Column_List">
    id, coupon_token, coupon_name, coupon_amount, user_type, coupon_type, coupon_num, use_num, send_num,
    use_limit_type, use_limit_value, product_limit_type, product_limit_value, start_time,
    end_time, status, create_time, pid, remark,skup_forbid_type,skup_allow_type,business_client,
    receive_start_time,receive_end_time,receive_channels,check_required
  </sql>

  <update id="updateCouponSendNum" >
    update coupon set send_num=#{sendNum} where coupon_token=#{couponToken}
  </update>

  <select id="selectByCouponToken" parameterType="java.lang.String" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List" />
    from coupon
    where coupon_token = #{couponToken,jdbcType=VARCHAR}
  </select>

  <select id="selectByCouponIds" parameterType="java.lang.Integer" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List" />
    from coupon
    where id IN
    <foreach item="id" index="index" collection="ids" open="(" separator="," close=")">
      #{id}
    </foreach>
  </select>

  <select id="selectByCouponTokens" parameterType="java.lang.String" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List" />
    from coupon
    where coupon_token IN
    <foreach item="token" index="index" collection="list" open="(" separator="," close=")">
      #{token}
    </foreach>
  </select>

</mapper>