CustomerCardSettingDetailMapper.xml 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  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.CustomerCardSettingDetailMapper">
  6. <resultMap type="CustomerCardSettingDetail" id="CustomerCardSettingDetailResult">
  7. <result property="id" column="id" />
  8. <result property="parentId" column="parent_id" />
  9. <result property="settingRuleType" column="setting_rule_type" />
  10. <result property="discountAmtStart" column="discount_amt_start" />
  11. <result property="discountAmtEnd" column="discount_amt_end" />
  12. <result property="presentAmt" column="present_amt" />
  13. <result property="cardType" column="card_type" />
  14. <result property="status" column="status" />
  15. <result property="cardOilsType" column="card_oils_type" />
  16. <result property="discountTimeSetting" column="discount_time_setting" />
  17. <result property="discountTimeType" column="discount_time_type" />
  18. <result property="isDiscountCoupon" column="is_discount_coupon" />
  19. <result property="isGradeSetting" column="is_grade_setting" />
  20. <result property="isMarket" column="is_market"/>
  21. <result property="presentScale" column="present_scale"/>
  22. <result property="enjoyIntegralMultiple" column="enjoy_integral_multiple"/>
  23. <result property="delFlag" column="del_flag"/>
  24. </resultMap>
  25. <sql id="selectCustomerCardSettingDetailVo">
  26. select id, parent_id, setting_rule_type, discount_amt_start,discount_amt_end,
  27. present_amt,card_type,status,del_flag
  28. from customer_card_setting_detail
  29. </sql>
  30. <select id="selectCustomerCardSettingDetailList" parameterType="CustomerCardSettingDetail" resultMap="CustomerCardSettingDetailResult">
  31. <include refid="selectCustomerCardSettingDetailVo"/>
  32. <where>
  33. <if test="parentId != null "> and parent_id = #{parentId}</if>
  34. <if test="settingRuleType != null and settingRuleType != ''"> and setting_rule_type = #{settingRuleType}</if>
  35. <if test="discountAmtStart != null "> and discount_amt_start = #{discountAmtStart}</if>
  36. <if test="discountAmtEnd != null "> and discount_amt_end = #{discountAmtEnd}</if>
  37. <if test="presentAmt != null "> and present_amt = #{presentAmt}</if>
  38. <if test="cardType != null "> and card_type = #{cardType}</if>
  39. <if test="status != null "> and status = #{status}</if>
  40. <if test="delFlag != null "> and del_flag = #{delFlag}</if>
  41. <if test="stationIdList != null ">
  42. and station_id in
  43. <foreach item="item" index="index" collection="stationIdList"
  44. open="(" separator="," close=")">
  45. #{item}
  46. </foreach>
  47. </if>
  48. </where>
  49. </select>
  50. <select id="listDetailInfo" parameterType="CustomerCardSetting" resultMap="CustomerCardSettingDetailResult">
  51. SELECT a.setting_rule_type,a.discount_amt_start,a.discount_amt_end,a.present_amt,card_type,b.card_oils_type,
  52. b.discount_time_setting,b.discount_time_type,b.is_discount_coupon,b.is_market,b.is_grade_setting,b.present_scale,
  53. b.enjoy_integral_multiple
  54. from customer_card_setting_detail a join customer_card_setting b on a.parent_id= b.id
  55. <where>
  56. <!-- <if test="parentId != null "> and parent_id = #{parentId}</if>-->
  57. <!-- <if test="settingRuleType != null and settingRuleType != ''"> and setting_rule_type = #{settingRuleType}</if>-->
  58. <!-- <if test="discountAmtStart != null "> and discount_amt_start = #{discountAmtStart}</if>-->
  59. <!-- <if test="discountAmtEnd != null "> and discount_amt_end = #{discountAmtEnd}</if>-->
  60. <!-- <if test="presentAmt != null "> and present_amt = #{presentAmt}</if>-->
  61. <!-- <if test="cardType != null "> and card_type = #{cardType}</if>-->
  62. <!-- <if test="status != null "> and status = #{status}</if>-->
  63. <if test="delFlag != null "> and a.del_flag = #{delFlag}</if>
  64. <if test="stationIdList != null ">
  65. and station_id in
  66. <foreach item="item" index="index" collection="stationIdList"
  67. open="(" separator="," close=")">
  68. #{item}
  69. </foreach>
  70. </if>
  71. </where>
  72. </select>
  73. <select id="selectCustomerCardSettingDetailById" parameterType="Long" resultMap="CustomerCardSettingDetailResult">
  74. <include refid="selectCustomerCardSettingDetailVo"/>
  75. where id = #{id}
  76. </select>
  77. <insert id="insertCustomerCardSettingDetail" parameterType="CustomerCardSettingDetail">
  78. insert into customer_card_setting_detail
  79. <trim prefix="(" suffix=")" suffixOverrides=",">
  80. <if test="id != null">id,</if>
  81. <if test="parentId != null">parent_id,</if>
  82. <if test="settingRuleType != null">setting_rule_type,</if>
  83. <if test="discountAmtStart != null">discount_amt_start,</if>
  84. <if test="discountAmtEnd != null">discount_amt_end,</if>
  85. <if test="presentAmt != null">present_amt,</if>
  86. <if test="cardType != null">card_type,</if>
  87. <if test="status != null">status,</if>
  88. <if test="delFlag != null">del_flag,</if>
  89. </trim>
  90. <trim prefix="values (" suffix=")" suffixOverrides=",">
  91. <if test="id != null">#{id},</if>
  92. <if test="parentId != null">#{parentId},</if>
  93. <if test="settingRuleType != null">#{settingRuleType},</if>
  94. <if test="discountAmtStart != null">#{discountAmtStart},</if>
  95. <if test="discountAmtEnd != null">#{discountAmtEnd},</if>
  96. <if test="presentAmt != null">#{presentAmt},</if>
  97. <if test="cardType != null">#{cardType},</if>
  98. <if test="status != null">#{status},</if>
  99. <if test="delFlag != null">#{delFlag},</if>
  100. </trim>
  101. </insert>
  102. <update id="updateCustomerCardSettingDetail" parameterType="CustomerCardSettingDetail">
  103. update customer_card_setting_detail
  104. <trim prefix="SET" suffixOverrides=",">
  105. <if test="parentId != null">parent_id = #{parentId},</if>
  106. <if test="settingRuleType != null">setting_rule_type = #{settingRuleType},</if>
  107. <if test="discountAmtStart != null">discount_amt_start = #{discountAmtStart},</if>
  108. <if test="discountAmtEnd != null">discount_amt_end = #{discountAmtEnd},</if>
  109. <if test="presentAmt != null">present_amt = #{presentAmt},</if>
  110. <if test="cardType != null">card_type = #{cardType},</if>
  111. <if test="status != null">status = #{status},</if>
  112. <if test="delFlag != null">del_flag = #{delFlag},</if>
  113. </trim>
  114. where id = #{id}
  115. </update>
  116. <update id="updateDetail" parameterType="CustomerCardSettingDetail">
  117. update customer_card_setting_detail set del_flag = #{delFlag}
  118. where parent_id = #{parentId}
  119. </update>
  120. <delete id="deleteCustomerCardSettingDetailById" parameterType="Long">
  121. delete from customer_card_setting_detail where id = #{id}
  122. </delete>
  123. <delete id="deleteCustomerCardSettingDetailByIds" parameterType="String">
  124. delete from customer_card_setting_detail where id in
  125. <foreach item="id" collection="array" open="(" separator="," close=")">
  126. #{id}
  127. </foreach>
  128. </delete>
  129. <delete id="deleteCustomerCardSettingDetail" parameterType="CustomerCardSettingDetail">
  130. delete from customer_card_setting_detail
  131. <where>
  132. <if test="parentId != null "> and parent_id = #{parentId}</if>
  133. <if test="settingRuleType != null and settingRuleType != ''"> and setting_rule_type = #{settingRuleType}</if>
  134. <if test="discountAmtStart != null "> and discount_amt_start = #{discountAmtStart}</if>
  135. <if test="discountAmtEnd != null "> and discount_amt_end = #{discountAmtEnd}</if>
  136. <if test="presentAmt != null "> and present_amt = #{presentAmt}</if>
  137. <if test="cardType != null"> and card_type = #{cardType}</if>
  138. <if test="status != null"> and status = #{status}</if>
  139. </where>
  140. </delete>
  141. </mapper>