CouponInfoMapper.xml 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  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.CouponInfoMapper">
  6. <resultMap type="CouponInfo" id="CouponInfoResult">
  7. <result property="id" column="id" />
  8. <result property="couponId" column="coupon_id" />
  9. <result property="couponName" column="coupon_name" />
  10. <result property="couponType" column="coupon_type" />
  11. <result property="useDiscountType" column="use_discount_type" />
  12. <result property="oilName" column="oil_name" />
  13. <result property="oilType" column="oil_type" />
  14. <result property="couponAmt" column="coupon_amt" />
  15. <result property="couponNum" column="coupon_num" />
  16. <result property="effectiveTimeType" column="effective_time_type" />
  17. <result property="effectiveTimeStart" column="effective_time_start" />
  18. <result property="effectiveTimeEnd" column="effective_time_end" />
  19. <result property="effectiveDayNum" column="effective_day_num" />
  20. <result property="couponReceiveNum" column="coupon_receive_num" />
  21. <result property="openPlatform" column="open_platform" />
  22. <result property="grantStatus" column="grant_status" />
  23. <result property="status" column="status" />
  24. <result property="createBy" column="create_by" />
  25. <result property="createTime" column="create_time" />
  26. <result property="updateBy" column="update_by" />
  27. <result property="updateTime" column="update_time" />
  28. </resultMap>
  29. <sql id="selectCouponInfoVo">
  30. 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
  31. </sql>
  32. <select id="selectCouponInfoList" parameterType="CouponInfo" resultMap="CouponInfoResult">
  33. <include refid="selectCouponInfoVo"/>
  34. <where>
  35. <if test="couponId != null and couponId != ''"> and coupon_id = #{couponId}</if>
  36. <if test="couponName != null and couponName != ''"> and coupon_name like concat('%', #{couponName}, '%')</if>
  37. <if test="couponType != null and couponType != ''"> and coupon_type = #{couponType}</if>
  38. <if test="useDiscountType != null and useDiscountType != ''"> and use_discount_type = #{useDiscountType}</if>
  39. <if test="oilName != null and oilName != ''"> and oil_name like concat('%', #{oilName}, '%')</if>
  40. <if test="oilType != null and oilType != ''"> and oil_type = #{oilType}</if>
  41. <if test="couponAmt != null "> and coupon_amt = #{couponAmt}</if>
  42. <if test="couponNum != null "> and coupon_num = #{couponNum}</if>
  43. <if test="effectiveTimeType != null and effectiveTimeType != ''"> and effective_time_type = #{effectiveTimeType}</if>
  44. <if test="effectiveTimeStart != null "> and effective_time_start = #{effectiveTimeStart}</if>
  45. <if test="effectiveTimeEnd != null "> and effective_time_end = #{effectiveTimeEnd}</if>
  46. <if test="effectiveDayNum != null "> and effective_day_num = #{effectiveDayNum}</if>
  47. <if test="couponReceiveNum != null "> and coupon_receive_num = #{couponReceiveNum}</if>
  48. <if test="openPlatform != null and openPlatform != ''"> and open_platform = #{openPlatform}</if>
  49. <if test="grantStatus != null and grantStatus != ''"> and grant_status = #{grantStatus}</if>
  50. <if test="status != null and status != ''"> and status = #{status}</if>
  51. </where>
  52. </select>
  53. <select id="selectCouponInfoById" parameterType="Integer" resultMap="CouponInfoResult">
  54. <include refid="selectCouponInfoVo"/>
  55. where id = #{id}
  56. </select>
  57. <insert id="insertCouponInfo" parameterType="CouponInfo" useGeneratedKeys="true" keyProperty="id">
  58. insert into coupon_info
  59. <trim prefix="(" suffix=")" suffixOverrides=",">
  60. <if test="couponId != null">coupon_id,</if>
  61. <if test="couponName != null">coupon_name,</if>
  62. <if test="couponType != null">coupon_type,</if>
  63. <if test="useDiscountType != null">use_discount_type,</if>
  64. <if test="oilName != null">oil_name,</if>
  65. <if test="oilType != null">oil_type,</if>
  66. <if test="couponAmt != null">coupon_amt,</if>
  67. <if test="couponNum != null">coupon_num,</if>
  68. <if test="effectiveTimeType != null">effective_time_type,</if>
  69. <if test="effectiveTimeStart != null">effective_time_start,</if>
  70. <if test="effectiveTimeEnd != null">effective_time_end,</if>
  71. <if test="effectiveDayNum != null">effective_day_num,</if>
  72. <if test="couponReceiveNum != null">coupon_receive_num,</if>
  73. <if test="openPlatform != null">open_platform,</if>
  74. <if test="grantStatus != null">grant_status,</if>
  75. <if test="status != null">status,</if>
  76. <if test="createBy != null">create_by,</if>
  77. <if test="createTime != null">create_time,</if>
  78. <if test="updateBy != null">update_by,</if>
  79. <if test="updateTime != null">update_time,</if>
  80. </trim>
  81. <trim prefix="values (" suffix=")" suffixOverrides=",">
  82. <if test="couponId != null">#{couponId},</if>
  83. <if test="couponName != null">#{couponName},</if>
  84. <if test="couponType != null">#{couponType},</if>
  85. <if test="useDiscountType != null">#{useDiscountType},</if>
  86. <if test="oilName != null">#{oilName},</if>
  87. <if test="oilType != null">#{oilType},</if>
  88. <if test="couponAmt != null">#{couponAmt},</if>
  89. <if test="couponNum != null">#{couponNum},</if>
  90. <if test="effectiveTimeType != null">#{effectiveTimeType},</if>
  91. <if test="effectiveTimeStart != null">#{effectiveTimeStart},</if>
  92. <if test="effectiveTimeEnd != null">#{effectiveTimeEnd},</if>
  93. <if test="effectiveDayNum != null">#{effectiveDayNum},</if>
  94. <if test="couponReceiveNum != null">#{couponReceiveNum},</if>
  95. <if test="openPlatform != null">#{openPlatform},</if>
  96. <if test="grantStatus != null">#{grantStatus},</if>
  97. <if test="status != null">#{status},</if>
  98. <if test="createBy != null">#{createBy},</if>
  99. <if test="createTime != null">#{createTime},</if>
  100. <if test="updateBy != null">#{updateBy},</if>
  101. <if test="updateTime != null">#{updateTime},</if>
  102. </trim>
  103. </insert>
  104. <update id="updateCouponInfo" parameterType="CouponInfo">
  105. update coupon_info
  106. <trim prefix="SET" suffixOverrides=",">
  107. <if test="couponId != null">coupon_id = #{couponId},</if>
  108. <if test="couponName != null">coupon_name = #{couponName},</if>
  109. <if test="couponType != null">coupon_type = #{couponType},</if>
  110. <if test="useDiscountType != null">use_discount_type = #{useDiscountType},</if>
  111. <if test="oilName != null">oil_name = #{oilName},</if>
  112. <if test="oilType != null">oil_type = #{oilType},</if>
  113. <if test="couponAmt != null">coupon_amt = #{couponAmt},</if>
  114. <if test="couponNum != null">coupon_num = #{couponNum},</if>
  115. <if test="effectiveTimeType != null">effective_time_type = #{effectiveTimeType},</if>
  116. <if test="effectiveTimeStart != null">effective_time_start = #{effectiveTimeStart},</if>
  117. <if test="effectiveTimeEnd != null">effective_time_end = #{effectiveTimeEnd},</if>
  118. <if test="effectiveDayNum != null">effective_day_num = #{effectiveDayNum},</if>
  119. <if test="couponReceiveNum != null">coupon_receive_num = #{couponReceiveNum},</if>
  120. <if test="openPlatform != null">open_platform = #{openPlatform},</if>
  121. <if test="grantStatus != null">grant_status = #{grantStatus},</if>
  122. <if test="status != null">status = #{status},</if>
  123. <if test="createBy != null">create_by = #{createBy},</if>
  124. <if test="createTime != null">create_time = #{createTime},</if>
  125. <if test="updateBy != null">update_by = #{updateBy},</if>
  126. <if test="updateTime != null">update_time = #{updateTime},</if>
  127. </trim>
  128. where id = #{id}
  129. </update>
  130. <delete id="deleteCouponInfoById" parameterType="Integer">
  131. delete from coupon_info where id = #{id}
  132. </delete>
  133. <delete id="deleteCouponInfoByIds" parameterType="String">
  134. delete from coupon_info where id in
  135. <foreach item="id" collection="array" open="(" separator="," close=")">
  136. #{id}
  137. </foreach>
  138. </delete>
  139. </mapper>