StationClassStructureMapper.xml 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504
  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.StationClassStructureMapper">
  6. <resultMap type="StationClassStructure" id="StationClassStructureResult">
  7. <result property="id" column="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="oilGun" column="oil_gun" />
  12. <result property="oilName" column="oil_name" />
  13. <result property="oilPirce" column="oil_pirce" />
  14. <result property="oilType" column="oil_type" />
  15. <result property="consumerId" column="consumer_id" />
  16. <result property="consumer" column="consumer" />
  17. <result property="amt" column="amt" />
  18. <result property="orderLiters" column="order_liters" />
  19. <result property="payType" column="pay_type" />
  20. <result property="payWay" column="pay_way" />
  21. <result property="payDate" column="pay_date" />
  22. <result property="oilPersonnel" column="oil_personnel" />
  23. <result property="oilPersonnelId" column="oil_personnel_id" />
  24. <result property="orderType" column="order_type" />
  25. <result property="printNum" column="print_num" />
  26. <result property="classStructureNo" column="class_structure_no" />
  27. <result property="classStartDate" column="class_start_date" />
  28. <result property="classStructureDate" column="class_structure_date" />
  29. <result property="classStructureMan" column="class_structure_man" />
  30. <result property="oils" column="oils" />
  31. <result property="receivableAmt" column="receivable_amt" />
  32. <result property="receivedAmt" column="received_amt" />
  33. <result property="discountAmt" column="discount_amt" />
  34. <result property="discountCouponAmt" column="discount_coupon_amt" />
  35. <result property="discountCoupon" column="discount_coupon" />
  36. <result property="wxAmt" column="wx_amt" />
  37. <result property="zfbAmt" column="zfb_amt" />
  38. <result property="posAmt" column="pos_amt" />
  39. <result property="xjAmt" column="xj_amt" />
  40. <result property="didiAppAmt" column="didi_app_amt" />
  41. <result property="tyAppAmt" column="ty_app_amt" />
  42. <result property="otherAmt" column="other_amt" />
  43. <result property="dzkAmt" column="dzk_amt" />
  44. <result property="score" column="score" />
  45. <result property="memberNo" column="member_no" />
  46. <result property="memberAmt" column="member_amt" />
  47. <result property="carNo" column="car_no" />
  48. <result property="customerPhone" column="customer_phone" />
  49. <result property="customerGrade" column="customer_grade" />
  50. <result property="num" column="num" />
  51. <result property="wxNum" column="wx_num" />
  52. <result property="zfbNum" column="zfb_num" />
  53. <result property="xjNum" column="xj_num" />
  54. <result property="status" column="status" />
  55. <result property="dzkNum" column="dzk_num" />
  56. <result property="refundAmt" column="refund_amt" />
  57. </resultMap>
  58. <sql id="selectStationClassStructureVo">
  59. select id, order_no, station_id, d.dept_name as station_name, oil_gun, oil_name, oil_pirce, oil_type,
  60. consumer_id, consumer, amt, order_liters, pay_type, pay_way, pay_date,oil_personnel_id, oil_personnel, order_type,
  61. print_num, class_structure_no, class_start_date, class_structure_date, class_structure_man, oils,
  62. receivable_amt, received_amt, discount_amt, discount_coupon_amt, discount_coupon, wx_amt, zfb_amt,
  63. pos_amt, xj_amt, didi_app_amt, ty_app_amt, other_amt, dzk_amt, score, member_no, member_amt, car_no,
  64. customer_phone, customer_grade,status
  65. from station_class_structure s join sys_dept d on s.station_id = d.dept_id
  66. </sql>
  67. <select id="selectStationClassStructureList" parameterType="StationClassStructure" resultMap="StationClassStructureResult">
  68. <include refid="selectStationClassStructureVo"/>
  69. <where>
  70. <if test="orderNo != null and orderNo != ''"> and order_no = #{orderNo}</if>
  71. <if test="stationId != null "> and station_id = #{stationId}</if>
  72. <if test="oilGun != null and oilGun != ''"> and oil_gun = #{oilGun}</if>
  73. <if test="oilName != null and oilName != ''"> and oil_name like concat('%', #{oilName}, '%')</if>
  74. <if test="oilPirce != null "> and oil_pirce = #{oilPirce}</if>
  75. <if test="oilType != null and oilType != ''"> and oil_type = #{oilType}</if>
  76. <if test="consumerId != null "> and consumer_id = #{consumerId}</if>
  77. <if test="consumer != null and consumer != ''"> and consumer like concat('%', #{consumer}, '%')</if>
  78. <if test="amt != null "> and amt = #{amt}</if>
  79. <if test="orderLiters != null "> and order_liters = #{orderLiters}</if>
  80. <if test="payType != null and payType != ''"> and pay_type = #{payType}</if>
  81. <if test="payWay != null and payWay != ''"> and pay_way = #{payWay}</if>
  82. <if test="payDate != null "> and pay_date = #{payDate}</if>
  83. <if test="oilPersonnel != null and oilPersonnel != ''"> and oil_personnel = #{oilPersonnel}</if>
  84. <if test="oilPersonnelId != null and oilPersonnelId != ''"> and oil_personnel_id = #{oilPersonnelId}</if>
  85. <if test="orderType != null and orderType != ''"> and order_type = #{orderType}</if>
  86. <if test="printNum != null "> and print_num = #{printNum}</if>
  87. <if test="classStructureNo != null and classStructureNo != ''"> and class_structure_no = #{classStructureNo}</if>
  88. <if test="classStartDate != null "> and class_start_date = #{classStartDate}</if>
  89. <if test="classStructureDate != null "> and class_structure_date = #{classStructureDate}</if>
  90. <if test="classStructureMan != null and classStructureMan != ''"> and class_structure_man = #{classStructureMan}</if>
  91. <if test="oils != null and oils != ''"> and oils = #{oils}</if>
  92. <if test="receivableAmt != null "> and receivable_amt = #{receivableAmt}</if>
  93. <if test="receivedAmt != null "> and received_amt = #{receivedAmt}</if>
  94. <if test="discountAmt != null "> and discount_amt = #{discountAmt}</if>
  95. <if test="discountCouponAmt != null "> and discount_coupon_amt = #{discountCouponAmt}</if>
  96. <if test="discountCoupon != null and discountCoupon != ''"> and discount_coupon = #{discountCoupon}</if>
  97. <if test="wxAmt != null "> and wx_amt = #{wxAmt}</if>
  98. <if test="zfbAmt != null "> and zfb_amt = #{zfbAmt}</if>
  99. <if test="posAmt != null "> and pos_amt = #{posAmt}</if>
  100. <if test="xjAmt != null "> and xj_amt = #{xjAmt}</if>
  101. <if test="didiAppAmt != null "> and didi_app_amt = #{didiAppAmt}</if>
  102. <if test="tyAppAmt != null "> and ty_app_amt = #{tyAppAmt}</if>
  103. <if test="otherAmt != null "> and other_amt = #{otherAmt}</if>
  104. <if test="dzkAmt != null "> and dzk_amt = #{dzkAmt}</if>
  105. <if test="score != null "> and score = #{score}</if>
  106. <if test="memberNo != null and memberNo != ''"> and member_no = #{memberNo}</if>
  107. <if test="memberAmt != null "> and member_amt = #{memberAmt}</if>
  108. <if test="carNo != null and carNo != ''"> and car_no = #{carNo}</if>
  109. <if test="customerPhone != null and customerPhone != ''"> and customer_phone = #{customerPhone}</if>
  110. <if test="customerGrade != null and customerGrade != ''"> and customer_grade = #{customerGrade}</if>
  111. <if test="status != null and status != ''"> and status = #{status}</if>
  112. </where>
  113. order by id desc
  114. </select>
  115. <select id="listPersonnelStructure" parameterType="StationClassStructure" resultMap="StationClassStructureResult">
  116. 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
  117. from station_class_structure a
  118. <where>
  119. <if test="stationId != null "> and a.station_id = #{stationId}</if>
  120. <if test="classStructureNo != null and classStructureNo != ''"> and class_structure_no = #{classStructureNo}</if>
  121. <if test="orderType != null and orderType != ''"> and order_type = #{orderType}</if>
  122. <if test="status != null and status != ''"> and status = #{status}</if>
  123. </where>
  124. GROUP BY a.oil_personnel
  125. </select>
  126. <select id="listOilStructure" parameterType="StationClassStructure" resultMap="StationClassStructureResult">
  127. SELECT a.station_id, a.oil_name,GROUP_CONCAT(DISTINCT oil_gun) as oil_gun,ROUND(SUM(a.amt),2) as amt,ROUND(SUM(a.receivable_amt),2) as receivable_amt,ROUND(SUM(a.received_amt),2) as received_amt,ROUND(SUM(order_liters),2) as order_liters,ROUND(SUM(a.discount_amt),2) as discount_amt ,COUNT(order_no) as order_no,a.class_start_date,a.class_structure_date,a.class_structure_man,sum(a.print_num) print_num
  128. from station_class_structure a
  129. <where>
  130. <if test="stationId != null "> and a.station_id = #{stationId}</if>
  131. <if test="classStructureNo != null and classStructureNo != ''"> and class_structure_no = #{classStructureNo}</if>
  132. <if test="status != null and status != ''"> and status = #{status}</if>
  133. </where>
  134. GROUP BY a.oil_name,a.station_id,a.class_start_date,a.class_structure_date,a.class_structure_man
  135. </select>
  136. <select id="selectStationClassStructureMax" parameterType="StationClassStructure" resultMap="StationClassStructureResult">
  137. select id, station_id, order_no, oil_gun, 02., consumer_id, consumer, amt,d.dept_name as station_name,
  138. order_liters, pay_type, pay_way, pay_date, oil_personnel,oil_personnel_id, order_type, oil_type, print_num,
  139. class_structure_no, class_structure_date, class_structure_man, oils
  140. from station_class_structure s join sys_dept d on s.station_id = d.dept_id
  141. where id = (
  142. SELECT MAX(id) from station_class_structure
  143. <where>
  144. <if test="stationId != null "> and station_id = #{stationId}</if>
  145. <if test="orderType != null and orderType != ''"> and order_type = #{orderType}</if>
  146. <if test="status != null and status != ''"> and status = #{status}</if>
  147. </where>
  148. )
  149. </select>
  150. <select id="selectStationClassStructureById" parameterType="Long" resultMap="StationClassStructureResult">
  151. <include refid="selectStationClassStructureVo"/>
  152. where id = #{id}
  153. </select>
  154. <select id="selectDistnctClassStructure" parameterType="StationClassStructure" resultMap="StationClassStructureResult">
  155. select count(DISTINCT class_structure_no) as num
  156. from station_class_structure
  157. <where>
  158. <if test="stationId != null and stationId != ''"> and station_id = #{stationId}</if>
  159. <if test="likeClassStructureNo != null and likeClassStructureNo != ''"> and class_structure_no like concat( #{likeClassStructureNo}, '%') </if>
  160. <if test="orderType != null and orderType != ''"> and order_type = #{orderType}</if>
  161. <if test="status != null and status != ''"> and status = #{status}</if>
  162. </where>
  163. </select>
  164. <!--根据班次号汇总班结数据-->
  165. <select id="selectSummyClassStructure" parameterType="StationClassStructure" resultMap="StationClassStructureResult">
  166. select class_structure_no,class_start_date,class_structure_date,station_id,d.dept_name as station_name,count(order_no) as num,
  167. sum(order_liters) as order_liters,sum(receivable_amt) as receivable_amt,sum(amt) as amt,class_structure_man,
  168. sum(print_num) as print_num,sum(wx_amt) as wx_amt,sum(zfb_amt) as zfb_amt,
  169. sum(dzk_amt) as dzk_amt,sum(discount_amt) as discount_amt,SUM(pos_amt) as pos_amt,sum(xj_amt) as xj_amt
  170. from station_class_structure s join sys_dept d on s.station_id = d.dept_id
  171. <where>
  172. <if test="stationId != null and stationId != ''"> and station_id = #{stationId}</if>
  173. <if test="classStructureNo != null and classStructureNo != ''"> and class_structure_no = #{classStructureNo}</if>
  174. <if test="orderType != null and orderType != ''"> and order_type = #{orderType}</if>
  175. <if test="status != null and status != ''"> and s.status = #{status}</if>
  176. </where>
  177. GROUP BY class_structure_no,class_start_date,station_id,d.dept_name,class_structure_date,class_structure_man
  178. </select>
  179. <!--按员工/支付方式汇总数据-->
  180. <!-- 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,sum(discount_amt) discount_amt,SUM(discount_coupon_amt) discount_coupon_amt,SUM(wx_amt) wx_amt,SUM(zfb_amt) zfb_amt,SUM(xj_amt) xj_amt,sum(member_amt) member_amt-->
  181. <!-- from station_class_structure-->
  182. <!-- <where>-->
  183. <!-- <if test="stationId != null and stationId != ''"> and station_id = #{stationId}</if>-->
  184. <!-- <if test="classStructureNo != null and classStructureNo != ''"> and class_structure_no = #{classStructureNo}</if>-->
  185. <!-- <if test="orderType != null and orderType != ''"> and order_type = #{orderType}</if>-->
  186. <!-- </where>-->
  187. <!-- GROUP BY oil_personnel-->
  188. <select id="listPersonnelPayStructure" parameterType="StationClassStructure" resultMap="StationClassStructureResult">
  189. SELECT oil_personnel,GROUP_CONCAT(DISTINCT oil_gun) oil_gun,
  190. sum(discount_amt) discount_amt,
  191. SUM(discount_coupon_amt) discount_coupon_amt,SUM(wx_amt) wx_amt,SUM(zfb_amt) zfb_amt,sum(dzk_amt) dzk_amt,
  192. SUM(xj_amt) xj_amt,sum(member_amt) member_amt,
  193. sum(e.xj_num) xj_num,sum(e.zfb_num) zfb_num,sum(e.wx_num) wx_num,sum(e.dzk_num) dzk_num,sum(e.refund_amt) refund_amt
  194. from (
  195. SELECT station_id,class_structure_no, order_type,oil_personnel,oil_gun,discount_amt,discount_coupon_amt,wx_amt,zfb_amt,xj_amt,member_amt,status,dzk_amt,
  196. (SELECT COUNT(b.order_no) from station_class_structure b where 1=1 and a.id = b.id and b.pay_type="xj" ) xj_num,
  197. (SELECT COUNT(c.order_no) from station_class_structure c where 1=1 and a.id = c.id and c.pay_type="zfb" ) zfb_num,
  198. (SELECT COUNT(d.order_no) from station_class_structure d where 1=1 and a.id = d.id and d.pay_type="wx" ) wx_num,
  199. (SELECT COUNT(d.order_no) from station_class_structure d where 1=1 and a.id = d.id and d.pay_type="dzk" ) dzk_num,
  200. (SELECT sum(d.amt) from station_class_structure d where 1=1 and a.id = d.id and d.status="3") refund_amt
  201. from station_class_structure a
  202. <where>
  203. <if test="stationId != null and stationId != ''"> and a.station_id = #{stationId}</if>
  204. <if test="classStructureNo != null and classStructureNo != ''"> and a.class_structure_no = #{classStructureNo}</if>
  205. <if test="orderType != null and orderType != ''"> and a.order_type = #{orderType}</if>
  206. <if test="status != null and status != ''"> and a.status = #{status}</if>
  207. </where>
  208. ) e
  209. <where>
  210. <if test="stationId != null and stationId != ''"> and e.station_id = #{stationId}</if>
  211. <if test="classStructureNo != null and classStructureNo != ''"> and e.class_structure_no = #{classStructureNo}</if>
  212. <if test="orderType != null and orderType != ''"> and e.order_type = #{orderType}</if>
  213. <if test="status != null and status != ''"> and e.status = #{status}</if>
  214. </where>
  215. GROUP BY e.oil_personnel
  216. </select>
  217. <select id="listClass" parameterType="StationClassStructure" resultMap="StationClassStructureResult">
  218. SELECT * from
  219. station_class_structure
  220. where id =(SELECT max(id) from station_class_structure
  221. <where>
  222. <if test="classStructureMan != null and classStructureMan != ''"> and class_structure_man = #{classStructureMan}</if>
  223. <if test="classStructureNo != null and classStructureNo != ''"> and class_structure_no = #{classStructureNo}</if>
  224. <if test="orderType != null and orderType != ''"> and order_type = #{orderType}</if>
  225. </where>
  226. )
  227. </select>
  228. <!--根据支付方式汇总数据-->
  229. <select id="listPayStructure" parameterType="StationClassStructure" resultMap="StationClassStructureResult">
  230. SELECT dict_label as pay_type,sum(order_liters) as order_liters,sum(discount_amt) as discount_amt,count(order_no) order_no,sum(amt) as amt,sum(receivable_amt) as receivable_amt,sum(received_amt) as received_amt
  231. from station_class_structure left JOIN sys_dict_data on dict_value = pay_type and dict_type ='pay_type'
  232. <where>
  233. <if test="stationId != null and stationId != ''"> and station_id = #{stationId}</if>
  234. <if test="classStructureNo != null and classStructureNo != ''"> and class_structure_no = #{classStructureNo}</if>
  235. <if test="orderType != null and orderType != ''"> and order_type = #{orderType}</if>
  236. <if test="status != null and status != ''"> and status = #{status}</if>
  237. </where>
  238. GROUP BY pay_type,dict_label
  239. </select>
  240. <!-- 根据支付方式汇总数据-->
  241. <select id="listOilStructureSum" parameterType="StationClassStructure" resultMap="StationClassStructureResult">
  242. SELECT SUM(amt) as amt,SUM(amt) as amt,SUM(order_liters) as order_liters,sum(order_no) as order_no
  243. from (SELECT a.station_id, a.oil_name,GROUP_CONCAT(DISTINCT oil_gun) as oil_gun,ROUND(SUM(a.amt),2) as amt,ROUND(SUM(a.receivable_amt),2) as receivable_amt,ROUND(SUM(a.received_amt),2) as received_amt,ROUND(SUM(order_liters),2) as order_liters,ROUND(SUM(a.discount_amt),2) as discount_amt ,COUNT(order_no) as order_no,a.class_start_date,a.class_structure_date,a.class_structure_man,sum(a.print_num) print_num
  244. from station_class_structure a
  245. <where>
  246. <if test="stationId != null "> and a.station_id = #{stationId}</if>
  247. <if test="classStructureNo != null and classStructureNo != ''"> and a.class_structure_no = #{classStructureNo}</if>
  248. <if test="status != null and status != ''"> and a.status = #{status}</if>
  249. </where>
  250. GROUP BY a.oil_name,a.station_id,a.class_start_date,a.class_structure_date,a.class_structure_man) c
  251. </select>
  252. <!--按员工/支付方式汇总数据-->
  253. <select id="listPersonnelPayStructureSum" parameterType="StationClassStructure" resultMap="StationClassStructureResult">
  254. SELECT GROUP_CONCAT(DISTINCT oil_gun) oil_gun,
  255. sum(discount_amt) discount_amt,
  256. SUM(discount_coupon_amt) discount_coupon_amt,SUM(wx_amt) wx_amt,SUM(zfb_amt) zfb_amt,sum(dzk_amt) dzk_amt,
  257. SUM(xj_amt) xj_amt,sum(member_amt) member_amt,
  258. sum(e.xj_num) xj_num,sum(e.zfb_num) zfb_num,sum(e.wx_num) wx_num,sum(e.dzk_num) dzk_num,sum(refund_amt) redund_amt
  259. from (SELECT station_id,class_structure_no, order_type,oil_personnel,oil_gun,discount_amt,discount_coupon_amt,wx_amt,zfb_amt,xj_amt,member_amt,dzk,
  260. (SELECT COUNT(b.order_no) from station_class_structure b where 1=1 and a.id = b.id and b.pay_type="xj" ) xj_num,
  261. (SELECT COUNT(c.order_no) from station_class_structure c where 1=1 and a.id = c.id and c.pay_type="zfb" ) zfb_num,
  262. (SELECT COUNT(d.order_no) from station_class_structure d where 1=1 and a.id = d.id and d.pay_type="wx" ) wx_num,
  263. (SELECT COUNT(d.order_no) from station_class_structure d where 1=1 and a.id = d.id and d.pay_type="dzk" ) dzk_num,
  264. (SELECT sum(d.amt) from station_class_structure d where 1=1 and a.id = d.id and d.status="3") refund_amt
  265. from station_class_structure a
  266. <where>
  267. <if test="stationId != null "> and a.station_id = #{stationId}</if>
  268. <if test="classStructureNo != null and classStructureNo != ''"> and a.class_structure_no = #{classStructureNo}</if>
  269. <if test="orderType != null and orderType != ''"> and a.order_type = #{orderType}</if>
  270. <if test="status != null and status != ''"> and a.status = #{status}</if>
  271. </where>
  272. ) e
  273. <where>
  274. <if test="stationId != null "> and e.station_id = #{stationId}</if>
  275. <if test="classStructureNo != null and classStructureNo != ''"> and e.class_structure_no = #{classStructureNo}</if>
  276. <if test="orderType != null and orderType != ''"> and e.order_type = #{orderType}</if>
  277. <if test="status != null and status != ''"> and e.status = #{status}</if>
  278. </where>
  279. </select>
  280. <select id="listPersonnelStructureSum" parameterType="StationClassStructure" resultMap="StationClassStructureResult">
  281. SELECT SUM(amt) as amt,SUM(order_liters) as order_liters,SUM(order_no) as order_no
  282. from ( 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
  283. from station_class_structure a
  284. <where>
  285. <if test="stationId != null "> and a.station_id = #{stationId}</if>
  286. <if test="classStructureNo != null and classStructureNo != ''"> and class_structure_no = #{classStructureNo}</if>
  287. <if test="orderType != null and orderType != ''"> and order_type = #{orderType}</if>
  288. <if test="status != null and status != ''"> and status = #{status}</if>
  289. </where>
  290. GROUP BY a.oil_personnel ) b
  291. </select>
  292. <select id="selectStationClassStructureExport" parameterType="StationClassStructure" resultMap="StationClassStructureResult">
  293. <include refid="selectStationClassStructureVo"/>
  294. <where>
  295. <if test="orderNo != null and orderNo != ''"> and order_no = #{orderNo}</if>
  296. <if test="stationId != null "> and station_id = #{stationId}</if>
  297. <if test="oilGun != null and oilGun != ''"> and oil_gun = #{oilGun}</if>
  298. <if test="oilName != null and oilName != ''"> and oil_name like concat('%', #{oilName}, '%')</if>
  299. <if test="oilPirce != null "> and oil_pirce = #{oilPirce}</if>
  300. <if test="oilType != null and oilType != ''"> and oil_type = #{oilType}</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="amt != null "> and amt = #{amt}</if>
  304. <if test="orderLiters != null "> and order_liters = #{orderLiters}</if>
  305. <if test="payType != null and payType != ''"> and pay_type = #{payType}</if>
  306. <if test="payWay != null and payWay != ''"> and pay_way = #{payWay}</if>
  307. <if test="payDate != null "> and pay_date = #{payDate}</if>
  308. <if test="oilPersonnel != null and oilPersonnel != ''"> and oil_personnel = #{oilPersonnel}</if>
  309. <if test="oilPersonnelId != null and oilPersonnelId != ''"> and oil_personnel_id = #{oilPersonnelId}</if>
  310. <if test="orderType != null and orderType != ''"> and order_type = #{orderType}</if>
  311. <if test="printNum != null "> and print_num = #{printNum}</if>
  312. <if test="classStructureNo != null and classStructureNo != ''"> and class_structure_no = #{classStructureNo}</if>
  313. <if test="classStartDate != null "> and class_start_date = #{classStartDate}</if>
  314. <if test="classStructureDate != null "> and class_structure_date = #{classStructureDate}</if>
  315. <if test="classStructureMan != null and classStructureMan != ''"> and class_structure_man = #{classStructureMan}</if>
  316. <if test="oils != null and oils != ''"> and oils = #{oils}</if>
  317. <if test="receivableAmt != null "> and receivable_amt = #{receivableAmt}</if>
  318. <if test="receivedAmt != null "> and received_amt = #{receivedAmt}</if>
  319. <if test="discountAmt != null "> and discount_amt = #{discountAmt}</if>
  320. <if test="discountCouponAmt != null "> and discount_coupon_amt = #{discountCouponAmt}</if>
  321. <if test="discountCoupon != null and discountCoupon != ''"> and discount_coupon = #{discountCoupon}</if>
  322. <if test="wxAmt != null "> and wx_amt = #{wxAmt}</if>
  323. <if test="zfbAmt != null "> and zfb_amt = #{zfbAmt}</if>
  324. <if test="posAmt != null "> and pos_amt = #{posAmt}</if>
  325. <if test="xjAmt != null "> and xj_amt = #{xjAmt}</if>
  326. <if test="didiAppAmt != null "> and didi_app_amt = #{didiAppAmt}</if>
  327. <if test="tyAppAmt != null "> and ty_app_amt = #{tyAppAmt}</if>
  328. <if test="otherAmt != null "> and other_amt = #{otherAmt}</if>
  329. <if test="dzkAmt != null "> and dzk_amt = #{dzkAmt}</if>
  330. <if test="score != null "> and score = #{score}</if>
  331. <if test="memberNo != null and memberNo != ''"> and member_no = #{memberNo}</if>
  332. <if test="memberAmt != null "> and member_amt = #{memberAmt}</if>
  333. <if test="carNo != null and carNo != ''"> and car_no = #{carNo}</if>
  334. <if test="customerPhone != null and customerPhone != ''"> and customer_phone = #{customerPhone}</if>
  335. <if test="status != null and status != ''"> and status = #{status}</if>
  336. </where>
  337. order by id desc
  338. </select>
  339. <insert id="insertStationClassStructure" parameterType="StationClassStructure" useGeneratedKeys="true" keyProperty="id">
  340. insert into station_class_structure
  341. <trim prefix="(" suffix=")" suffixOverrides=",">
  342. <if test="orderNo != null">order_no,</if>
  343. <if test="stationId != null">station_id,</if>
  344. <if test="stationName != null">station_name,</if>
  345. <if test="oilGun != null">oil_gun,</if>
  346. <if test="oilName != null">oil_name,</if>
  347. <if test="oilPirce != null">oil_pirce,</if>
  348. <if test="oilType != null">oil_type,</if>
  349. <if test="consumerId != null">consumer_id,</if>
  350. <if test="consumer != null">consumer,</if>
  351. <if test="amt != null">amt,</if>
  352. <if test="orderLiters != null">order_liters,</if>
  353. <if test="payType != null">pay_type,</if>
  354. <if test="payWay != null">pay_way,</if>
  355. <if test="payDate != null">pay_date,</if>
  356. <if test="oilPersonnel != null">oil_personnel,</if>
  357. <if test="oilPersonnelId != null">oil_personnel_id,</if>
  358. <if test="orderType != null">order_type,</if>
  359. <if test="printNum != null">print_num,</if>
  360. <if test="classStructureNo != null">class_structure_no,</if>
  361. <if test="classStartDate != null">class_start_date,</if>
  362. <if test="classStructureDate != null">class_structure_date,</if>
  363. <if test="classStructureMan != null">class_structure_man,</if>
  364. <if test="oils != null">oils,</if>
  365. <if test="receivableAmt != null">receivable_amt,</if>
  366. <if test="receivedAmt != null">received_amt,</if>
  367. <if test="discountAmt != null">discount_amt,</if>
  368. <if test="discountCouponAmt != null">discount_coupon_amt,</if>
  369. <if test="discountCoupon != null">discount_coupon,</if>
  370. <if test="wxAmt != null">wx_amt,</if>
  371. <if test="zfbAmt != null">zfb_amt,</if>
  372. <if test="posAmt != null">pos_amt,</if>
  373. <if test="xjAmt != null">xj_amt,</if>
  374. <if test="didiAppAmt != null">didi_app_amt,</if>
  375. <if test="tyAppAmt != null">ty_app_amt,</if>
  376. <if test="otherAmt != null">other_amt,</if>
  377. <if test="dzkAmt != null">dzk_amt,</if>
  378. <if test="score != null">score,</if>
  379. <if test="memberNo != null">member_no,</if>
  380. <if test="memberAmt != null">member_amt,</if>
  381. <if test="carNo != null">car_no,</if>
  382. <if test="customerPhone != null">customer_phone,</if>
  383. <if test="customerGrade != null">customer_grade,</if>
  384. <if test="status != null">status,</if>
  385. </trim>
  386. <trim prefix="values (" suffix=")" suffixOverrides=",">
  387. <if test="orderNo != null">#{orderNo},</if>
  388. <if test="stationId != null">#{stationId},</if>
  389. <if test="stationName != null">#{stationName},</if>
  390. <if test="oilGun != null">#{oilGun},</if>
  391. <if test="oilName != null">#{oilName},</if>
  392. <if test="oilPirce != null">#{oilPirce},</if>
  393. <if test="oilType != null">#{oilType},</if>
  394. <if test="consumerId != null">#{consumerId},</if>
  395. <if test="consumer != null">#{consumer},</if>
  396. <if test="amt != null">#{amt},</if>
  397. <if test="orderLiters != null">#{orderLiters},</if>
  398. <if test="payType != null">#{payType},</if>
  399. <if test="payWay != null">#{payWay},</if>
  400. <if test="payDate != null">#{payDate},</if>
  401. <if test="oilPersonnel != null">#{oilPersonnel},</if>
  402. <if test="oilPersonnelId != null">#{oilPersonnelId},</if>
  403. <if test="orderType != null">#{orderType},</if>
  404. <if test="printNum != null">#{printNum},</if>
  405. <if test="classStructureNo != null">#{classStructureNo},</if>
  406. <if test="classStartDate != null">#{classStartDate},</if>
  407. <if test="classStructureDate != null">#{classStructureDate},</if>
  408. <if test="classStructureMan != null">#{classStructureMan},</if>
  409. <if test="oils != null">#{oils},</if>
  410. <if test="receivableAmt != null">#{receivableAmt},</if>
  411. <if test="receivedAmt != null">#{receivedAmt},</if>
  412. <if test="discountAmt != null">#{discountAmt},</if>
  413. <if test="discountCouponAmt != null">#{discountCouponAmt},</if>
  414. <if test="discountCoupon != null">#{discountCoupon},</if>
  415. <if test="wxAmt != null">#{wxAmt},</if>
  416. <if test="zfbAmt != null">#{zfbAmt},</if>
  417. <if test="posAmt != null">#{posAmt},</if>
  418. <if test="xjAmt != null">#{xjAmt},</if>
  419. <if test="didiAppAmt != null">#{didiAppAmt},</if>
  420. <if test="tyAppAmt != null">#{tyAppAmt},</if>
  421. <if test="otherAmt != null">#{otherAmt},</if>
  422. <if test="dzkAmt != null">#{dzkAmt},</if>
  423. <if test="score != null">#{score},</if>
  424. <if test="memberNo != null">#{memberNo},</if>
  425. <if test="memberAmt != null">#{memberAmt},</if>
  426. <if test="carNo != null">#{carNo},</if>
  427. <if test="customerPhone != null">#{customerPhone},</if>
  428. <if test="customerGrade != null">#{customerGrade},</if>
  429. <if test="status != null">#{status},</if>
  430. </trim>
  431. </insert>
  432. <update id="updateStationClassStructure" parameterType="StationClassStructure">
  433. update station_class_structure
  434. <trim prefix="SET" suffixOverrides=",">
  435. <if test="orderNo != null">order_no = #{orderNo},</if>
  436. <if test="stationId != null">station_id = #{stationId},</if>
  437. <if test="stationName != null">station_name = #{stationName},</if>
  438. <if test="oilGun != null">oil_gun = #{oilGun},</if>
  439. <if test="oilName != null">oil_name = #{oilName},</if>
  440. <if test="oilPirce != null">oil_pirce = #{oilPirce},</if>
  441. <if test="oilType != null">oil_type = #{oilType},</if>
  442. <if test="consumerId != null">consumer_id = #{consumerId},</if>
  443. <if test="consumer != null">consumer = #{consumer},</if>
  444. <if test="amt != null">amt = #{amt},</if>
  445. <if test="orderLiters != null">order_liters = #{orderLiters},</if>
  446. <if test="payType != null">pay_type = #{payType},</if>
  447. <if test="payWay != null">pay_way = #{payWay},</if>
  448. <if test="payDate != null">pay_date = #{payDate},</if>
  449. <if test="oilPersonnel != null">oil_personnel = #{oilPersonnel},</if>
  450. <if test="oilPersonnelId != null">oil_personnel_id = #{oilPersonnelId},</if>
  451. <if test="orderType != null">order_type = #{orderType},</if>
  452. <if test="printNum != null">print_num = #{printNum},</if>
  453. <if test="classStructureNo != null">class_structure_no = #{classStructureNo},</if>
  454. <if test="classStartDate != null">class_start_date = #{classStartDate},</if>
  455. <if test="classStructureDate != null">class_structure_date = #{classStructureDate},</if>
  456. <if test="classStructureMan != null">class_structure_man = #{classStructureMan},</if>
  457. <if test="oils != null">oils = #{oils},</if>
  458. <if test="receivableAmt != null">receivable_amt = #{receivableAmt},</if>
  459. <if test="receivedAmt != null">received_amt = #{receivedAmt},</if>
  460. <if test="discountAmt != null">discount_amt = #{discountAmt},</if>
  461. <if test="discountCouponAmt != null">discount_coupon_amt = #{discountCouponAmt},</if>
  462. <if test="discountCoupon != null">discount_coupon = #{discountCoupon},</if>
  463. <if test="wxAmt != null">wx_amt = #{wxAmt},</if>
  464. <if test="zfbAmt != null">zfb_amt = #{zfbAmt},</if>
  465. <if test="posAmt != null">pos_amt = #{posAmt},</if>
  466. <if test="xjAmt != null">xj_amt = #{xjAmt},</if>
  467. <if test="didiAppAmt != null">didi_app_amt = #{didiAppAmt},</if>
  468. <if test="tyAppAmt != null">ty_app_amt = #{tyAppAmt},</if>
  469. <if test="otherAmt != null">other_amt = #{otherAmt},</if>
  470. <if test="dzkAmt != null">dzk_amt = #{dzkAmt},</if>
  471. <if test="score != null">score = #{score},</if>
  472. <if test="memberNo != null">member_no = #{memberNo},</if>
  473. <if test="memberAmt != null">member_amt = #{memberAmt},</if>
  474. <if test="carNo != null">car_no = #{carNo},</if>
  475. <if test="customerPhone != null">customer_phone = #{customerPhone},</if>
  476. <if test="customerGrade != null">customer_grade = #{customerGrade},</if>
  477. <if test="status != null">status = #{status},</if>
  478. </trim>
  479. where id = #{id}
  480. </update>
  481. <delete id="deleteStationClassStructureById" parameterType="Long">
  482. delete from station_class_structure where id = #{id}
  483. </delete>
  484. <delete id="deleteStationClassStructureByIds" parameterType="String">
  485. delete from station_class_structure where id in
  486. <foreach item="id" collection="array" open="(" separator="," close=")">
  487. #{id}
  488. </foreach>
  489. </delete>
  490. </mapper>