142 lines
6.7 KiB
XML
142 lines
6.7 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="name" column="name" />
|
|
<result property="type" column="type" />
|
|
<result property="discountPercent" column="discount_percent" />
|
|
<result property="areaId" column="area_id" />
|
|
<result property="discountAmount" column="discount_amount" />
|
|
<result property="createTime" column="create_time" />
|
|
<result property="validityValue" column="validity_value" />
|
|
<result property="validityUnit" column="validity_unit" />
|
|
<result property="status" column="status" />
|
|
<result property="limitNum" column="limit_num" />
|
|
<result property="descr" column="descr" />
|
|
<result property="retailPrice" column="retail_price" />
|
|
<result property="originalPrice" column="original_price" />
|
|
<result property="isHot" column="is_hot" />
|
|
</resultMap>
|
|
|
|
<sql id="selectEtCouponVo">
|
|
select coupon_id, name, type, discount_percent, area_id, discount_amount, create_time, validity_value, validity_unit, status, limit_num, `descr`, retail_price, original_price, is_hot from et_coupon
|
|
</sql>
|
|
|
|
<select id="selectEtCouponList" parameterType="EtCoupon" resultMap="EtCouponResult">
|
|
SELECT
|
|
c.coupon_id,
|
|
c.name,
|
|
c.type,
|
|
c.discount_percent,
|
|
c.area_id,
|
|
a.area_name areaName,
|
|
c.discount_amount,
|
|
c.create_time,
|
|
c.validity_value,
|
|
c.validity_unit,
|
|
c.status,
|
|
c.limit_num,
|
|
c.descr,
|
|
c.retail_price,
|
|
c.original_price,
|
|
c.is_hot
|
|
FROM
|
|
et_coupon c
|
|
left join et_operating_area a on a.area_id = c.area_id
|
|
where del_flag != 2
|
|
<if test="name != null "> and c.name like concat('%', #{name}, '%')</if>
|
|
<if test="type != null and type != ''"> and c.type = #{type}</if>
|
|
<if test="discountPercent != null "> and c.discount_percent = #{discountPercent}</if>
|
|
<if test="areaId != null "> and c.area_id = #{areaId}</if>
|
|
<if test="areaName != null "> and a.area_name like concat('%', #{areaName}, '%')</if>
|
|
<if test="discountAmount != null "> and c.discount_amount = #{discountAmount}</if>
|
|
<if test="status != null and status != ''"> and c.status = #{status}</if>
|
|
<if test="limitNum != null and limitNum != ''"> and c.limit_num = #{limitNum}</if>
|
|
<if test="typeList != null">
|
|
AND c.type IN
|
|
<foreach item="item" index="index" collection="typeList" open="(" separator="," close=")">
|
|
#{item}
|
|
</foreach>
|
|
</if>
|
|
</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="name != null">name,</if>
|
|
<if test="type != null">type,</if>
|
|
<if test="discountPercent != null">discount_percent,</if>
|
|
<if test="areaId != null">area_id,</if>
|
|
<if test="discountAmount != null">discount_amount,</if>
|
|
<if test="createTime != null">create_time,</if>
|
|
<if test="validityValue != null">validity_value,</if>
|
|
<if test="validityUnit != null">validity_unit,</if>
|
|
<if test="status != null">status,</if>
|
|
<if test="limitNum != null">limit_num,</if>
|
|
<if test="descr != null">descr,</if>
|
|
<if test="retailPrice != null">retail_price,</if>
|
|
<if test="originalPrice != null">original_price,</if>
|
|
<if test="isHot != null">is_hot,</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="name != null">#{name},</if>
|
|
<if test="type != null">#{type},</if>
|
|
<if test="discountPercent != null">#{discountPercent},</if>
|
|
<if test="areaId != null">#{areaId},</if>
|
|
<if test="discountAmount != null">#{discountAmount},</if>
|
|
<if test="createTime != null">#{createTime},</if>
|
|
<if test="validityValue != null">#{validityValue},</if>
|
|
<if test="validityUnit != null">#{validityUnit},</if>
|
|
<if test="status != null">#{status},</if>
|
|
<if test="limitNum != null">#{limitNum},</if>
|
|
<if test="descr != null">#{descr},</if>
|
|
<if test="retailPrice != null">#{retailPrice},</if>
|
|
<if test="originalPrice != null">#{originalPrice},</if>
|
|
<if test="isHot != null">#{isHot},</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
<update id="updateEtCoupon" parameterType="EtCoupon">
|
|
update et_coupon
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="name != null">name = #{name},</if>
|
|
<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="discountAmount != null">discount_amount = #{discountAmount},</if>
|
|
<if test="createTime != null">create_time = #{createTime},</if>
|
|
<if test="validityValue != null">validity_value = #{validityValue},</if>
|
|
<if test="validityUnit != null">validity_unit = #{validityUnit},</if>
|
|
<if test="status != null">status = #{status},</if>
|
|
<if test="limitNum != null">limit_num = #{limitNum},</if>
|
|
<if test="descr != null">descr = #{descr},</if>
|
|
<if test="retailPrice != null">retail_price = #{retailPrice},</if>
|
|
<if test="originalPrice != null">original_price = #{originalPrice},</if>
|
|
<if test="isHot != null">is_hot = #{isHot},</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">
|
|
UPDATE et_coupon
|
|
SET del_flag = 2
|
|
WHERE coupon_id IN
|
|
<foreach item="couponId" collection="array" open="(" separator="," close=")">
|
|
#{couponId}
|
|
</foreach>
|
|
</delete>
|
|
</mapper>
|