CustomerGradeSettingMapper.xml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  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.CustomerGradeSettingMapper">
  6. <resultMap type="CustomerGradeSetting" id="CustomerGradeSettingResult">
  7. <result property="id" column="id" />
  8. <result property="grade" column="grade" />
  9. <result property="discountWay" column="discount_way" />
  10. <result property="gasoilDiscountLitre" column="gasoil_discount_litre" />
  11. <result property="dieseloilDiscountLitre" column="dieseloil_discount_litre" />
  12. <result property="gradeType" column="grade_type" />
  13. <result property="gasoilConsume" column="gasoil_consume" />
  14. <result property="gasoilGrowthValue" column="gasoil_growth_value" />
  15. <result property="dieseloilConsume" column="dieseloil_consume" />
  16. <result property="dieseloilGrowthValue" column="dieseloil_growth_value" />
  17. <result property="memberRecharge" column="member_recharge" />
  18. <result property="memberGrowthValue" column="member_growth_value" />
  19. <result property="growthValue" column="growth_value" />
  20. <result property="date" column="date" />
  21. <result property="deductionGrowthValue" column="deduction_growth_value" />
  22. <result property="memberCondit" column="member_condit" />
  23. <result property="stationId" column="station_id" />
  24. <result property="stationName" column="station_name" />
  25. <result property="oilName" column="oil_name" />
  26. <result property="memberConditStart" column="member_condit_start" />
  27. <result property="memberConditEnd" column="member_condit_end" />
  28. </resultMap>
  29. <sql id="selectCustomerGradeSettingVo">
  30. select id, grade, discount_way, gasoil_discount_litre, dieseloil_discount_litre, grade_type, gasoil_consume, gasoil_growth_value, dieseloil_consume, dieseloil_growth_value, member_recharge, member_growth_value, growth_value, date, deduction_growth_value, member_condit, station_id, station_name, oil_name, member_condit_start, member_condit_end from customer_grade_setting
  31. </sql>
  32. <select id="selectCustomerGradeSettingList" parameterType="CustomerGradeSetting" resultMap="CustomerGradeSettingResult">
  33. <include refid="selectCustomerGradeSettingVo"/>
  34. <where>
  35. <if test="grade != null and grade != ''"> and grade = #{grade}</if>
  36. <if test="discountWay != null and discountWay != ''"> and discount_way = #{discountWay}</if>
  37. <if test="gasoilDiscountLitre != null and gasoilDiscountLitre != ''"> and gasoil_discount_litre = #{gasoilDiscountLitre}</if>
  38. <if test="dieseloilDiscountLitre != null and dieseloilDiscountLitre != ''"> and dieseloil_discount_litre = #{dieseloilDiscountLitre}</if>
  39. <if test="gradeType != null and gradeType != ''"> and grade_type = #{gradeType}</if>
  40. <if test="gasoilConsume != null and gasoilConsume != ''"> and gasoil_consume = #{gasoilConsume}</if>
  41. <if test="gasoilGrowthValue != null and gasoilGrowthValue != ''"> and gasoil_growth_value = #{gasoilGrowthValue}</if>
  42. <if test="dieseloilConsume != null and dieseloilConsume != ''"> and dieseloil_consume = #{dieseloilConsume}</if>
  43. <if test="dieseloilGrowthValue != null and dieseloilGrowthValue != ''"> and dieseloil_growth_value = #{dieseloilGrowthValue}</if>
  44. <if test="memberRecharge != null and memberRecharge != ''"> and member_recharge = #{memberRecharge}</if>
  45. <if test="memberGrowthValue != null and memberGrowthValue != ''"> and member_growth_value = #{memberGrowthValue}</if>
  46. <if test="growthValue != null and growthValue != ''"> and growth_value = #{growthValue}</if>
  47. <if test="date != null "> and date = #{date}</if>
  48. <if test="deductionGrowthValue != null and deductionGrowthValue != ''"> and deduction_growth_value = #{deductionGrowthValue}</if>
  49. <if test="memberCondit != null and memberCondit != ''"> and member_condit = #{memberCondit}</if>
  50. <if test="stationId != null "> and station_id = #{stationId}</if>
  51. <if test="stationName != null and stationName != ''"> and station_name like concat('%', #{stationName}, '%')</if>
  52. <if test="oilName != null and oilName != ''"> and oil_name like concat('%', #{oilName}, '%')</if>
  53. <if test="memberConditStart != null "> and member_condit_start = #{memberConditStart}</if>
  54. <if test="memberConditEnd != null "> and member_condit_end = #{memberConditEnd}</if>
  55. <if test="stationIdList != null ">
  56. and station_id in
  57. <foreach item="item" index="index" collection="stationIdList"
  58. open="(" separator="," close=")">
  59. #{item}
  60. </foreach>
  61. </if>
  62. </where>
  63. order by id desc
  64. </select>
  65. <select id="selectCustomerGradeSettingById" parameterType="Long" resultMap="CustomerGradeSettingResult">
  66. <include refid="selectCustomerGradeSettingVo"/>
  67. where id = #{id}
  68. </select>
  69. <insert id="insertCustomerGradeSetting" parameterType="CustomerGradeSetting" useGeneratedKeys="true" keyProperty="id">
  70. insert into customer_grade_setting
  71. <trim prefix="(" suffix=")" suffixOverrides=",">
  72. <if test="grade != null">grade,</if>
  73. <if test="discountWay != null">discount_way,</if>
  74. <if test="gasoilDiscountLitre != null">gasoil_discount_litre,</if>
  75. <if test="dieseloilDiscountLitre != null">dieseloil_discount_litre,</if>
  76. <if test="gradeType != null">grade_type,</if>
  77. <if test="gasoilConsume != null">gasoil_consume,</if>
  78. <if test="gasoilGrowthValue != null">gasoil_growth_value,</if>
  79. <if test="dieseloilConsume != null">dieseloil_consume,</if>
  80. <if test="dieseloilGrowthValue != null">dieseloil_growth_value,</if>
  81. <if test="memberRecharge != null">member_recharge,</if>
  82. <if test="memberGrowthValue != null">member_growth_value,</if>
  83. <if test="growthValue != null">growth_value,</if>
  84. <if test="date != null">date,</if>
  85. <if test="deductionGrowthValue != null">deduction_growth_value,</if>
  86. <if test="memberCondit != null">member_condit,</if>
  87. <if test="stationId != null">station_id,</if>
  88. <if test="stationName != null">station_name,</if>
  89. <if test="oilName != null">oil_name,</if>
  90. <if test="memberConditStart != null">member_condit_start,</if>
  91. <if test="memberConditEnd != null">member_condit_end,</if>
  92. </trim>
  93. <trim prefix="values (" suffix=")" suffixOverrides=",">
  94. <if test="grade != null">#{grade},</if>
  95. <if test="discountWay != null">#{discountWay},</if>
  96. <if test="gasoilDiscountLitre != null">#{gasoilDiscountLitre},</if>
  97. <if test="dieseloilDiscountLitre != null">#{dieseloilDiscountLitre},</if>
  98. <if test="gradeType != null">#{gradeType},</if>
  99. <if test="gasoilConsume != null">#{gasoilConsume},</if>
  100. <if test="gasoilGrowthValue != null">#{gasoilGrowthValue},</if>
  101. <if test="dieseloilConsume != null">#{dieseloilConsume},</if>
  102. <if test="dieseloilGrowthValue != null">#{dieseloilGrowthValue},</if>
  103. <if test="memberRecharge != null">#{memberRecharge},</if>
  104. <if test="memberGrowthValue != null">#{memberGrowthValue},</if>
  105. <if test="growthValue != null">#{growthValue},</if>
  106. <if test="date != null">#{date},</if>
  107. <if test="deductionGrowthValue != null">#{deductionGrowthValue},</if>
  108. <if test="memberCondit != null">#{memberCondit},</if>
  109. <if test="stationId != null">#{stationId},</if>
  110. <if test="stationName != null">#{stationName},</if>
  111. <if test="oilName != null">#{oilName},</if>
  112. <if test="memberConditStart != null">#{memberConditStart},</if>
  113. <if test="memberConditEnd != null">#{memberConditEnd},</if>
  114. </trim>
  115. </insert>
  116. <update id="updateCustomerGradeSetting" parameterType="CustomerGradeSetting">
  117. update customer_grade_setting
  118. <trim prefix="SET" suffixOverrides=",">
  119. <if test="grade != null">grade = #{grade},</if>
  120. <if test="discountWay != null">discount_way = #{discountWay},</if>
  121. <if test="gasoilDiscountLitre != null">gasoil_discount_litre = #{gasoilDiscountLitre},</if>
  122. <if test="dieseloilDiscountLitre != null">dieseloil_discount_litre = #{dieseloilDiscountLitre},</if>
  123. <if test="gradeType != null">grade_type = #{gradeType},</if>
  124. <if test="gasoilConsume != null">gasoil_consume = #{gasoilConsume},</if>
  125. <if test="gasoilGrowthValue != null">gasoil_growth_value = #{gasoilGrowthValue},</if>
  126. <if test="dieseloilConsume != null">dieseloil_consume = #{dieseloilConsume},</if>
  127. <if test="dieseloilGrowthValue != null">dieseloil_growth_value = #{dieseloilGrowthValue},</if>
  128. <if test="memberRecharge != null">member_recharge = #{memberRecharge},</if>
  129. <if test="memberGrowthValue != null">member_growth_value = #{memberGrowthValue},</if>
  130. <if test="growthValue != null">growth_value = #{growthValue},</if>
  131. <if test="date != null">date = #{date},</if>
  132. <if test="deductionGrowthValue != null">deduction_growth_value = #{deductionGrowthValue},</if>
  133. <if test="memberCondit != null">member_condit = #{memberCondit},</if>
  134. <if test="stationId != null">station_id = #{stationId},</if>
  135. <if test="stationName != null">station_name = #{stationName},</if>
  136. <if test="oilName != null">oil_name = #{oilName},</if>
  137. <if test="memberConditStart != null">member_condit_start = #{memberConditStart},</if>
  138. <if test="memberConditEnd != null">member_condit_end = #{memberConditEnd},</if>
  139. </trim>
  140. where id = #{id}
  141. </update>
  142. <delete id="deleteCustomerGradeSettingById" parameterType="Long">
  143. delete from customer_grade_setting where id = #{id}
  144. </delete>
  145. <delete id="deleteCustomerGradeSettingByIds" parameterType="String">
  146. delete from customer_grade_setting where id in
  147. <foreach item="id" collection="array" open="(" separator="," close=")">
  148. #{id}
  149. </foreach>
  150. </delete>
  151. </mapper>