MarkertPlanMapper.xml 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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.market.mapper.MarkertPlanMapper">
  6. <resultMap type="MarkertPlan" id="MarkertPlanResult">
  7. <result property="id" column="id" />
  8. <result property="grade" column="grade" />
  9. <result property="discountTerm" column="discount_term" />
  10. <result property="discountAmt" column="discount_amt" />
  11. <result property="gasoilDiscountAmt" column="gasoil_discount_amt" />
  12. <result property="dieseloilDiscountAmt" column="dieseloil_discount_amt" />
  13. <result property="vipDiscountyPlus" column="vip_discounty_plus" />
  14. <result property="couponPlus" column="coupon_plus" />
  15. <result property="discountPlanType" column="discount_plan_type" />
  16. <result property="oilName" column="oil_name" />
  17. <result property="stationId" column="station_id" />
  18. <result property="stationName" column="station_name" />
  19. <result property="status" column="status" />
  20. </resultMap>
  21. <sql id="selectMarkertPlanVo">
  22. select id, grade, discount_term, discount_amt, gasoil_discount_amt, dieseloil_discount_amt, vip_discounty_plus, coupon_plus, discount_plan_type, oil_name, station_id, station_name, status from markert_plan
  23. </sql>
  24. <select id="selectMarkertPlanList" parameterType="MarkertPlan" resultMap="MarkertPlanResult">
  25. <include refid="selectMarkertPlanVo"/>
  26. <where>
  27. <if test="grade != null and grade != ''"> and grade = #{grade}</if>
  28. <if test="discountTerm != null and discountTerm != ''"> and discount_term = #{discountTerm}</if>
  29. <if test="discountAmt != null and discountAmt != ''"> and discount_amt = #{discountAmt}</if>
  30. <if test="gasoilDiscountAmt != null and gasoilDiscountAmt != ''"> and gasoil_discount_amt = #{gasoilDiscountAmt}</if>
  31. <if test="dieseloilDiscountAmt != null and dieseloilDiscountAmt != ''"> and dieseloil_discount_amt = #{dieseloilDiscountAmt}</if>
  32. <if test="vipDiscountyPlus != null and vipDiscountyPlus != ''"> and vip_discounty_plus = #{vipDiscountyPlus}</if>
  33. <if test="couponPlus != null and couponPlus != ''"> and coupon_plus = #{couponPlus}</if>
  34. <if test="discountPlanType != null and discountPlanType != ''"> and discount_plan_type = #{discountPlanType}</if>
  35. <if test="oilName != null and oilName != ''"> and oil_name like concat('%', #{oilName}, '%')</if>
  36. <if test="stationId != null "> and station_id = #{stationId}</if>
  37. <if test="stationName != null and stationName != ''"> and station_name like concat('%', #{stationName}, '%')</if>
  38. <if test="status != null and status != ''"> and status = #{status}</if>
  39. <if test="stationIdList != null ">
  40. and station_id in
  41. <foreach item="item" index="index" collection="stationIdList"
  42. open="(" separator="," close=")">
  43. #{item}
  44. </foreach>
  45. </if>
  46. </where>
  47. </select>
  48. <select id="selectMarkertPlanById" parameterType="Long" resultMap="MarkertPlanResult">
  49. <include refid="selectMarkertPlanVo"/>
  50. where id = #{id}
  51. </select>
  52. <insert id="insertMarkertPlan" parameterType="MarkertPlan" useGeneratedKeys="true" keyProperty="id">
  53. insert into markert_plan
  54. <trim prefix="(" suffix=")" suffixOverrides=",">
  55. <if test="grade != null">grade,</if>
  56. <if test="discountTerm != null">discount_term,</if>
  57. <if test="discountAmt != null">discount_amt,</if>
  58. <if test="gasoilDiscountAmt != null">gasoil_discount_amt,</if>
  59. <if test="dieseloilDiscountAmt != null">dieseloil_discount_amt,</if>
  60. <if test="vipDiscountyPlus != null">vip_discounty_plus,</if>
  61. <if test="couponPlus != null">coupon_plus,</if>
  62. <if test="discountPlanType != null">discount_plan_type,</if>
  63. <if test="oilName != null">oil_name,</if>
  64. <if test="stationId != null">station_id,</if>
  65. <if test="stationName != null">station_name,</if>
  66. <if test="status != null">status,</if>
  67. </trim>
  68. <trim prefix="values (" suffix=")" suffixOverrides=",">
  69. <if test="grade != null">#{grade},</if>
  70. <if test="discountTerm != null">#{discountTerm},</if>
  71. <if test="discountAmt != null">#{discountAmt},</if>
  72. <if test="gasoilDiscountAmt != null">#{gasoilDiscountAmt},</if>
  73. <if test="dieseloilDiscountAmt != null">#{dieseloilDiscountAmt},</if>
  74. <if test="vipDiscountyPlus != null">#{vipDiscountyPlus},</if>
  75. <if test="couponPlus != null">#{couponPlus},</if>
  76. <if test="discountPlanType != null">#{discountPlanType},</if>
  77. <if test="oilName != null">#{oilName},</if>
  78. <if test="stationId != null">#{stationId},</if>
  79. <if test="stationName != null">#{stationName},</if>
  80. <if test="status != null">#{status},</if>
  81. </trim>
  82. </insert>
  83. <update id="updateMarkertPlan" parameterType="MarkertPlan">
  84. update markert_plan
  85. <trim prefix="SET" suffixOverrides=",">
  86. <if test="grade != null">grade = #{grade},</if>
  87. <if test="discountTerm != null">discount_term = #{discountTerm},</if>
  88. <if test="discountAmt != null">discount_amt = #{discountAmt},</if>
  89. <if test="gasoilDiscountAmt != null">gasoil_discount_amt = #{gasoilDiscountAmt},</if>
  90. <if test="dieseloilDiscountAmt != null">dieseloil_discount_amt = #{dieseloilDiscountAmt},</if>
  91. <if test="vipDiscountyPlus != null">vip_discounty_plus = #{vipDiscountyPlus},</if>
  92. <if test="couponPlus != null">coupon_plus = #{couponPlus},</if>
  93. <if test="discountPlanType != null">discount_plan_type = #{discountPlanType},</if>
  94. <if test="oilName != null">oil_name = #{oilName},</if>
  95. <if test="stationId != null">station_id = #{stationId},</if>
  96. <if test="stationName != null">station_name = #{stationName},</if>
  97. <if test="status != null">status = #{status},</if>
  98. </trim>
  99. where id = #{id}
  100. </update>
  101. <delete id="deleteMarkertPlanById" parameterType="Long">
  102. delete from markert_plan where id = #{id}
  103. </delete>
  104. <delete id="deleteMarkertPlanByIds" parameterType="String">
  105. delete from markert_plan where id in
  106. <foreach item="id" collection="array" open="(" separator="," close=")">
  107. #{id}
  108. </foreach>
  109. </delete>
  110. </mapper>