|
@@ -0,0 +1,148 @@
|
|
|
+<?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.yijia.coupon.mapper.CouponInfoMapper">
|
|
|
+
|
|
|
+ <resultMap type="CouponInfo" id="CouponInfoResult">
|
|
|
+ <result property="id" column="id" />
|
|
|
+ <result property="couponId" column="coupon_id" />
|
|
|
+ <result property="couponName" column="coupon_name" />
|
|
|
+ <result property="couponType" column="coupon_type" />
|
|
|
+ <result property="useDiscountType" column="use_discount_type" />
|
|
|
+ <result property="oilName" column="oil_name" />
|
|
|
+ <result property="oilType" column="oil_type" />
|
|
|
+ <result property="couponAmt" column="coupon_amt" />
|
|
|
+ <result property="couponNum" column="coupon_num" />
|
|
|
+ <result property="effectiveTimeType" column="effective_time_type" />
|
|
|
+ <result property="effectiveTimeStart" column="effective_time_start" />
|
|
|
+ <result property="effectiveTimeEnd" column="effective_time_end" />
|
|
|
+ <result property="effectiveDayNum" column="effective_day_num" />
|
|
|
+ <result property="couponReceiveNum" column="coupon_receive_num" />
|
|
|
+ <result property="openPlatform" column="open_platform" />
|
|
|
+ <result property="grantStatus" column="grant_status" />
|
|
|
+ <result property="status" column="status" />
|
|
|
+ <result property="createBy" column="create_by" />
|
|
|
+ <result property="createTime" column="create_time" />
|
|
|
+ <result property="updateBy" column="update_by" />
|
|
|
+ <result property="updateTime" column="update_time" />
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <sql id="selectCouponInfoVo">
|
|
|
+ select id, coupon_id, coupon_name, coupon_type, use_discount_type, oil_name, oil_type, coupon_amt, coupon_num, effective_time_type, effective_time_start, effective_time_end, effective_day_num, coupon_receive_num, open_platform, grant_status, status, create_by, create_time, update_by, update_time from coupon_info
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <select id="selectCouponInfoList" parameterType="CouponInfo" resultMap="CouponInfoResult">
|
|
|
+ <include refid="selectCouponInfoVo"/>
|
|
|
+ <where>
|
|
|
+ <if test="couponId != null and couponId != ''"> and coupon_id = #{couponId}</if>
|
|
|
+ <if test="couponName != null and couponName != ''"> and coupon_name like concat('%', #{couponName}, '%')</if>
|
|
|
+ <if test="couponType != null and couponType != ''"> and coupon_type = #{couponType}</if>
|
|
|
+ <if test="useDiscountType != null and useDiscountType != ''"> and use_discount_type = #{useDiscountType}</if>
|
|
|
+ <if test="oilName != null and oilName != ''"> and oil_name like concat('%', #{oilName}, '%')</if>
|
|
|
+ <if test="oilType != null and oilType != ''"> and oil_type = #{oilType}</if>
|
|
|
+ <if test="couponAmt != null "> and coupon_amt = #{couponAmt}</if>
|
|
|
+ <if test="couponNum != null "> and coupon_num = #{couponNum}</if>
|
|
|
+ <if test="effectiveTimeType != null and effectiveTimeType != ''"> and effective_time_type = #{effectiveTimeType}</if>
|
|
|
+ <if test="effectiveTimeStart != null "> and effective_time_start = #{effectiveTimeStart}</if>
|
|
|
+ <if test="effectiveTimeEnd != null "> and effective_time_end = #{effectiveTimeEnd}</if>
|
|
|
+ <if test="effectiveDayNum != null "> and effective_day_num = #{effectiveDayNum}</if>
|
|
|
+ <if test="couponReceiveNum != null "> and coupon_receive_num = #{couponReceiveNum}</if>
|
|
|
+ <if test="openPlatform != null and openPlatform != ''"> and open_platform = #{openPlatform}</if>
|
|
|
+ <if test="grantStatus != null and grantStatus != ''"> and grant_status = #{grantStatus}</if>
|
|
|
+ <if test="status != null and status != ''"> and status = #{status}</if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectCouponInfoById" parameterType="Integer" resultMap="CouponInfoResult">
|
|
|
+ <include refid="selectCouponInfoVo"/>
|
|
|
+ where id = #{id}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <insert id="insertCouponInfo" parameterType="CouponInfo" useGeneratedKeys="true" keyProperty="id">
|
|
|
+ insert into coupon_info
|
|
|
+ <trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="couponId != null">coupon_id,</if>
|
|
|
+ <if test="couponName != null">coupon_name,</if>
|
|
|
+ <if test="couponType != null">coupon_type,</if>
|
|
|
+ <if test="useDiscountType != null">use_discount_type,</if>
|
|
|
+ <if test="oilName != null">oil_name,</if>
|
|
|
+ <if test="oilType != null">oil_type,</if>
|
|
|
+ <if test="couponAmt != null">coupon_amt,</if>
|
|
|
+ <if test="couponNum != null">coupon_num,</if>
|
|
|
+ <if test="effectiveTimeType != null">effective_time_type,</if>
|
|
|
+ <if test="effectiveTimeStart != null">effective_time_start,</if>
|
|
|
+ <if test="effectiveTimeEnd != null">effective_time_end,</if>
|
|
|
+ <if test="effectiveDayNum != null">effective_day_num,</if>
|
|
|
+ <if test="couponReceiveNum != null">coupon_receive_num,</if>
|
|
|
+ <if test="openPlatform != null">open_platform,</if>
|
|
|
+ <if test="grantStatus != null">grant_status,</if>
|
|
|
+ <if test="status != null">status,</if>
|
|
|
+ <if test="createBy != null">create_by,</if>
|
|
|
+ <if test="createTime != null">create_time,</if>
|
|
|
+ <if test="updateBy != null">update_by,</if>
|
|
|
+ <if test="updateTime != null">update_time,</if>
|
|
|
+ </trim>
|
|
|
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="couponId != null">#{couponId},</if>
|
|
|
+ <if test="couponName != null">#{couponName},</if>
|
|
|
+ <if test="couponType != null">#{couponType},</if>
|
|
|
+ <if test="useDiscountType != null">#{useDiscountType},</if>
|
|
|
+ <if test="oilName != null">#{oilName},</if>
|
|
|
+ <if test="oilType != null">#{oilType},</if>
|
|
|
+ <if test="couponAmt != null">#{couponAmt},</if>
|
|
|
+ <if test="couponNum != null">#{couponNum},</if>
|
|
|
+ <if test="effectiveTimeType != null">#{effectiveTimeType},</if>
|
|
|
+ <if test="effectiveTimeStart != null">#{effectiveTimeStart},</if>
|
|
|
+ <if test="effectiveTimeEnd != null">#{effectiveTimeEnd},</if>
|
|
|
+ <if test="effectiveDayNum != null">#{effectiveDayNum},</if>
|
|
|
+ <if test="couponReceiveNum != null">#{couponReceiveNum},</if>
|
|
|
+ <if test="openPlatform != null">#{openPlatform},</if>
|
|
|
+ <if test="grantStatus != null">#{grantStatus},</if>
|
|
|
+ <if test="status != null">#{status},</if>
|
|
|
+ <if test="createBy != null">#{createBy},</if>
|
|
|
+ <if test="createTime != null">#{createTime},</if>
|
|
|
+ <if test="updateBy != null">#{updateBy},</if>
|
|
|
+ <if test="updateTime != null">#{updateTime},</if>
|
|
|
+ </trim>
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <update id="updateCouponInfo" parameterType="CouponInfo">
|
|
|
+ update coupon_info
|
|
|
+ <trim prefix="SET" suffixOverrides=",">
|
|
|
+ <if test="couponId != null">coupon_id = #{couponId},</if>
|
|
|
+ <if test="couponName != null">coupon_name = #{couponName},</if>
|
|
|
+ <if test="couponType != null">coupon_type = #{couponType},</if>
|
|
|
+ <if test="useDiscountType != null">use_discount_type = #{useDiscountType},</if>
|
|
|
+ <if test="oilName != null">oil_name = #{oilName},</if>
|
|
|
+ <if test="oilType != null">oil_type = #{oilType},</if>
|
|
|
+ <if test="couponAmt != null">coupon_amt = #{couponAmt},</if>
|
|
|
+ <if test="couponNum != null">coupon_num = #{couponNum},</if>
|
|
|
+ <if test="effectiveTimeType != null">effective_time_type = #{effectiveTimeType},</if>
|
|
|
+ <if test="effectiveTimeStart != null">effective_time_start = #{effectiveTimeStart},</if>
|
|
|
+ <if test="effectiveTimeEnd != null">effective_time_end = #{effectiveTimeEnd},</if>
|
|
|
+ <if test="effectiveDayNum != null">effective_day_num = #{effectiveDayNum},</if>
|
|
|
+ <if test="couponReceiveNum != null">coupon_receive_num = #{couponReceiveNum},</if>
|
|
|
+ <if test="openPlatform != null">open_platform = #{openPlatform},</if>
|
|
|
+ <if test="grantStatus != null">grant_status = #{grantStatus},</if>
|
|
|
+ <if test="status != null">status = #{status},</if>
|
|
|
+ <if test="createBy != null">create_by = #{createBy},</if>
|
|
|
+ <if test="createTime != null">create_time = #{createTime},</if>
|
|
|
+ <if test="updateBy != null">update_by = #{updateBy},</if>
|
|
|
+ <if test="updateTime != null">update_time = #{updateTime},</if>
|
|
|
+ </trim>
|
|
|
+ where id = #{id}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <delete id="deleteCouponInfoById" parameterType="Integer">
|
|
|
+ delete from coupon_info where id = #{id}
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <delete id="deleteCouponInfoByIds" parameterType="String">
|
|
|
+ delete from coupon_info where id in
|
|
|
+ <foreach item="id" collection="array" open="(" separator="," close=")">
|
|
|
+ #{id}
|
|
|
+ </foreach>
|
|
|
+ </delete>
|
|
|
+
|
|
|
+</mapper>
|