171 lines
5.9 KiB
XML
171 lines
5.9 KiB
XML
<?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.zhwl.coupon.mapper.ZdyCouponItemMapper">
|
|
|
|
<resultMap type="ZdyCouponItem" id="ZdyCouponItemResult">
|
|
<result property="id" column="id"/>
|
|
<result property="couponId" column="coupon_id"/>
|
|
<result property="storeCategory" column="store_category"/>
|
|
<result property="storeId" column="store_id"/>
|
|
<result property="storeName" column="store_name"/>
|
|
<result property="goodsId" column="goods_id"/>
|
|
<result property="goodsName" column="goods_name"/>
|
|
<result property="goodsPrice" column="goods_price"/>
|
|
<result property="createTime" column="create_time"/>
|
|
<result property="createBy" column="create_by"/>
|
|
</resultMap>
|
|
|
|
<sql id="selectZdyCouponItemVo">
|
|
select id,
|
|
coupon_id,
|
|
store_category,
|
|
store_id,
|
|
store_name,
|
|
goods_id,
|
|
goods_name,
|
|
goods_price,
|
|
create_time,
|
|
create_by
|
|
from zdy_coupon_item
|
|
</sql>
|
|
|
|
<select id="selectZdyCouponItemList" parameterType="ZdyCouponItem" resultMap="ZdyCouponItemResult">
|
|
<include refid="selectZdyCouponItemVo"/>
|
|
<where>
|
|
<if test="couponId != null ">
|
|
and coupon_id = #{couponId}
|
|
</if>
|
|
<if test="storeCategory != null and storeCategory != ''">
|
|
and store_category = #{storeCategory}
|
|
</if>
|
|
<if test="storeId != null ">
|
|
and store_id = #{storeId}
|
|
</if>
|
|
<if test="storeName != null and storeName != ''">
|
|
and store_name like concat('%', #{storeName}, '%')
|
|
</if>
|
|
<if test="goodsId != null ">
|
|
and goods_id = #{goodsId}
|
|
</if>
|
|
<if test="goodsName != null and goodsName != ''">
|
|
and goods_name like concat('%', #{goodsName}, '%')
|
|
</if>
|
|
<if test="goodsPrice != null ">
|
|
and goods_price = #{goodsPrice}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="selectZdyCouponItemById" parameterType="Long"
|
|
resultMap="ZdyCouponItemResult">
|
|
<include refid="selectZdyCouponItemVo"/>
|
|
where id = #{id}
|
|
</select>
|
|
<select id="selectItemListByCouponId" resultMap="ZdyCouponItemResult">
|
|
<include refid="selectZdyCouponItemVo"/>
|
|
where coupon_id = #{couponId}
|
|
</select>
|
|
|
|
<insert id="insertZdyCouponItem" parameterType="ZdyCouponItem" useGeneratedKeys="true" keyProperty="id">
|
|
insert into zdy_coupon_item
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="id != null">id,
|
|
</if>
|
|
<if test="couponId != null">coupon_id,
|
|
</if>
|
|
<if test="storeCategory != null">store_category,
|
|
</if>
|
|
<if test="storeId != null">store_id,
|
|
</if>
|
|
<if test="storeName != null">store_name,
|
|
</if>
|
|
<if test="goodsId != null">goods_id,
|
|
</if>
|
|
<if test="goodsName != null">goods_name,
|
|
</if>
|
|
<if test="goodsPrice != null">goods_price,
|
|
</if>
|
|
<if test="createTime != null">create_time,
|
|
</if>
|
|
<if test="createBy != null">create_by,
|
|
</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="id != null">#{id},
|
|
</if>
|
|
<if test="couponId != null">#{couponId},
|
|
</if>
|
|
<if test="storeCategory != null">#{storeCategory},
|
|
</if>
|
|
<if test="storeId != null">#{storeId},
|
|
</if>
|
|
<if test="storeName != null">#{storeName},
|
|
</if>
|
|
<if test="goodsId != null">#{goodsId},
|
|
</if>
|
|
<if test="goodsName != null">#{goodsName},
|
|
</if>
|
|
<if test="goodsPrice != null">#{goodsPrice},
|
|
</if>
|
|
<if test="createTime != null">#{createTime},
|
|
</if>
|
|
<if test="createBy != null">#{createBy},
|
|
</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
<update id="updateZdyCouponItem" parameterType="ZdyCouponItem">
|
|
update zdy_coupon_item
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="couponId != null">coupon_id =
|
|
#{couponId},
|
|
</if>
|
|
<if test="storeCategory != null">store_category =
|
|
#{storeCategory},
|
|
</if>
|
|
<if test="storeId != null">store_id =
|
|
#{storeId},
|
|
</if>
|
|
<if test="storeName != null">store_name =
|
|
#{storeName},
|
|
</if>
|
|
<if test="goodsId != null">goods_id =
|
|
#{goodsId},
|
|
</if>
|
|
<if test="goodsName != null">goods_name =
|
|
#{goodsName},
|
|
</if>
|
|
<if test="goodsPrice != null">goods_price =
|
|
#{goodsPrice},
|
|
</if>
|
|
<if test="createTime != null">create_time =
|
|
#{createTime},
|
|
</if>
|
|
<if test="createBy != null">create_by =
|
|
#{createBy},
|
|
</if>
|
|
</trim>
|
|
where id = #{id}
|
|
</update>
|
|
|
|
<delete id="deleteZdyCouponItemById" parameterType="Long">
|
|
delete
|
|
from zdy_coupon_item
|
|
where id = #{id}
|
|
</delete>
|
|
|
|
<delete id="deleteZdyCouponItemByIds" parameterType="String">
|
|
delete from zdy_coupon_item where id in
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</delete>
|
|
<delete id="deleteZdyCouponItemByCouponId">
|
|
delete
|
|
from zdy_coupon_item
|
|
where coupon_id = #{couponId}
|
|
</delete>
|
|
</mapper>
|