90 lines
4.4 KiB
XML
90 lines
4.4 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.ruoyi.system.mapper.EtCouponMapper">
|
||
|
|
|
||
|
|
<resultMap type="EtCoupon" id="EtCouponResult">
|
||
|
|
<result property="couponId" column="coupon_id" />
|
||
|
|
<result property="type" column="type" />
|
||
|
|
<result property="discountPercent" column="discount_percent" />
|
||
|
|
<result property="areaId" column="area_id" />
|
||
|
|
<result property="userId" column="user_id" />
|
||
|
|
<result property="discountAmount" column="discount_amount" />
|
||
|
|
<result property="createTime" column="create_time" />
|
||
|
|
<result property="expirationTime" column="expiration_time" />
|
||
|
|
<result property="status" column="status" />
|
||
|
|
</resultMap>
|
||
|
|
|
||
|
|
<sql id="selectEtCouponVo">
|
||
|
|
select coupon_id, type, discount_percent, area_id, user_id, discount_amount, create_time, expiration_time, status from et_coupon
|
||
|
|
</sql>
|
||
|
|
|
||
|
|
<select id="selectEtCouponList" parameterType="EtCoupon" resultMap="EtCouponResult">
|
||
|
|
<include refid="selectEtCouponVo"/>
|
||
|
|
<where>
|
||
|
|
<if test="type != null and type != ''"> and type = #{type}</if>
|
||
|
|
<if test="discountPercent != null "> and discount_percent = #{discountPercent}</if>
|
||
|
|
<if test="areaId != null "> and area_id = #{areaId}</if>
|
||
|
|
<if test="userId != null "> and user_id = #{userId}</if>
|
||
|
|
<if test="discountAmount != null "> and discount_amount = #{discountAmount}</if>
|
||
|
|
<if test="expirationTime != null "> and expiration_time = #{expirationTime}</if>
|
||
|
|
<if test="status != null and status != ''"> and status = #{status}</if>
|
||
|
|
</where>
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id="selectEtCouponByCouponId" parameterType="Long" resultMap="EtCouponResult">
|
||
|
|
<include refid="selectEtCouponVo"/>
|
||
|
|
where coupon_id = #{couponId}
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<insert id="insertEtCoupon" parameterType="EtCoupon" useGeneratedKeys="true" keyProperty="couponId">
|
||
|
|
insert into et_coupon
|
||
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||
|
|
<if test="type != null">type,</if>
|
||
|
|
<if test="discountPercent != null">discount_percent,</if>
|
||
|
|
<if test="areaId != null">area_id,</if>
|
||
|
|
<if test="userId != null">user_id,</if>
|
||
|
|
<if test="discountAmount != null">discount_amount,</if>
|
||
|
|
<if test="createTime != null">create_time,</if>
|
||
|
|
<if test="expirationTime != null">expiration_time,</if>
|
||
|
|
<if test="status != null">status,</if>
|
||
|
|
</trim>
|
||
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||
|
|
<if test="type != null">#{type},</if>
|
||
|
|
<if test="discountPercent != null">#{discountPercent},</if>
|
||
|
|
<if test="areaId != null">#{areaId},</if>
|
||
|
|
<if test="userId != null">#{userId},</if>
|
||
|
|
<if test="discountAmount != null">#{discountAmount},</if>
|
||
|
|
<if test="createTime != null">#{createTime},</if>
|
||
|
|
<if test="expirationTime != null">#{expirationTime},</if>
|
||
|
|
<if test="status != null">#{status},</if>
|
||
|
|
</trim>
|
||
|
|
</insert>
|
||
|
|
|
||
|
|
<update id="updateEtCoupon" parameterType="EtCoupon">
|
||
|
|
update et_coupon
|
||
|
|
<trim prefix="SET" suffixOverrides=",">
|
||
|
|
<if test="type != null">type = #{type},</if>
|
||
|
|
<if test="discountPercent != null">discount_percent = #{discountPercent},</if>
|
||
|
|
<if test="areaId != null">area_id = #{areaId},</if>
|
||
|
|
<if test="userId != null">user_id = #{userId},</if>
|
||
|
|
<if test="discountAmount != null">discount_amount = #{discountAmount},</if>
|
||
|
|
<if test="createTime != null">create_time = #{createTime},</if>
|
||
|
|
<if test="expirationTime != null">expiration_time = #{expirationTime},</if>
|
||
|
|
<if test="status != null">status = #{status},</if>
|
||
|
|
</trim>
|
||
|
|
where coupon_id = #{couponId}
|
||
|
|
</update>
|
||
|
|
|
||
|
|
<delete id="deleteEtCouponByCouponId" parameterType="Long">
|
||
|
|
delete from et_coupon where coupon_id = #{couponId}
|
||
|
|
</delete>
|
||
|
|
|
||
|
|
<delete id="deleteEtCouponByCouponIds" parameterType="String">
|
||
|
|
delete from et_coupon where coupon_id in
|
||
|
|
<foreach item="couponId" collection="array" open="(" separator="," close=")">
|
||
|
|
#{couponId}
|
||
|
|
</foreach>
|
||
|
|
</delete>
|
||
|
|
</mapper>
|