PayOrderMapper.xml 7.7 KB

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