MarkertPlanMapper.xml 7.6 KB

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