CustomerCardSettingMapper.xml 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  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.customer.mapper.CustomerCardSettingMapper">
  6. <resultMap type="CustomerCardSetting" id="CustomerCardSettingResult">
  7. <result property="id" column="id" />
  8. <result property="cardOilsType" column="card_oils_type" />
  9. <result property="discountTimeSetting" column="discount_time_setting" />
  10. <result property="discountTime" column="discount_time" />
  11. <result property="discountTimeType" column="discount_time_type" />
  12. <result property="presentScale" column="present_scale" />
  13. <result property="isDiscountCoupon" column="is_discount_coupon" />
  14. <result property="enjoyIntegralMultiple" column="enjoy_integral_multiple" />
  15. <result property="stationId" column="station_id" />
  16. <result property="stationName" column="station_name" />
  17. <result property="createTime" column="create_time" />
  18. <result property="createBy" column="create_by" />
  19. <result property="updateBy" column="update_by" />
  20. <result property="updateTime" column="update_time" />
  21. <result property="isGradeSetting" column="is_grade_setting" />
  22. <result property="isMarket" column="is_market" />
  23. <result property="cardEnabledFlag" column="card_enabled_flag" />
  24. <result property="isLabel" column="is_label" />
  25. </resultMap>
  26. <sql id="selectCustomerCardSettingVo">
  27. select id, card_oils_type, discount_time_setting, discount_time, present_scale, is_discount_coupon, enjoy_integral_multiple,
  28. station_id, d.dept_name as station_name, c.create_time,discount_time_type,is_market,is_grade_setting,card_enabled_flag,is_label
  29. from customer_card_setting c join sys_dept d on c.station_id = d.dept_id
  30. </sql>
  31. <select id="selectCustomerCardSettingList" parameterType="CustomerCardSetting" resultMap="CustomerCardSettingResult">
  32. <include refid="selectCustomerCardSettingVo"/>
  33. <where>
  34. <if test="cardOilsType != null and cardOilsType != ''"> and card_oils_type = #{cardOilsType}</if>
  35. <if test="discountTimeSetting != null and discountTimeSetting != ''"> and discount_time_setting = #{discountTimeSetting}</if>
  36. <if test="discountTime != null and discountTime != ''"> and discount_time = #{discountTime}</if>
  37. <if test="discountTimeType != null and discountTimeType != ''"> and discount_time_type = #{discountTimeType}</if>
  38. <if test="presentScale != null and presentScale != ''"> and present_scale = #{presentScale}</if>
  39. <if test="isDiscountCoupon != null and isDiscountCoupon != ''"> and is_discount_coupon = #{isDiscountCoupon}</if>
  40. <if test="enjoyIntegralMultiple != null and enjoyIntegralMultiple != ''"> and enjoy_integral_multiple = #{enjoyIntegralMultiple}</if>
  41. <if test="isGradeSetting != null and isGradeSetting != ''"> and is_grade_setting = #{isGradeSetting}</if>
  42. <if test="isMarket != null and isMarket != ''"> and is_market = #{isMarket}</if>
  43. <if test="stationId != null "> and station_id = #{stationId}</if>
  44. <if test="stationIdList != null ">
  45. and station_id in
  46. <foreach item="item" index="index" collection="stationIdList"
  47. open="(" separator="," close=")">
  48. #{item}
  49. </foreach>
  50. </if>
  51. </where>
  52. </select>
  53. <select id="selectCustomerCardSetting" parameterType="CustomerCardSetting" resultMap="CustomerCardSettingResult">
  54. <include refid="selectCustomerCardSettingVo"/>
  55. <where>
  56. <if test="cardOilsType != null and cardOilsType != ''"> and card_oils_type = #{cardOilsType}</if>
  57. <if test="discountTimeSetting != null and discountTimeSetting != ''"> and discount_time_setting = #{discountTimeSetting}</if>
  58. <if test="discountTime != null and discountTime != ''"> and discount_time = #{discountTime}</if>
  59. <if test="discountTimeType != null and discountTimeType != ''"> and discount_time_type = #{discountTimeType}</if>
  60. <if test="presentScale != null and presentScale != ''"> and present_scale = #{presentScale}</if>
  61. <if test="isDiscountCoupon != null and isDiscountCoupon != ''"> and is_discount_coupon = #{isDiscountCoupon}</if>
  62. <if test="enjoyIntegralMultiple != null and enjoyIntegralMultiple != ''"> and enjoy_integral_multiple = #{enjoyIntegralMultiple}</if>
  63. <if test="stationId != null "> and station_id = #{stationId}</if>
  64. <if test="isGradeSetting != null and isGradeSetting != ''"> and is_grade_setting = #{isGradeSetting}</if>
  65. <if test="isMarket != null and isMarket != ''"> and is_market = #{isMarket}</if>
  66. <if test="stationIdList != null ">
  67. and station_id in
  68. <foreach item="item" index="index" collection="stationIdList"
  69. open="(" separator="," close=")">
  70. #{item}
  71. </foreach>
  72. </if>
  73. </where>
  74. limit 0,1;
  75. </select>
  76. <select id="selectCustomerCardSettingById" parameterType="Long" resultMap="CustomerCardSettingResult">
  77. <include refid="selectCustomerCardSettingVo"/>
  78. where id = #{id}
  79. </select>
  80. <insert id="insertCustomerCardSetting" parameterType="CustomerCardSetting" useGeneratedKeys="true" keyProperty="id">
  81. insert into customer_card_setting
  82. <trim prefix="(" suffix=")" suffixOverrides=",">
  83. <if test="id != null">id,</if>
  84. <if test="cardOilsType != null">card_oils_type,</if>
  85. <if test="discountTimeSetting != null">discount_time_setting,</if>
  86. <if test="discountTime != null">discount_time,</if>
  87. <if test="discountTimeType != null ">discount_time_type,</if>
  88. <if test="presentScale != null">present_scale,</if>
  89. <if test="isDiscountCoupon != null">is_discount_coupon,</if>
  90. <if test="enjoyIntegralMultiple != null">enjoy_integral_multiple,</if>
  91. <if test="stationId != null">station_id,</if>
  92. <if test="createTime != null">create_time,</if>
  93. <if test="createBy != null">create_by,</if>
  94. <if test="updateTime != null">update_time,</if>
  95. <if test="updateBy != null">update_by,</if>
  96. <if test="isGradeSetting != null">is_grade_setting,</if>
  97. <if test="isMarket != null">is_market,</if>
  98. <if test="isLabel != null">is_label,</if>
  99. </trim>
  100. <trim prefix="values (" suffix=")" suffixOverrides=",">
  101. <if test="id != null">#{id},</if>
  102. <if test="cardOilsType != null">#{cardOilsType},</if>
  103. <if test="discountTimeSetting != null">#{discountTimeSetting},</if>
  104. <if test="discountTime != null">#{discountTime},</if>
  105. <if test="discountTimeType != null">#{discountTimeType},</if>
  106. <if test="presentScale != null">#{presentScale},</if>
  107. <if test="isDiscountCoupon != null">#{isDiscountCoupon},</if>
  108. <if test="enjoyIntegralMultiple != null">#{enjoyIntegralMultiple},</if>
  109. <if test="stationId != null">#{stationId},</if>
  110. <if test="createTime != null">#{createTime},</if>
  111. <if test="createBy != null">#{createBy},</if>
  112. <if test="updateTime != null">#{updateTime},</if>
  113. <if test="updateBy != null">#{updateBy},</if>
  114. <if test="isGradeSetting != null">#{isGradeSetting},</if>
  115. <if test="isMarket != null">#{isMarket},</if>
  116. <if test="isLabel != null">#{isLabel},</if>
  117. </trim>
  118. </insert>
  119. <update id="updateCustomerCardSetting" parameterType="CustomerCardSetting">
  120. update customer_card_setting
  121. <trim prefix="SET" suffixOverrides=",">
  122. <if test="cardOilsType != null">card_oils_type = #{cardOilsType},</if>
  123. <if test="discountTimeSetting != null">discount_time_setting = #{discountTimeSetting},</if>
  124. <if test="discountTime != null">discount_time = #{discountTime},</if>
  125. <if test="discountTimeType != null"> discount_time_type = #{discountTimeType},</if>
  126. <if test="presentScale != null">present_scale = #{presentScale},</if>
  127. <if test="isDiscountCoupon != null">is_discount_coupon = #{isDiscountCoupon},</if>
  128. <if test="enjoyIntegralMultiple != null">enjoy_integral_multiple = #{enjoyIntegralMultiple},</if>
  129. <if test="stationId != null">station_id = #{stationId},</if>
  130. <if test="createTime != null">create_time = #{createTime},</if>
  131. <if test="createBy != null">create_by = #{createBy},</if>
  132. <if test="updateTime != null">update_time = #{updateTime},</if>
  133. <if test="updateBy != null">update_by = #{updateBy},</if>
  134. <if test="isMarket != null">is_market = #{isMarket},</if>
  135. <if test="isLabel != null">is_label = #{isLabel},</if>
  136. <if test="isGradeSetting != null">is_grade_setting = #{isGradeSetting},</if>
  137. </trim>
  138. where id = #{id}
  139. </update>
  140. <delete id="deleteCustomerCardSettingById" parameterType="Long">
  141. delete from customer_card_setting where id = #{id}
  142. </delete>
  143. <delete id="deleteCustomerCardSettingByIds" parameterType="String">
  144. delete from customer_card_setting where id in
  145. <foreach item="id" collection="array" open="(" separator="," close=")">
  146. #{id}
  147. </foreach>
  148. </delete>
  149. </mapper>