CouponIssueMapper.xml 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.yijia.coupon.mapper.CouponIssueMapper">
  6. <resultMap type="CouponIssue" id="CouponIssueResult">
  7. <result property="id" column="id" />
  8. <result property="issueName" column="issue_name" />
  9. <result property="issueType" column="issue_type" />
  10. <result property="discountThresholdAmt" column="discount_threshold_amt" />
  11. <result property="status" column="status" />
  12. <result property="stationId" column="station_id" />
  13. <result property="createBy" column="create_by" />
  14. <result property="createTime" column="create_time" />
  15. <result property="updateBy" column="update_by" />
  16. <result property="updateTime" column="update_time" />
  17. <result property="showId" column="show_id" />
  18. <result property="appointedDays" column="appointed_days" />
  19. <result property="cycleDays" column="cycle_days" />
  20. <result property="availableControl" column="available_control" />
  21. <result property="giveCount" column="give_count" />
  22. <result property="giveLimit" column="give_limit" />
  23. <result property="issueRemark" column="issue_remark" />
  24. </resultMap>
  25. <sql id="selectCouponIssueVo">
  26. select id,issue_name, issue_type, discount_threshold_amt, status, station_id, create_by, create_time, update_by, update_time, show_id,
  27. appointed_days,cycle_days,available_control,give_count,give_limit,issue_remark
  28. from coupon_issue
  29. </sql>
  30. <select id="selectCouponIssueList" parameterType="CouponIssue" resultMap="CouponIssueResult">
  31. <include refid="selectCouponIssueVo"/>
  32. <where>
  33. <if test="issueName != null and issueName != ''"> and issue_name like concat('%', #{issueName}, '%')</if>
  34. <if test="issueType != null and issueType != ''"> and issue_type = #{issueType}</if>
  35. <if test="discountThresholdAmt != null "> and discount_threshold_amt = #{discountThresholdAmt}</if>
  36. <if test="status != null and status != ''"> and status = #{status}</if>
  37. <if test="stationId != null "> and station_id = #{stationId}</if>
  38. <if test="showId != null and showId != ''"> and show_id = #{showId}</if>
  39. <if test="appointedDays != null and appointedDays != ''"> and appointed_days = #{appointedDays}</if>
  40. <if test="cycleDays != null and cycleDays != ''"> and cycle_days = #{cycleDays}</if>
  41. <if test="availableControl != null and availableControl != ''"> and available_control = #{availableControl}</if>
  42. <if test="giveCount != null and giveCount != ''"> and give_count = #{giveCount}</if>
  43. <if test="giveLimit != null and giveLimit != ''"> and give_limit = #{giveLimit}</if>
  44. <if test="issueRemark != null and issueRemark != ''"> and issue_remark like concat('%', #{issueRemark}, '%')</if>
  45. <if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
  46. AND date_format(create_time,'%y-%m-%d %H:%i:%s') &gt;= date_format(#{beginTime},'%y-%m-%d %H:%i:%s')
  47. </if>
  48. <if test="endTime != null and endTime != ''"><!-- 结束时间检索 -->
  49. AND date_format(create_time,'%y-%m-%d %H:%i:%s') &lt;= date_format(#{endTime},'%y-%m-%d %H:%i:%s')
  50. </if>
  51. </where>
  52. order by status desc , create_time desc
  53. </select>
  54. <select id="selectCouponIssueById" parameterType="String" resultMap="CouponIssueResult">
  55. <include refid="selectCouponIssueVo"/>
  56. where id = #{id}
  57. </select>
  58. <insert id="insertCouponIssue" parameterType="CouponIssue" >
  59. insert into coupon_issue(
  60. <if test="id != null">id,</if>
  61. <if test="issueName != null">issue_name,</if>
  62. <if test="issueType != null">issue_type,</if>
  63. <if test="discountThresholdAmt != null">discount_threshold_amt,</if>
  64. <if test="status != null">status,</if>
  65. <if test="stationId != null">station_id,</if>
  66. <if test="createBy != null">create_by,</if>
  67. <if test="createTime != null">create_time,</if>
  68. <if test="updateBy != null">update_by,</if>
  69. <if test="updateTime != null">update_time,</if>
  70. <if test="showId != null">show_id,</if>
  71. <if test="appointedDays != null">appointed_days,</if>
  72. <if test="cycleDays != null">cycle_days,</if>
  73. <if test="availableControl != null">available_control,</if>
  74. <if test="giveCount != null">give_count,</if>
  75. <if test="giveLimit != null">give_limit,</if>
  76. <if test="issueRemark != null">issue_remark</if>
  77. )values(
  78. <if test="id != null">#{id},</if>
  79. <if test="issueName != null">#{issueName},</if>
  80. <if test="issueType != null">#{issueType},</if>
  81. <if test="discountThresholdAmt != null">#{discountThresholdAmt},</if>
  82. <if test="status != null">#{status},</if>
  83. <if test="stationId != null">#{stationId},</if>
  84. <if test="createBy != null">#{createBy},</if>
  85. <if test="createTime != null">#{createTime},</if>
  86. <if test="updateBy != null">#{updateBy},</if>
  87. <if test="updateTime != null">#{updateTime},</if>
  88. <if test="showId != null">#{showId},</if>
  89. <if test="appointedDays != null">#{appointedDays},</if>
  90. <if test="cycleDays != null">#{cycleDays},</if>
  91. <if test="availableControl != null">#{availableControl},</if>
  92. <if test="giveCount != null">#{giveCount},</if>
  93. <if test="giveLimit != null">#{giveLimit},</if>
  94. <if test="issueRemark != null">#{issueRemark}</if>
  95. )
  96. </insert>
  97. <update id="updateCouponIssue" parameterType="CouponIssue">
  98. update coupon_issue
  99. <trim prefix="SET" suffixOverrides=",">
  100. <if test="issueName != null">issue_name = #{issueName},</if>
  101. <if test="issueType != null">issue_type = #{issueType},</if>
  102. <if test="discountThresholdAmt != null">discount_threshold_amt = #{discountThresholdAmt},</if>
  103. <if test="status != null">status = #{status},</if>
  104. <if test="stationId != null">station_id = #{stationId},</if>
  105. <if test="createBy != null">create_by = #{createBy},</if>
  106. <if test="createTime != null">create_time = #{createTime},</if>
  107. <if test="updateBy != null">update_by = #{updateBy},</if>
  108. <if test="updateTime != null">update_time = #{updateTime},</if>
  109. <if test="showId != null">show_id = #{showId},</if>
  110. <if test="appointedDays != null">appointed_days = #{appointedDays},</if>
  111. <if test="cycleDays != null">cycle_days = #{cycleDays},</if>
  112. <if test="availableControl != null">available_control = #{availableControl},</if>
  113. <if test="giveCount != null">give_count = #{giveCount},</if>
  114. <if test="giveLimit != null">give_limit = #{giveLimit},</if>
  115. <if test="issueRemark != null">issue_remark = #{issueRemark},</if>
  116. </trim>
  117. where id = #{id}
  118. </update>
  119. <delete id="deleteCouponIssueById" parameterType="Integer">
  120. delete from coupon_issue where id = #{id}
  121. </delete>
  122. <delete id="deleteCouponIssueByIds" parameterType="String">
  123. delete from coupon_issue where id in
  124. <foreach item="id" collection="array" open="(" separator="," close=")">
  125. #{id}
  126. </foreach>
  127. </delete>
  128. </mapper>