CustomerGradeSettingMapper.xml 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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="oilName" column="oil_name" />
  10. <result property="memberConditStart" column="member_condit_start" />
  11. <result property="memberConditEnd" column="member_condit_end" />
  12. <result property="discountAmt" column="discount_amt"/>
  13. <result property="stationId" column="station_id"/>
  14. <result property="delFlag" column="del_flag"/>
  15. <result property="createBy" column="create_by" />
  16. <result property="createTime" column="create_time" />
  17. <result property="updateBy" column="update_by" />
  18. <result property="updateTime" column="update_time" />
  19. </resultMap>
  20. <sql id="selectCustomerGradeSettingVo">
  21. select s.id, s.grade, s.discount_amt, s.station_id, s.oil_name, s.member_condit_start, s.member_condit_end,s.create_by,
  22. s.create_time,s.update_by,s.update_time,s.del_flag,d.dept_name as station_name
  23. from customer_grade_setting s join sys_dept d on d.dept_id =s.station_id
  24. </sql>
  25. <select id="selectCustomerGradeSettingList" parameterType="CustomerGradeSetting" resultMap="CustomerGradeSettingResult">
  26. select s.id, s.grade, s.discount_amt, s.station_id, s.oil_name, s.member_condit_start, s.member_condit_end,s.create_by,
  27. s.create_time,s.update_by,s.update_time,s.del_flag,d.dept_name as station_name
  28. from customer_grade_setting s join sys_dept d on d.dept_id =s.station_id
  29. <where>
  30. <if test="grade != null and grade != ''"> and s.grade = #{grade}</if>
  31. <if test="discountAmt != null and discountAmt != ''"> and s.discount_amt = #{discountAmt}</if>
  32. <if test="stationId != null "> and s.station_id = #{stationId}</if>
  33. <if test="oilName != null and oilName != ''"> and s.oil_name like concat('%', #{oilName}, '%')</if>
  34. <if test="memberConditStart != null "> and s.member_condit_start = #{memberConditStart}</if>
  35. <if test="memberConditEnd != null "> and s.member_condit_end = #{memberConditEnd}</if>
  36. <if test="delFlag != null "> and s.del_flag = #{delFlag}</if>
  37. <if test="stationIdList != null ">
  38. and s.station_id in
  39. <foreach item="item" index="index" collection="stationIdList"
  40. open="(" separator="," close=")">
  41. #{item}
  42. </foreach>
  43. </if>
  44. </where>
  45. order by id desc
  46. </select>
  47. <select id="selectCustomerGradeSettingById" parameterType="Long" resultMap="CustomerGradeSettingResult">
  48. select s.id, s.grade, s.discount_amt, s.station_id, s.oil_name, s.member_condit_start, s.member_condit_end,s.create_by,
  49. s.create_time,s.update_by,s.update_time,s.del_Flag,d.dept_name as station_name
  50. from customer_grade_setting s join sys_dept d on d.dept_id =s.station_id
  51. where id = #{id}
  52. </select>
  53. <insert id="insertCustomerGradeSetting" parameterType="CustomerGradeSetting" useGeneratedKeys="true" keyProperty="id">
  54. insert into customer_grade_setting
  55. <trim prefix="(" suffix=")" suffixOverrides=",">
  56. <if test="grade != null">grade,</if>
  57. <if test="discountAmt != null">discount_amt,</if>
  58. <if test="stationId != null">station_id,</if>
  59. <if test="oilName != null">oil_name,</if>
  60. <if test="memberConditStart != null">member_condit_start,</if>
  61. <if test="memberConditEnd != null">member_condit_end,</if>
  62. <if test="delFlag != null">del_flag,</if>
  63. <if test="createBy != null">create_by,</if>
  64. <if test="createTime != null">create_time,</if>
  65. <if test="updateBy != null">update_by,</if>
  66. <if test="updateTime != null">update_time,</if>
  67. </trim>
  68. <trim prefix="values (" suffix=")" suffixOverrides=",">
  69. <if test="grade != null">#{grade},</if>
  70. <if test="discountAmt != null">#{discountAmt},</if>
  71. <if test="stationId != null">#{stationId},</if>
  72. <if test="oilName != null">#{oilName},</if>
  73. <if test="memberConditStart != null">#{memberConditStart},</if>
  74. <if test="memberConditEnd != null">#{memberConditEnd},</if>
  75. <if test="delFlag != null">#{delFlag},</if>
  76. <if test="createBy != null">#{createBy},</if>
  77. <if test="createTime != null">#{createTime},</if>
  78. <if test="updateBy != null">#{updateBy},</if>
  79. <if test="updateTime != null">#{updateTime},</if>
  80. </trim>
  81. </insert>
  82. <update id="updateCustomerGradeSetting" parameterType="CustomerGradeSetting">
  83. update customer_grade_setting
  84. <trim prefix="SET" suffixOverrides=",">
  85. <if test="grade != null">grade = #{grade},</if>
  86. <if test="oilName != null">oil_name = #{oilName},</if>
  87. <if test="memberConditStart != null">member_condit_start = #{memberConditStart},</if>
  88. <if test="memberConditEnd != null">member_condit_end = #{memberConditEnd},</if>
  89. <if test="discountAmt != null">discount_amt = #{discountAmt},</if>
  90. <if test="stationId != null">station_id = #{stationId},</if>
  91. <if test="delFlag != null">del_flag=#{delFlag},</if>
  92. <if test="createBy != null">create_by = #{createBy},</if>
  93. <if test="createTime != null">create_time = #{createTime},</if>
  94. <if test="updateBy != null">update_by = #{updateBy},</if>
  95. <if test="updateTime != null">update_time = #{updateTime},</if>
  96. </trim>
  97. where id = #{id}
  98. </update>
  99. <delete id="deleteCustomerGradeSettingById" parameterType="Long">
  100. delete from customer_grade_setting where id = #{id}
  101. </delete>
  102. <delete id="deleteCustomerGradeSettingByIds" parameterType="String">
  103. delete from customer_grade_setting where id in
  104. <foreach item="id" collection="array" open="(" separator="," close=")">
  105. #{id}
  106. </foreach>
  107. </delete>
  108. </mapper>