StationClassStructureMapper.xml 32 KB

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