PayOrderMapper.xml 54 KB

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