PayOrderMapper.xml 55 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.platform.yijia.dao.PayOrderMapper">
  4. <!--订单对象实体类-->
  5. <resultMap id="BaseResultMap" type="com.platform.yijia.pojo.PayOrder">
  6. <id column="order_id" jdbcType="INTEGER" property="orderId" />
  7. <result column="order_no" jdbcType="VARCHAR" property="orderNo" />
  8. <result column="oil_gun" jdbcType="VARCHAR" property="oilGun" />
  9. <result column="oil_name" jdbcType="VARCHAR" property="oilName" />
  10. <result column="oil_pirce" jdbcType="VARCHAR" property="oilPirce" />
  11. <result column="consumer_id" jdbcType="INTEGER" property="consumerId" />
  12. <result column="consumer" jdbcType="VARCHAR" property="consumer" />
  13. <result column="amt" jdbcType="DOUBLE" property="amt" />
  14. <result column="station_id" jdbcType="INTEGER" property="stationId" />
  15. <result column="status" jdbcType="VARCHAR" property="status" />
  16. <result column="order_liters" jdbcType="VARCHAR" property="orderLiters" />
  17. <result column="pay_type" jdbcType="VARCHAR" property="payType" />
  18. <result column="pay_way" jdbcType="VARCHAR" property="payWay" />
  19. <result column="pay_date" jdbcType="TIMESTAMP" property="payDate" />
  20. <result column="oil_personnel" jdbcType="VARCHAR" property="oilPersonnel" />
  21. <result column="created_date" jdbcType="TIMESTAMP" property="createdDate" />
  22. <result column="order_type" jdbcType="CHAR" property="orderType" />
  23. <result column="station_name" jdbcType="CHAR" property="stationName" />
  24. <result column="receivable_amt" jdbcType="DOUBLE" property="receivableAmt" />
  25. <result column="received_amt" jdbcType="DOUBLE" property="receivedAmt" />
  26. <result column="discount_coupon" jdbcType="VARCHAR" property="discountCoupon" />
  27. <result column="discount_amt" jdbcType="DOUBLE" property="discountAmt" />
  28. <result column="discount_coupon_amt" jdbcType="DOUBLE" property="discountCouponAmt" />
  29. <result column="wx_amt" jdbcType="DOUBLE" property="wxAmt" />
  30. <result column="zfb_amt" jdbcType="DOUBLE" property="zfbAmt" />
  31. <result column="pos_amt" jdbcType="DOUBLE" property="posAmt" />
  32. <result column="xj_amt" jdbcType="DOUBLE" property="xjAmt" />
  33. <result column="didi_app_amt" jdbcType="DOUBLE" property="didiAppAmt" />
  34. <result column="ty_app_amt" jdbcType="DOUBLE" property="tyAppAmt" />
  35. <result column="other_amt" jdbcType="DOUBLE" property="otherAmt" />
  36. <result column="dzk_amt" jdbcType="DOUBLE" property="dzkAmt" />
  37. <result column="score" jdbcType="INTEGER" property="score" />
  38. <result column="member_no" jdbcType="VARCHAR" property="memberNo" />
  39. <result column="member_amt" jdbcType="DOUBLE" property="memberAmt" />
  40. <result column="print_count" jdbcType="INTEGER" property="printCount" />
  41. <result column="car_no" jdbcType="VARCHAR" property="carNo" />
  42. <result column="customer_phone" jdbcType="VARCHAR" property="customerPhone" />
  43. <result column="customer_grade" jdbcType="VARCHAR" property="customerGrade" />
  44. <result column="oil_type" jdbcType="VARCHAR" property="oilType" />
  45. <result column="payTypeName" property="payTypeName" />
  46. </resultMap>
  47. <sql id="Example_Where_Clause">
  48. <where>
  49. <foreach collection="oredCriteria" item="criteria" separator="or">
  50. <if test="criteria.valid">
  51. <trim prefix="(" prefixOverrides="and" suffix=")">
  52. <foreach collection="criteria.criteria" item="criterion">
  53. <choose>
  54. <when test="criterion.noValue">
  55. and ${criterion.condition}
  56. </when>
  57. <when test="criterion.singleValue">
  58. and ${criterion.condition} #{criterion.value}
  59. </when>
  60. <when test="criterion.betweenValue">
  61. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  62. </when>
  63. <when test="criterion.listValue">
  64. and ${criterion.condition}
  65. <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
  66. #{listItem}
  67. </foreach>
  68. </when>
  69. </choose>
  70. </foreach>
  71. </trim>
  72. </if>
  73. </foreach>
  74. </where>
  75. </sql>
  76. <sql id="Update_By_Example_Where_Clause">
  77. <!--
  78. WARNING - @mbg.generated
  79. This element is automatically generated by MyBatis Generator, do not modify.
  80. -->
  81. <where>
  82. <foreach collection="example.oredCriteria" item="criteria" separator="or">
  83. <if test="criteria.valid">
  84. <trim prefix="(" prefixOverrides="and" suffix=")">
  85. <foreach collection="criteria.criteria" item="criterion">
  86. <choose>
  87. <when test="criterion.noValue">
  88. and ${criterion.condition}
  89. </when>
  90. <when test="criterion.singleValue">
  91. and ${criterion.condition} #{criterion.value}
  92. </when>
  93. <when test="criterion.betweenValue">
  94. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  95. </when>
  96. <when test="criterion.listValue">
  97. and ${criterion.condition}
  98. <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
  99. #{listItem}
  100. </foreach>
  101. </when>
  102. </choose>
  103. </foreach>
  104. </trim>
  105. </if>
  106. </foreach>
  107. </where>
  108. </sql>
  109. <sql id="Base_Column_List_PayTypeName_Status">
  110. T1.order_id, T1.order_no, T1.oil_gun, T1.oil_name, T1.oil_pirce, T1.consumer_id, T1.consumer, T1.amt, T1.station_id,
  111. CASE T1.status WHEN "1" THEN "已支付" ELSE "未支付" END AS status,
  112. T1.order_liters, T1.pay_type, T1.pay_way, T1.pay_date, T1.oil_personnel, T1.created_date, T1.order_type, T1.station_name,
  113. T1.receivable_amt, T1.received_amt, T1.discount_amt, T1.discount_coupon_amt, T1.discount_coupon, T1.wx_amt,
  114. T1.zfb_amt, T1.pos_amt, T1.xj_amt, T1.didi_app_amt, T1.ty_app_amt, T1.other_amt, T1.dzk_amt, T1.score, T1.member_no, T1.member_amt,
  115. T1.print_count, T1.car_no, T1.customer_phone, T1.customer_grade, T1.oil_type,
  116. T2.dict_label AS payTypeName
  117. </sql>
  118. <sql id="Base_Column_List">
  119. order_id, order_no, oil_gun, oil_name, oil_pirce, consumer_id, consumer, amt, station_id, status,
  120. order_liters, pay_type, pay_way, pay_date, oil_personnel, created_date, order_type, station_name,
  121. receivable_amt, received_amt, discount_amt, discount_coupon_amt, discount_coupon, wx_amt,
  122. zfb_amt, pos_amt, xj_amt, didi_app_amt, ty_app_amt, other_amt, dzk_amt, score, member_no, member_amt,
  123. print_count, car_no, customer_phone, customer_grade, oil_type
  124. </sql>
  125. <!--根据订单号查询订单信息-->
  126. <select id="selectOrderInfoByOrdNo" parameterType="String" resultMap="BaseResultMap">
  127. SELECT
  128. <include refid="Base_Column_List"/>
  129. FROM
  130. pay_order
  131. WHERE
  132. order_no =#{ordNo}
  133. </select>
  134. <sql id="Base_Column_List_oilName">
  135. SELECT
  136. T1.dict_label AS oilName,
  137. COUNT(T2.order_no) AS orderSum,
  138. SUM(IFNULL(T2.order_liters,0)) AS orderLitersSum,
  139. SUM(IFNULL(T2.receivable_amt,0)) AS receivableAmtSum,
  140. SUM(IFNULL(T2.discount_amt,0)) AS discountAmtSum,
  141. SUM(IFNULL(T2.amt,0)) AS amtSum
  142. FROM sys_dict_data AS T1
  143. LEFT JOIN pay_order AS T2 ON T1.dict_label = T2.oil_name
  144. <if test="stationId !=null">
  145. AND T2.station_id= #{stationId}
  146. </if>
  147. <if test="status !=null">
  148. AND T2.status= #{status}
  149. </if>
  150. <if test="beginTime !=null">
  151. AND T2.pay_date &gt;= #{beginTime}
  152. </if>
  153. <if test="endTime !=null">
  154. AND T2.pay_date &lt; #{endTime}
  155. </if>
  156. WHERE
  157. T1.dict_type ="oil_name"
  158. GROUP BY T1.dict_label
  159. ORDER BY amtSum DESC
  160. </sql>
  161. <sql id="Base_Column_List_payType">
  162. SELECT
  163. T1.dict_label AS payType,
  164. COUNT(T2.order_no) AS orderSum,
  165. SUM(IFNULL(T2.order_liters,0)) AS orderLitersSum,
  166. SUM(IFNULL(T2.receivable_amt,0)) AS receivableAmtSum,
  167. SUM(IFNULL(T2.discount_amt,0)) AS discountAmtSum,
  168. SUM(IFNULL(T2.amt,0)) AS amtSum
  169. FROM sys_dict_data AS T1
  170. LEFT JOIN pay_order AS T2 ON T1.dict_value = T2.pay_type
  171. <if test="stationId !=null">
  172. AND T2.station_id= #{stationId}
  173. </if>
  174. <if test="status !=null">
  175. AND T2.status= #{status}
  176. </if>
  177. <if test="beginTime !=null and beginTime !=''">
  178. AND T2.pay_date &gt;= #{beginTime}
  179. </if>
  180. <if test="endTime !=null">
  181. AND T2.pay_date &lt; #{endTime}
  182. </if>
  183. WHERE
  184. T1.dict_type ="pay_type"
  185. GROUP BY T1.dict_label
  186. ORDER BY amtSum DESC
  187. </sql>
  188. <sql id="Base_Column_List_NoGroupBy">
  189. SELECT
  190. COUNT(T2.order_no) AS orderSum,
  191. SUM(IFNULL(T2.order_liters,0)) AS orderLitersSum,
  192. SUM(IFNULL(T2.receivable_amt,0)) AS receivableAmtSum,
  193. SUM(IFNULL(T2.discount_amt,0)) AS discountAmtSum,
  194. SUM(IFNULL(T2.amt,0)) AS amtSum,
  195. SUM(IFNULL(T2.received_amt,0)) AS receivedAmtSum,
  196. SUM(IFNULL(T2.print_count,0)) AS printCountSum
  197. FROM
  198. pay_order AS T2
  199. <where>
  200. <if test="stationId !=null">
  201. T2.station_id= #{stationId}
  202. </if>
  203. <if test="status !=null">
  204. AND T2.status= #{status}
  205. </if>
  206. <if test="beginTime !=null">
  207. AND T2.pay_date &gt;= #{beginTime}
  208. </if>
  209. <if test="endTime !=null">
  210. AND T2.pay_date &lt; #{endTime}
  211. </if>
  212. </where>
  213. </sql>
  214. <!--获取支付类型列表-->
  215. <select id="selectPayTypeList" resultType="com.platform.yijia.pojo.PayType">
  216. SELECT
  217. dict_value AS payType,
  218. dict_label AS payTypeName
  219. FROM
  220. sys_dict_data
  221. WHERE
  222. dict_type ="pay_type"
  223. </select>
  224. <!--查询油品总和-->
  225. <select id="selectSum" parameterType="com.platform.yijia.pojo.PayOrder" resultType="Map">
  226. <if test="groupBy !=null and groupBy =='oilName'">
  227. <include refid="Base_Column_List_oilName"/>
  228. </if>
  229. <if test="groupBy !=null and groupBy =='payType'">
  230. <include refid="Base_Column_List_payType"/>
  231. </if>
  232. <if test="groupBy ==''">
  233. <include refid="Base_Column_List_NoGroupBy"/>
  234. </if>
  235. </select>
  236. <!--查询昨日数据-->
  237. <select id="selectPosYesterDayData" parameterType="com.platform.yijia.pojo.PayOrder" resultType="map">
  238. SELECT
  239. orderSum,
  240. averPrice,
  241. amtSum,
  242. IFNULL(TT2.amtSumTT2, 0) AS lastAmtSum,
  243. DATE_FORMAT(NOW() -INTERVAL 8 DAY,"%w") AS week,
  244. IFNULL(ROUND(((amtSum-amtSumTT2)/amtSumTT2),2), 0) AS QOQ
  245. FROM (
  246. (SELECT
  247. T1.station_id,
  248. IFNULL(SUM(T1.amt), 0) AS amtSum,
  249. COUNT(T1.order_no) AS orderSum,
  250. IFNULL(ROUND((SUM(T1.amt)/COUNT(T1.order_no)),2),0) AS averPrice
  251. FROM pay_order AS T1
  252. WHERE
  253. T1.station_id = #{stationId}
  254. AND T1.`status` = "1"
  255. AND T1.created_date &gt;= #{beginTime}
  256. AND T1.created_date &lt; #{endTime}) AS TT1 LEFT JOIN
  257. (SELECT
  258. T2.station_id,
  259. IFNULL(SUM(T2.amt), 0) AS amtSumTT2
  260. FROM pay_order AS T2
  261. WHERE
  262. T2.station_id = #{stationId}
  263. AND T2.`status` = "1"
  264. AND T2.created_date &gt;= #{beginTimeQOQ}
  265. AND T2.created_date &lt; #{endTimeQOQ}) AS TT2 ON TT1.station_id = TT2.station_id
  266. )
  267. </select>
  268. <!--POS机查询近七天数据-->
  269. <!-- <select id="selectPosRecentlySevenData" parameterType="com.platform.yijia.pojo.PayOrder" resultType="map">-->
  270. <!-- SELECT-->
  271. <!-- DATE_FORMAT(T3.days, '%m-%d') AS time,-->
  272. <!-- SUM(IFNULL(T2.amt,0)) AS amtSum,-->
  273. <!-- COUNT(T2.order_no) AS orderSum-->
  274. <!-- FROM (-->
  275. <!-- ( SELECT-->
  276. <!-- @date := DATE_ADD(@date, INTERVAL + 1 DAY) AS days-->
  277. <!-- FROM-->
  278. <!-- ( SELECT @date := DATE_ADD(#{endTime}, INTERVAL - 8 DAY) FROM pay_order LIMIT 7 ) T1-->
  279. <!-- ) T3 LEFT JOIN pay_order AS T2 ON T3.days = DATE_FORMAT(T2.created_date, '%Y-%m-%d')-->
  280. <!-- AND T2.station_id= #{stationId}-->
  281. <!-- AND T2.status= #{status}-->
  282. <!-- AND T2.created_date &gt;= #{beginTime}-->
  283. <!-- AND T2.created_date &lt; #{endTime}-->
  284. <!-- )-->
  285. <!-- GROUP BY T3.days-->
  286. <!-- </select>-->
  287. <!--POS机查询近七天数据-->
  288. <select id="selectPosRecentlySevenData" parameterType="com.platform.yijia.pojo.PayOrder" resultType="map">
  289. SELECT
  290. V.month_days AS time,
  291. ROUND(SUM(IFNULL(T1.amt,"0")),2) AS amtSum,
  292. COUNT(T1.order_no) AS orderSum
  293. FROM view_recently_seven_day AS V
  294. LEFT JOIN pay_order AS T1 ON V.month_days = DATE_FORMAT(T1.created_date,'%m-%d')
  295. <if test="stationId !=null">
  296. AND T1.station_id= #{stationId}
  297. </if>
  298. <if test="status !=null">
  299. AND T1.status= #{status}
  300. </if>
  301. <if test="beginTime !=null">
  302. AND T1.created_date &gt;= #{beginTime}
  303. </if>
  304. <if test="endTime !=null">
  305. AND T1.created_date &lt; #{endTime}
  306. </if>
  307. GROUP BY month_days
  308. </select>
  309. <!--查询班结时间内订单-->
  310. <select id="selectPayOrderListFormater" parameterType="com.platform.yijia.pojo.PayOrder" resultMap="BaseResultMap">
  311. SELECT
  312. <include refid="Base_Column_List_PayTypeName_Status"/>
  313. FROM
  314. pay_order AS T1
  315. LEFT JOIN sys_dict_data AS T2 ON T1.pay_type = T2.dict_value
  316. <where>
  317. <if test="stationId !=null">
  318. T1.station_id= #{stationId}
  319. </if>
  320. <if test="payType !=null and payType !=''">
  321. AND T1.pay_type= #{payType}
  322. </if>
  323. <if test="status !=null">
  324. AND T1.status= #{status}
  325. </if>
  326. <if test="beginTime !=null and beginTime !=''">
  327. AND T1.pay_date &gt;= #{beginTime}
  328. </if>
  329. <if test="endTime !=null and endTime !=''">
  330. AND T1.pay_date &lt; #{endTime}
  331. </if>
  332. </where>
  333. ORDER BY T1.pay_date DESC
  334. </select>
  335. <!--查询班结时间内订单-->
  336. <select id="selectPayOrderList" parameterType="com.platform.yijia.pojo.PayOrder" resultMap="BaseResultMap">
  337. SELECT
  338. <include refid="Base_Column_List"/>
  339. FROM
  340. pay_order
  341. <where>
  342. <if test="stationId !=null">
  343. station_id= #{stationId}
  344. </if>
  345. <if test="payType !=null and payType !=''">
  346. AND pay_type= #{payType}
  347. </if>
  348. <if test="status !=null">
  349. AND status= #{status}
  350. </if>
  351. <if test="beginTime !=null and beginTime !=''">
  352. AND pay_date &gt;= #{beginTime}
  353. </if>
  354. <if test="endTime !=null and endTime !=''">
  355. AND pay_date &lt; #{endTime}
  356. </if>
  357. </where>
  358. </select>
  359. <!--初次班结 班结时间默认为当前时间订单信息-->
  360. <select id="getPayOrderInfoMin" parameterType="com.platform.yijia.pojo.PayOrder" resultMap="BaseResultMap">
  361. SELECT
  362. <include refid="Base_Column_List"/>
  363. FROM
  364. pay_order
  365. <where>
  366. <if test="stationId !=null">
  367. station_id= #{stationId}
  368. </if>
  369. <if test="status !=null">
  370. AND status= #{status}
  371. </if>
  372. </where>
  373. ORDER BY pay_date ASC LIMIT 0,1
  374. </select>
  375. <!--根据用户openId和用户类型userType查询用户订单-->
  376. <select id="getOrderListByOpenIdAndUserType" parameterType="com.platform.yijia.pojo.AppUserInfo" resultType="com.platform.yijia.pojo.PayOrder">
  377. SELECT
  378. B.order_no AS orderNo,
  379. B.oil_gun AS oilGun,
  380. B.oil_name AS oilName,
  381. B.consumer AS consumer,
  382. B.order_liters AS orderLiters,
  383. B.pay_date AS payDate,
  384. B.amt AS amt,
  385. B.created_date AS createdDate,
  386. B.oil_pirce AS oilPirce,
  387. B.station_name AS stationName,
  388. B.receivable_amt AS receivableAmt,
  389. B.discount_amt AS discountAmt,
  390. B.score AS score,
  391. B.status AS status,
  392. B.discount_coupon_amt AS discountCouponAmt
  393. FROM
  394. app_user_info AS A LEFT JOIN pay_order AS B ON A.user_id = B.consumer_id
  395. <where>
  396. <if test="userType != null and userType !=''">
  397. A.user_type = #{userType}
  398. </if>
  399. <if test="blogOpenid != null and blogOpenid !=''">
  400. AND A.blog_openid = #{blogOpenid}
  401. </if>
  402. <if test="minaOpenid != null and minaOpenid !=''">
  403. AND A.mina_openid = #{minaOpenid}
  404. </if>
  405. </where>
  406. ORDER BY B.created_date DESC
  407. </select>
  408. <!-- 查询加油员-->
  409. <select id="selectPersonelName" parameterType="map" resultType="map">
  410. SELECT
  411. A.personnel_id AS personnelId,
  412. A.personnel_name AS personelName
  413. FROM
  414. station_personnel AS A
  415. <where>
  416. <if test="oliGunNo != null and oliGunNo !=''">
  417. FIND_IN_SET(#{oliGunNo}, A.gun_no)
  418. </if>
  419. <if test="stationId !=null and stationId !=''">
  420. AND A.station_id = #{stationId}
  421. </if>
  422. </where>
  423. </select>
  424. <!-- 根据油品名称和油站查询油枪编号和价格 -->
  425. <select id="selectOilGunNoAndOilPrice" parameterType="map" resultType="map">
  426. SELECT
  427. A.oil_gun_no AS oliGunNo,
  428. A.oil_name AS oilName,
  429. A.station_name AS stationName,
  430. B.oil_price AS oilPrice,
  431. C.personnel_name AS personelName
  432. FROM station_oil_gun AS A
  433. LEFT JOIN station_oil_price AS B ON A.oil_name = B.oil_name AND A.station_id = B.station_id
  434. LEFT JOIN station_personnel AS C ON A.oil_gun_no = C.gun_no AND A.station_id = C.station_id
  435. <where>
  436. <if test="oliGunNo != null and oliGunNo !=''">
  437. A.oil_gun_no = #{oliGunNo}
  438. </if>
  439. <if test="stationId !=null and stationId !=''">
  440. AND A.station_id = #{stationId}
  441. </if>
  442. </where>
  443. </select>
  444. <!-- 根据油品名称和油站id获取当前油品调价信息 -->
  445. <select id="selectOilPriceAdjust" parameterType="map" resultType="map">
  446. SELECT
  447. adjust_price_id AS adjustPriceId,
  448. oil_name AS oilName,
  449. oil_adjust_price AS oilAdjustPrice,
  450. take_effect_status AS takeEffectStatus,
  451. take_effect_date AS takeEffectDate,
  452. adjust_date AS adjustDate,
  453. station_id AS stationId,
  454. operator AS operator,
  455. status AS status
  456. FROM
  457. station_oil_price_adjust
  458. <where>
  459. <if test="oilName !=null and oilName !=''">
  460. oil_name = #{oilName}
  461. </if>
  462. <if test="stationId !=null and stationId !=''">
  463. AND station_id = #{stationId}
  464. </if>
  465. ORDER BY take_effect_date DESC
  466. </where>
  467. </select>
  468. <select id="selectByExample" parameterType="com.platform.yijia.pojo.PayOrderExample" resultMap="BaseResultMap">
  469. <!--
  470. WARNING - @mbg.generated
  471. This element is automatically generated by MyBatis Generator, do not modify.
  472. -->
  473. select
  474. <if test="distinct">
  475. distinct
  476. </if>
  477. <include refid="Base_Column_List" />
  478. from pay_order
  479. <if test="_parameter != null">
  480. <include refid="Example_Where_Clause" />
  481. </if>
  482. <if test="orderByClause != null">
  483. order by ${orderByClause}
  484. </if>
  485. </select>
  486. <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
  487. <!--
  488. WARNING - @mbg.generated
  489. This element is automatically generated by MyBatis Generator, do not modify.
  490. -->
  491. select
  492. <include refid="Base_Column_List" />
  493. from pay_order
  494. where order_id = #{orderId,jdbcType=INTEGER}
  495. </select>
  496. <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
  497. <!--
  498. WARNING - @mbg.generated
  499. This element is automatically generated by MyBatis Generator, do not modify.
  500. -->
  501. delete from pay_order
  502. where order_id = #{orderId,jdbcType=INTEGER}
  503. </delete>
  504. <delete id="deleteByExample" parameterType="com.platform.yijia.pojo.PayOrderExample">
  505. <!--
  506. WARNING - @mbg.generated
  507. This element is automatically generated by MyBatis Generator, do not modify.
  508. -->
  509. delete from pay_order
  510. <if test="_parameter != null">
  511. <include refid="Example_Where_Clause" />
  512. </if>
  513. </delete>
  514. <insert id="insert" parameterType="com.platform.yijia.pojo.PayOrder">
  515. <!--
  516. WARNING - @mbg.generated
  517. This element is automatically generated by MyBatis Generator, do not modify.
  518. -->
  519. INSERT into
  520. pay_order (order_id, order_no, oil_gun,
  521. oil_name, oil_pirce, consumer_id, consumer,
  522. amt, station_id, status,
  523. order_liters, pay_type, pay_way,
  524. pay_date, oil_personnel, created_date,
  525. order_type, station_name, receivable_amt, received_amt, discount_amt, discount_coupon_amt, discount_coupon, wx_amt,
  526. zfb_amt, pos_amt, xj_amt, didi_app_amt, ty_app_amt, other_amt, dzk_amt, score,
  527. member_no, member_amt, print_count, car_no, customer_phone, customer_grade, oil_type)
  528. VALUES (
  529. #{orderId,jdbcType=INTEGER}, #{orderNo,jdbcType=VARCHAR}, #{oilGun,jdbcType=VARCHAR},
  530. #{oilName,jdbcType=VARCHAR}, #{oilPirce,jdbcType=DOUBLE}, #{consumerId,jdbcType=INTEGER}, #{consumer,jdbcType=VARCHAR},
  531. #{amt,jdbcType=DOUBLE}, #{stationId,jdbcType=INTEGER}, #{status,jdbcType=VARCHAR},
  532. #{orderLiters,jdbcType=VARCHAR}, #{payType,jdbcType=VARCHAR}, #{payWay,jdbcType=VARCHAR},
  533. #{payDate,jdbcType=TIMESTAMP}, #{oilPersonnel,jdbcType=VARCHAR}, #{createdDate,jdbcType=TIMESTAMP},
  534. #{orderType,jdbcType=CHAR}, #{stationName,jdbcType=VARCHAR},
  535. #{receivableAmt,jdbcType=DOUBLE}, #{receivedAmt,jdbcType=DOUBLE},#{discountAmt,jdbcType=DOUBLE}, #{discountCouponAmt,jdbcType=DOUBLE},
  536. #{discountCoupon,jdbcType=INTEGER}, #{wxAmt,jdbcType=DOUBLE}, #{zfbAmt,jdbcType=DOUBLE},#{posAmt,jdbcType=DOUBLE},
  537. #{xjAmt,jdbcType=DOUBLE}, #{didiAppAmt,jdbcType=DOUBLE}, #{tyAppAmt,jdbcType=DOUBLE}, #{otherAmt,jdbcType=DOUBLE},
  538. #{dzkAmt,jdbcType=DOUBLE}, #{score,jdbcType=INTEGER}, #{memberNo,jdbcType=VARCHAR}, #{memberAmt,jdbcType=DOUBLE},
  539. #{printCount,jdbcType=INTEGER}, #{carNo,jdbcType=VARCHAR}, #{customerPhone,jdbcType=VARCHAR}, #{customerGrade,jdbcType=VARCHAR}, #{oilType,jdbcType=VARCHAR}
  540. )
  541. </insert>
  542. <insert id="insertSelective" parameterType="com.platform.yijia.pojo.PayOrder">
  543. <!--
  544. WARNING - @mbg.generated
  545. This element is automatically generated by MyBatis Generator, do not modify.
  546. -->
  547. insert into pay_order
  548. <trim prefix="(" suffix=")" suffixOverrides=",">
  549. <if test="orderId != null">
  550. order_id,
  551. </if>
  552. <if test="orderNo != null">
  553. order_no,
  554. </if>
  555. <if test="oilGun != null">
  556. oil_gun,
  557. </if>
  558. <if test="oilName != null">
  559. oil_name,
  560. </if>
  561. <if test="oilPirce != null">
  562. oil_pirce,
  563. </if>
  564. <if test="consumerId != null">
  565. consumer_id,
  566. </if>
  567. <if test="consumer != null">
  568. consumer,
  569. </if>
  570. <if test="amt != null">
  571. amt,
  572. </if>
  573. <if test="stationId != null">
  574. station_id,
  575. </if>
  576. <if test="status != null">
  577. status,
  578. </if>
  579. <if test="orderLiters != null">
  580. order_liters,
  581. </if>
  582. <if test="payType != null">
  583. pay_type,
  584. </if>
  585. <if test="payWay != null">
  586. pay_way,
  587. </if>
  588. <if test="payDate != null">
  589. pay_date,
  590. </if>
  591. <if test="oilPersonnel != null">
  592. oil_personnel,
  593. </if>
  594. <if test="createdDate != null">
  595. created_date,
  596. </if>
  597. <if test="orderType != null">
  598. order_type,
  599. </if>
  600. <if test="stationName != null">
  601. station_name,
  602. </if>
  603. <if test="receivableAmt != null">
  604. receivable_amt,
  605. </if>
  606. <if test="receivedAmt != null">
  607. received_amt,
  608. </if>
  609. <if test="discountAmt != null">
  610. discount_amt,
  611. </if>
  612. <if test="discountCouponAmt != null">
  613. discount_coupon_amt,
  614. </if>
  615. <if test="discountCoupon != null">
  616. discount_coupon,
  617. </if>
  618. <if test="wxAmt != null">
  619. wx_amt,
  620. </if>
  621. <if test="zfbAmt != null">
  622. zfb_amt,
  623. </if>
  624. <if test="posAmt != null">
  625. pos_amt,
  626. </if>
  627. <if test="didiAppAmt != null">
  628. didi_app_amt,
  629. </if>
  630. <if test="tyAppAmt != null">
  631. ty_app_amt,
  632. </if>
  633. <if test="otherAmt != null">
  634. other_amt,
  635. </if>
  636. <if test="dzkAmt != null">
  637. dzk_amt,
  638. </if>
  639. <if test="score != null">
  640. score,
  641. </if>
  642. <if test="memberNo != null">
  643. member_no,
  644. </if>
  645. <if test="memberAmt != null">
  646. member_amt,
  647. </if>
  648. <if test="printCount != null">
  649. print_count,
  650. </if>
  651. <if test="carNo != null">
  652. car_no,
  653. </if>
  654. <if test="customerPhone != null">
  655. customer_phone,
  656. </if>
  657. <if test="customerGrade != null">
  658. customer_grade,
  659. </if>
  660. <if test="oilType != null">
  661. oil_type
  662. </if>
  663. </trim>
  664. <trim prefix="values (" suffix=")" suffixOverrides=",">
  665. <if test="orderId != null">
  666. #{orderId,jdbcType=INTEGER},
  667. </if>
  668. <if test="orderNo != null">
  669. #{orderNo,jdbcType=VARCHAR},
  670. </if>
  671. <if test="oilGun != null">
  672. #{oilGun,jdbcType=VARCHAR},
  673. </if>
  674. <if test="oilName != null">
  675. #{oilName,jdbcType=VARCHAR},
  676. </if>
  677. <if test="oilPirce != null">
  678. #{oilPirce,jdbcType=DOUBLE},
  679. </if>
  680. <if test="consumerId != null">
  681. #{consumerId,jdbcType=INTEGER},
  682. </if>
  683. <if test="consumer != null">
  684. #{consumer,jdbcType=VARCHAR},
  685. </if>
  686. <if test="amt != null">
  687. #{amt,jdbcType=DOUBLE},
  688. </if>
  689. <if test="stationId != null">
  690. #{stationId,jdbcType=INTEGER},
  691. </if>
  692. <if test="status != null">
  693. #{status,jdbcType=VARCHAR},
  694. </if>
  695. <if test="orderLiters != null">
  696. #{orderLiters,jdbcType=VARCHAR},
  697. </if>
  698. <if test="payType != null">
  699. #{payType,jdbcType=VARCHAR},
  700. </if>
  701. <if test="payWay != null">
  702. #{payWay,jdbcType=VARCHAR},
  703. </if>
  704. <if test="payDate != null">
  705. #{payDate,jdbcType=TIMESTAMP},
  706. </if>
  707. <if test="oilPersonnel != null">
  708. #{oilPersonnel,jdbcType=VARCHAR},
  709. </if>
  710. <if test="createdDate != null">
  711. #{createdDate,jdbcType=TIMESTAMP},
  712. </if>
  713. <if test="orderType != null">
  714. #{orderType,jdbcType=CHAR},
  715. </if>
  716. <if test="stationName != null">
  717. #{stationName,jdbcType=VARCHAR},
  718. </if>
  719. <if test="receivableAmt != null">
  720. #{receivableAmt,jdbcType=DOUBLE},
  721. </if>
  722. <if test="receivedAmt != null">
  723. #{receivedAmt,jdbcType=DOUBLE},
  724. </if>
  725. <if test="discountAmt != null">
  726. #{discountAmt,jdbcType=DOUBLE},
  727. </if>
  728. <if test="discountCouponAmt != null">
  729. #{discountCouponAmt,jdbcType=DOUBLE},
  730. </if>
  731. <if test="discountCoupon != null">
  732. #{discountCoupon,jdbcType=VARCHAR},
  733. </if>
  734. <if test="wxAmt != null">
  735. #{wxAmt,jdbcType=DOUBLE},
  736. </if>
  737. <if test="zfbAmt != null">
  738. #{zfbAmt,jdbcType=DOUBLE},
  739. </if>
  740. <if test="posAmt != null">
  741. #{posAmt,jdbcType=DOUBLE},
  742. </if>
  743. <if test="xjAmt != null">
  744. #{xjAmt,jdbcType=DOUBLE},
  745. </if>
  746. <if test="didiAppAmt != null">
  747. #{didiAppAmt,jdbcType=DOUBLE},
  748. </if>
  749. <if test="tyAppAmt != null">
  750. #{tyAppAmt,jdbcType=DOUBLE},
  751. </if>
  752. <if test="otherAmt != null">
  753. #{otherAmt,jdbcType=DOUBLE},
  754. </if>
  755. <if test="dzkAmt != null">
  756. #{dzkAmt,jdbcType=DOUBLE},
  757. </if>
  758. <if test="score != null">
  759. #{score,jdbcType=INTEGER},
  760. </if>
  761. <if test="memberNo != null">
  762. #{memberNo,jdbcType=VARCHAR},
  763. </if>
  764. <if test="memberAmt != null">
  765. #{memberAmt,jdbcType=DOUBLE},
  766. </if>
  767. <if test="printCount != null">
  768. #{printCount,jdbcType=INTEGER},
  769. </if>
  770. <if test="carNo != null">
  771. #{carNo,jdbcType=VARCHAR},
  772. </if>
  773. <if test="customerPhone != null">
  774. #{customerPhone,jdbcType=VARCHAR},
  775. </if>
  776. <if test="customerGrade != null">
  777. #{customerGrade,jdbcType=VARCHAR},
  778. </if>
  779. <if test="oilType != null">
  780. #{oilType,jdbcType=VARCHAR}
  781. </if>
  782. </trim>
  783. </insert>
  784. <select id="countByExample" parameterType="com.platform.yijia.pojo.PayOrderExample" resultType="java.lang.Long">
  785. <!--
  786. WARNING - @mbg.generated
  787. This element is automatically generated by MyBatis Generator, do not modify.
  788. -->
  789. select count(*) from pay_order
  790. <if test="_parameter != null">
  791. <include refid="Example_Where_Clause" />
  792. </if>
  793. </select>
  794. <update id="updateByExampleSelective" parameterType="map">
  795. <!--
  796. WARNING - @mbg.generated
  797. This element is automatically generated by MyBatis Generator, do not modify.
  798. -->
  799. update pay_order
  800. <set>
  801. <if test="record.orderId != null">
  802. order_id = #{record.orderId,jdbcType=INTEGER},
  803. </if>
  804. <if test="record.orderNo != null">
  805. order_no = #{record.orderNo,jdbcType=VARCHAR},
  806. </if>
  807. <if test="record.oilGun != null">
  808. oil_gun = #{record.oilGun,jdbcType=VARCHAR},
  809. </if>
  810. <if test="record.oilName != null">
  811. oil_name = #{record.oilName,jdbcType=VARCHAR},
  812. </if>
  813. <if test="record.oilPirce != null">
  814. oil_pirce = #{record.oilPirce,jdbcType=VARCHAR},
  815. </if>
  816. <if test="record.consumerId != null">
  817. consumer_id = #{record.consumerId,jdbcType=INTEGER},
  818. </if>
  819. <if test="record.consumer != null">
  820. consumer = #{record.consumer,jdbcType=VARCHAR},
  821. </if>
  822. <if test="record.amt != null">
  823. amt = #{record.amt,jdbcType=DOUBLE},
  824. </if>
  825. <if test="record.stationId != null">
  826. station_id = #{record.stationId,jdbcType=INTEGER},
  827. </if>
  828. <if test="record.status != null">
  829. status = #{record.status,jdbcType=VARCHAR},
  830. </if>
  831. <if test="record.orderLiters != null">
  832. order_liters = #{record.orderLiters,jdbcType=VARCHAR},
  833. </if>
  834. <if test="record.payType != null">
  835. pay_type = #{record.payType,jdbcType=VARCHAR},
  836. </if>
  837. <if test="record.payWay != null">
  838. pay_way = #{record.payWay,jdbcType=VARCHAR},
  839. </if>
  840. <if test="record.payDate != null">
  841. pay_date = #{record.payDate,jdbcType=TIMESTAMP},
  842. </if>
  843. <if test="record.oilPersonnel != null">
  844. oil_personnel = #{record.oilPersonnel,jdbcType=VARCHAR},
  845. </if>
  846. <if test="record.createdDate != null">
  847. created_date = #{record.createdDate,jdbcType=TIMESTAMP},
  848. </if>
  849. <if test="record.orderType != null">
  850. order_type = #{record.orderType,jdbcType=CHAR},
  851. </if>
  852. <if test="record.stationName != null">
  853. station_name = #{record.stationName,jdbcType=VARCHAR},
  854. </if>
  855. <if test="record.receivableAmt != null">
  856. receivable_amt = #{record.receivableAmt,jdbcType=DOUBLE},
  857. </if>
  858. <if test="record.receivedAmt != null">
  859. received_amt = #{record.receivedAmt,jdbcType=DOUBLE},
  860. </if>
  861. <if test="record.discountAmt != null">
  862. discount_amt = #{record.discountAmt,jdbcType=DOUBLE},
  863. </if>
  864. <if test="record.discountCouponAmt != null">
  865. discount_coupon_amt = #{record.discountCouponAmt,jdbcType=DOUBLE},
  866. </if>
  867. <if test="record.discountCoupon != null">
  868. discount_coupon = #{record.discountCoupon,jdbcType=VARCHAR},
  869. </if>
  870. <if test="record.wxAmt != null">
  871. wx_amt = #{record.wxAmt,jdbcType=DOUBLE},
  872. </if>
  873. <if test="record.zfbAmt != null">
  874. zfb_amt = #{record.zfbAmt,jdbcType=DOUBLE},
  875. </if>
  876. <if test="record.posAmt != null">
  877. pos_amt = #{record.posAmt,jdbcType=DOUBLE},
  878. </if>
  879. <if test="record.xjAmt != null">
  880. xj_amt = #{record.xjAmt,jdbcType=DOUBLE},
  881. </if>
  882. <if test="record.didiAppAmt != null">
  883. didi_app_amt = #{record.didiAppAmt,jdbcType=DOUBLE},
  884. </if>
  885. <if test="record.tyAppAmt != null">
  886. ty_app_amt = #{record.tyAppAmt,jdbcType=DOUBLE},
  887. </if>
  888. <if test="record.otherAmt != null">
  889. other_amt = #{record.otherAmt,jdbcType=DOUBLE},
  890. </if>
  891. <if test="record.dzkAmt != null">
  892. dzk_amt = #{record.dzkAmt,jdbcType=DOUBLE},
  893. </if>
  894. <if test="record.score != null">
  895. score = #{record.score,jdbcType=INTEGER},
  896. </if>
  897. <if test="record.memberNo != null">
  898. member_no = #{record.memberNo,jdbcType=VARCHAR},
  899. </if>
  900. <if test="record.memberAmt != null">
  901. member_amt = #{record.memberAmt,jdbcType=DOUBLE},
  902. </if>
  903. <if test="record.printCount != null">
  904. print_count = #{record.printCount,jdbcType=INTEGER},
  905. </if>
  906. <if test="record.carNo != null">
  907. car_no = #{record.carNo,jdbcType=VARCHAR},
  908. </if>
  909. <if test="record.customerPhone != null">
  910. customer_phone = #{record.customerPhone,jdbcType=VARCHAR},
  911. </if>
  912. <if test="record.customerGrade != null">
  913. customer_grade = #{record.customerGrade,jdbcType=VARCHAR},
  914. </if>
  915. <if test="oilType != null">
  916. oil_type = #{record.oilType,jdbcType=VARCHAR},
  917. </if>
  918. </set>
  919. <if test="_parameter != null">
  920. <include refid="Update_By_Example_Where_Clause" />
  921. </if>
  922. </update>
  923. <!--根据订单号查询订单信息和用户信息 此方法在随行付回调之后和电子卡支付后修改状态完成后-->
  924. <select id="getOrderInfoAndUserInfoByOrderNo" parameterType="com.platform.yijia.pojo.PayOrder" resultType="map">
  925. SELECT
  926. A.order_no AS orderNo,
  927. A.consumer AS consumer,
  928. A.station_id AS stationId,
  929. A.status AS status,
  930. A.pay_way AS payWay,
  931. A.pay_type AS payType,
  932. A.oil_name AS oilName,
  933. A.oil_gun AS oilGun,
  934. A.oil_type AS oilType,
  935. A.order_liters AS orderLiters,
  936. A.amt AS amt,
  937. A.order_type AS orderType,
  938. A.oil_pirce AS oilPirce,
  939. A.receivable_amt AS receivableAmt,
  940. A.discount_amt AS discountAmt,
  941. A.created_date AS createdDate,
  942. A.pay_date AS payDate,
  943. A.consumer_id AS consumerId,
  944. B.user_type AS userType,
  945. B.registe_date AS registeDate,
  946. B.blog_openid AS blogOpenid,
  947. B.mina_openid AS minaOpenid,
  948. B.union_id AS unionId,
  949. B.mobile_phone AS mobilePhone,
  950. C.dept_name AS stationName,
  951. C.parent_id AS groupId
  952. FROM
  953. pay_order AS A
  954. LEFT JOIN app_user_info AS B ON A.consumer_id = B.user_id
  955. LEFT JOIN sys_dept AS C ON A.station_id = C.dept_id
  956. WHERE
  957. A.order_no = #{orderNo}
  958. </select>
  959. <!-- 更新订单-->
  960. <update id="updateOrderStatus" parameterType="com.platform.yijia.pojo.PayOrder">
  961. UPDATE
  962. pay_order
  963. <set>
  964. <if test="status != null">
  965. status = #{status,jdbcType=VARCHAR},
  966. </if>
  967. <if test="receivedAmt != null">
  968. received_amt = #{receivedAmt,jdbcType=DOUBLE},
  969. </if>
  970. <if test="payType != null">
  971. pay_type = #{payType,jdbcType=VARCHAR},
  972. </if>
  973. <if test="wxAmt != null">
  974. wx_amt = #{wxAmt,jdbcType=DOUBLE},
  975. </if>
  976. <if test="dzkAmt != null">
  977. dzk_amt = #{dzkAmt,jdbcType=DOUBLE},
  978. </if>
  979. <if test="payDate != null">
  980. pay_date = #{payDate,jdbcType=TIMESTAMP},
  981. </if>
  982. <if test="printCount != null">
  983. print_count = #{printCount,jdbcType=INTEGER},
  984. </if>
  985. </set>
  986. <where>
  987. order_no = #{orderNo,jdbcType=VARCHAR}
  988. </where>
  989. </update>
  990. <!--根据用户登录openId 获取用户信息用于插入客户表-->
  991. <select id="getUserInfoByOpenId" parameterType="com.platform.yijia.pojo.AppUserInfo" resultType="com.platform.yijia.pojo.AppUserInfo">
  992. SELECT
  993. user_id AS userId,
  994. blog_nick_name AS blogNickName,
  995. mina_openid AS minaOpenid,
  996. blog_openid AS blogOpenid,
  997. registe_date AS registeDate,
  998. mobile_phone AS mobilePhone,
  999. user_type AS userType,
  1000. union_id AS unionId,
  1001. station_id AS stationId
  1002. FROM
  1003. app_user_info
  1004. <where>
  1005. <if test="mobilePhone !=null and mobilePhone !='' ">
  1006. mobile_phone = #{mobilePhone}
  1007. </if>
  1008. <if test="stationId !=null and stationId !='' ">
  1009. AND station_id = #{stationId}
  1010. </if>
  1011. </where>
  1012. </select>
  1013. <!-- 判断客户表是否已存在-->
  1014. <select id="isExistCustomer" parameterType="com.platform.yijia.pojo.CustomerManage" resultType="com.platform.yijia.pojo.CustomerManage">
  1015. SELECT
  1016. id AS id,
  1017. member_id AS memberId,
  1018. member_grade AS memberGrade,
  1019. phone_number AS phoneNumber,
  1020. regtime AS regtime,
  1021. station_name AS stationName,
  1022. oil_name AS oilName,
  1023. liters AS liters,
  1024. amt AS amt
  1025. FROM
  1026. customer_manage
  1027. <where>
  1028. <if test="phoneNumber !=null and phoneNumber !='' ">
  1029. phone_number = #{phoneNumber}
  1030. </if>
  1031. <if test="stationId !=null and stationId !='' ">
  1032. AND station_id = #{stationId}
  1033. </if>
  1034. <if test="oilName !=null and oilName !='' ">
  1035. AND oil_name = #{oilName}
  1036. </if>
  1037. </where>
  1038. </select>
  1039. <!-- 根据手机号更新客户表 -->
  1040. <update id="updateCustomerByPhoneNumber" parameterType="com.platform.yijia.pojo.CustomerManage">
  1041. UPDATE
  1042. customer_manage
  1043. <set>
  1044. <if test="customerName !=null ">
  1045. customer_name = #{customerName},
  1046. </if>
  1047. <if test="phoneNumber !=null ">
  1048. phone_number = #{phoneNumber},
  1049. </if>
  1050. <if test="regtime !=null ">
  1051. regtime = #{regtime},
  1052. </if>
  1053. <if test="stationName !=null ">
  1054. station_name = #{stationName},
  1055. </if>
  1056. <if test="stationId !=null ">
  1057. station_id = #{stationId},
  1058. </if>
  1059. <if test="blogUserId !=null ">
  1060. blog_user_id = #{blogUserId},
  1061. </if>
  1062. <if test="minaUserId !=null ">
  1063. mina_user_id = #{minaUserId},
  1064. </if>
  1065. <if test="oilName !=null ">
  1066. oil_name = #{oilName},
  1067. </if>
  1068. <if test="liters !=null ">
  1069. liters = #{liters},
  1070. </if>
  1071. <if test="amt !=null ">
  1072. amt = #{amt},
  1073. </if>
  1074. <if test="unionId !=null and unionId !=null">
  1075. union_id = #{unionId},
  1076. </if>
  1077. </set>
  1078. <where>
  1079. <if test="phoneNumber !=null and phoneNumber !='' ">
  1080. phone_number = #{phoneNumber}
  1081. </if>
  1082. </where>
  1083. </update>
  1084. <!-- 更新客户表 -->
  1085. <update id="updateCustomer" parameterType="com.platform.yijia.pojo.CustomerManage">
  1086. UPDATE
  1087. customer_manage
  1088. <set>
  1089. <if test="memberGrade !=null ">
  1090. member_grade = #{memberGrade},
  1091. </if>
  1092. <if test="customerName !=null ">
  1093. customer_name = #{customerName},
  1094. </if>
  1095. <if test="phoneNumber !=null ">
  1096. phone_number = #{phoneNumber},
  1097. </if>
  1098. <if test="regtime !=null ">
  1099. regtime = #{regtime},
  1100. </if>
  1101. <if test="stationName !=null ">
  1102. station_name = #{stationName},
  1103. </if>
  1104. <if test="oilName !=null ">
  1105. oil_name = #{oilName},
  1106. </if>
  1107. <if test="liters !=null ">
  1108. liters = #{liters},
  1109. </if>
  1110. <if test="amt !=null ">
  1111. amt = #{amt},
  1112. </if>
  1113. <if test="grade !=null ">
  1114. grade = #{grade},
  1115. </if>
  1116. <if test="unionId !=null ">
  1117. union_id = #{unionId},
  1118. </if>
  1119. </set>
  1120. <where>
  1121. <if test="stationId != null and stationId !='' ">
  1122. station_id = #{stationId}
  1123. </if>
  1124. <if test="phoneNumber !=null and phoneNumber !='' ">
  1125. AND phone_number = #{phoneNumber}
  1126. </if>
  1127. <if test="oilName !=null and oilName !='' ">
  1128. AND oil_name = #{oilName}
  1129. </if>
  1130. </where>
  1131. </update>
  1132. <!-- 插入客户表 -->
  1133. <insert id="insertCustomer" parameterType="com.platform.yijia.pojo.CustomerManage">
  1134. INSERT INTO customer_manage
  1135. <trim prefix="(" suffix=")" suffixOverrides=",">
  1136. <if test="memberId !=null ">
  1137. member_id,
  1138. </if>
  1139. <if test="customerName !=null ">
  1140. customer_name,
  1141. </if>
  1142. <if test="commendMan !=null ">
  1143. commend_man,
  1144. </if>
  1145. <if test="memberGrade !=null ">
  1146. member_grade,
  1147. </if>
  1148. <if test="phoneNumber !=null ">
  1149. phone_number,
  1150. </if>
  1151. <if test="carNumber !=null ">
  1152. car_number,
  1153. </if>
  1154. <if test="balance !=null ">
  1155. balance,
  1156. </if>
  1157. <if test="integral !=null ">
  1158. integral,
  1159. </if>
  1160. <if test="specialCarType !=null ">
  1161. specialCarType,
  1162. </if>
  1163. <if test="regtime !=null ">
  1164. regtime,
  1165. </if>
  1166. <if test="stationId !=null ">
  1167. station_id,
  1168. </if>
  1169. <if test="stationName !=null ">
  1170. station_name,
  1171. </if>
  1172. <if test="oilName !=null ">
  1173. oil_name,
  1174. </if>
  1175. <if test="liters !=null ">
  1176. liters,
  1177. </if>
  1178. <if test="amt !=null ">
  1179. amt,
  1180. </if>
  1181. <if test="cyGrade !=null ">
  1182. cy_grade,
  1183. </if>
  1184. <if test="qyGrade !=null ">
  1185. qy_grade,
  1186. </if>
  1187. <if test="blogOpenid !=null ">
  1188. blog_openid,
  1189. </if>
  1190. <if test="minaOpenid !=null ">
  1191. mina_openid,
  1192. </if>
  1193. <if test="blogUserId !=null ">
  1194. blog_user_id,
  1195. </if>
  1196. <if test="minaUserId !=null ">
  1197. mina_user_id,
  1198. </if>
  1199. <if test="grade !=null ">
  1200. grade,
  1201. </if>
  1202. <if test="unionId !=null and unionId !=''">
  1203. union_id
  1204. </if>
  1205. </trim>
  1206. <trim prefix="values (" suffix=")" suffixOverrides=",">
  1207. <if test="memberId !=null ">
  1208. #{memberId},
  1209. </if>
  1210. <if test="customerName !=null ">
  1211. #{customerName},
  1212. </if>
  1213. <if test="commendMan !=null ">
  1214. #{commendMan},
  1215. </if>
  1216. <if test="memberGrade !=null ">
  1217. #{memberGrade},
  1218. </if>
  1219. <if test="phoneNumber !=null ">
  1220. #{phoneNumber},
  1221. </if>
  1222. <if test="carNumber !=null ">
  1223. #{carNumber},
  1224. </if>
  1225. <if test="balance !=null ">
  1226. #{balance},
  1227. </if>
  1228. <if test="integral !=null ">
  1229. #{integral},
  1230. </if>
  1231. <if test="specialCarType !=null ">
  1232. #{specialCarType},
  1233. </if>
  1234. <if test="regtime !=null ">
  1235. #{regtime},
  1236. </if>
  1237. <if test="stationId !=null ">
  1238. #{stationId, jdbcType=INTEGER},
  1239. </if>
  1240. <if test="stationName !=null ">
  1241. #{stationName, jdbcType=VARCHAR},
  1242. </if>
  1243. <if test="oilName !=null ">
  1244. #{oilName},
  1245. </if>
  1246. <if test="liters !=null ">
  1247. #{liters},
  1248. </if>
  1249. <if test="amt !=null ">
  1250. #{amt},
  1251. </if>
  1252. <if test="cyGrade !=null ">
  1253. #{cyGrade},
  1254. </if>
  1255. <if test="qyGrade !=null ">
  1256. #{qyGrade},
  1257. </if>
  1258. <if test="blogOpenid !=null ">
  1259. #{blogOpenid},
  1260. </if>
  1261. <if test="minaOpenid !=null ">
  1262. #{minaOpenid, jdbcType=VARCHAR},
  1263. </if>
  1264. <if test="blogUserId !=null ">
  1265. #{blogUserId, jdbcType=INTEGER},
  1266. </if>
  1267. <if test="minaUserId !=null ">
  1268. #{minaUserId, jdbcType=INTEGER},
  1269. </if>
  1270. <if test="grade !=null ">
  1271. #{grade, jdbcType=VARCHAR},
  1272. </if>
  1273. <if test="unionId !=null and unionId !=''">
  1274. #{unionId, jdbcType=VARCHAR}
  1275. </if>
  1276. </trim>
  1277. </insert>
  1278. <update id="updateByExample" parameterType="map">
  1279. <!--
  1280. WARNING - @mbg.generated
  1281. This element is automatically generated by MyBatis Generator, do not modify.
  1282. -->
  1283. update pay_order
  1284. set order_id = #{record.orderId,jdbcType=INTEGER},
  1285. order_no = #{record.orderNo,jdbcType=VARCHAR},
  1286. oil_gun = #{record.oilGun,jdbcType=VARCHAR},
  1287. oil_name = #{record.oilName,jdbcType=VARCHAR},
  1288. oil_pirce = #{record.oilPirce,jdbcType=VARCHAR},
  1289. consumer_id = #{record.consumerId,jdbcType=INTEGER},
  1290. consumer = #{record.consumer,jdbcType=VARCHAR},
  1291. amt = #{record.amt,jdbcType=DOUBLE},
  1292. station_id = #{record.stationId,jdbcType=INTEGER},
  1293. status = #{record.status,jdbcType=VARCHAR},
  1294. order_liters = #{record.orderLiters,jdbcType=VARCHAR},
  1295. pay_type = #{record.payType,jdbcType=VARCHAR},
  1296. pay_way = #{record.payWay,jdbcType=VARCHAR},
  1297. pay_date = #{record.payDate,jdbcType=TIMESTAMP},
  1298. oil_personnel = #{record.oilPersonnel,jdbcType=VARCHAR},
  1299. created_date = #{record.createdDate,jdbcType=TIMESTAMP},
  1300. order_type = #{record.orderType,jdbcType=CHAR},
  1301. station_name = #{record.stationName,jdbcType=VARCHAR},
  1302. receivable_amt = #{record.receivableAmt,jdbcType=DOUBLE},
  1303. received_amt = #{record.receivedAmt,jdbcType=DOUBLE},
  1304. discount_amt = #{record.discountAmt,jdbcType=DOUBLE},
  1305. discount_coupon_amt = #{record.discountCouponAmt,jdbcType=DOUBLE},
  1306. discount_coupon = #{record.discountCoupon,jdbcType=DOUBLE},
  1307. wx_amt = #{record.wxAmt,jdbcType=DOUBLE},
  1308. zfb_amt = #{record.zfbAmt,jdbcType=DOUBLE},
  1309. pos_amt = #{record.posAmt,jdbcType=DOUBLE},
  1310. xj_amt = #{record.xjAmt,jdbcType=DOUBLE},
  1311. didi_app_amt = #{record.didiAppAmt,jdbcType=DOUBLE},
  1312. ty_app_amt = #{record.tyAppAmt,jdbcType=DOUBLE},
  1313. other_amt = #{record.otherAmt,jdbcType=DOUBLE},
  1314. dzk_amt = #{record.dzkAmt,jdbcType=DOUBLE},
  1315. score = #{record.score,jdbcType=INTEGER},
  1316. member_no = #{record.memberNo,jdbcType=VARCHAR},
  1317. member_amt = #{record.memberAmt,jdbcType=DOUBLE},
  1318. print_count = #{record.printCount,jdbcType=INTEGER},
  1319. car_no = #{record.carNo,jdbcType=VARCHAR},
  1320. customer_phone = #{record.customerPhone,jdbcType=VARCHAR},
  1321. customer_grade = #{record.customerGrade,jdbcType=VARCHAR},
  1322. oil_type = #{record.oilType,jdbcType=VARCHAR}
  1323. <if test="_parameter != null">
  1324. <include refid="Update_By_Example_Where_Clause" />
  1325. </if>
  1326. </update>
  1327. <update id="updateByPrimaryKeySelective" parameterType="com.platform.yijia.pojo.PayOrder">
  1328. <!--
  1329. WARNING - @mbg.generated
  1330. This element is automatically generated by MyBatis Generator, do not modify.
  1331. -->
  1332. update pay_order
  1333. <set>
  1334. <if test="orderNo != null">
  1335. order_no = #{orderNo,jdbcType=VARCHAR},
  1336. </if>
  1337. <if test="oilGun != null">
  1338. oil_gun = #{oilGun,jdbcType=VARCHAR},
  1339. </if>
  1340. <if test="oilName != null">
  1341. oil_name = #{oilName,jdbcType=VARCHAR},
  1342. </if>
  1343. <if test="oilPirce != null">
  1344. oil_pirce = #{oilPirce,jdbcType=DOUBLE},
  1345. </if>
  1346. <if test="consumerId != null">
  1347. consumer_id = #{consumerId,jdbcType=INTEGER},
  1348. </if>
  1349. <if test="consumer != null">
  1350. consumer = #{consumer,jdbcType=VARCHAR},
  1351. </if>
  1352. <if test="amt != null">
  1353. amt = #{amt,jdbcType=DOUBLE},
  1354. </if>
  1355. <if test="stationId != null">
  1356. station_id = #{stationId,jdbcType=INTEGER},
  1357. </if>
  1358. <if test="status != null">
  1359. status = #{status,jdbcType=VARCHAR},
  1360. </if>
  1361. <if test="orderLiters != null">
  1362. order_liters = #{orderLiters,jdbcType=VARCHAR},
  1363. </if>
  1364. <if test="payType != null">
  1365. pay_type = #{payType,jdbcType=VARCHAR},
  1366. </if>
  1367. <if test="payWay != null">
  1368. pay_way = #{payWay,jdbcType=VARCHAR},
  1369. </if>
  1370. <if test="payDate != null">
  1371. pay_date = #{payDate,jdbcType=TIMESTAMP},
  1372. </if>
  1373. <if test="oilPersonnel != null">
  1374. oil_personnel = #{oilPersonnel,jdbcType=VARCHAR},
  1375. </if>
  1376. <if test="createdDate != null">
  1377. created_date = #{createdDate,jdbcType=TIMESTAMP},
  1378. </if>
  1379. <if test="orderType != null">
  1380. order_type = #{orderType,jdbcType=CHAR},
  1381. </if>
  1382. <if test="stationName != null">
  1383. station_name = #{stationName,jdbcType=CHAR},
  1384. </if>
  1385. <if test="receivableAmt != null">
  1386. receivable_amt = #{receivableAmt,jdbcType=DOUBLE},
  1387. </if>
  1388. <if test="receivedAmt != null">
  1389. received_amt = #{receivedAmt,jdbcType=DOUBLE},
  1390. </if>
  1391. <if test="discountAmt != null">
  1392. discount_amt = #{discountAmt,jdbcType=DOUBLE},
  1393. </if>
  1394. <if test="discountCouponAmt != null">
  1395. discount_coupon_amt = #{discountCouponAmt,jdbcType=DOUBLE},
  1396. </if>
  1397. <if test="discountCoupon != null">
  1398. discount_coupon = #{discountCoupon,jdbcType=VARCHAR},
  1399. </if>
  1400. <if test="wxAmt != null">
  1401. wx_amt = #{wxAmt,jdbcType=DOUBLE},
  1402. </if>
  1403. <if test="zfbAmt != null">
  1404. zfb_amt = #{zfbAmt,jdbcType=DOUBLE},
  1405. </if>
  1406. <if test="posAmt != null">
  1407. pos_amt = #{posAmt,jdbcType=DOUBLE},
  1408. </if>
  1409. <if test="xjAmt != null">
  1410. xj_amt = #{xjAmt,jdbcType=DOUBLE},
  1411. </if>
  1412. <if test="didiAppAmt != null">
  1413. didi_app_amt = #{didiAppAmt,jdbcType=DOUBLE},
  1414. </if>
  1415. <if test="tyAppAmt != null">
  1416. ty_app_amt = #{tyAppAmt,jdbcType=DOUBLE},
  1417. </if>
  1418. <if test="otherAmt != null">
  1419. other_amt = #{otherAmt,jdbcType=DOUBLE},
  1420. </if>
  1421. <if test="dzkAmt != null">
  1422. dzk_amt = #{dzkAmt,jdbcType=DOUBLE},
  1423. </if>
  1424. <if test="score != null">
  1425. score = #{score,jdbcType=INTEGER},
  1426. </if>
  1427. <if test="memberNo != null">
  1428. member_no = #{memberNo,jdbcType=VARCHAR},
  1429. </if>
  1430. <if test="memberAmt != null">
  1431. member_amt = #{memberAmt,jdbcType=DOUBLE},
  1432. </if>
  1433. <if test="printCount != null">
  1434. print_count = #{printCount,jdbcType=INTEGER},
  1435. </if>
  1436. <if test="carNo != null">
  1437. car_no = #{carNo,jdbcType=VARCHAR},
  1438. </if>
  1439. <if test="customerPhone != null">
  1440. customer_phone = #{customerPhone,jdbcType=VARCHAR},
  1441. </if>
  1442. <if test="oilType != null">
  1443. oil_type = #{oilType,jdbcType=VARCHAR}
  1444. </if>
  1445. </set>
  1446. where order_id = #{orderId,jdbcType=INTEGER}
  1447. </update>
  1448. <update id="updateByPrimaryKey" parameterType="com.platform.yijia.pojo.PayOrder">
  1449. <!--
  1450. WARNING - @mbg.generated
  1451. This element is automatically generated by MyBatis Generator, do not modify.
  1452. -->
  1453. update pay_order
  1454. set order_no = #{orderNo,jdbcType=VARCHAR},
  1455. oil_gun = #{oilGun,jdbcType=VARCHAR},
  1456. oil_name = #{oilName,jdbcType=VARCHAR},
  1457. oil_pirce = #{oilPirce,jdbcType=DOUBLE},
  1458. consumer_id = #{consumerId,jdbcType=INTEGER},
  1459. consumer = #{consumer,jdbcType=VARCHAR},
  1460. amt = #{amt,jdbcType=VARCHAR},
  1461. station_id = #{stationId,jdbcType=INTEGER},
  1462. status = #{status,jdbcType=VARCHAR},
  1463. order_liters = #{orderLiters,jdbcType=VARCHAR},
  1464. pay_type = #{payType,jdbcType=VARCHAR},
  1465. pay_way = #{payWay,jdbcType=VARCHAR},
  1466. pay_date = #{payDate,jdbcType=TIMESTAMP},
  1467. oil_personnel = #{oilPersonnel,jdbcType=VARCHAR},
  1468. created_date = #{createdDate,jdbcType=TIMESTAMP},
  1469. order_type = #{orderType,jdbcType=CHAR}
  1470. station_name = #{stationName,jdbcType=VARCHAR},
  1471. receivable_amt = #{receivableAmt,jdbcType=DOUBLE},
  1472. received_amt = #{receivedAmt,jdbcType=DOUBLE},
  1473. discount_amt = #{discountAmt,jdbcType=DOUBLE},
  1474. discount_coupon_amt = #{discountCouponAmt,jdbcType=DOUBLE},
  1475. discount_coupon = #{discountCoupon,jdbcType=DOUBLE},
  1476. wx_amt = #{wxAmt,jdbcType=DOUBLE},
  1477. zfb_amt = #{zfbAmt,jdbcType=DOUBLE},
  1478. pos_amt = #{posAmt,jdbcType=DOUBLE},
  1479. xj_amt = #{xjAmt,jdbcType=DOUBLE},
  1480. didi_app_amt = #{didiAppAmt,jdbcType=DOUBLE},
  1481. ty_app_amt = #{tyAppAmt,jdbcType=DOUBLE},
  1482. other_amt = #{otherAmt,jdbcType=DOUBLE},
  1483. dzk_amt = #{dzkAmt,jdbcType=DOUBLE},
  1484. score = #{score,jdbcType=INTEGER},
  1485. member_no = #{memberNo,jdbcType=VARCHAR},
  1486. member_amt = #{memberAmt,jdbcType=DOUBLE},
  1487. print_count = #{printCount,jdbcType=INTEGER},
  1488. car_no = #{carNo,jdbcType=VARCHAR},
  1489. customer_phone = #{customerPhone,jdbcType=VARCHAR},
  1490. customer_grade = #{customerGrade,jdbcType=VARCHAR},
  1491. oil_type = #{oilType,jdbcType=VARCHAR}
  1492. where order_id = #{orderId,jdbcType=INTEGER}
  1493. </update>
  1494. </mapper>