123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137 |
- <?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.CouponIssueMapper">
- <resultMap type="CouponIssue" id="CouponIssueResult">
- <result property="id" column="id" />
- <result property="issueName" column="issue_name" />
- <result property="issueType" column="issue_type" />
- <result property="discountThresholdAmt" column="discount_threshold_amt" />
- <result property="status" column="status" />
- <result property="stationId" column="station_id" />
- <result property="createBy" column="create_by" />
- <result property="createTime" column="create_time" />
- <result property="updateBy" column="update_by" />
- <result property="updateTime" column="update_time" />
- <result property="showId" column="show_id" />
- <result property="appointedDays" column="appointed_days" />
- <result property="cycleDays" column="cycle_days" />
- <result property="availableControl" column="available_control" />
- <result property="giveCount" column="give_count" />
- <result property="giveLimit" column="give_limit" />
- <result property="issueRemark" column="issue_remark" />
- </resultMap>
- <sql id="selectCouponIssueVo">
- select id,issue_name, issue_type, discount_threshold_amt, status, station_id, create_by, create_time, update_by, update_time, show_id,
- appointed_days,cycle_days,available_control,give_count,give_limit,issue_remark
- from coupon_issue
- </sql>
- <select id="selectCouponIssueList" parameterType="CouponIssue" resultMap="CouponIssueResult">
- <include refid="selectCouponIssueVo"/>
- <where>
- <if test="issueName != null and issueName != ''"> and issue_name like concat('%', #{issueName}, '%')</if>
- <if test="issueType != null and issueType != ''"> and issue_type = #{issueType}</if>
- <if test="discountThresholdAmt != null "> and discount_threshold_amt = #{discountThresholdAmt}</if>
- <if test="status != null and status != ''"> and status = #{status}</if>
- <if test="stationId != null "> and station_id = #{stationId}</if>
- <if test="showId != null and showId != ''"> and show_id = #{showId}</if>
- <if test="appointedDays != null and appointedDays != ''"> and appointed_days = #{appointedDays}</if>
- <if test="cycleDays != null and cycleDays != ''"> and cycle_days = #{cycleDays}</if>
- <if test="availableControl != null and availableControl != ''"> and available_control = #{availableControl}</if>
- <if test="giveCount != null and giveCount != ''"> and give_count = #{giveCount}</if>
- <if test="giveLimit != null and giveLimit != ''"> and give_limit = #{giveLimit}</if>
- <if test="issueRemark != null and issueRemark != ''"> and issue_remark like concat('%', #{issueRemark}, '%')</if>
- <if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
- AND date_format(create_time,'%y-%m-%d %H:%i:%s') >= date_format(#{beginTime},'%y-%m-%d %H:%i:%s')
- </if>
- <if test="endTime != null and endTime != ''"><!-- 结束时间检索 -->
- AND date_format(create_time,'%y-%m-%d %H:%i:%s') <= date_format(#{endTime},'%y-%m-%d %H:%i:%s')
- </if>
- </where>
- order by status desc , create_time desc
- </select>
- <select id="selectCouponIssueById" parameterType="String" resultMap="CouponIssueResult">
- <include refid="selectCouponIssueVo"/>
- where id = #{id}
- </select>
- <insert id="insertCouponIssue" parameterType="CouponIssue" >
- insert into coupon_issue(
- <if test="id != null">id,</if>
- <if test="issueName != null">issue_name,</if>
- <if test="issueType != null">issue_type,</if>
- <if test="discountThresholdAmt != null">discount_threshold_amt,</if>
- <if test="status != null">status,</if>
- <if test="stationId != null">station_id,</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>
- <if test="showId != null">show_id,</if>
- <if test="appointedDays != null">appointed_days,</if>
- <if test="cycleDays != null">cycle_days,</if>
- <if test="availableControl != null">available_control,</if>
- <if test="giveCount != null">give_count,</if>
- <if test="giveLimit != null">give_limit,</if>
- <if test="issueRemark != null">issue_remark</if>
- )values(
- <if test="id != null">#{id},</if>
- <if test="issueName != null">#{issueName},</if>
- <if test="issueType != null">#{issueType},</if>
- <if test="discountThresholdAmt != null">#{discountThresholdAmt},</if>
- <if test="status != null">#{status},</if>
- <if test="stationId != null">#{stationId},</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>
- <if test="showId != null">#{showId},</if>
- <if test="appointedDays != null">#{appointedDays},</if>
- <if test="cycleDays != null">#{cycleDays},</if>
- <if test="availableControl != null">#{availableControl},</if>
- <if test="giveCount != null">#{giveCount},</if>
- <if test="giveLimit != null">#{giveLimit},</if>
- <if test="issueRemark != null">#{issueRemark}</if>
- )
- </insert>
- <update id="updateCouponIssue" parameterType="CouponIssue">
- update coupon_issue
- <trim prefix="SET" suffixOverrides=",">
- <if test="issueName != null">issue_name = #{issueName},</if>
- <if test="issueType != null">issue_type = #{issueType},</if>
- <if test="discountThresholdAmt != null">discount_threshold_amt = #{discountThresholdAmt},</if>
- <if test="status != null">status = #{status},</if>
- <if test="stationId != null">station_id = #{stationId},</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>
- <if test="showId != null">show_id = #{showId},</if>
- <if test="appointedDays != null">appointed_days = #{appointedDays},</if>
- <if test="cycleDays != null">cycle_days = #{cycleDays},</if>
- <if test="availableControl != null">available_control = #{availableControl},</if>
- <if test="giveCount != null">give_count = #{giveCount},</if>
- <if test="giveLimit != null">give_limit = #{giveLimit},</if>
- <if test="issueRemark != null">issue_remark = #{issueRemark},</if>
- </trim>
- where id = #{id}
- </update>
- <delete id="deleteCouponIssueById" parameterType="Integer">
- delete from coupon_issue where id = #{id}
- </delete>
- <delete id="deleteCouponIssueByIds" parameterType="String">
- delete from coupon_issue where id in
- <foreach item="id" collection="array" open="(" separator="," close=")">
- #{id}
- </foreach>
- </delete>
- </mapper>
|