PayOrderMapper.xml 57 KB

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