CouponRulerDao.xml 2.8 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.diligrp.etrade.coupon.dao.CouponRulerDao">
  <resultMap id="BaseResultMap" type="com.diligrp.etrade.coupon.domain.CouponRulerDto">
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="template_no" jdbcType="VARCHAR" property="templateNo" />
    <result column="satisfied_amount" jdbcType="BIGINT" property="satisfiedAmount" />
  </resultMap>
  <sql id="Base_Column_List">
    id, template_no, satisfied_amount
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
    select 
    <include refid="Base_Column_List" />
    from coupon_ruler
    where id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    delete from coupon_ruler
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.diligrp.etrade.coupon.domain.CouponRulerDto" useGeneratedKeys="true">
    insert into coupon_ruler (template_no, satisfied_amount)
    values (#{templateNo,jdbcType=VARCHAR}, #{satisfiedAmount,jdbcType=BIGINT})
  </insert>
  <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.diligrp.etrade.coupon.domain.CouponRulerDto" useGeneratedKeys="true">
    insert into coupon_ruler
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="templateNo != null">
        template_no,
      </if>
      <if test="satisfiedAmount != null">
        satisfied_amount,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="templateNo != null">
        #{templateNo,jdbcType=VARCHAR},
      </if>
      <if test="satisfiedAmount != null">
        #{satisfiedAmount,jdbcType=BIGINT},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.diligrp.etrade.coupon.domain.CouponRulerDto">
    update coupon_ruler
    <set>
      <if test="templateNo != null">
        template_no = #{templateNo,jdbcType=VARCHAR},
      </if>
      <if test="satisfiedAmount != null">
        satisfied_amount = #{satisfiedAmount,jdbcType=BIGINT},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.diligrp.etrade.coupon.domain.CouponRulerDto">
    update coupon_ruler
    set template_no = #{templateNo,jdbcType=VARCHAR},
      satisfied_amount = #{satisfiedAmount,jdbcType=BIGINT}
    where id = #{id,jdbcType=BIGINT}
  </update>
  <select id="selectByTemplateNo" resultType="com.diligrp.etrade.coupon.model.CouponRulerDo">
    select
    <include refid="Base_Column_List"/>
    from coupon_bind_user
    WHERE template_no = #{templateNo}
  </select>
</mapper>