PayOrderMapper.xml 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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.station.mapper.PayOrderMapper">
  6. <resultMap type="PayOrder" id="PayOrderResult">
  7. <result property="orderId" column="order_id" />
  8. <result property="orderNo" column="order_no" />
  9. <result property="oilGun" column="oil_gun" />
  10. <result property="oilName" column="oil_name" />
  11. <result property="consumerId" column="consumer_id" />
  12. <result property="consumer" column="consumer" />
  13. <result property="amt" column="amt" />
  14. <result property="stationId" column="station_id" />
  15. <result property="status" column="status" />
  16. <result property="orderLiters" column="order_liters" />
  17. <result property="payType" column="pay_type" />
  18. <result property="payWay" column="pay_way" />
  19. <result property="payDate" column="pay_date" />
  20. <result property="oilPersonnel" column="oil_personnel" />
  21. <result property="createdDate" column="created_date" />
  22. <result property="orderType" column="order_type" />
  23. </resultMap>
  24. <sql id="selectPayOrderVo">
  25. select order_id, order_no, oil_gun, oil_name, consumer_id, consumer, amt, station_id, status, order_liters, pay_type, pay_way, pay_date, oil_personnel, created_date, order_type from pay_order
  26. </sql>
  27. <select id="selectPayOrderList" parameterType="PayOrder" resultMap="PayOrderResult">
  28. <include refid="selectPayOrderVo"/>
  29. <where>
  30. <if test="orderNo != null and orderNo != ''"> and order_no = #{orderNo}</if>
  31. <if test="oilGun != null and oilGun != ''"> and oil_gun = #{oilGun}</if>
  32. <if test="oilName != null and oilName != ''"> and oil_name like concat('%', #{oilName}, '%')</if>
  33. <if test="consumerId != null "> and consumer_id = #{consumerId}</if>
  34. <if test="consumer != null and consumer != ''"> and consumer = #{consumer}</if>
  35. <if test="amt != null and amt != ''"> and amt = #{amt}</if>
  36. <if test="stationId != null "> and station_id = #{stationId}</if>
  37. <if test="status != null and status != ''"> and status = #{status}</if>
  38. <if test="orderLiters != null and orderLiters != ''"> and order_liters = #{orderLiters}</if>
  39. <if test="payType != null and payType != ''"> and pay_type = #{payType}</if>
  40. <if test="payWay != null and payWay != ''"> and pay_way = #{payWay}</if>
  41. <if test="payDate != null "> and pay_date = #{payDate}</if>
  42. <if test="oilPersonnel != null and oilPersonnel != ''"> and oil_personnel = #{oilPersonnel}</if>
  43. <if test="createdDate != null "> and created_date = #{createdDate}</if>
  44. <if test="orderType != null and orderType != ''"> and order_type = #{orderType}</if>
  45. </where>
  46. ORDER BY created_date DESC
  47. </select>
  48. <select id="selectPayOrderById" parameterType="Long" resultMap="PayOrderResult">
  49. <include refid="selectPayOrderVo"/>
  50. where order_id = #{orderId}
  51. </select>
  52. <insert id="insertPayOrder" parameterType="PayOrder" useGeneratedKeys="true" keyProperty="orderId">
  53. insert into pay_order
  54. <trim prefix="(" suffix=")" suffixOverrides=",">
  55. <if test="orderNo != null">order_no,</if>
  56. <if test="oilGun != null">oil_gun,</if>
  57. <if test="oilName != null">oil_name,</if>
  58. <if test="consumerId != null">consumer_id,</if>
  59. <if test="consumer != null">consumer,</if>
  60. <if test="amt != null">amt,</if>
  61. <if test="stationId != null">station_id,</if>
  62. <if test="status != null">status,</if>
  63. <if test="orderLiters != null">order_liters,</if>
  64. <if test="payType != null">pay_type,</if>
  65. <if test="payWay != null">pay_way,</if>
  66. <if test="payDate != null">pay_date,</if>
  67. <if test="oilPersonnel != null">oil_personnel,</if>
  68. <if test="createdDate != null">created_date,</if>
  69. <if test="orderType != null">order_type,</if>
  70. </trim>
  71. <trim prefix="values (" suffix=")" suffixOverrides=",">
  72. <if test="orderNo != null">#{orderNo},</if>
  73. <if test="oilGun != null">#{oilGun},</if>
  74. <if test="oilName != null">#{oilName},</if>
  75. <if test="consumerId != null">#{consumerId},</if>
  76. <if test="consumer != null">#{consumer},</if>
  77. <if test="amt != null">#{amt},</if>
  78. <if test="stationId != null">#{stationId},</if>
  79. <if test="status != null">#{status},</if>
  80. <if test="orderLiters != null">#{orderLiters},</if>
  81. <if test="payType != null">#{payType},</if>
  82. <if test="payWay != null">#{payWay},</if>
  83. <if test="payDate != null">#{payDate},</if>
  84. <if test="oilPersonnel != null">#{oilPersonnel},</if>
  85. <if test="createdDate != null">#{createdDate},</if>
  86. <if test="orderType != null">#{orderType},</if>
  87. </trim>
  88. </insert>
  89. <update id="updatePayOrder" parameterType="PayOrder">
  90. update pay_order
  91. <trim prefix="SET" suffixOverrides=",">
  92. <if test="orderNo != null">order_no = #{orderNo},</if>
  93. <if test="oilGun != null">oil_gun = #{oilGun},</if>
  94. <if test="oilName != null">oil_name = #{oilName},</if>
  95. <if test="consumerId != null">consumer_id = #{consumerId},</if>
  96. <if test="consumer != null">consumer = #{consumer},</if>
  97. <if test="amt != null">amt = #{amt},</if>
  98. <if test="stationId != null">station_id = #{stationId},</if>
  99. <if test="status != null">status = #{status},</if>
  100. <if test="orderLiters != null">order_liters = #{orderLiters},</if>
  101. <if test="payType != null">pay_type = #{payType},</if>
  102. <if test="payWay != null">pay_way = #{payWay},</if>
  103. <if test="payDate != null">pay_date = #{payDate},</if>
  104. <if test="oilPersonnel != null">oil_personnel = #{oilPersonnel},</if>
  105. <if test="createdDate != null">created_date = #{createdDate},</if>
  106. <if test="orderType != null">order_type = #{orderType},</if>
  107. </trim>
  108. where order_id = #{orderId}
  109. </update>
  110. <delete id="deletePayOrderById" parameterType="Long">
  111. delete from pay_order where order_id = #{orderId}
  112. </delete>
  113. <delete id="deletePayOrderByIds" parameterType="String">
  114. delete from pay_order where order_id in
  115. <foreach item="orderId" collection="array" open="(" separator="," close=")">
  116. #{orderId}
  117. </foreach>
  118. </delete>
  119. </mapper>