PayOrderMapper.xml 55 KB

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