CouponProductLimitMapper.xml 1.32 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.yoho.ufo.dal.CouponProductLimitMapper">
    <resultMap id="BaseResultMap" type="com.yoho.ufo.model.coupon.CouponProductLimit">
        <result column="id" property="id" jdbcType="INTEGER" />
        <result column="coupon_id" property="couponId" jdbcType="INTEGER" />
        <result column="limit_type" property="limitType" jdbcType="INTEGER" />
        <result column="product_id" property="productId" jdbcType="INTEGER" />
    </resultMap>

    <sql id="Base_Column_List">
        id,coupon_id,limit_type,product_id
    </sql>
    <insert id="insertBatchByProductIds">
        insert into coupon_product_limit(
        coupon_id,
        limit_type,
        product_id)values
        <foreach collection="productIds" separator="," item="productId">
            (#{couponId},#{limitType},#{productId})
        </foreach>
    </insert>
    <delete id="deleteByCouponId">
        delete from coupon_product_limit where coupon_id=#{id}
    </delete>
    <select id="selectByCouponId" resultType="com.yoho.ufo.model.coupon.CouponProductLimit">
        select <include refid="Base_Column_List" /> from coupon_product_limit where coupon_id=#{id} order by id desc
    </select>
</mapper>