ElectronicMembershipCardMapper.xml 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757
  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.ElectronicMembershipCardMapper">
  4. <!--储蓄卡返回结果-->
  5. <resultMap id="CardBaseResultMap" type="com.platform.yijia.pojo.CustomerElectronicCard">
  6. <id column="id" jdbcType="INTEGER" property="id" />
  7. <result column="union_id" jdbcType="VARCHAR" property="unionId" />
  8. <result column="blog_openid" jdbcType="VARCHAR" property="blogOpenid" />
  9. <result column="mina_openid" jdbcType="VARCHAR" property="minaOpenid" />
  10. <result column="customer_no" jdbcType="VARCHAR" property="customerNo" />
  11. <result column="customer_name" jdbcType="VARCHAR" property="customerName" />
  12. <result column="mobile_phone" jdbcType="VARCHAR" property="mobilePhone" />
  13. <result column="amt" jdbcType="DECIMAL" property="amt" />
  14. <result column="card_oils_type" jdbcType="VARCHAR" property="cardOilsType" />
  15. <result column="station_id" jdbcType="INTEGER" property="stationId" />
  16. <result column="station_name" jdbcType="VARCHAR" property="stationName" />
  17. <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
  18. <result column="recently_time" jdbcType="TIMESTAMP" property="recentlyTime" />
  19. </resultMap>
  20. <!--储蓄卡使用记录返回结果-->
  21. <resultMap id="CardRecordBaseResultMap" type="com.platform.yijia.pojo.CustomerCardUseRecord">
  22. <id column="id" jdbcType="INTEGER" property="id" />
  23. <result column="order_no" jdbcType="VARCHAR" property="orderNo" />
  24. <result column="union_id" jdbcType="VARCHAR" property="unionId" />
  25. <result column="ali_id" jdbcType="VARCHAR" property="aliId" />
  26. <result column="customer_no" jdbcType="VARCHAR" property="customerNo" />
  27. <result column="customer_name" jdbcType="VARCHAR" property="customerName" />
  28. <result column="mobile_phone" jdbcType="VARCHAR" property="mobilePhone" />
  29. <result column="usage_type" jdbcType="VARCHAR" property="usageType" />
  30. <result column="pay_type" jdbcType="VARCHAR" property="payType" />
  31. <result column="card_oils_type" jdbcType="VARCHAR" property="cardOilsType" />
  32. <result column="amt" jdbcType="DECIMAL" property="amt" />
  33. <result column="present_amt" jdbcType="DECIMAL" property="presentAmt" />
  34. <result column="balance" jdbcType="DECIMAL" property="balance" />
  35. <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
  36. <result column="station_id" jdbcType="INTEGER" property="stationId" />
  37. <result column="station_name" jdbcType="VARCHAR" property="stationName" />
  38. <result column="status" jdbcType="VARCHAR" property="status" />
  39. </resultMap>
  40. <!--储蓄卡充值规则返回结果-->
  41. <resultMap id="CardSettingBaseResultMap" type="com.platform.yijia.pojo.CustomerCardSetting">
  42. <id column="id" jdbcType="INTEGER" property="id" />
  43. <result column="card_oils_type" jdbcType="VARCHAR" property="cardOilsType" />
  44. <result column="discount_time_setting" jdbcType="VARCHAR" property="discountTimeSetting" />
  45. <result column="discount_time_type" jdbcType="VARCHAR" property="discountTimeType" />
  46. <result column="discount_time" jdbcType="VARCHAR" property="discountTime" />
  47. <result column="present_scale" jdbcType="VARCHAR" property="presentScale" />
  48. <result column="is_discount_coupon" jdbcType="VARCHAR" property="isDiscountCoupon" />
  49. <result column="enjoy_integral_multiple" jdbcType="DATE" property="enjoyIntegralMultiple" />
  50. <result column="station_id" jdbcType="INTEGER" property="stationId" />
  51. <result column="station_name" jdbcType="VARCHAR" property="stationName" />
  52. <result column="create_time" jdbcType="VARCHAR" property="createTime" />
  53. <result column="is_market" jdbcType="VARCHAR" property="isMarket" />
  54. <result column="is_grade_setting" jdbcType="VARCHAR" property="isGradeSetting" />
  55. <collection property="customerCardSettingDetailList" resultMap="CardSettingDetailResultMap"/>
  56. </resultMap>
  57. <!--储蓄卡充值规则明细表-->
  58. <resultMap id="CardSettingDetailResultMap" type="com.platform.yijia.pojo.CustomerCardSettingDetail">
  59. <id column="cardSettingDetailId" jdbcType="INTEGER" property="cardSettingDetailId" />
  60. <result column="parent_id" jdbcType="INTEGER" property="parentId"/>
  61. <result column="setting_rule_type" jdbcType="VARCHAR" property="settingRuleType" />
  62. <result column="discount_amt_start" jdbcType="DECIMAL" property="discountAmtStart" />
  63. <result column="discount_amt_end" jdbcType="DECIMAL" property="discountAmtEnd" />
  64. <result column="present_amt" jdbcType="DECIMAL" property="presentAmt"/>
  65. <result column="oil_name" jdbcType="VARCHAR" property="oilName" />
  66. <result column="status" jdbcType="VARCHAR" property="status" />
  67. </resultMap>
  68. <!--查询油站电子会员卡(储蓄卡)充值设置规则-->
  69. <select id="getCardRechargeSettingList" parameterType="com.platform.yijia.pojo.CustomerCardSetting" resultMap="CardSettingBaseResultMap">
  70. SELECT
  71. T1.id,
  72. T1.card_oils_type,
  73. T1.discount_time_setting,
  74. T1.discount_time_type,
  75. T1.discount_time,
  76. T1.present_scale,
  77. T1.is_discount_coupon,
  78. T1.enjoy_integral_multiple,
  79. T1.station_id,
  80. T1.station_name,
  81. T1.create_time,
  82. T1.is_market,
  83. T1.is_grade_setting,
  84. T2.id AS cardSettingDetailId,
  85. T2.parent_id,
  86. T2.setting_rule_type,
  87. T2.discount_amt_start,
  88. T2.discount_amt_end,
  89. T2.present_amt,
  90. T2.oil_name,
  91. T2.status
  92. FROM
  93. customer_card_setting AS T1 LEFT JOIN customer_card_setting_detail AS T2 ON T1.id = T2.parent_id
  94. <where>
  95. T2.del_flag ="0"
  96. <if test="stationId !=null">
  97. AND T1.station_id = #{stationId}
  98. </if>
  99. <if test="cardOilsType !=null">
  100. AND FIND_IN_SET(#{cardOilsType}, T1.card_oils_type)
  101. </if>
  102. <if test="cardOilsType !=null">
  103. AND T2.oil_name = #{cardOilsType}
  104. </if>
  105. </where>
  106. <if test="orderBy !=null and orderBy !=''">
  107. ORDER BY T2.discount_amt_start ${orderBy}
  108. </if>
  109. </select>
  110. <!--查询客户充值的订单信息-->
  111. <select id="getCardRecordByOrderNo" parameterType="com.platform.yijia.pojo.CustomerCardUseRecord" resultMap="CardRecordBaseResultMap">
  112. SELECT
  113. T1.id,
  114. T1.order_no,
  115. T1.union_id,
  116. T1.ali_id,
  117. T2.blog_nick_name AS customer_name,
  118. T2.mobile_phone,
  119. T1.usage_type,
  120. T1.pay_type,
  121. T1.card_oils_type,
  122. T1.amt,
  123. T1.balance,
  124. T1.present_amt,
  125. T1.create_time,
  126. T1.station_id,
  127. T3.station_name,
  128. T1.status
  129. FROM
  130. customer_card_use_record AS T1
  131. LEFT JOIN app_user_info AS T2 ON T1.station_id = T2.station_id AND T1.union_id =T2.union_id
  132. LEFT JOIN sys_dept AS T2 ON T1.station_id = T3.station_id
  133. <where>
  134. <if test=" orderNo !=null and orderNo !=''">
  135. T1.order_no = #{orderNo}
  136. </if>
  137. </where>
  138. </select>
  139. <!--根据订单号更新用户充值记录的状态-->
  140. <update id="updateCardRecordStatusByOrderNo" parameterType="com.platform.yijia.pojo.CustomerElectronicCard">
  141. UPDATE
  142. customer_card_use_record
  143. <set>
  144. <if test="status !=null">
  145. status = #{status},
  146. </if>
  147. <if test="balance !=null">
  148. balance = #{balance}
  149. </if>
  150. </set>
  151. <where>
  152. <if test=" orderNo !=null and orderNo !=''">
  153. order_no = #{orderNo}
  154. </if>
  155. </where>
  156. </update>
  157. <!--插入用户电子会员卡的充值使用记录-->
  158. <insert id="insetCardUseRecordRecharge" parameterType="com.platform.yijia.pojo.CustomerCardUseRecord">
  159. INSERT INTO customer_card_use_record
  160. <trim prefix="(" suffix=")" suffixOverrides=",">
  161. <if test="orderNo !=null">
  162. order_no,
  163. </if>
  164. <if test="unionId !=null">
  165. union_id,
  166. </if>
  167. <if test="aliId !=null">
  168. ali_id,
  169. </if>
  170. <if test="customerNo !=null">
  171. customer_no,
  172. </if>
  173. <if test="customerName !=null">
  174. customer_name,
  175. </if>
  176. <if test="usageType !=null">
  177. usage_type,
  178. </if>
  179. <if test="payType !=null">
  180. pay_type,
  181. </if>
  182. <if test="cardOilsType !=null">
  183. card_oils_type,
  184. </if>
  185. <if test="amt !=null">
  186. amt,
  187. </if>
  188. <if test="presentAmt !=null">
  189. present_amt,
  190. </if>
  191. <if test="balance !=null">
  192. balance,
  193. </if>
  194. <if test="createTime !=null">
  195. create_time,
  196. </if>
  197. <if test="stationId !=null">
  198. station_id,
  199. </if>
  200. <if test="stationName !=null">
  201. station_name,
  202. </if>
  203. <if test="status !=null">
  204. status,
  205. </if>
  206. </trim>
  207. <trim prefix="values (" suffix=")" suffixOverrides=",">
  208. <if test="orderNo !=null">
  209. #{orderNo},
  210. </if>
  211. <if test="unionId !=null">
  212. #{unionId},
  213. </if>
  214. <if test="aliId !=null">
  215. #{aliId},
  216. </if>
  217. <if test="customerNo !=null">
  218. #{customerNo},
  219. </if>
  220. <if test="customerName !=null">
  221. #{customerName},
  222. </if>
  223. <if test="usageType !=null">
  224. #{usageType},
  225. </if>
  226. <if test="payType !=null">
  227. #{payType},
  228. </if>
  229. <if test="cardOilsType !=null">
  230. #{cardOilsType},
  231. </if>
  232. <if test="amt !=null">
  233. #{amt},
  234. </if>
  235. <if test="presentAmt !=null">
  236. #{presentAmt},
  237. </if>
  238. <if test="balance !=null">
  239. #{balance},
  240. </if>
  241. <if test="createTime !=null">
  242. #{createTime},
  243. </if>
  244. <if test="stationId !=null">
  245. #{stationId},
  246. </if>
  247. <if test="stationName !=null">
  248. #{stationName},
  249. </if>
  250. <if test="status !=null">
  251. #{status},
  252. </if>
  253. </trim>
  254. </insert>
  255. <!--插入用户电子会员卡的消费使用记录-->
  256. <insert id="insetCardUseRecordConsumption" parameterType="com.platform.yijia.pojo.CustomerCardUseRecord">
  257. INSERT INTO customer_card_use_record
  258. <trim prefix="(" suffix=")" suffixOverrides=",">
  259. <if test="orderNo !=null">
  260. order_no,
  261. </if>
  262. <if test="unionId !=null">
  263. union_id,
  264. </if>
  265. <if test="customerNo !=null">
  266. customer_no,
  267. </if>
  268. <if test="customerName !=null">
  269. customer_name,
  270. </if>
  271. <if test="usageType !=null">
  272. usage_type,
  273. </if>
  274. <if test="payType !=null">
  275. pay_type,
  276. </if>
  277. <if test="cardOilsType !=null">
  278. card_oils_type,
  279. </if>
  280. <if test="amt !=null">
  281. amt,
  282. </if>
  283. <if test="balance !=null">
  284. balance,
  285. </if>
  286. <if test="createTime !=null">
  287. create_time,
  288. </if>
  289. <if test="stationId !=null">
  290. station_id,
  291. </if>
  292. <if test="stationName !=null">
  293. station_name,
  294. </if>
  295. <if test="status !=null">
  296. status,
  297. </if>
  298. </trim>
  299. <trim prefix="values (" suffix=")" suffixOverrides=",">
  300. <if test="orderNo !=null">
  301. #{orderNo},
  302. </if>
  303. <if test="unionId !=null">
  304. #{unionId},
  305. </if>
  306. <if test="customerNo !=null">
  307. #{customerNo},
  308. </if>
  309. <if test="customerName !=null">
  310. #{customerName},
  311. </if>
  312. <if test="usageType !=null">
  313. #{usageType},
  314. </if>
  315. <if test="payType !=null">
  316. #{payType},
  317. </if>
  318. <if test="cardOilsType !=null">
  319. #{cardOilsType},
  320. </if>
  321. <if test="amt !=null">
  322. #{amt},
  323. </if>
  324. <if test="balance !=null">
  325. #{balance},
  326. </if>
  327. <if test="createTime !=null">
  328. #{createTime},
  329. </if>
  330. <if test="stationId !=null">
  331. #{stationId},
  332. </if>
  333. <if test="stationName !=null">
  334. #{stationName},
  335. </if>
  336. <if test="status !=null">
  337. #{status},
  338. </if>
  339. </trim>
  340. </insert>
  341. <!--充值-->
  342. <sql id="Base_Column_List_recharge">
  343. SELECT
  344. id,
  345. order_no,
  346. union_id,
  347. customer_no,
  348. customer_name,
  349. usage_type,
  350. pay_type,
  351. card_oils_type,
  352. amt,
  353. present_amt,
  354. balance,
  355. create_time,
  356. station_id,
  357. station_name,
  358. status
  359. FROM
  360. customer_card_record_recharge
  361. <where>
  362. status ="1"
  363. <if test="stationId !=null and stationId !=''">
  364. AND station_id = #{stationId}
  365. </if>
  366. <if test="unionId !=null and unionId !=''">
  367. AND union_id = #{unionId}
  368. </if>
  369. </where>
  370. ORDER BY create_time DESC
  371. </sql>
  372. <!--消费-->
  373. <sql id="Base_Column_List_consumption">
  374. SELECT
  375. id,
  376. order_no,
  377. union_id,
  378. customer_no,
  379. customer_name,
  380. usage_type,
  381. pay_type,
  382. card_oils_type,
  383. amt,
  384. balance,
  385. create_time,
  386. station_id,
  387. station_name,
  388. status
  389. FROM
  390. customer_card_record_consumption
  391. <where>
  392. <if test="stationId !=null and stationId !=''">
  393. AND station_id = #{stationId}
  394. </if>
  395. <if test="unionId !=null and unionId !=''">
  396. AND union_id = #{unionId}
  397. </if>
  398. </where>
  399. ORDER BY create_time DESC
  400. </sql>
  401. <!--全部-->
  402. <sql id="Base_Column_List">
  403. SELECT
  404. union_id, station_id, amt, present_amt, balance, card_oils_type, usage_type, create_time, `status`
  405. FROM customer_card_record_recharge
  406. <where>
  407. status ="1"
  408. <if test="stationId !=null and stationId !=''">
  409. AND station_id = #{stationId}
  410. </if>
  411. <if test="unionId !=null and unionId !=''">
  412. AND union_id = #{unionId}
  413. </if>
  414. </where>
  415. UNION ALL
  416. SELECT
  417. union_id, station_id, amt, "0" AS present_amt, balance, card_oils_type, usage_type,create_time, `status`
  418. FROM customer_card_record_consumption
  419. <where>
  420. status ="1"
  421. <if test="stationId !=null and stationId !=''">
  422. AND station_id = #{stationId}
  423. </if>
  424. <if test="unionId !=null and unionId !=''">
  425. AND union_id = #{unionId}
  426. </if>
  427. </where>
  428. ORDER BY create_time DESC
  429. </sql>
  430. <!--查询客户电子会员卡的使用记录-->
  431. <select id="getCardUseRecordList" resultMap="CardRecordBaseResultMap" parameterType="com.platform.yijia.pojo.CustomerCardUseRecord">
  432. SELECT
  433. union_id, station_id, amt, present_amt, usage_type, balance, card_oils_type, usage_type, create_time, `status`
  434. FROM customer_card_use_record
  435. <where>
  436. status ="1"
  437. <if test="stationId !=null and stationId !=''">
  438. AND station_id = #{stationId}
  439. </if>
  440. <if test="unionId !=null and unionId !=''">
  441. AND union_id = #{unionId}
  442. </if>
  443. <if test="usageType !=null and usageType !=''">
  444. AND usage_type = #{usageType}
  445. </if>
  446. </where>
  447. </select>
  448. <!--查询用户所拥有的储蓄卡-->
  449. <select id="getElectronicCardList" resultMap="CardBaseResultMap" parameterType="com.platform.yijia.pojo.CustomerElectronicCard">
  450. SELECT
  451. id,
  452. union_id,
  453. blog_openid,
  454. mina_openid,
  455. customer_no,
  456. customer_name,
  457. amt,
  458. card_oils_type,
  459. station_id,
  460. station_name,
  461. create_time,
  462. recently_time
  463. FROM
  464. customer_electronic_card
  465. <where>
  466. <if test="stationId !=null and stationId !=''">
  467. station_id = #{stationId}
  468. </if>
  469. <if test="unionId !=null and unionId !=''">
  470. AND union_id = #{unionId}
  471. </if>
  472. <if test="cardOilsType !=null and cardOilsType !=''">
  473. AND card_oils_type = #{cardOilsType}
  474. </if>
  475. </where>
  476. </select>
  477. <!--插入用户电子会员卡-->
  478. <insert id="insetElectronicCard" parameterType="com.platform.yijia.pojo.CustomerElectronicCard">
  479. INSERT INTO
  480. customer_electronic_card
  481. <trim prefix="(" suffix=")" suffixOverrides=",">
  482. <if test="unionId !=null">
  483. union_id,
  484. </if>
  485. <if test="blogOpenid !=null">
  486. blog_openid,
  487. </if>
  488. <if test="minaOpenid !=null">
  489. mina_openid,
  490. </if>
  491. <if test="customerNo !=null">
  492. customer_no,
  493. </if>
  494. <if test="customerName !=null">
  495. customer_name,
  496. </if>
  497. <if test="mobilePhone !=null">
  498. mobile_phone,
  499. </if>
  500. <if test="amt !=null">
  501. amt,
  502. </if>
  503. <if test="cardOilsType !=null">
  504. card_oils_type,
  505. </if>
  506. <if test="stationId !=null">
  507. station_id,
  508. </if>
  509. <if test="stationName !=null">
  510. station_name,
  511. </if>
  512. <if test="createTime !=null">
  513. create_time,
  514. </if>
  515. <if test="recentlyTime !=null">
  516. recently_time,
  517. </if>
  518. </trim>
  519. <trim prefix="values (" suffix=")" suffixOverrides=",">
  520. <if test="unionId !=null">
  521. #{unionId},
  522. </if>
  523. <if test="blogOpenid !=null">
  524. #{blogOpenid},
  525. </if>
  526. <if test="minaOpenid !=null">
  527. #{minaOpenid},
  528. </if>
  529. <if test="customerNo !=null">
  530. #{customerNo},
  531. </if>
  532. <if test="customerName !=null">
  533. #{customerName},
  534. </if>
  535. <if test="mobilePhone !=null">
  536. #{mobilePhone},
  537. </if>
  538. <if test="amt !=null">
  539. #{amt},
  540. </if>
  541. <if test="cardOilsType !=null">
  542. #{cardOilsType},
  543. </if>
  544. <if test="stationId !=null">
  545. #{stationId},
  546. </if>
  547. <if test="stationName !=null">
  548. #{stationName},
  549. </if>
  550. <if test="createTime !=null">
  551. #{createTime},
  552. </if>
  553. <if test="recentlyTime !=null">
  554. #{recentlyTime},
  555. </if>
  556. </trim>
  557. </insert>
  558. <!--根据unionId获取用户用要充值电子会员卡(储蓄卡)信息-->
  559. <select id="getElectronicCardInfoByUnionId" resultMap="CardBaseResultMap" parameterType="com.platform.yijia.pojo.CustomerElectronicCard">
  560. SELECT
  561. id,
  562. union_id,
  563. blog_openid,
  564. mina_openid,
  565. customer_no,
  566. customer_name,
  567. amt,
  568. card_oils_type,
  569. station_id,
  570. station_name,
  571. create_time,
  572. recently_time
  573. FROM
  574. customer_electronic_card
  575. <where>
  576. <if test="stationId != null" >
  577. station_id = #{stationId}
  578. </if>
  579. <if test="unionId !=null and unionId !=''">
  580. AND union_id = #{unionId}
  581. </if>
  582. <!-- <if test="blogOpenid !=null and blogOpenid !=''">-->
  583. <!-- AND blog_openid = #{blogOpenid}-->
  584. <!-- </if>-->
  585. <!-- <if test="minaOpenid !=null and minaOpenid !=''">-->
  586. <!-- AND mina_openid = #{minaOpenid}-->
  587. <!-- </if>-->
  588. <if test="cardOilsType !=null and cardOilsType !=''">
  589. AND card_oils_type = #{cardOilsType}
  590. </if>
  591. </where>
  592. </select>
  593. <!--获取用户用要充值电子会员卡(储蓄卡)信息-->
  594. <select id="getElectronicCardInfo" resultMap="CardBaseResultMap" parameterType="com.platform.yijia.pojo.CustomerElectronicCard">
  595. SELECT
  596. id,
  597. union_id,
  598. blog_openid,
  599. mina_openid,
  600. customer_no,
  601. customer_name,
  602. amt,
  603. card_oils_type,
  604. station_id,
  605. station_name,
  606. create_time,
  607. recently_time
  608. FROM
  609. customer_electronic_card
  610. <where>
  611. <if test="id !=null and id !=''">
  612. id = #{id}
  613. </if>
  614. </where>
  615. </select>
  616. <!--更新用户的电子会员卡的信息-->
  617. <update id="updateElectronicCardInfo" parameterType="com.platform.yijia.pojo.CustomerElectronicCard">
  618. UPDATE
  619. customer_electronic_card
  620. <set>
  621. <if test="amt !=null">
  622. amt = #{amt},
  623. </if>
  624. <if test="recentlyTime !=null">
  625. recently_time = #{recentlyTime}
  626. </if>
  627. </set>
  628. <where>
  629. <if test="id !=null and id != ''">
  630. id = #{id}
  631. </if>
  632. </where>
  633. </update>
  634. <!--根据unionId更新用户的电子会员卡的信息-->
  635. <update id="updateElectronicCardInfoByUnionId" parameterType="com.platform.yijia.pojo.CustomerElectronicCard">
  636. UPDATE customer_electronic_card
  637. <set>
  638. <if test="unionId !=null">
  639. union_id = #{unionId},
  640. </if>
  641. <if test="blogOpenid !=null">
  642. blog_openid = #{blogOpenid},
  643. </if>
  644. <if test="minaOpenid !=null">
  645. mina_openid = #{minaOpenid},
  646. </if>
  647. <if test="customerNo !=null">
  648. customer_no = #{customerNo},
  649. </if>
  650. <if test="customerName !=null">
  651. customer_name = #{customerName},
  652. </if>
  653. <if test="mobilePhone !=null">
  654. mobile_phone = #{mobilePhone},
  655. </if>
  656. <if test="amt !=null">
  657. amt = #{amt},
  658. </if>
  659. <if test="cardOilsType !=null">
  660. card_oils_type = #{cardOilsType},
  661. </if>
  662. <if test="stationId !=null">
  663. station_id = #{stationId},
  664. </if>
  665. <if test="stationName !=null">
  666. station_name = #{stationName},
  667. </if>
  668. <if test="createTime !=null">
  669. create_time = #{createTime},
  670. </if>
  671. <if test="recentlyTime !=null">
  672. recently_time = #{recentlyTime}
  673. </if>
  674. </set>
  675. <where>
  676. <if test="stationId !='' and stationId != null" >
  677. station_id = #{stationId}
  678. </if>
  679. <!-- <if test="blogOpenid !=null and blogOpenid !=''">-->
  680. <!-- AND blog_openid = #{blogOpenid}-->
  681. <!-- </if>-->
  682. <!-- <if test="minaOpenid !=null and minaOpenid !=''">-->
  683. <!-- AND mina_openid = #{minaOpenid}-->
  684. <!-- </if>-->
  685. <if test="unionId !=null and unionId != ''">
  686. AND union_id = #{unionId}
  687. </if>
  688. <if test="cardOilsType !='' and cardOilsType != null" >
  689. AND card_oils_type = #{cardOilsType}
  690. </if>
  691. </where>
  692. </update>
  693. <!--查询油站的会员卡启用标识 (1、启动 2,停用)-->
  694. <select id="getStationCardEnabledFlag" parameterType="Integer" resultType="String">
  695. SELECT
  696. card_enabled_flag AS cardEnabledFlag
  697. FROM
  698. sys_dept
  699. <where>
  700. <if test="stationId !='' and stationId != null" >
  701. station_id = #{stationId}
  702. </if>
  703. </where>
  704. </select>
  705. <!--根据小程序用户openId查询客户电子会员卡信息-->
  706. <select id="getElectronicCardInfoByMinaOpenId" resultMap="CardBaseResultMap" parameterType="com.platform.yijia.pojo.CustomerElectronicCard">
  707. SELECT
  708. id,
  709. union_id,
  710. blog_openid,
  711. mina_openid,
  712. customer_no,
  713. customer_name,
  714. amt,
  715. card_oils_type,
  716. station_id,
  717. station_name,
  718. create_time,
  719. recently_time
  720. FROM
  721. customer_electronic_card
  722. <where>
  723. <if test="stationId !='' and stationId != null" >
  724. station_id = #{stationId}
  725. </if>
  726. <if test="minaOpenid !='' and minaOpenid != null" >
  727. AND mina_openid = #{minaOpenid}
  728. </if>
  729. <if test="cardOilsType !='' and cardOilsType != null" >
  730. AND card_oils_type = #{cardOilsType}
  731. </if>
  732. </where>
  733. </select>
  734. </mapper>