CustomerCardSettingDetailMapper.xml 8.3 KB

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