PayOrderMapper.xml 68 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076
  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="stationId" column="station_id" />
  10. <result property="stationName" column="station_name" />
  11. <result property="status" column="status" />
  12. <result property="consumerId" column="consumer_id" />
  13. <result property="consumer" column="consumer" />
  14. <result property="oilGun" column="oil_gun" />
  15. <result property="oilName" column="oil_name" />
  16. <result property="oilPirce" column="oil_pirce" />
  17. <result property="oilType" column="oil_type" />
  18. <result property="orderLiters" column="order_liters" />
  19. <result property="amt" column="amt" />
  20. <result property="receivableAmt" column="receivable_amt" />
  21. <result property="receivedAmt" column="received_amt" />
  22. <result property="discountAmt" column="discount_amt" />
  23. <result property="discountCouponAmt" column="discount_coupon_amt" />
  24. <result property="discountCoupon" column="discount_coupon" />
  25. <result property="wxAmt" column="wx_amt" />
  26. <result property="zfbAmt" column="zfb_amt" />
  27. <result property="posAmt" column="pos_amt" />
  28. <result property="xjAmt" column="xj_amt" />
  29. <result property="didiAppAmt" column="didi_app_amt" />
  30. <result property="tyAppAmt" column="ty_app_amt" />
  31. <result property="otherAmt" column="other_amt" />
  32. <result property="dzkAmt" column="dzk_amt" />
  33. <result property="score" column="score" />
  34. <result property="memberNo" column="member_no" />
  35. <result property="memberAmt" column="member_amt" />
  36. <result property="printCount" column="print_count" />
  37. <result property="payType" column="pay_type" />
  38. <result property="payWay" column="pay_way" />
  39. <result property="oilPersonnel" column="oil_personnel" />
  40. <result property="oilPersonnelId" column="oil_personnel_id" />
  41. <result property="payDate" column="pay_date" />
  42. <result property="createdDate" column="created_date" />
  43. <result property="orderType" column="order_type" />
  44. <result property="carNo" column="car_no" />
  45. <result property="customerPhone" column="customer_phone" />
  46. <result property="customerGrade" column="customer_grade" />
  47. <result property="wxNum" column="wx_num" />
  48. <result property="zfbNum" column="zfb_num" />
  49. <result property="xjNum" column="xj_num" />
  50. <result property="qyAmt" column="qy_amt" />
  51. <result property="cyAmt" column="cy_amt" />
  52. <result property="sellAmt" column="sell_amt" />
  53. <result property="sellDiscountAmt" column="sell_discount_amt" />
  54. <result property="mobilePhone" column="mobile_phone" />
  55. <result property="sellOilPrice" column="sell_oil_price" />
  56. <result property="driverOilPrice" column="driver_oil_price" />
  57. <result property="countNum" column="count_num" />
  58. <result property="driverDiscountAmt" column="driver_discount_amt" />
  59. <result property="refundUser" column="refund_user" />
  60. <result property="refundDate" column="refund_date" />
  61. <result property="examinUser" column="examin_user" />
  62. <result property="examinDate" column="examin_date" />
  63. <result property="examinStatus" column="examin_status" />
  64. <result property="refundSuccessDate" column="refund_success_date" />
  65. <result property="dzkNum" column="dzk_num" />
  66. </resultMap>
  67. <sql id="selectPayOrderVo">
  68. select order_id, order_no, station_id,d.dept_name as station_name, p.status,consumer_id, consumer, oil_gun,
  69. oil_name, oil_pirce, oil_type, order_liters, amt, receivable_amt, received_amt, discount_amt,sell_oil_price,driver_oil_price,oil_personnel_id,
  70. discount_coupon_amt, discount_coupon, wx_amt, zfb_amt, pos_amt, xj_amt, didi_app_amt, ty_app_amt,
  71. other_amt, dzk_amt, score, member_no, member_amt, print_count, pay_type, pay_way, oil_personnel,
  72. pay_date, created_date, order_type, car_no, customer_phone, customer_grade,sell_amt,sell_discount_amt,driver_discount_amt,
  73. examin_user,examin_date,refund_user,refund_date,examin_status,refund_success_date
  74. from pay_order p join sys_dept d on p.station_id =d.dept_id
  75. </sql>
  76. <select id="selectPayOrderList" parameterType="PayOrder" resultMap="PayOrderResult">
  77. <include refid="selectPayOrderVo"/>
  78. <where>
  79. <if test="orderNo != null and orderNo != ''"> and order_no like concat('%', #{orderNo}, '%')</if>
  80. <if test="stationId != null "> and station_id = #{stationId}</if>
  81. <if test="status != null and status != ''"> and p.status = #{status}</if>
  82. <if test="status == null or status == ''"> and p.status != 0</if>
  83. <if test="consumerId != null "> and consumer_id = #{consumerId}</if>
  84. <if test="consumer != null and consumer != ''"> and consumer like concat('%', #{consumer}, '%')</if>
  85. <if test="oilGun != null and oilGun != ''"> and oil_gun = #{oilGun}</if>
  86. <if test="oilName != null and oilName != ''"> and oil_name like concat('%', #{oilName}, '%')</if>
  87. <if test="oilPirce != null "> and oil_pirce = #{oilPirce}</if>
  88. <if test="oilType != null and oilType != ''"> and oil_type = #{oilType}</if>
  89. <if test="orderLiters != null "> and order_liters = #{orderLiters}</if>
  90. <if test="amt != null "> and amt = #{amt}</if>
  91. <if test="receivableAmt != null "> and receivable_amt = #{receivableAmt}</if>
  92. <if test="receivedAmt != null "> and received_amt = #{receivedAmt}</if>
  93. <if test="discountAmt != null "> and discount_amt = #{discountAmt}</if>
  94. <if test="discountCouponAmt != null "> and discount_coupon_amt = #{discountCouponAmt}</if>
  95. <if test="discountCoupon != null and discountCoupon != ''"> and discount_coupon = #{discountCoupon}</if>
  96. <if test="wxAmt != null "> and wx_amt = #{wxAmt}</if>
  97. <if test="zfbAmt != null "> and zfb_amt = #{zfbAmt}</if>
  98. <if test="posAmt != null "> and pos_amt = #{posAmt}</if>
  99. <if test="xjAmt != null "> and xj_amt = #{xjAmt}</if>
  100. <if test="didiAppAmt != null "> and didi_app_amt = #{didiAppAmt}</if>
  101. <if test="tyAppAmt != null "> and ty_app_amt = #{tyAppAmt}</if>
  102. <if test="otherAmt != null "> and other_amt = #{otherAmt}</if>
  103. <if test="dzkAmt != null "> and dzk_amt = #{dzkAmt}</if>
  104. <if test="score != null "> and score = #{score}</if>
  105. <if test="memberNo != null and memberNo != ''"> and member_no = #{memberNo}</if>
  106. <if test="memberAmt != null "> and member_amt = #{memberAmt}</if>
  107. <if test="printCount != null "> and print_count = #{printCount}</if>
  108. <if test="payType != null and payType != ''"> and pay_type = #{payType}</if>
  109. <if test="payWay != null and payWay != ''"> and pay_way = #{payWay}</if>
  110. <if test="oilPersonnel != null and oilPersonnel != ''"> and oil_personnel = #{oilPersonnel}</if>
  111. <if test="oilPersonnelId != null and oilPersonnelId != ''"> and oil_personnel_id = #{oilPersonnelId}</if>
  112. <if test="payDate != null "> and pay_date = #{payDate}</if>
  113. <if test="createdDate != null "> and created_date = #{createdDate}</if>
  114. <if test="orderType != null and orderType != ''"> and order_type = #{orderType}</if>
  115. <if test="carNo != null and carNo != ''"> and car_no = #{carNo}</if>
  116. <if test="customerPhone != null and customerPhone != ''"> and customer_phone = #{customerPhone}</if>
  117. <if test="customerGrade != null and customerGrade != ''"> and customer_grade = #{customerGrade}</if>
  118. <if test="refundUser != null and refundUser != ''"> and refund_user = #{refundUser}</if>
  119. <if test="refundDate != null and refundDate != ''"> and refund_date = #{refundDate}</if>
  120. <if test="examinUser != null and examinUser != ''"> and examin_user = #{examinUser}</if>
  121. <if test="examinDate != null and examinDate != ''"> and examin_date = #{examinDate}</if>
  122. <if test="examinStatus != null and examinStatus != ''">
  123. <if test="examinStatus == '-1'">
  124. and examin_status !=0 and examin_status !=null
  125. </if>
  126. <if test="examinStatus != '-1'">
  127. and examin_status = #{examinStatus}
  128. </if>
  129. </if>
  130. <if test="likeConsumer != null and likeConsumer != ''"> and consumer like concat('%',#{likeConsumer}, '%')</if>
  131. <if test="likeCarNo != null and likeCarNo != ''"> and car_no like concat('%',#{likeCarNo}, '%') </if>
  132. <if test="likeCustomerPhone != null and likeCustomerPhone != ''"> and customer_phone like concat('%',#{likeCustomerPhone}, '%') </if>
  133. <if test="refundSuccessStatus == '1'.toString() ">
  134. <if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
  135. AND date_format(refund_success_date,'%y-%m-%d %H:%i:%s') &gt;= date_format(#{beginTime},'%y-%m-%d %H:%i:%s')
  136. </if>
  137. <if test="endTime != null and endTime != ''"><!-- 结束时间检索 -->
  138. AND date_format(refund_success_date,'%y-%m-%d %H:%i:%s') &lt;= date_format(#{endTime},'%y-%m-%d %H:%i:%s')
  139. </if>
  140. </if>
  141. <if test="refundSuccessStatus != '1'.toString() ">
  142. <if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
  143. AND date_format(created_date,'%y-%m-%d %H:%i:%s') &gt;= date_format(#{beginTime},'%y-%m-%d %H:%i:%s')
  144. </if>
  145. <if test="endTime != null and endTime != ''"><!-- 结束时间检索 -->
  146. AND date_format(created_date,'%y-%m-%d %H:%i:%s') &lt;= date_format(#{endTime},'%y-%m-%d %H:%i:%s')
  147. </if>
  148. </if>
  149. <if test="stationIdList != null ">
  150. and station_id in
  151. <foreach item="item" index="index" collection="stationIdList"
  152. open="(" separator="," close=")">
  153. #{item}
  154. </foreach>
  155. </if>
  156. </where>
  157. order by order_id desc
  158. </select>
  159. <!--查询导出数据-->
  160. <select id="selectPayOrderExport" parameterType="PayOrder" resultMap="PayOrderResult">
  161. select order_no,oil_name,oil_pirce,order_liters, amt,consumer,oil_personnel,oil_gun,pay_type,pay_way,sell_oil_price,driver_oil_price
  162. from pay_order
  163. <where>
  164. <if test="orderNo != null and orderNo != ''"> and order_no = #{orderNo}</if>
  165. <if test="stationId != null "> and station_id = #{stationId}</if>
  166. <if test="status != null and status != ''"> and status = #{status}</if>
  167. <if test="status == null or status == ''"> and p.status != 0</if>
  168. <if test="consumerId != null "> and consumer_id = #{consumerId}</if>
  169. <if test="consumer != null and consumer != ''"> and consumer = #{consumer}</if>
  170. <if test="oilGun != null and oilGun != ''"> and oil_gun = #{oilGun}</if>
  171. <if test="oilName != null and oilName != ''"> and oil_name like concat('%', #{oilName}, '%')</if>
  172. <if test="oilPirce != null "> and oil_pirce = #{oilPirce}</if>
  173. <if test="oilType != null and oilType != ''"> and oil_type = #{oilType}</if>
  174. <if test="orderLiters != null "> and order_liters = #{orderLiters}</if>
  175. <if test="amt != null "> and amt = #{amt}</if>
  176. <if test="receivableAmt != null "> and receivable_amt = #{receivableAmt}</if>
  177. <if test="receivedAmt != null "> and received_amt = #{receivedAmt}</if>
  178. <if test="discountAmt != null "> and discount_amt = #{discountAmt}</if>
  179. <if test="discountCouponAmt != null "> and discount_coupon_amt = #{discountCouponAmt}</if>
  180. <if test="discountCoupon != null and discountCoupon != ''"> and discount_coupon = #{discountCoupon}</if>
  181. <if test="wxAmt != null "> and wx_amt = #{wxAmt}</if>
  182. <if test="zfbAmt != null "> and zfb_amt = #{zfbAmt}</if>
  183. <if test="posAmt != null "> and pos_amt = #{posAmt}</if>
  184. <if test="xjAmt != null "> and xj_amt = #{xjAmt}</if>
  185. <if test="didiAppAmt != null "> and didi_app_amt = #{didiAppAmt}</if>
  186. <if test="tyAppAmt != null "> and ty_app_amt = #{tyAppAmt}</if>
  187. <if test="otherAmt != null "> and other_amt = #{otherAmt}</if>
  188. <if test="dzkAmt != null "> and dzk_amt = #{dzkAmt}</if>
  189. <if test="score != null "> and score = #{score}</if>
  190. <if test="memberNo != null and memberNo != ''"> and member_no = #{memberNo}</if>
  191. <if test="memberAmt != null "> and member_amt = #{memberAmt}</if>
  192. <if test="printCount != null "> and print_count = #{printCount}</if>
  193. <if test="payType != null and payType != ''"> and pay_type = #{payType}</if>
  194. <if test="payWay != null and payWay != ''"> and pay_way = #{payWay}</if>
  195. <if test="oilPersonnel != null and oilPersonnel != ''"> and oil_personnel = #{oilPersonnel}</if>
  196. <if test="payDate != null "> and pay_date = #{payDate}</if>
  197. <if test="createdDate != null "> and created_date = #{createdDate}</if>
  198. <if test="orderType != null and orderType != ''"> and order_type = #{orderType}</if>
  199. <if test="carNo != null and carNo != ''"> and car_no = #{carNo}</if>
  200. <if test="refundUser != null and refundUser != ''"> and refund_user = #{refundUser}</if>
  201. <if test="refundDate != null and refundDate != ''"> and refund_date = #{refundDate}</if>
  202. <if test="examinUser != null and examinUser != ''"> and examin_user = #{examinUser}</if>
  203. <if test="examinDate != null and examinDate != ''"> and examin_date = #{examinDate}</if>
  204. <if test="examinStatus != null and examinStatus != ''"> and examin_status = #{examinStatus}</if>
  205. <if test="customerPhone != null and customerPhone != ''"> and customer_phone like concat('%',#{customerPhone}, '%') </if>
  206. <if test="customerGrade != null and customerGrade != ''"> and customer_grade like concat('%',#{customerGrade}, '%') </if>
  207. <if test="stationIdList != null ">
  208. and station_id in
  209. <foreach item="item" index="index" collection="stationIdList"
  210. open="(" separator="," close=")">
  211. #{item}
  212. </foreach>
  213. </if>
  214. <if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
  215. AND date_format(created_date,'%y-%m-%d %H:%i:%s') &gt;= date_format(#{beginTime},'%y-%m-%d %H:%i:%s')
  216. </if>
  217. <if test="endTime != null and endTime != ''"><!-- 结束时间检索 -->
  218. AND date_format(created_date,'%y-%m-%d %H:%i:%s') &lt;= date_format(#{endTime},'%y-%m-%d %H:%i:%s')
  219. </if>
  220. </where>
  221. order by order_id desc
  222. </select>
  223. <!--用戶信息关联订单查询-->
  224. <select id="selectUserPayOrderList" parameterType="PayOrder" resultMap="PayOrderResult">
  225. SELECT order_id,dept_name as station_name,oil_name,order_no,p.oil_pirce,order_liters,receivable_amt,amt,sell_amt,sell_discount_amt,amt,discount_amt,pay_date,mobile_phone as customer_phone,sell_oil_price,driver_oil_price,driver_discount_amt
  226. from pay_order p
  227. left join sys_dept d on d.dept_id =p.station_id
  228. join app_user_info a on a.user_id=p.consumer_id
  229. <where>
  230. <if test="orderNo != null and orderNo != ''"> and p.order_no = #{orderNo}</if>
  231. <if test="stationId != null "> and p.station_id = #{stationId}</if>
  232. <if test="status != null and status != ''"> and p.status = #{status}</if>
  233. <if test="status == null or status == ''"> and p.status != 0</if>
  234. <if test="consumerId != null "> and consumer_id = #{consumerId}</if>
  235. <if test="consumer != null and consumer != ''"> and consumer = #{consumer}</if>
  236. <if test="oilGun != null and oilGun != ''"> and oil_gun = #{oilGun}</if>
  237. <if test="oilName != null and oilName != ''"> and oil_name like concat('%', #{oilName}, '%')</if>
  238. <if test="oilPirce != null "> and oil_pirce = #{oilPirce}</if>
  239. <if test="oilType != null and oilType != ''"> and oil_type = #{oilType}</if>
  240. <if test="orderLiters != null "> and order_liters = #{orderLiters}</if>
  241. <if test="amt != null "> and amt = #{amt}</if>
  242. <if test="receivableAmt != null "> and receivable_amt = #{receivableAmt}</if>
  243. <if test="receivedAmt != null "> and received_amt = #{receivedAmt}</if>
  244. <if test="discountAmt != null "> and discount_amt = #{discountAmt}</if>
  245. <if test="discountCouponAmt != null "> and discount_coupon_amt = #{discountCouponAmt}</if>
  246. <if test="discountCoupon != null and discountCoupon != ''"> and discount_coupon = #{discountCoupon}</if>
  247. <if test="wxAmt != null "> and wx_amt = #{wxAmt}</if>
  248. <if test="zfbAmt != null "> and zfb_amt = #{zfbAmt}</if>
  249. <if test="posAmt != null "> and pos_amt = #{posAmt}</if>
  250. <if test="xjAmt != null "> and xj_amt = #{xjAmt}</if>
  251. <if test="didiAppAmt != null "> and didi_app_amt = #{didiAppAmt}</if>
  252. <if test="tyAppAmt != null "> and ty_app_amt = #{tyAppAmt}</if>
  253. <if test="otherAmt != null "> and other_amt = #{otherAmt}</if>
  254. <if test="dzkAmt != null "> and dzk_amt = #{dzkAmt}</if>
  255. <if test="score != null "> and score = #{score}</if>
  256. <if test="oilPersonnelId != null and oilPersonnelId != ''"> and oil_personnel_id = #{oilPersonnelId}</if>
  257. <if test="memberNo != null and memberNo != ''"> and member_no = #{memberNo}</if>
  258. <if test="memberAmt != null "> and member_amt = #{memberAmt}</if>
  259. <if test="printCount != null "> and print_count = #{printCount}</if>
  260. <if test="payType != null and payType != ''"> and pay_type = #{payType}</if>
  261. <if test="payWay != null and payWay != ''"> and pay_way = #{payWay}</if>
  262. <if test="oilPersonnel != null and oilPersonnel != ''"> and oil_personnel = #{oilPersonnel}</if>
  263. <if test="payDate != null "> and pay_date = #{payDate}</if>
  264. <if test="createdDate != null "> and created_date = #{createdDate}</if>
  265. <if test="orderType != null and orderType != ''"> and order_type = #{orderType}</if>
  266. <if test="carNo != null and carNo != ''"> and car_no = #{carNo}</if>
  267. <if test="refundUser != null and refundUser != ''"> and refund_user = #{refundUser}</if>
  268. <if test="refundDate != null and refundDate != ''"> and refund_date = #{refundDate}</if>
  269. <if test="examinUser != null and examinUser != ''"> and examin_user = #{examinUser}</if>
  270. <if test="examinDate != null and examinDate != ''"> and examin_date = #{examinDate}</if>
  271. <if test="examinStatus != null and examinStatus != ''"> and examin_status = #{examinStatus}</if>
  272. <if test="customerPhone != null and customerPhone != ''"> and mobile_phone like concat('%',#{customerPhone}, '%') </if>
  273. <if test="customerGrade != null and customerGrade != ''"> and customer_grade like concat('%',#{customerGrade}, '%') </if>
  274. <if test="stationIdList != null ">
  275. and p.station_id in
  276. <foreach item="item" index="index" collection="stationIdList"
  277. open="(" separator="," close=")">
  278. #{item}
  279. </foreach>
  280. </if>
  281. <if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
  282. AND date_format(p.created_date,'%y-%m-%d %H:%i:%s') &gt;= date_format(#{beginTime},'%y-%m-%d %H:%i:%s')
  283. </if>
  284. <if test="endTime != null and endTime != ''"><!-- 结束时间检索 -->
  285. AND date_format(p.created_date,'%y-%m-%d %H:%i:%s') &lt;= date_format(#{endTime},'%y-%m-%d %H:%i:%s')
  286. </if>
  287. </where>
  288. order by order_id desc
  289. </select>
  290. <!--查询LNG导出数据-->
  291. <select id="selectLNGPayOrderExport" parameterType="PayOrder" resultMap="PayOrderResult">
  292. SELECT order_id,dept_name as station_name,oil_name,order_no,p.oil_pirce,order_liters,receivable_amt,amt,sell_amt,sell_discount_amt,discount_amt,pay_date,mobile_phone,sell_oil_price,driver_oil_price,driver_discount_amt,p.status
  293. from pay_order p
  294. left join sys_dept d on d.dept_id =p.station_id
  295. join app_user_info a on a.user_id=p.consumer_id
  296. <where>
  297. <if test="orderNo != null and orderNo != ''"> and p.order_no = #{orderNo}</if>
  298. <if test="stationId != null "> and p.station_id = #{stationId}</if>
  299. <if test="status != null and status != ''"> and (p.status = #{status} or p.status=2)</if>
  300. <if test="status == null or status == ''"> and p.status != 0</if>
  301. <if test="consumerId != null "> and consumer_id = #{consumerId}</if>
  302. <if test="consumer != null and consumer != ''"> and consumer = #{consumer}</if>
  303. <if test="oilGun != null and oilGun != ''"> and oil_gun = #{oilGun}</if>
  304. <if test="oilName != null and oilName != ''"> and oil_name like concat('%', #{oilName}, '%')</if>
  305. <if test="oilPirce != null "> and oil_pirce = #{oilPirce}</if>
  306. <if test="oilType != null and oilType != ''"> and oil_type = #{oilType}</if>
  307. <if test="orderLiters != null "> and order_liters = #{orderLiters}</if>
  308. <if test="amt != null "> and amt = #{amt}</if>
  309. <if test="receivableAmt != null "> and receivable_amt = #{receivableAmt}</if>
  310. <if test="receivedAmt != null "> and received_amt = #{receivedAmt}</if>
  311. <if test="discountAmt != null "> and discount_amt = #{discountAmt}</if>
  312. <if test="discountCouponAmt != null "> and discount_coupon_amt = #{discountCouponAmt}</if>
  313. <if test="discountCoupon != null and discountCoupon != ''"> and discount_coupon = #{discountCoupon}</if>
  314. <if test="wxAmt != null "> and wx_amt = #{wxAmt}</if>
  315. <if test="zfbAmt != null "> and zfb_amt = #{zfbAmt}</if>
  316. <if test="posAmt != null "> and pos_amt = #{posAmt}</if>
  317. <if test="xjAmt != null "> and xj_amt = #{xjAmt}</if>
  318. <if test="didiAppAmt != null "> and didi_app_amt = #{didiAppAmt}</if>
  319. <if test="tyAppAmt != null "> and ty_app_amt = #{tyAppAmt}</if>
  320. <if test="otherAmt != null "> and other_amt = #{otherAmt}</if>
  321. <if test="dzkAmt != null "> and dzk_amt = #{dzkAmt}</if>
  322. <if test="score != null "> and score = #{score}</if>
  323. <if test="oilPersonnelId != null and oilPersonnelId != ''"> and oil_personnel_id = #{oilPersonnelId}</if>
  324. <if test="memberNo != null and memberNo != ''"> and member_no = #{memberNo}</if>
  325. <if test="memberAmt != null "> and member_amt = #{memberAmt}</if>
  326. <if test="printCount != null "> and print_count = #{printCount}</if>
  327. <if test="payType != null and payType != ''"> and pay_type = #{payType}</if>
  328. <if test="payWay != null and payWay != ''"> and pay_way = #{payWay}</if>
  329. <if test="oilPersonnel != null and oilPersonnel != ''"> and oil_personnel = #{oilPersonnel}</if>
  330. <if test="payDate != null "> and pay_date = #{payDate}</if>
  331. <if test="createdDate != null "> and created_date = #{createdDate}</if>
  332. <if test="orderType != null and orderType != ''"> and order_type = #{orderType}</if>
  333. <if test="carNo != null and carNo != ''"> and car_no = #{carNo}</if>
  334. <if test="refundUser != null and refundUser != ''"> and refund_user = #{refundUser}</if>
  335. <if test="refundDate != null and refundDate != ''"> and refund_date = #{refundDate}</if>
  336. <if test="examinUser != null and examinUser != ''"> and examin_user = #{examinUser}</if>
  337. <if test="examinDate != null and examinDate != ''"> and examin_date = #{examinDate}</if>
  338. <if test="examinStatus != null and examinStatus != ''"> and examin_status = #{examinStatus}</if>
  339. <if test="customerPhone != null and customerPhone != ''"> and mobile_phone like concat('%',#{customerPhone}, '%') </if>
  340. <if test="customerGrade != null and customerGrade != ''"> and customer_grade like concat('%',#{customerGrade}, '%') </if>
  341. <if test="stationIdList != null ">
  342. and p.station_id in
  343. <foreach item="item" index="index" collection="stationIdList"
  344. open="(" separator="," close=")">
  345. #{item}
  346. </foreach>
  347. </if>
  348. <if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
  349. AND date_format(p.created_date,'%y-%m-%d %H:%i:%s') &gt;= date_format(#{beginTime},'%y-%m-%d %H:%i:%s')
  350. </if>
  351. <if test="endTime != null and endTime != ''"><!-- 结束时间检索 -->
  352. AND date_format(p.created_date,'%y-%m-%d %H:%i:%s') &lt;= date_format(#{endTime},'%y-%m-%d %H:%i:%s')
  353. </if>
  354. </where>
  355. order by order_id desc
  356. </select>
  357. <select id="LNGDeptList" parameterType="PayOrder" resultMap="PayOrderResult">
  358. SELECT dept_name as station_name,order_id,order_no,oil_name,p.oil_pirce,sell_oil_price,order_liters,receivable_amt,sell_amt,sell_discount_amt,pay_date,driver_discount_amt,
  359. concat(LEFT (mobile_phone, 3), '****', RIGHT (mobile_phone, 4)) mobile_phone,p.status
  360. from pay_order p
  361. left join sys_dept d on d.dept_id =p.station_id
  362. join app_user_info a on a.user_id=p.consumer_id
  363. <where>
  364. <if test="orderNo != null and orderNo != ''"> and p.order_no = #{orderNo}</if>
  365. <if test="stationId != null "> and p.station_id = #{stationId}</if>
  366. <if test="status != null and status != ''"> and (p.status = #{status} or p.status=2)</if>
  367. <if test="status == null or status == ''"> and p.status != 0</if>
  368. <if test="consumerId != null "> and p.consumer_id = #{consumerId}</if>
  369. <if test="consumer != null and consumer != ''"> and consumer = #{consumer}</if>
  370. <if test="oilGun != null and oilGun != ''"> and oil_gun = #{oilGun}</if>
  371. <if test="oilName != null and oilName != ''"> and oil_name like concat('%', #{oilName}, '%')</if>
  372. <if test="oilPirce != null "> and oil_pirce = #{oilPirce}</if>
  373. <if test="oilType != null and oilType != ''"> and oil_type = #{oilType}</if>
  374. <if test="orderLiters != null "> and order_liters = #{orderLiters}</if>
  375. <if test="amt != null "> and amt = #{amt}</if>
  376. <if test="receivableAmt != null "> and receivable_amt = #{receivableAmt}</if>
  377. <if test="receivedAmt != null "> and received_amt = #{receivedAmt}</if>
  378. <if test="discountAmt != null "> and discount_amt = #{discountAmt}</if>
  379. <if test="discountCouponAmt != null "> and discount_coupon_amt = #{discountCouponAmt}</if>
  380. <if test="discountCoupon != null and discountCoupon != ''"> and discount_coupon = #{discountCoupon}</if>
  381. <if test="wxAmt != null "> and wx_amt = #{wxAmt}</if>
  382. <if test="zfbAmt != null "> and zfb_amt = #{zfbAmt}</if>
  383. <if test="posAmt != null "> and pos_amt = #{posAmt}</if>
  384. <if test="xjAmt != null "> and xj_amt = #{xjAmt}</if>
  385. <if test="didiAppAmt != null "> and didi_app_amt = #{didiAppAmt}</if>
  386. <if test="tyAppAmt != null "> and ty_app_amt = #{tyAppAmt}</if>
  387. <if test="otherAmt != null "> and other_amt = #{otherAmt}</if>
  388. <if test="dzkAmt != null "> and dzk_amt = #{dzkAmt}</if>
  389. <if test="score != null "> and score = #{score}</if>
  390. <if test="memberNo != null and memberNo != ''"> and member_no = #{memberNo}</if>
  391. <if test="memberAmt != null "> and member_amt = #{memberAmt}</if>
  392. <if test="printCount != null "> and print_count = #{printCount}</if>
  393. <if test="payType != null and payType != ''"> and pay_type = #{payType}</if>
  394. <if test="payWay != null and payWay != ''"> and pay_way = #{payWay}</if>
  395. <if test="oilPersonnel != null and oilPersonnel != ''"> and oil_personnel = #{oilPersonnel}</if>
  396. <if test="payDate != null "> and pay_date = #{payDate}</if>
  397. <if test="createdDate != null "> and created_date = #{createdDate}</if>
  398. <if test="orderType != null and orderType != ''"> and order_type = #{orderType}</if>
  399. <if test="carNo != null and carNo != ''"> and car_no = #{carNo}</if>
  400. <if test="refundUser != null and refundUser != ''"> and refund_user = #{refundUser}</if>
  401. <if test="refundDate != null and refundDate != ''"> and refund_date = #{refundDate}</if>
  402. <if test="examinUser != null and examinUser != ''"> and examin_user = #{examinUser}</if>
  403. <if test="examinDate != null and examinDate != ''"> and examin_date = #{examinDate}</if>
  404. <if test="examinStatus != null and examinStatus != ''"> and examin_status = #{examinStatus}</if>
  405. <if test="customerPhone != null and customerPhone != ''"> and customer_phone like concat('%',#{customerPhone}, '%') </if>
  406. <if test="customerGrade != null and customerGrade != ''"> and customer_grade like concat('%',#{customerGrade}, '%') </if>
  407. <if test="stationIdList != null ">
  408. and p.station_id in
  409. <foreach item="item" index="index" collection="stationIdList"
  410. open="(" separator="," close=")">
  411. #{item}
  412. </foreach>
  413. </if>
  414. <if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
  415. AND date_format(p.created_date,'%y-%m-%d %H:%i:%s') &gt;= date_format(#{beginTime},'%y-%m-%d %H:%i:%s')
  416. </if>
  417. <if test="endTime != null and endTime != ''"><!-- 结束时间检索 -->
  418. AND date_format(p.created_date,'%y-%m-%d %H:%i:%s') &lt;= date_format(#{endTime},'%y-%m-%d %H:%i:%s')
  419. </if>
  420. </where>
  421. order by order_id desc
  422. </select>
  423. <select id="LNGDeptListAll" parameterType="PayOrder" resultMap="PayOrderResult">
  424. SELECT dept_name as station_name,order_id,order_no,oil_name,p.oil_pirce,sell_oil_price,order_liters,receivable_amt,sell_amt,sell_discount_amt,pay_date,driver_discount_amt,
  425. concat(LEFT (mobile_phone, 3), '****', RIGHT (mobile_phone, 4)) mobile_phone,p.status
  426. from pay_order p
  427. left join sys_dept d on d.dept_id =p.station_id
  428. join app_user_info a on a.user_id=p.consumer_id
  429. <where>
  430. <if test="orderNo != null and orderNo != ''"> and p.order_no = #{orderNo}</if>
  431. <if test="stationId != null "> and p.station_id = #{stationId}</if>
  432. <if test="status != null and status != ''"> and p.status = #{status}</if>
  433. <if test="status == null or status == ''"> and p.status != 0</if>
  434. <if test="consumerId != null "> and p.consumer_id = #{consumerId}</if>
  435. <if test="consumer != null and consumer != ''"> and consumer = #{consumer}</if>
  436. <if test="oilGun != null and oilGun != ''"> and oil_gun = #{oilGun}</if>
  437. <if test="oilName != null and oilName != ''"> and oil_name like concat('%', #{oilName}, '%')</if>
  438. <if test="oilPirce != null "> and oil_pirce = #{oilPirce}</if>
  439. <if test="oilType != null and oilType != ''"> and oil_type = #{oilType}</if>
  440. <if test="orderLiters != null "> and order_liters = #{orderLiters}</if>
  441. <if test="amt != null "> and amt = #{amt}</if>
  442. <if test="receivableAmt != null "> and receivable_amt = #{receivableAmt}</if>
  443. <if test="receivedAmt != null "> and received_amt = #{receivedAmt}</if>
  444. <if test="discountAmt != null "> and discount_amt = #{discountAmt}</if>
  445. <if test="discountCouponAmt != null "> and discount_coupon_amt = #{discountCouponAmt}</if>
  446. <if test="discountCoupon != null and discountCoupon != ''"> and discount_coupon = #{discountCoupon}</if>
  447. <if test="wxAmt != null "> and wx_amt = #{wxAmt}</if>
  448. <if test="zfbAmt != null "> and zfb_amt = #{zfbAmt}</if>
  449. <if test="posAmt != null "> and pos_amt = #{posAmt}</if>
  450. <if test="xjAmt != null "> and xj_amt = #{xjAmt}</if>
  451. <if test="didiAppAmt != null "> and didi_app_amt = #{didiAppAmt}</if>
  452. <if test="tyAppAmt != null "> and ty_app_amt = #{tyAppAmt}</if>
  453. <if test="otherAmt != null "> and other_amt = #{otherAmt}</if>
  454. <if test="dzkAmt != null "> and dzk_amt = #{dzkAmt}</if>
  455. <if test="score != null "> and score = #{score}</if>
  456. <if test="memberNo != null and memberNo != ''"> and member_no = #{memberNo}</if>
  457. <if test="memberAmt != null "> and member_amt = #{memberAmt}</if>
  458. <if test="printCount != null "> and print_count = #{printCount}</if>
  459. <if test="payType != null and payType != ''"> and pay_type = #{payType}</if>
  460. <if test="payWay != null and payWay != ''"> and pay_way = #{payWay}</if>
  461. <if test="oilPersonnel != null and oilPersonnel != ''"> and oil_personnel = #{oilPersonnel}</if>
  462. <if test="payDate != null "> and pay_date = #{payDate}</if>
  463. <if test="createdDate != null "> and created_date = #{createdDate}</if>
  464. <if test="orderType != null and orderType != ''"> and order_type = #{orderType}</if>
  465. <if test="carNo != null and carNo != ''"> and car_no = #{carNo}</if>
  466. <if test="customerPhone != null and customerPhone != ''"> and customer_phone like concat('%',#{customerPhone}, '%') </if>
  467. <if test="customerGrade != null and customerGrade != ''"> and customer_grade like concat('%',#{customerGrade}, '%') </if>
  468. <if test="stationIdList != null ">
  469. and p.station_id in
  470. <foreach item="item" index="index" collection="stationIdList"
  471. open="(" separator="," close=")">
  472. #{item}
  473. </foreach>
  474. </if>
  475. <if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
  476. AND date_format(p.created_date,'%y-%m-%d %H:%i:%s') &gt;= date_format(#{beginTime},'%y-%m-%d %H:%i:%s')
  477. </if>
  478. <if test="endTime != null and endTime != ''"><!-- 结束时间检索 -->
  479. AND date_format(p.created_date,'%y-%m-%d %H:%i:%s') &lt;= date_format(#{endTime},'%y-%m-%d %H:%i:%s')
  480. </if>
  481. </where>
  482. order by order_id desc
  483. </select>
  484. <select id="selectPayOrderById" parameterType="Long" resultMap="PayOrderResult">
  485. select order_id, order_no, p.station_id, p.station_name, p.status,consumer_id, consumer, oil_gun,
  486. oil_name, oil_pirce, oil_type, order_liters, amt, receivable_amt, received_amt, discount_amt,sell_oil_price,driver_oil_price,
  487. discount_coupon_amt, discount_coupon, wx_amt, zfb_amt, pos_amt, xj_amt, didi_app_amt, ty_app_amt,
  488. other_amt, dzk_amt, score, member_no, member_amt, print_count, pay_type, pay_way, oil_personnel,oil_personnel_id,
  489. pay_date, created_date, order_type, car_no,customer_grade,sell_amt,sell_discount_amt,d.mobile_phone as customer_phone,
  490. examin_user,examin_date,refund_user,refund_date,examin_status
  491. from pay_order p join app_user_info d on p.consumer_id =d.user_id
  492. where order_id = #{orderId}
  493. </select>
  494. <select id="selectDaySources" parameterType="PayOrder" resultMap="PayOrderResult">
  495. SELECT SUM(amt) as amt,sum(order_liters) as order_liters,sum(sell_amt) as sell_amt,count(1) count_num
  496. from pay_order
  497. <where>
  498. <if test="stationId != null "> and station_id = #{stationId}</if>
  499. <if test="status != null "> and status = #{status}</if>
  500. <if test="status == null or status == ''"> and status != 0</if>
  501. <if test="orderType != null and orderType != ''"> and order_type = #{orderType}</if>
  502. <if test="createdDate != null "> and created_date like concat(#{createdDate}, '%') </if>
  503. <if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
  504. AND date_format(created_date,'%Y-%m-%d %H:%i:%s') &gt;= date_format(#{beginTime},'%Y-%m-%d %H:%i:%s')
  505. </if>
  506. <if test="endTime != null and endTime != ''"><!-- 结束时间检索 -->
  507. AND date_format(created_date,'%Y-%m-%d %H:%i:%s') &lt;= date_format(#{endTime},'%Y-%m-%d %H:%i:%s')
  508. </if>
  509. <if test="stationIdList != null ">
  510. and station_id in
  511. <foreach item="item" index="index" collection="stationIdList"
  512. open="(" separator="," close=")">
  513. #{item}
  514. </foreach>
  515. </if>
  516. </where>
  517. </select>
  518. <select id="selectAllDaySources" parameterType="PayOrder" resultMap="PayOrderResult">
  519. SELECT SUM(amt) as amt,sum(order_liters) as order_liters,sum(sell_amt) as sell_amt,count(1) count_num
  520. from pay_order
  521. <where>
  522. <if test="stationId != null "> and station_id = #{stationId}</if>
  523. <if test="status != null "> and (status = #{status} or status=2)</if>
  524. <if test="status == null or status == ''"> and status != 0</if>
  525. <if test="orderType != null and orderType != ''"> and order_type = #{orderType}</if>
  526. <if test="createdDate != null "> and created_date like concat(#{createdDate}, '%') </if>
  527. <if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
  528. AND date_format(created_date,'%Y-%m-%d %H:%i:%s') &gt;= date_format(#{beginTime},'%Y-%m-%d %H:%i:%s')
  529. </if>
  530. <if test="endTime != null and endTime != ''"><!-- 结束时间检索 -->
  531. AND date_format(created_date,'%Y-%m-%d %H:%i:%s') &lt;= date_format(#{endTime},'%Y-%m-%d %H:%i:%s')
  532. </if>
  533. <if test="stationIdList != null ">
  534. and station_id in
  535. <foreach item="item" index="index" collection="stationIdList"
  536. open="(" separator="," close=")">
  537. #{item}
  538. </foreach>
  539. </if>
  540. </where>
  541. </select>
  542. <select id="selectOilTypeSources" parameterType="Long" resultMap="PayOrderResult">
  543. SELECT SUM(amt) as amt,sum(order_liters) as order_liters,sum(sell_amt) sell_amt, oil_type,count(1) count_num
  544. from pay_order
  545. <where>
  546. <if test="stationId != null "> and station_id = #{stationId}</if>
  547. <if test="status != null "> and status = #{status}</if>
  548. <if test="status == null or status == ''"> and status != 0</if>
  549. <if test="orderType != null and orderType != ''"> and order_type = #{orderType}</if>
  550. <if test="createdDate != null "> and created_date = #{createdDate}</if>
  551. <if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
  552. AND date_format(created_date,'%Y-%m-%d %H:%i:%s') &gt;= date_format(#{beginTime},'%Y-%m-%d %H:%i:%s')
  553. </if>
  554. <if test="endTime != null and endTime != ''"><!-- 结束时间检索 -->
  555. AND date_format(created_date,'%Y-%m-%d %H:%i:%s') &lt;= date_format(#{endTime},'%Y-%m-%d %H:%i:%s')
  556. </if>
  557. <if test="stationIdList != null ">
  558. and station_id in
  559. <foreach item="item" index="index" collection="stationIdList"
  560. open="(" separator="," close=")">
  561. #{item}
  562. </foreach>
  563. </if>
  564. </where>
  565. GROUP BY oil_type
  566. </select>
  567. <select id="selectAllOilTypeSources" parameterType="Long" resultMap="PayOrderResult">
  568. SELECT SUM(amt) as amt,sum(order_liters) as order_liters,sum(sell_amt) sell_amt, oil_type,count(1) count_num
  569. from pay_order
  570. <where>
  571. <if test="stationId != null "> and station_id = #{stationId}</if>
  572. <if test="status != null "> and (status = #{status} or status=2)</if>
  573. <if test="status == null or status == ''"> and status != 0</if>
  574. <if test="orderType != null and orderType != ''"> and order_type = #{orderType}</if>
  575. <if test="createdDate != null "> and created_date = #{createdDate}</if>
  576. <if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
  577. AND date_format(created_date,'%Y-%m-%d %H:%i:%s') &gt;= date_format(#{beginTime},'%Y-%m-%d %H:%i:%s')
  578. </if>
  579. <if test="endTime != null and endTime != ''"><!-- 结束时间检索 -->
  580. AND date_format(created_date,'%Y-%m-%d %H:%i:%s') &lt;= date_format(#{endTime},'%Y-%m-%d %H:%i:%s')
  581. </if>
  582. <if test="stationIdList != null ">
  583. and station_id in
  584. <foreach item="item" index="index" collection="stationIdList"
  585. open="(" separator="," close=")">
  586. #{item}
  587. </foreach>
  588. </if>
  589. </where>
  590. GROUP BY oil_type
  591. </select>
  592. <select id="dayOilTypeSources" parameterType="Long" resultMap="PayOrderResult">
  593. SELECT oil_name,GROUP_CONCAT(DISTINCT oil_gun) as oil_gun,sum(order_liters) as order_liters,SUM(receivable_amt) as receivable_amt,
  594. sum(discount_amt) as discount_amt,sum(discount_coupon_amt) as discount_coupon_amt,sum(amt) as amt,
  595. sum(member_amt) as member_amt,sum(wx_amt) as wx_amt,sum(zfb_amt) as zfb_amt
  596. from pay_order
  597. <where>
  598. <if test="stationId != null "> and station_id = #{stationId}</if>
  599. <if test="status != null "> and status = #{status}</if>
  600. <if test="status == null or status == ''"> and status != 0</if>
  601. <if test="orderType != null and orderType != ''"> and order_type = #{orderType}</if>
  602. <if test="createdDate != null "> and created_date = #{createdDate}</if>
  603. <if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
  604. AND date_format(created_date,'%Y-%m-%d %H:%i:%s') &gt;= date_format(#{beginTime},'%Y-%m-%d %H:%i:%s')
  605. </if>
  606. <if test="endTime != null and endTime != ''"><!-- 结束时间检索 -->
  607. AND date_format(created_date,'%Y-%m-%d %H:%i:%s') &lt;= date_format(#{endTime},'%Y-%m-%d %H:%i:%s')
  608. </if>
  609. <if test="stationIdList != null ">
  610. and station_id in
  611. <foreach item="item" index="index" collection="stationIdList"
  612. open="(" separator="," close=")">
  613. #{item}
  614. </foreach>
  615. </if>
  616. </where>
  617. GROUP BY oil_name
  618. </select>
  619. <select id="dayAllOilTypeSources" parameterType="Long" resultMap="PayOrderResult">
  620. SELECT oil_name,GROUP_CONCAT(DISTINCT oil_gun) as oil_gun,sum(order_liters) as order_liters,SUM(receivable_amt) as receivable_amt,
  621. sum(discount_amt) as discount_amt,sum(discount_coupon_amt) as discount_coupon_amt,sum(amt) as amt,
  622. sum(member_amt) as member_amt,sum(wx_amt) as wx_amt,sum(zfb_amt) as zfb_amt
  623. from pay_order
  624. <where>
  625. <if test="stationId != null "> and station_id = #{stationId}</if>
  626. <if test="status != null "> and (status = #{status} or status=2)</if>
  627. <if test="status == null or status == ''"> and status != 0</if>
  628. <if test="orderType != null and orderType != ''"> and order_type = #{orderType}</if>
  629. <if test="createdDate != null "> and created_date = #{createdDate}</if>
  630. <if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
  631. AND date_format(created_date,'%Y-%m-%d %H:%i:%s') &gt;= date_format(#{beginTime},'%Y-%m-%d %H:%i:%s')
  632. </if>
  633. <if test="endTime != null and endTime != ''"><!-- 结束时间检索 -->
  634. AND date_format(created_date,'%Y-%m-%d %H:%i:%s') &lt;= date_format(#{endTime},'%Y-%m-%d %H:%i:%s')
  635. </if>
  636. <if test="stationIdList != null ">
  637. and station_id in
  638. <foreach item="item" index="index" collection="stationIdList"
  639. open="(" separator="," close=")">
  640. #{item}
  641. </foreach>
  642. </if>
  643. </where>
  644. GROUP BY oil_name
  645. </select>
  646. <select id="selectOverViewData" parameterType="Long" resultMap="PayOrderResult">
  647. SELECT SUM(wx_amt) as wx_amt,sum(zfb_amt) as zfb_amt, sum(dzk_amt) as dzk_amt,sum(pos_amt) as pos_amt, sum(xj_amt) as xj_amt,sum(didi_app_amt) as didi_app_amt,sum(ty_app_amt) as ty_app_amt,sum(other_amt) as other_amt,sum(member_amt) as member_amt
  648. from pay_order
  649. <where>
  650. <if test="stationId != null "> and station_id = #{stationId}</if>
  651. <if test="status != null "> and status = #{status}</if>
  652. <if test="status == null or status == ''"> and status != 0</if>
  653. <if test="orderType != null and orderType != ''"> and order_type = #{orderType}</if>
  654. <if test="createdDate != null "> and created_date = #{createdDate}</if>
  655. <if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
  656. AND date_format(created_date,'%Y-%m-%d %H:%i:%s') &gt;= date_format(#{beginTime},'%Y-%m-%d %H:%i:%s')
  657. </if>
  658. <if test="endTime != null and endTime != ''"><!-- 结束时间检索 -->
  659. AND date_format(created_date,'%Y-%m-%d %H:%i:%s') &lt;= date_format(#{endTime},'%Y-%m-%d %H:%i:%s')
  660. </if>
  661. <if test="stationIdList != null ">
  662. and station_id in
  663. <foreach item="item" index="index" collection="stationIdList"
  664. open="(" separator="," close=")">
  665. #{item}
  666. </foreach>
  667. </if>
  668. </where>
  669. </select>
  670. <select id="selectAllOverViewData" parameterType="Long" resultMap="PayOrderResult">
  671. SELECT SUM(wx_amt) as wx_amt,sum(zfb_amt) as zfb_amt, sum(dzk_amt) as dzk_amt,sum(pos_amt) as pos_amt, sum(xj_amt) as xj_amt,sum(didi_app_amt) as didi_app_amt,sum(ty_app_amt) as ty_app_amt,sum(other_amt) as other_amt,sum(member_amt) as member_amt
  672. from pay_order
  673. <where>
  674. <if test="stationId != null "> and station_id = #{stationId}</if>
  675. <if test="status != null "> and (status = #{status} or status=2)</if>
  676. <if test="status == null or status == ''"> and status != 0</if>
  677. <if test="orderType != null and orderType != ''"> and order_type = #{orderType}</if>
  678. <if test="createdDate != null "> and created_date = #{createdDate}</if>
  679. <if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
  680. AND date_format(created_date,'%Y-%m-%d %H:%i:%s') &gt;= date_format(#{beginTime},'%Y-%m-%d %H:%i:%s')
  681. </if>
  682. <if test="endTime != null and endTime != ''"><!-- 结束时间检索 -->
  683. AND date_format(created_date,'%Y-%m-%d %H:%i:%s') &lt;= date_format(#{endTime},'%Y-%m-%d %H:%i:%s')
  684. </if>
  685. <if test="stationIdList != null ">
  686. and station_id in
  687. <foreach item="item" index="index" collection="stationIdList"
  688. open="(" separator="," close=")">
  689. #{item}
  690. </foreach>
  691. </if>
  692. </where>
  693. </select>
  694. <!--日报数据-->
  695. <select id="selectDayReport" parameterType="Long" resultMap="PayOrderResult">
  696. SELECT
  697. b.created_date,
  698. sum( b.amt ) amt,
  699. sum( b.order_liters ) order_liters,
  700. sum( b.member_amt ) member_amt,
  701. sum( b.receivable_amt ) receivable_amt,
  702. sum( b.received_amt ) received_amt,
  703. MAX(CASE b.oil_type WHEN '1' THEN amt ELSE 0 END) AS qy_amt,
  704. MAX(CASE b.oil_type WHEN '2' THEN amt ELSE 0 END) AS cy_amt,
  705. sum(b.order_no) order_no
  706. from (
  707. SELECT
  708. date_format( a.created_date, '%Y-%m-%d' ) as created_date,
  709. sum( a.amt ) amt,
  710. sum( a.order_liters ) order_liters,
  711. sum( a.member_amt ) member_amt,
  712. sum( a.receivable_amt ) receivable_amt,
  713. sum( a.received_amt ) received_amt,
  714. a.oil_type,
  715. count( 1 ) order_no
  716. FROM
  717. pay_order a
  718. <where>
  719. <if test="stationId != null "> and a.station_id = #{stationId}</if>
  720. <if test="status != null "> and a.status = #{status}</if>
  721. <if test="status == null or status == ''"> and a.status != 0</if>
  722. <if test="orderType != null and orderType != ''"> and a.order_type = #{orderType}</if>
  723. <if test="stationIdList != null ">
  724. and a.station_id in
  725. <foreach item="item" index="index" collection="stationIdList"
  726. open="(" separator="," close=")">
  727. #{item}
  728. </foreach>
  729. </if>
  730. </where>
  731. GROUP BY
  732. date_format( a.created_date, '%Y-%m-%d' ),a.oil_type
  733. ) b
  734. GROUP BY b.created_date
  735. ORDER BY b.created_date desc
  736. </select>
  737. <!--日报数据-->
  738. <select id="selectAllDayReport" parameterType="Long" resultMap="PayOrderResult">
  739. SELECT
  740. b.created_date,
  741. sum( b.amt ) amt,
  742. sum( b.order_liters ) order_liters,
  743. sum( b.member_amt ) member_amt,
  744. sum( b.receivable_amt ) receivable_amt,
  745. sum( b.received_amt ) received_amt,
  746. MAX(CASE b.oil_type WHEN '1' THEN amt ELSE 0 END) AS qy_amt,
  747. MAX(CASE b.oil_type WHEN '2' THEN amt ELSE 0 END) AS cy_amt,
  748. sum(b.order_no) order_no
  749. from (
  750. SELECT
  751. date_format( a.created_date, '%Y-%m-%d' ) as created_date,
  752. sum( a.amt ) amt,
  753. sum( a.order_liters ) order_liters,
  754. sum( a.member_amt ) member_amt,
  755. sum( a.receivable_amt ) receivable_amt,
  756. sum( a.received_amt ) received_amt,
  757. a.oil_type,
  758. count( 1 ) order_no
  759. FROM
  760. pay_order a
  761. <where>
  762. <if test="stationId != null "> and a.station_id = #{stationId}</if>
  763. <if test="status != null "> and (a.status = #{status} or a.status=2)</if>
  764. <if test="status == null or status == ''"> and a.status != 0</if>
  765. <if test="orderType != null and orderType != ''"> and a.order_type = #{orderType}</if>
  766. <if test="stationIdList != null ">
  767. and a.station_id in
  768. <foreach item="item" index="index" collection="stationIdList"
  769. open="(" separator="," close=")">
  770. #{item}
  771. </foreach>
  772. </if>
  773. </where>
  774. GROUP BY
  775. date_format( a.created_date, '%Y-%m-%d' ),a.oil_type
  776. ) b
  777. GROUP BY b.created_date
  778. ORDER BY b.created_date desc
  779. </select>
  780. <!-- 日报折线图油品数据-->
  781. <select id="listQydata" parameterType="Long" resultMap="PayOrderResult">
  782. SELECT sum(amt) as amt,date_format(created_date,'%Y-%m-%d') as created_date
  783. from pay_order
  784. <where>
  785. <if test="stationId != null "> and station_id = #{stationId}</if>
  786. <if test="status != null and status != ''"> and status = #{status}</if>
  787. <if test="orderType != null and orderType != ''"> and order_type = #{orderType}</if>
  788. <if test="oilName != null "> and oil_name = #{oilName}</if>
  789. <if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
  790. AND date_format(created_date,'%Y-%m-%d %H:%i:%s') &gt;= date_format(#{beginTime},'%Y-%m-%d %H:%i:%s')
  791. </if>
  792. <if test="endTime != null and endTime != ''"><!-- 结束时间检索 -->
  793. AND date_format(created_date,'%Y-%m-%d %H:%i:%s') &lt;= date_format(#{endTime},'%Y-%m-%d %H:%i:%s')
  794. </if>
  795. <if test="stationIdList != null ">
  796. and station_id in
  797. <foreach item="item" index="index" collection="stationIdList"
  798. open="(" separator="," close=")">
  799. #{item}
  800. </foreach>
  801. </if>
  802. </where>
  803. GROUP BY oil_name ,date_format(created_date,'%Y-%m-%d')
  804. </select>
  805. <!-- 日报折线图X轴数据-->
  806. <select id="listXdata" parameterType="Long" resultMap="PayOrderResult">
  807. SELECT date_format(created_date,'%Y-%m-%d') as created_date
  808. from pay_order
  809. <where>
  810. <if test="stationId != null "> and station_id = #{stationId}</if>
  811. <if test="status != null and status != ''"> and status = #{status}</if>
  812. <if test="orderType != null and orderType != ''"> and order_type = #{orderType}</if>
  813. <if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
  814. AND date_format(created_date,'%Y-%m-%d %H:%i:%s') &gt;= date_format(#{beginTime},'%Y-%m-%d %H:%i:%s')
  815. </if>
  816. <if test="endTime != null and endTime != ''"><!-- 结束时间检索 -->
  817. AND date_format(created_date,'%Y-%m-%d %H:%i:%s') &lt;= date_format(#{endTime},'%Y-%m-%d %H:%i:%s')
  818. </if>
  819. <if test="stationIdList != null ">
  820. and station_id in
  821. <foreach item="item" index="index" collection="stationIdList"
  822. open="(" separator="," close=")">
  823. #{item}
  824. </foreach>
  825. </if>
  826. </where>
  827. GROUP BY date_format(created_date,'%Y-%m-%d')
  828. </select>
  829. <!--查询数据,根据员工汇总数据-->
  830. <select id="selectPersonnelStructure" parameterType="Long" resultMap="PayOrderResult">
  831. SELECT a.oil_personnel,GROUP_CONCAT(DISTINCT a.oil_gun) as oil_gun,ROUND(SUM(a.amt),2) as amt,ROUND(SUM(order_liters),2) as order_liters,COUNT(order_no) as order_no
  832. from pay_order a
  833. <where>
  834. <if test="stationId != null "> and a.station_id = #{stationId}</if>
  835. <if test="status != null and status != ''"> and status = #{status}</if>
  836. <if test="orderType != null and orderType != ''"> and order_type = #{orderType}</if>
  837. <if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
  838. AND date_format(created_date,'%Y-%m-%d %H:%i:%s') &gt;= date_format(#{beginTime},'%Y-%m-%d %H:%i:%s')
  839. </if>
  840. <if test="endTime != null and endTime != ''"><!-- 结束时间检索 -->
  841. AND date_format(created_date,'%Y-%m-%d %H:%i:%s') &lt;= date_format(#{endTime},'%Y-%m-%d %H:%i:%s')
  842. </if>
  843. <if test="stationIdList != null ">
  844. and station_id in
  845. <foreach item="item" index="index" collection="stationIdList"
  846. open="(" separator="," close=")">
  847. #{item}
  848. </foreach>
  849. </if>
  850. </where>
  851. GROUP BY a.oil_personnel
  852. </select>
  853. <!--初始化数据班结数据,根据油品汇总 -->
  854. <select id="selectOilStructure" parameterType="Long" resultMap="PayOrderResult">
  855. SELECT a.oil_name,GROUP_CONCAT(DISTINCT oil_gun) as oil_gun,ROUND(SUM(a.amt),2) as amt,ROUND(SUM(order_liters),2) as order_liters,COUNT(order_no) as order_no
  856. from pay_order a
  857. <where>
  858. <if test="stationId != null "> and a.station_id = #{stationId}</if>
  859. <if test="status != null and status != ''"> and status = #{status}</if>
  860. <if test="orderType != null and orderType != ''"> and order_type = #{orderType}</if>
  861. <if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
  862. AND date_format(created_date,'%Y-%m-%d %H:%i:%s') &gt;= date_format(#{beginTime},'%Y-%m-%d %H:%i:%s')
  863. </if>
  864. <if test="endTime != null and endTime != ''"><!-- 结束时间检索 -->
  865. AND date_format(created_date,'%Y-%m-%d %H:%i:%s') &lt;= date_format(#{endTime},'%Y-%m-%d %H:%i:%s')
  866. </if>
  867. </where>
  868. GROUP BY a.oil_name
  869. </select>
  870. <!--初始化数据班结数据,根据员工/支付方式汇总 -->
  871. <select id="selectPersonnelPayStructure" parameterType="Long" resultMap="PayOrderResult">
  872. SELECT oil_personnel,GROUP_CONCAT(DISTINCT oil_gun) oil_gun,count(wx_amt) wx_num,count(zfb_amt) zfb_num,count(xj_amt) xj_num,
  873. sum(discount_amt) discount_amt,SUM(discount_coupon_amt) discount_coupon_amt,SUM(wx_amt) wx_amt,SUM(zfb_amt) zfb_amt,
  874. SUM(xj_amt) xj_amt,sum(member_amt) member_amt,sum(dzk_amt) dzk_amt,count(dzk_amt) dzk_num
  875. from pay_order a
  876. <where>
  877. <if test="stationId != null "> and a.station_id = #{stationId}</if>
  878. <if test="status != null and status != ''"> and status = #{status}</if>
  879. <if test="status == null or status == ''"> and status !=0 </if>
  880. <if test="orderType != null and orderType != ''"> and order_type = #{orderType}</if>
  881. <if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
  882. AND date_format(created_date,'%Y-%m-%d %H:%i:%s') &gt;= date_format(#{beginTime},'%Y-%m-%d %H:%i:%s')
  883. </if>
  884. <if test="endTime != null and endTime != ''"><!-- 结束时间检索 -->
  885. AND date_format(created_date,'%Y-%m-%d %H:%i:%s') &lt;= date_format(#{endTime},'%Y-%m-%d %H:%i:%s')
  886. </if>
  887. </where>
  888. GROUP BY a.oil_personnel
  889. </select>
  890. <!--查询本站第一笔数据-->
  891. <select id="getPayOrderInfoMin" parameterType="Long" resultMap="PayOrderResult">
  892. SELECT * from pay_order where order_id = (
  893. SELECT min(order_id)
  894. from pay_order
  895. <where>
  896. <if test="orderNo != null and orderNo != ''"> and order_no = #{orderNo}</if>
  897. <if test="stationId != null "> and station_id = #{stationId}</if>
  898. <if test="status != null and status != ''"> and status = #{status}</if>
  899. <if test="orderType != null and orderType != ''"> and order_type = #{orderType}</if>
  900. </where>
  901. )
  902. </select>
  903. <insert id="insertPayOrder" parameterType="PayOrder" useGeneratedKeys="true" keyProperty="orderId">
  904. insert into pay_order
  905. <trim prefix="(" suffix=")" suffixOverrides=",">
  906. <if test="orderNo != null">order_no,</if>
  907. <if test="stationId != null">station_id,</if>
  908. <if test="status != null">status,</if>
  909. <if test="consumerId != null">consumer_id,</if>
  910. <if test="consumer != null">consumer,</if>
  911. <if test="oilGun != null">oil_gun,</if>
  912. <if test="oilName != null">oil_name,</if>
  913. <if test="oilPirce != null">oil_pirce,</if>
  914. <if test="oilType != null">oil_type,</if>
  915. <if test="orderLiters != null">order_liters,</if>
  916. <if test="amt != null">amt,</if>
  917. <if test="receivableAmt != null">receivable_amt,</if>
  918. <if test="receivedAmt != null">received_amt,</if>
  919. <if test="discountAmt != null">discount_amt,</if>
  920. <if test="discountCouponAmt != null">discount_coupon_amt,</if>
  921. <if test="discountCoupon != null">discount_coupon,</if>
  922. <if test="wxAmt != null">wx_amt,</if>
  923. <if test="zfbAmt != null">zfb_amt,</if>
  924. <if test="posAmt != null">pos_amt,</if>
  925. <if test="xjAmt != null">xj_amt,</if>
  926. <if test="didiAppAmt != null">didi_app_amt,</if>
  927. <if test="tyAppAmt != null">ty_app_amt,</if>
  928. <if test="otherAmt != null">other_amt,</if>
  929. <if test="dzkAmt != null">dzk_amt,</if>
  930. <if test="score != null">score,</if>
  931. <if test="memberNo != null">member_no,</if>
  932. <if test="memberAmt != null">member_amt,</if>
  933. <if test="printCount != null">print_count,</if>
  934. <if test="payType != null">pay_type,</if>
  935. <if test="payWay != null">pay_way,</if>
  936. <if test="oilPersonnel != null">oil_personnel,</if>
  937. <if test="payDate != null">pay_date,</if>
  938. <if test="createdDate != null">created_date,</if>
  939. <if test="orderType != null">order_type,</if>
  940. <if test="carNo != null">car_no,</if>
  941. <if test="customerPhone != null">customer_phone,</if>
  942. <if test="customerGrade != null">customer_grade,</if>
  943. <if test="refundUser != null">refund_user,</if>
  944. <if test="refundDate != null">refund_date,</if>
  945. <if test="examinUser != null">examin_user,</if>
  946. <if test="examinDate != null">examin_date,</if>
  947. <if test="examinStatus != null">examin_status,</if>
  948. <if test="refundSuccessDate != null">refund_success_date,</if>
  949. </trim>
  950. <trim prefix="values (" suffix=")" suffixOverrides=",">
  951. <if test="orderNo != null">#{orderNo},</if>
  952. <if test="stationId != null">#{stationId},</if>
  953. <if test="status != null">#{status},</if>
  954. <if test="consumerId != null">#{consumerId},</if>
  955. <if test="consumer != null">#{consumer},</if>
  956. <if test="oilGun != null">#{oilGun},</if>
  957. <if test="oilName != null">#{oilName},</if>
  958. <if test="oilPirce != null">#{oilPirce},</if>
  959. <if test="oilType != null">#{oilType},</if>
  960. <if test="orderLiters != null">#{orderLiters},</if>
  961. <if test="amt != null">#{amt},</if>
  962. <if test="receivableAmt != null">#{receivableAmt},</if>
  963. <if test="receivedAmt != null">#{receivedAmt},</if>
  964. <if test="discountAmt != null">#{discountAmt},</if>
  965. <if test="discountCouponAmt != null">#{discountCouponAmt},</if>
  966. <if test="discountCoupon != null">#{discountCoupon},</if>
  967. <if test="wxAmt != null">#{wxAmt},</if>
  968. <if test="zfbAmt != null">#{zfbAmt},</if>
  969. <if test="posAmt != null">#{posAmt},</if>
  970. <if test="xjAmt != null">#{xjAmt},</if>
  971. <if test="didiAppAmt != null">#{didiAppAmt},</if>
  972. <if test="tyAppAmt != null">#{tyAppAmt},</if>
  973. <if test="otherAmt != null">#{otherAmt},</if>
  974. <if test="dzkAmt != null">#{dzkAmt},</if>
  975. <if test="score != null">#{score},</if>
  976. <if test="memberNo != null">#{memberNo},</if>
  977. <if test="memberAmt != null">#{memberAmt},</if>
  978. <if test="printCount != null">#{printCount},</if>
  979. <if test="payType != null">#{payType},</if>
  980. <if test="payWay != null">#{payWay},</if>
  981. <if test="oilPersonnel != null">#{oilPersonnel},</if>
  982. <if test="payDate != null">#{payDate},</if>
  983. <if test="createdDate != null">#{createdDate},</if>
  984. <if test="orderType != null">#{orderType},</if>
  985. <if test="carNo != null">#{carNo},</if>
  986. <if test="customerPhone != null">#{customerPhone},</if>
  987. <if test="customerGrade != null">#{customerGrade},</if>
  988. <if test="refundUser != null">#{refundUser},</if>
  989. <if test="refundDate != null">#{refundDate},</if>
  990. <if test="examinUser != null">#{examinUser},</if>
  991. <if test="examinDate != null">#{examinDate},</if>
  992. <if test="examinStatus != null">#{examinStatus},</if>
  993. <if test="refundSuccessDate != null">#{refundSuccessDate},</if>
  994. </trim>
  995. </insert>
  996. <update id="updatePayOrder" parameterType="PayOrder">
  997. update pay_order
  998. <trim prefix="SET" suffixOverrides=",">
  999. <if test="orderNo != null">order_no = #{orderNo},</if>
  1000. <if test="stationId != null">station_id = #{stationId},</if>
  1001. <if test="status != null">status = #{status},</if>
  1002. <if test="consumerId != null">consumer_id = #{consumerId},</if>
  1003. <if test="consumer != null">consumer = #{consumer},</if>
  1004. <if test="oilGun != null">oil_gun = #{oilGun},</if>
  1005. <if test="oilName != null">oil_name = #{oilName},</if>
  1006. <if test="oilPirce != null">oil_pirce = #{oilPirce},</if>
  1007. <if test="oilType != null">oil_type = #{oilType},</if>
  1008. <if test="orderLiters != null">order_liters = #{orderLiters},</if>
  1009. <if test="amt != null">amt = #{amt},</if>
  1010. <if test="receivableAmt != null">receivable_amt = #{receivableAmt},</if>
  1011. <if test="receivedAmt != null">received_amt = #{receivedAmt},</if>
  1012. <if test="discountAmt != null">discount_amt = #{discountAmt},</if>
  1013. <if test="discountCouponAmt != null">discount_coupon_amt = #{discountCouponAmt},</if>
  1014. <if test="discountCoupon != null">discount_coupon = #{discountCoupon},</if>
  1015. <if test="wxAmt != null">wx_amt = #{wxAmt},</if>
  1016. <if test="zfbAmt != null">zfb_amt = #{zfbAmt},</if>
  1017. <if test="posAmt != null">pos_amt = #{posAmt},</if>
  1018. <if test="xjAmt != null">xj_amt = #{xjAmt},</if>
  1019. <if test="didiAppAmt != null">didi_app_amt = #{didiAppAmt},</if>
  1020. <if test="tyAppAmt != null">ty_app_amt = #{tyAppAmt},</if>
  1021. <if test="otherAmt != null">other_amt = #{otherAmt},</if>
  1022. <if test="dzkAmt != null">dzk_amt = #{dzkAmt},</if>
  1023. <if test="score != null">score = #{score},</if>
  1024. <if test="memberNo != null">member_no = #{memberNo},</if>
  1025. <if test="memberAmt != null">member_amt = #{memberAmt},</if>
  1026. <if test="printCount != null">print_count = #{printCount},</if>
  1027. <if test="payType != null">pay_type = #{payType},</if>
  1028. <if test="payWay != null">pay_way = #{payWay},</if>
  1029. <if test="oilPersonnel != null">oil_personnel = #{oilPersonnel},</if>
  1030. <if test="payDate != null">pay_date = #{payDate},</if>
  1031. <if test="createdDate != null">created_date = #{createdDate},</if>
  1032. <if test="orderType != null">order_type = #{orderType},</if>
  1033. <if test="carNo != null">car_no = #{carNo},</if>
  1034. <if test="customerPhone != null">customer_phone = #{customerPhone},</if>
  1035. <if test="customerGrade != null">customer_grade = #{customerGrade},</if>
  1036. <if test="refundUser != null">refund_user = #{refundUser},</if>
  1037. <if test="refundDate != null">refund_date = #{refundDate},</if>
  1038. <if test="examinUser != null">examin_user = #{examinUser},</if>
  1039. <if test="examinDate != null">examin_date = #{examinDate},</if>
  1040. <if test="examinStatus != null">examin_status = #{examinStatus},</if>
  1041. <if test="refundSuccessDate != null">refund_success_date = #{refundSuccessDate},</if>
  1042. </trim>
  1043. where order_id = #{orderId}
  1044. </update>
  1045. <delete id="deletePayOrderById" parameterType="Long">
  1046. delete from pay_order where order_id = #{orderId}
  1047. </delete>
  1048. <delete id="deletePayOrderByIds" parameterType="String">
  1049. delete from pay_order where order_id in
  1050. <foreach item="orderId" collection="array" open="(" separator="," close=")">
  1051. #{orderId}
  1052. </foreach>
  1053. </delete>
  1054. </mapper>