PayOrderMapper.xml 55 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580
  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.order_liters AS orderLiters,
  934. A.amt AS amt,
  935. A.order_type AS orderType,
  936. A.oil_pirce AS oilPirce,
  937. A.receivable_amt AS receivableAmt,
  938. A.discount_amt AS discountAmt,
  939. A.created_date AS createdDate,
  940. A.pay_date AS payDate,
  941. A.consumer_id AS consumerId,
  942. B.user_type AS userType,
  943. B.registe_date AS registeDate,
  944. B.blog_openid AS blogOpenid,
  945. B.mina_openid AS minaOpenid,
  946. B.union_id AS unionId,
  947. B.mobile_phone AS mobilePhone,
  948. C.dept_name AS stationName,
  949. C.parent_id AS groupId
  950. FROM
  951. pay_order AS A
  952. LEFT JOIN app_user_info AS B ON A.consumer_id = B.user_id
  953. LEFT JOIN sys_dept AS C ON A.station_id = C.dept_id
  954. WHERE
  955. A.order_no = #{orderNo}
  956. </select>
  957. <!-- 更新订单-->
  958. <update id="updateOrderStatus" parameterType="com.platform.yijia.pojo.PayOrder">
  959. UPDATE
  960. pay_order
  961. <set>
  962. <if test="status != null">
  963. status = #{status,jdbcType=VARCHAR},
  964. </if>
  965. <if test="receivedAmt != null">
  966. received_amt = #{receivedAmt,jdbcType=DOUBLE},
  967. </if>
  968. <if test="payType != null">
  969. pay_type = #{payType,jdbcType=VARCHAR},
  970. </if>
  971. <if test="wxAmt != null">
  972. wx_amt = #{wxAmt,jdbcType=DOUBLE},
  973. </if>
  974. <if test="dzkAmt != null">
  975. dzk_amt = #{dzkAmt,jdbcType=DOUBLE},
  976. </if>
  977. <if test="payDate != null">
  978. pay_date = #{payDate,jdbcType=TIMESTAMP},
  979. </if>
  980. <if test="printCount != null">
  981. print_count = #{printCount,jdbcType=INTEGER},
  982. </if>
  983. </set>
  984. <where>
  985. order_no = #{orderNo,jdbcType=VARCHAR}
  986. </where>
  987. </update>
  988. <!--根据用户登录openId 获取用户信息用于插入客户表-->
  989. <select id="getUserInfoByOpenId" parameterType="com.platform.yijia.pojo.AppUserInfo" resultType="com.platform.yijia.pojo.AppUserInfo">
  990. SELECT
  991. user_id AS userId,
  992. blog_nick_name AS blogNickName,
  993. mina_openid AS minaOpenid,
  994. blog_openid AS blogOpenid,
  995. registe_date AS registeDate,
  996. mobile_phone AS mobilePhone,
  997. user_type AS userType,
  998. union_id AS unionId,
  999. station_id AS stationId
  1000. FROM
  1001. app_user_info
  1002. <where>
  1003. <if test="mobilePhone !=null and mobilePhone !='' ">
  1004. mobile_phone = #{mobilePhone}
  1005. </if>
  1006. <if test="stationId !=null and stationId !='' ">
  1007. AND station_id = #{stationId}
  1008. </if>
  1009. </where>
  1010. </select>
  1011. <!-- 判断客户表是否已存在-->
  1012. <select id="isExistCustomer" parameterType="com.platform.yijia.pojo.CustomerManage" resultType="com.platform.yijia.pojo.CustomerManage">
  1013. SELECT
  1014. id AS id,
  1015. member_id AS memberId,
  1016. member_grade AS memberGrade,
  1017. phone_number AS phoneNumber,
  1018. regtime AS regtime,
  1019. station_name AS stationName,
  1020. oil_name AS oilName,
  1021. liters AS liters,
  1022. amt AS amt
  1023. FROM
  1024. customer_manage
  1025. <where>
  1026. <if test="phoneNumber !=null and phoneNumber !='' ">
  1027. phone_number = #{phoneNumber}
  1028. </if>
  1029. <if test="stationId !=null and stationId !='' ">
  1030. AND station_id = #{stationId}
  1031. </if>
  1032. <if test="oilName !=null and oilName !='' ">
  1033. AND oil_name = #{oilName}
  1034. </if>
  1035. </where>
  1036. </select>
  1037. <!-- 根据手机号更新客户表 -->
  1038. <update id="updateCustomerByPhoneNumber" parameterType="com.platform.yijia.pojo.CustomerManage">
  1039. UPDATE
  1040. customer_manage
  1041. <set>
  1042. <if test="customerName !=null ">
  1043. customer_name = #{customerName},
  1044. </if>
  1045. <if test="phoneNumber !=null ">
  1046. phone_number = #{phoneNumber},
  1047. </if>
  1048. <if test="regtime !=null ">
  1049. regtime = #{regtime},
  1050. </if>
  1051. <if test="stationName !=null ">
  1052. station_name = #{stationName},
  1053. </if>
  1054. <if test="stationId !=null ">
  1055. station_id = #{stationId},
  1056. </if>
  1057. <if test="blogUserId !=null ">
  1058. blog_user_id = #{blogUserId},
  1059. </if>
  1060. <if test="minaUserId !=null ">
  1061. mina_user_id = #{minaUserId},
  1062. </if>
  1063. <if test="oilName !=null ">
  1064. oil_name = #{oilName},
  1065. </if>
  1066. <if test="liters !=null ">
  1067. liters = #{liters},
  1068. </if>
  1069. <if test="amt !=null ">
  1070. amt = #{amt},
  1071. </if>
  1072. <if test="unionId !=null and unionId !=null">
  1073. union_id = #{unionId},
  1074. </if>
  1075. </set>
  1076. <where>
  1077. <if test="phoneNumber !=null and phoneNumber !='' ">
  1078. phone_number = #{phoneNumber}
  1079. </if>
  1080. </where>
  1081. </update>
  1082. <!-- 更新客户表 -->
  1083. <update id="updateCustomer" parameterType="com.platform.yijia.pojo.CustomerManage">
  1084. UPDATE
  1085. customer_manage
  1086. <set>
  1087. <if test="memberGrade !=null ">
  1088. member_grade = #{memberGrade},
  1089. </if>
  1090. <if test="customerName !=null ">
  1091. customer_name = #{customerName},
  1092. </if>
  1093. <if test="phoneNumber !=null ">
  1094. phone_number = #{phoneNumber},
  1095. </if>
  1096. <if test="regtime !=null ">
  1097. regtime = #{regtime},
  1098. </if>
  1099. <if test="stationName !=null ">
  1100. station_name = #{stationName},
  1101. </if>
  1102. <if test="oilName !=null ">
  1103. oil_name = #{oilName},
  1104. </if>
  1105. <if test="liters !=null ">
  1106. liters = #{liters},
  1107. </if>
  1108. <if test="amt !=null ">
  1109. amt = #{amt},
  1110. </if>
  1111. <if test="grade !=null ">
  1112. grade = #{grade},
  1113. </if>
  1114. <if test="unionId !=null ">
  1115. union_id = #{unionId},
  1116. </if>
  1117. </set>
  1118. <where>
  1119. <if test="stationId != null and stationId !='' ">
  1120. station_id = #{stationId}
  1121. </if>
  1122. <if test="phoneNumber !=null and phoneNumber !='' ">
  1123. AND phone_number = #{phoneNumber}
  1124. </if>
  1125. <if test="oilName !=null and oilName !='' ">
  1126. AND oil_name = #{oilName}
  1127. </if>
  1128. </where>
  1129. </update>
  1130. <!-- 插入客户表 -->
  1131. <insert id="insertCustomer" parameterType="com.platform.yijia.pojo.CustomerManage">
  1132. INSERT INTO customer_manage
  1133. <trim prefix="(" suffix=")" suffixOverrides=",">
  1134. <if test="memberId !=null ">
  1135. member_id,
  1136. </if>
  1137. <if test="customerName !=null ">
  1138. customer_name,
  1139. </if>
  1140. <if test="commendMan !=null ">
  1141. commend_man,
  1142. </if>
  1143. <if test="memberGrade !=null ">
  1144. member_grade,
  1145. </if>
  1146. <if test="phoneNumber !=null ">
  1147. phone_number,
  1148. </if>
  1149. <if test="carNumber !=null ">
  1150. car_number,
  1151. </if>
  1152. <if test="balance !=null ">
  1153. balance,
  1154. </if>
  1155. <if test="integral !=null ">
  1156. integral,
  1157. </if>
  1158. <if test="specialCarType !=null ">
  1159. specialCarType,
  1160. </if>
  1161. <if test="regtime !=null ">
  1162. regtime,
  1163. </if>
  1164. <if test="stationId !=null ">
  1165. station_id,
  1166. </if>
  1167. <if test="stationName !=null ">
  1168. station_name,
  1169. </if>
  1170. <if test="oilName !=null ">
  1171. oil_name,
  1172. </if>
  1173. <if test="liters !=null ">
  1174. liters,
  1175. </if>
  1176. <if test="amt !=null ">
  1177. amt,
  1178. </if>
  1179. <if test="cyGrade !=null ">
  1180. cy_grade,
  1181. </if>
  1182. <if test="qyGrade !=null ">
  1183. qy_grade,
  1184. </if>
  1185. <if test="blogOpenid !=null ">
  1186. blog_openid,
  1187. </if>
  1188. <if test="minaOpenid !=null ">
  1189. mina_openid,
  1190. </if>
  1191. <if test="blogUserId !=null ">
  1192. blog_user_id,
  1193. </if>
  1194. <if test="minaUserId !=null ">
  1195. mina_user_id,
  1196. </if>
  1197. <if test="grade !=null ">
  1198. grade,
  1199. </if>
  1200. <if test="unionId !=null and unionId !=''">
  1201. union_id
  1202. </if>
  1203. </trim>
  1204. <trim prefix="values (" suffix=")" suffixOverrides=",">
  1205. <if test="memberId !=null ">
  1206. #{memberId},
  1207. </if>
  1208. <if test="customerName !=null ">
  1209. #{customerName},
  1210. </if>
  1211. <if test="commendMan !=null ">
  1212. #{commendMan},
  1213. </if>
  1214. <if test="memberGrade !=null ">
  1215. #{memberGrade},
  1216. </if>
  1217. <if test="phoneNumber !=null ">
  1218. #{phoneNumber},
  1219. </if>
  1220. <if test="carNumber !=null ">
  1221. #{carNumber},
  1222. </if>
  1223. <if test="balance !=null ">
  1224. #{balance},
  1225. </if>
  1226. <if test="integral !=null ">
  1227. #{integral},
  1228. </if>
  1229. <if test="specialCarType !=null ">
  1230. #{specialCarType},
  1231. </if>
  1232. <if test="regtime !=null ">
  1233. #{regtime},
  1234. </if>
  1235. <if test="stationId !=null ">
  1236. #{stationId, jdbcType=INTEGER},
  1237. </if>
  1238. <if test="stationName !=null ">
  1239. #{stationName, jdbcType=VARCHAR},
  1240. </if>
  1241. <if test="oilName !=null ">
  1242. #{oilName},
  1243. </if>
  1244. <if test="liters !=null ">
  1245. #{liters},
  1246. </if>
  1247. <if test="amt !=null ">
  1248. #{amt},
  1249. </if>
  1250. <if test="cyGrade !=null ">
  1251. #{cyGrade},
  1252. </if>
  1253. <if test="qyGrade !=null ">
  1254. #{qyGrade},
  1255. </if>
  1256. <if test="blogOpenid !=null ">
  1257. #{blogOpenid},
  1258. </if>
  1259. <if test="minaOpenid !=null ">
  1260. #{minaOpenid, jdbcType=VARCHAR},
  1261. </if>
  1262. <if test="blogUserId !=null ">
  1263. #{blogUserId, jdbcType=INTEGER},
  1264. </if>
  1265. <if test="minaUserId !=null ">
  1266. #{minaUserId, jdbcType=INTEGER},
  1267. </if>
  1268. <if test="grade !=null ">
  1269. #{grade, jdbcType=VARCHAR},
  1270. </if>
  1271. <if test="unionId !=null and unionId !=''">
  1272. #{unionId, jdbcType=VARCHAR}
  1273. </if>
  1274. </trim>
  1275. </insert>
  1276. <update id="updateByExample" parameterType="map">
  1277. <!--
  1278. WARNING - @mbg.generated
  1279. This element is automatically generated by MyBatis Generator, do not modify.
  1280. -->
  1281. update pay_order
  1282. set order_id = #{record.orderId,jdbcType=INTEGER},
  1283. order_no = #{record.orderNo,jdbcType=VARCHAR},
  1284. oil_gun = #{record.oilGun,jdbcType=VARCHAR},
  1285. oil_name = #{record.oilName,jdbcType=VARCHAR},
  1286. oil_pirce = #{record.oilPirce,jdbcType=VARCHAR},
  1287. consumer_id = #{record.consumerId,jdbcType=INTEGER},
  1288. consumer = #{record.consumer,jdbcType=VARCHAR},
  1289. amt = #{record.amt,jdbcType=DOUBLE},
  1290. station_id = #{record.stationId,jdbcType=INTEGER},
  1291. status = #{record.status,jdbcType=VARCHAR},
  1292. order_liters = #{record.orderLiters,jdbcType=VARCHAR},
  1293. pay_type = #{record.payType,jdbcType=VARCHAR},
  1294. pay_way = #{record.payWay,jdbcType=VARCHAR},
  1295. pay_date = #{record.payDate,jdbcType=TIMESTAMP},
  1296. oil_personnel = #{record.oilPersonnel,jdbcType=VARCHAR},
  1297. created_date = #{record.createdDate,jdbcType=TIMESTAMP},
  1298. order_type = #{record.orderType,jdbcType=CHAR},
  1299. station_name = #{record.stationName,jdbcType=VARCHAR},
  1300. receivable_amt = #{record.receivableAmt,jdbcType=DOUBLE},
  1301. received_amt = #{record.receivedAmt,jdbcType=DOUBLE},
  1302. discount_amt = #{record.discountAmt,jdbcType=DOUBLE},
  1303. discount_coupon_amt = #{record.discountCouponAmt,jdbcType=DOUBLE},
  1304. discount_coupon = #{record.discountCoupon,jdbcType=DOUBLE},
  1305. wx_amt = #{record.wxAmt,jdbcType=DOUBLE},
  1306. zfb_amt = #{record.zfbAmt,jdbcType=DOUBLE},
  1307. pos_amt = #{record.posAmt,jdbcType=DOUBLE},
  1308. xj_amt = #{record.xjAmt,jdbcType=DOUBLE},
  1309. didi_app_amt = #{record.didiAppAmt,jdbcType=DOUBLE},
  1310. ty_app_amt = #{record.tyAppAmt,jdbcType=DOUBLE},
  1311. other_amt = #{record.otherAmt,jdbcType=DOUBLE},
  1312. dzk_amt = #{record.dzkAmt,jdbcType=DOUBLE},
  1313. score = #{record.score,jdbcType=INTEGER},
  1314. member_no = #{record.memberNo,jdbcType=VARCHAR},
  1315. member_amt = #{record.memberAmt,jdbcType=DOUBLE},
  1316. print_count = #{record.printCount,jdbcType=INTEGER},
  1317. car_no = #{record.carNo,jdbcType=VARCHAR},
  1318. customer_phone = #{record.customerPhone,jdbcType=VARCHAR},
  1319. customer_grade = #{record.customerGrade,jdbcType=VARCHAR},
  1320. oil_type = #{record.oilType,jdbcType=VARCHAR}
  1321. <if test="_parameter != null">
  1322. <include refid="Update_By_Example_Where_Clause" />
  1323. </if>
  1324. </update>
  1325. <update id="updateByPrimaryKeySelective" parameterType="com.platform.yijia.pojo.PayOrder">
  1326. <!--
  1327. WARNING - @mbg.generated
  1328. This element is automatically generated by MyBatis Generator, do not modify.
  1329. -->
  1330. update pay_order
  1331. <set>
  1332. <if test="orderNo != null">
  1333. order_no = #{orderNo,jdbcType=VARCHAR},
  1334. </if>
  1335. <if test="oilGun != null">
  1336. oil_gun = #{oilGun,jdbcType=VARCHAR},
  1337. </if>
  1338. <if test="oilName != null">
  1339. oil_name = #{oilName,jdbcType=VARCHAR},
  1340. </if>
  1341. <if test="oilPirce != null">
  1342. oil_pirce = #{oilPirce,jdbcType=DOUBLE},
  1343. </if>
  1344. <if test="consumerId != null">
  1345. consumer_id = #{consumerId,jdbcType=INTEGER},
  1346. </if>
  1347. <if test="consumer != null">
  1348. consumer = #{consumer,jdbcType=VARCHAR},
  1349. </if>
  1350. <if test="amt != null">
  1351. amt = #{amt,jdbcType=DOUBLE},
  1352. </if>
  1353. <if test="stationId != null">
  1354. station_id = #{stationId,jdbcType=INTEGER},
  1355. </if>
  1356. <if test="status != null">
  1357. status = #{status,jdbcType=VARCHAR},
  1358. </if>
  1359. <if test="orderLiters != null">
  1360. order_liters = #{orderLiters,jdbcType=VARCHAR},
  1361. </if>
  1362. <if test="payType != null">
  1363. pay_type = #{payType,jdbcType=VARCHAR},
  1364. </if>
  1365. <if test="payWay != null">
  1366. pay_way = #{payWay,jdbcType=VARCHAR},
  1367. </if>
  1368. <if test="payDate != null">
  1369. pay_date = #{payDate,jdbcType=TIMESTAMP},
  1370. </if>
  1371. <if test="oilPersonnel != null">
  1372. oil_personnel = #{oilPersonnel,jdbcType=VARCHAR},
  1373. </if>
  1374. <if test="createdDate != null">
  1375. created_date = #{createdDate,jdbcType=TIMESTAMP},
  1376. </if>
  1377. <if test="orderType != null">
  1378. order_type = #{orderType,jdbcType=CHAR},
  1379. </if>
  1380. <if test="stationName != null">
  1381. station_name = #{stationName,jdbcType=CHAR},
  1382. </if>
  1383. <if test="receivableAmt != null">
  1384. receivable_amt = #{receivableAmt,jdbcType=DOUBLE},
  1385. </if>
  1386. <if test="receivedAmt != null">
  1387. received_amt = #{receivedAmt,jdbcType=DOUBLE},
  1388. </if>
  1389. <if test="discountAmt != null">
  1390. discount_amt = #{discountAmt,jdbcType=DOUBLE},
  1391. </if>
  1392. <if test="discountCouponAmt != null">
  1393. discount_coupon_amt = #{discountCouponAmt,jdbcType=DOUBLE},
  1394. </if>
  1395. <if test="discountCoupon != null">
  1396. discount_coupon = #{discountCoupon,jdbcType=VARCHAR},
  1397. </if>
  1398. <if test="wxAmt != null">
  1399. wx_amt = #{wxAmt,jdbcType=DOUBLE},
  1400. </if>
  1401. <if test="zfbAmt != null">
  1402. zfb_amt = #{zfbAmt,jdbcType=DOUBLE},
  1403. </if>
  1404. <if test="posAmt != null">
  1405. pos_amt = #{posAmt,jdbcType=DOUBLE},
  1406. </if>
  1407. <if test="xjAmt != null">
  1408. xj_amt = #{xjAmt,jdbcType=DOUBLE},
  1409. </if>
  1410. <if test="didiAppAmt != null">
  1411. didi_app_amt = #{didiAppAmt,jdbcType=DOUBLE},
  1412. </if>
  1413. <if test="tyAppAmt != null">
  1414. ty_app_amt = #{tyAppAmt,jdbcType=DOUBLE},
  1415. </if>
  1416. <if test="otherAmt != null">
  1417. other_amt = #{otherAmt,jdbcType=DOUBLE},
  1418. </if>
  1419. <if test="dzkAmt != null">
  1420. dzk_amt = #{dzkAmt,jdbcType=DOUBLE},
  1421. </if>
  1422. <if test="score != null">
  1423. score = #{score,jdbcType=INTEGER},
  1424. </if>
  1425. <if test="memberNo != null">
  1426. member_no = #{memberNo,jdbcType=VARCHAR},
  1427. </if>
  1428. <if test="memberAmt != null">
  1429. member_amt = #{memberAmt,jdbcType=DOUBLE},
  1430. </if>
  1431. <if test="printCount != null">
  1432. print_count = #{printCount,jdbcType=INTEGER},
  1433. </if>
  1434. <if test="carNo != null">
  1435. car_no = #{carNo,jdbcType=VARCHAR},
  1436. </if>
  1437. <if test="customerPhone != null">
  1438. customer_phone = #{customerPhone,jdbcType=VARCHAR},
  1439. </if>
  1440. <if test="oilType != null">
  1441. oil_type = #{oilType,jdbcType=VARCHAR}
  1442. </if>
  1443. </set>
  1444. where order_id = #{orderId,jdbcType=INTEGER}
  1445. </update>
  1446. <update id="updateByPrimaryKey" parameterType="com.platform.yijia.pojo.PayOrder">
  1447. <!--
  1448. WARNING - @mbg.generated
  1449. This element is automatically generated by MyBatis Generator, do not modify.
  1450. -->
  1451. update pay_order
  1452. set order_no = #{orderNo,jdbcType=VARCHAR},
  1453. oil_gun = #{oilGun,jdbcType=VARCHAR},
  1454. oil_name = #{oilName,jdbcType=VARCHAR},
  1455. oil_pirce = #{oilPirce,jdbcType=DOUBLE},
  1456. consumer_id = #{consumerId,jdbcType=INTEGER},
  1457. consumer = #{consumer,jdbcType=VARCHAR},
  1458. amt = #{amt,jdbcType=VARCHAR},
  1459. station_id = #{stationId,jdbcType=INTEGER},
  1460. status = #{status,jdbcType=VARCHAR},
  1461. order_liters = #{orderLiters,jdbcType=VARCHAR},
  1462. pay_type = #{payType,jdbcType=VARCHAR},
  1463. pay_way = #{payWay,jdbcType=VARCHAR},
  1464. pay_date = #{payDate,jdbcType=TIMESTAMP},
  1465. oil_personnel = #{oilPersonnel,jdbcType=VARCHAR},
  1466. created_date = #{createdDate,jdbcType=TIMESTAMP},
  1467. order_type = #{orderType,jdbcType=CHAR}
  1468. station_name = #{stationName,jdbcType=VARCHAR},
  1469. receivable_amt = #{receivableAmt,jdbcType=DOUBLE},
  1470. received_amt = #{receivedAmt,jdbcType=DOUBLE},
  1471. discount_amt = #{discountAmt,jdbcType=DOUBLE},
  1472. discount_coupon_amt = #{discountCouponAmt,jdbcType=DOUBLE},
  1473. discount_coupon = #{discountCoupon,jdbcType=DOUBLE},
  1474. wx_amt = #{wxAmt,jdbcType=DOUBLE},
  1475. zfb_amt = #{zfbAmt,jdbcType=DOUBLE},
  1476. pos_amt = #{posAmt,jdbcType=DOUBLE},
  1477. xj_amt = #{xjAmt,jdbcType=DOUBLE},
  1478. didi_app_amt = #{didiAppAmt,jdbcType=DOUBLE},
  1479. ty_app_amt = #{tyAppAmt,jdbcType=DOUBLE},
  1480. other_amt = #{otherAmt,jdbcType=DOUBLE},
  1481. dzk_amt = #{dzkAmt,jdbcType=DOUBLE},
  1482. score = #{score,jdbcType=INTEGER},
  1483. member_no = #{memberNo,jdbcType=VARCHAR},
  1484. member_amt = #{memberAmt,jdbcType=DOUBLE},
  1485. print_count = #{printCount,jdbcType=INTEGER},
  1486. car_no = #{carNo,jdbcType=VARCHAR},
  1487. customer_phone = #{customerPhone,jdbcType=VARCHAR},
  1488. customer_grade = #{customerGrade,jdbcType=VARCHAR},
  1489. oil_type = #{oilType,jdbcType=VARCHAR}
  1490. where order_id = #{orderId,jdbcType=INTEGER}
  1491. </update>
  1492. </mapper>