PayCodeOrderMapper.xml 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694
  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.izouma.awesomeadmin.dao.PayCodeOrderMapper">
  4. <resultMap id="BaseResultMap" type="com.izouma.awesomeadmin.model.PayCodeOrder">
  5. <!--generatedStart-->
  6. <id column="id" property="id" jdbcType="INTEGER"/>
  7. <result column="del_flag" property="delFlag" jdbcType="CHAR"/>
  8. <result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
  9. <result column="update_user" property="updateUser" jdbcType="VARCHAR"/>
  10. <result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
  11. <result column="create_user" property="createUser" jdbcType="VARCHAR"/>
  12. <result column="order_code" property="orderCode" jdbcType="VARCHAR"/>
  13. <result column="type_flag" property="typeFlag" jdbcType="INTEGER"/>
  14. <result column="code_id" property="codeId" jdbcType="INTEGER"/>
  15. <result column="stock_id" property="stockId" jdbcType="INTEGER"/>
  16. <result column="pay_type" property="payType" jdbcType="VARCHAR"/>
  17. <result column="money" property="money" jdbcType="DECIMAL"/>
  18. <result column="pay_money" property="payMoney" jdbcType="DECIMAL"/>
  19. <result column="status_flag" property="statusFlag" jdbcType="INTEGER"/>
  20. <result column="pay_time" property="payTime" jdbcType="TIMESTAMP"/>
  21. <result column="user_id" property="userId" jdbcType="INTEGER"/>
  22. <result column="remark" property="remark" jdbcType="VARCHAR"/>
  23. <result column="product_id" property="productId" jdbcType="INTEGER"/>
  24. <result column="channel" property="channel" jdbcType="INTEGER"/>
  25. <!--generatedEnd-->
  26. </resultMap>
  27. <sql id="Base_Column_List">
  28. <!--generatedStart-->
  29. id, del_flag, update_time, update_user, create_time, create_user, order_code, type_flag,
  30. code_id, stock_id, pay_type, money, pay_money, status_flag, pay_time, user_id, remark,
  31. product_id,channel <!--generatedEnd-->
  32. </sql>
  33. <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer">
  34. SELECT
  35. <include refid="Base_Column_List"/>
  36. FROM pay_code_order
  37. WHERE id = #{id,jdbcType=INTEGER}
  38. </select>
  39. <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
  40. DELETE
  41. FROM pay_code_order
  42. WHERE id = #{id,jdbcType=INTEGER}
  43. </delete>
  44. <insert id="insertSelective" parameterType="com.izouma.awesomeadmin.model.PayCodeOrder" useGeneratedKeys="true"
  45. keyProperty="id">
  46. INSERT INTO pay_code_order
  47. <trim prefix="(" suffix=")" suffixOverrides=",">
  48. <!--generatedStart-->
  49. <if test="id!= null">
  50. id,
  51. </if>
  52. <if test="delFlag!= null">
  53. del_flag,
  54. </if>
  55. <if test="updateTime!= null">
  56. update_time,
  57. </if>
  58. <if test="updateUser!= null">
  59. update_user,
  60. </if>
  61. <if test="createTime!= null">
  62. create_time,
  63. </if>
  64. <if test="createUser!= null">
  65. create_user,
  66. </if>
  67. <if test="orderCode!= null">
  68. order_code,
  69. </if>
  70. <if test="typeFlag!= null">
  71. type_flag,
  72. </if>
  73. <if test="codeId!= null">
  74. code_id,
  75. </if>
  76. <if test="stockId!= null">
  77. stock_id,
  78. </if>
  79. <if test="payType!= null">
  80. pay_type,
  81. </if>
  82. <if test="money!= null">
  83. money,
  84. </if>
  85. <if test="payMoney!= null">
  86. pay_money,
  87. </if>
  88. <if test="statusFlag!= null">
  89. status_flag,
  90. </if>
  91. <if test="payTime!= null">
  92. pay_time,
  93. </if>
  94. <if test="userId!= null">
  95. user_id,
  96. </if>
  97. <if test="remark!= null">
  98. remark,
  99. </if>
  100. <if test="productId!= null">
  101. product_id,
  102. </if>
  103. <if test="channel!= null">
  104. channel,
  105. </if>
  106. <!--generatedEnd-->
  107. </trim>
  108. <trim prefix="values (" suffix=")" suffixOverrides=",">
  109. <!--generatedStart-->
  110. <if test="id != null">
  111. #{id,jdbcType=INTEGER},
  112. </if>
  113. <if test="delFlag != null">
  114. #{delFlag,jdbcType=CHAR},
  115. </if>
  116. <if test="updateTime != null">
  117. #{updateTime,jdbcType=TIMESTAMP},
  118. </if>
  119. <if test="updateUser != null">
  120. #{updateUser,jdbcType=VARCHAR},
  121. </if>
  122. <if test="createTime != null">
  123. #{createTime,jdbcType=TIMESTAMP},
  124. </if>
  125. <if test="createUser != null">
  126. #{createUser,jdbcType=VARCHAR},
  127. </if>
  128. <if test="orderCode != null">
  129. #{orderCode,jdbcType=VARCHAR},
  130. </if>
  131. <if test="typeFlag != null">
  132. #{typeFlag,jdbcType=INTEGER},
  133. </if>
  134. <if test="codeId != null">
  135. #{codeId,jdbcType=INTEGER},
  136. </if>
  137. <if test="stockId != null">
  138. #{stockId,jdbcType=INTEGER},
  139. </if>
  140. <if test="payType != null">
  141. #{payType,jdbcType=VARCHAR},
  142. </if>
  143. <if test="money != null">
  144. #{money,jdbcType=DECIMAL},
  145. </if>
  146. <if test="payMoney != null">
  147. #{payMoney,jdbcType=DECIMAL},
  148. </if>
  149. <if test="statusFlag != null">
  150. #{statusFlag,jdbcType=INTEGER},
  151. </if>
  152. <if test="payTime != null">
  153. #{payTime,jdbcType=TIMESTAMP},
  154. </if>
  155. <if test="userId != null">
  156. #{userId,jdbcType=INTEGER},
  157. </if>
  158. <if test="remark != null">
  159. #{remark,jdbcType=VARCHAR},
  160. </if>
  161. <if test="productId != null">
  162. #{productId,jdbcType=INTEGER},
  163. </if>
  164. <if test="channel != null">
  165. #{channel,jdbcType=INTEGER},
  166. </if>
  167. <!--generatedEnd-->
  168. </trim>
  169. </insert>
  170. <update id="updateByPrimaryKeySelective" parameterType="com.izouma.awesomeadmin.model.PayCodeOrder">
  171. UPDATE pay_code_order
  172. <set>
  173. <!--generatedStart-->
  174. <if test="id != null">
  175. id= #{id,jdbcType=INTEGER},
  176. </if>
  177. <if test="delFlag != null">
  178. del_flag= #{delFlag,jdbcType=CHAR},
  179. </if>
  180. <if test="updateTime != null">
  181. update_time= #{updateTime,jdbcType=TIMESTAMP},
  182. </if>
  183. <if test="updateUser != null">
  184. update_user= #{updateUser,jdbcType=VARCHAR},
  185. </if>
  186. <if test="createTime != null">
  187. create_time= #{createTime,jdbcType=TIMESTAMP},
  188. </if>
  189. <if test="createUser != null">
  190. create_user= #{createUser,jdbcType=VARCHAR},
  191. </if>
  192. <if test="orderCode != null">
  193. order_code= #{orderCode,jdbcType=VARCHAR},
  194. </if>
  195. <if test="typeFlag != null">
  196. type_flag= #{typeFlag,jdbcType=INTEGER},
  197. </if>
  198. <if test="codeId != null">
  199. code_id= #{codeId,jdbcType=INTEGER},
  200. </if>
  201. <if test="stockId != null">
  202. stock_id= #{stockId,jdbcType=INTEGER},
  203. </if>
  204. <if test="payType != null">
  205. pay_type= #{payType,jdbcType=VARCHAR},
  206. </if>
  207. <if test="money != null">
  208. money= #{money,jdbcType=DECIMAL},
  209. </if>
  210. <if test="payMoney != null">
  211. pay_money= #{payMoney,jdbcType=DECIMAL},
  212. </if>
  213. <if test="statusFlag != null">
  214. status_flag= #{statusFlag,jdbcType=INTEGER},
  215. </if>
  216. <if test="payTime != null">
  217. pay_time= #{payTime,jdbcType=TIMESTAMP},
  218. </if>
  219. <if test="userId != null">
  220. user_id= #{userId,jdbcType=INTEGER},
  221. </if>
  222. <if test="remark != null">
  223. remark= #{remark,jdbcType=VARCHAR},
  224. </if>
  225. <if test="productId != null">
  226. product_id= #{productId,jdbcType=INTEGER},
  227. </if>
  228. <if test="channel != null">
  229. channel= #{channel,jdbcType=INTEGER},
  230. </if>
  231. <!--generatedEnd-->
  232. </set>
  233. WHERE
  234. <if test="id != null and !&quot;&quot;.equals(id)">
  235. id = #{id,jdbcType=INTEGER}
  236. </if>
  237. <if test="idStr != null and !&quot;&quot;.equals(idStr)">
  238. id IN (${idStr})
  239. </if>
  240. </update>
  241. <select id="queryPayCodeOrderByPage" parameterType="java.util.Map"
  242. resultMap="PagePayCodeOrderResult">
  243. SELECT
  244. <include refid="Base_Column_List"/>
  245. FROM pay_code_order
  246. <where>
  247. AND del_flag = 'N'
  248. <if test="record.idStr != null and !&quot;&quot;.equals(record.idStr)">
  249. AND id IN (${record.idStr})
  250. </if>
  251. <!--generatedStart-->
  252. <if test="record.id != null and !&quot;&quot;.equals(record.id)">
  253. AND id = #{record.id}
  254. </if>
  255. <if test="record.delFlag != null and !&quot;&quot;.equals(record.delFlag)">
  256. AND del_flag = #{record.delFlag}
  257. </if>
  258. <if test="record.updateTime != null and !&quot;&quot;.equals(record.updateTime)">
  259. AND update_time = #{record.updateTime}
  260. </if>
  261. <if test="record.updateUser != null and !&quot;&quot;.equals(record.updateUser)">
  262. AND update_user = #{record.updateUser}
  263. </if>
  264. <if test="record.createTime != null and !&quot;&quot;.equals(record.createTime)">
  265. AND create_time = #{record.createTime}
  266. </if>
  267. <if test="record.createUser != null and !&quot;&quot;.equals(record.createUser)">
  268. AND create_user = #{record.createUser}
  269. </if>
  270. <if test="record.orderCode != null and !&quot;&quot;.equals(record.orderCode)">
  271. AND order_code = #{record.orderCode}
  272. </if>
  273. <if test="record.typeFlag != null and !&quot;&quot;.equals(record.typeFlag)">
  274. AND type_flag = #{record.typeFlag}
  275. </if>
  276. <if test="record.codeId != null and !&quot;&quot;.equals(record.codeId)">
  277. AND code_id = #{record.codeId}
  278. </if>
  279. <if test="record.stockId != null and !&quot;&quot;.equals(record.stockId)">
  280. AND stock_id = #{record.stockId}
  281. </if>
  282. <if test="record.payType != null and !&quot;&quot;.equals(record.payType)">
  283. AND pay_type = #{record.payType}
  284. </if>
  285. <if test="record.money != null and !&quot;&quot;.equals(record.money)">
  286. AND money = #{record.money}
  287. </if>
  288. <if test="record.payMoney != null and !&quot;&quot;.equals(record.payMoney)">
  289. AND pay_money = #{record.payMoney}
  290. </if>
  291. <if test="record.statusFlag != null and !&quot;&quot;.equals(record.statusFlag)">
  292. AND status_flag = #{record.statusFlag}
  293. </if>
  294. <if test="record.payTime != null and !&quot;&quot;.equals(record.payTime)">
  295. AND pay_time = #{record.payTime}
  296. </if>
  297. <if test="record.userId != null and !&quot;&quot;.equals(record.userId)">
  298. AND user_id = #{record.userId}
  299. </if>
  300. <if test="record.remark != null and !&quot;&quot;.equals(record.remark)">
  301. AND remark = #{record.remark}
  302. </if>
  303. <if test="record.productId != null and !&quot;&quot;.equals(record.productId)">
  304. AND product_id = #{record.productId}
  305. </if>
  306. <if test="record.channel != null and !&quot;&quot;.equals(record.channel)">
  307. AND channel = #{record.channel}
  308. </if>
  309. <!--generatedEnd-->
  310. <if test="record.searchKey != null and !&quot;&quot;.equals(record.searchKey)">
  311. <trim prefix="and (" suffix=")" prefixOverrides="OR">
  312. <!--generatedStart-->
  313. OR order_code LIKE concat('%',#{record.searchKey},'%')
  314. OR code_id LIKE concat('%',#{record.searchKey},'%')
  315. OR stock_id LIKE concat('%',#{record.searchKey},'%')
  316. OR money LIKE concat('%',#{record.searchKey},'%')
  317. OR pay_money LIKE concat('%',#{record.searchKey},'%')
  318. OR user_id LIKE concat('%',#{record.searchKey},'%')
  319. OR remark LIKE concat('%',#{record.searchKey},'%')
  320. <!--generatedEnd-->
  321. OR code_id IN (
  322. SELECT
  323. id
  324. FROM
  325. pay_code_info
  326. WHERE
  327. del_flag = 'N'
  328. AND code_name LIKE concat('%',#{record.searchKey},'%')
  329. )
  330. AND stock_id IN (
  331. SELECT
  332. id
  333. FROM
  334. pay_code_stock
  335. WHERE
  336. del_flag = 'N'
  337. AND NAME LIKE concat('%',#{record.searchKey},'%')
  338. )
  339. </trim>
  340. </if>
  341. <if test="record.advancedQuery != null and !&quot;&quot;.equals(record.advancedQuery)">
  342. <foreach item="item" index="index" collection="record.advancedQuery.split('_;')">
  343. <choose>
  344. <when test="item.indexOf('like') != -1">
  345. <foreach item="itemDetail" index="detailIndex" collection="item.split('_,')">
  346. <if test="detailIndex == 3">
  347. concat('%',#{itemDetail},'%')
  348. </if>
  349. <if test="detailIndex &lt; 3">
  350. ${itemDetail}
  351. </if>
  352. </foreach>
  353. </when>
  354. <otherwise>
  355. <foreach item="itemDetail" index="detailIndex" collection="item.split('_,')">
  356. <if test="detailIndex == 3">
  357. #{itemDetail}
  358. </if>
  359. <if test="detailIndex &lt; 3">
  360. ${itemDetail}
  361. </if>
  362. </foreach>
  363. </otherwise>
  364. </choose>
  365. </foreach>
  366. </if>
  367. </where>
  368. ORDER BY
  369. <if test="record.orderByStr != null and !&quot;&quot;.equals(record.orderByStr)">
  370. <trim suffixOverrides=",">
  371. <foreach item="item" index="index" separator="," collection="record.orderByStr.split('_;')">
  372. <foreach item="itemDetail" index="detailIndex" collection="item.split('_,')">
  373. ${itemDetail}
  374. </foreach>
  375. </foreach>
  376. </trim>
  377. ,
  378. </if>
  379. id DESC
  380. </select>
  381. <select id="queryAllPayCodeOrder" parameterType="java.util.Map"
  382. resultType="com.izouma.awesomeadmin.model.PayCodeOrder">
  383. SELECT
  384. <include refid="Base_Column_List"/>
  385. FROM pay_code_order
  386. <where>
  387. AND del_flag = 'N'
  388. <if test="idStr != null and !&quot;&quot;.equals(idStr)">
  389. AND id IN (${idStr})
  390. </if>
  391. <!--generatedStart-->
  392. <if test="id != null and !&quot;&quot;.equals(id)">
  393. AND id = #{id}
  394. </if>
  395. <if test="delFlag != null and !&quot;&quot;.equals(delFlag)">
  396. AND del_flag = #{delFlag}
  397. </if>
  398. <if test="updateTime != null and !&quot;&quot;.equals(updateTime)">
  399. AND update_time = #{updateTime}
  400. </if>
  401. <if test="updateUser != null and !&quot;&quot;.equals(updateUser)">
  402. AND update_user = #{updateUser}
  403. </if>
  404. <if test="createTime != null and !&quot;&quot;.equals(createTime)">
  405. AND create_time = #{createTime}
  406. </if>
  407. <if test="createUser != null and !&quot;&quot;.equals(createUser)">
  408. AND create_user = #{createUser}
  409. </if>
  410. <if test="orderCode != null and !&quot;&quot;.equals(orderCode)">
  411. AND order_code = #{orderCode}
  412. </if>
  413. <if test="typeFlag != null and !&quot;&quot;.equals(typeFlag)">
  414. AND type_flag = #{typeFlag}
  415. </if>
  416. <if test="codeId != null and !&quot;&quot;.equals(codeId)">
  417. AND code_id = #{codeId}
  418. </if>
  419. <if test="stockId != null and !&quot;&quot;.equals(stockId)">
  420. AND stock_id = #{stockId}
  421. </if>
  422. <if test="payType != null and !&quot;&quot;.equals(payType)">
  423. AND pay_type = #{payType}
  424. </if>
  425. <if test="money != null and !&quot;&quot;.equals(money)">
  426. AND money = #{money}
  427. </if>
  428. <if test="payMoney != null and !&quot;&quot;.equals(payMoney)">
  429. AND pay_money = #{payMoney}
  430. </if>
  431. <if test="statusFlag != null and !&quot;&quot;.equals(statusFlag)">
  432. AND status_flag = #{statusFlag}
  433. </if>
  434. <if test="payTime != null and !&quot;&quot;.equals(payTime)">
  435. AND pay_time = #{payTime}
  436. </if>
  437. <if test="userId != null and !&quot;&quot;.equals(userId)">
  438. AND user_id = #{userId}
  439. </if>
  440. <if test="remark != null and !&quot;&quot;.equals(remark)">
  441. AND remark = #{remark}
  442. </if>
  443. <if test="productId != null and !&quot;&quot;.equals(productId)">
  444. AND product_id = #{productId}
  445. </if>
  446. <if test="channel != null and !&quot;&quot;.equals(channel)">
  447. AND channel = #{channel}
  448. </if>
  449. <!--generatedEnd-->
  450. <if test="searchKey != null and !&quot;&quot;.equals(searchKey)">
  451. <trim prefix="and (" suffix=")" prefixOverrides="OR">
  452. <!--generatedStart-->
  453. OR order_code LIKE concat('%',#{searchKey},'%')
  454. OR type_flag LIKE concat('%',#{searchKey},'%')
  455. OR code_id LIKE concat('%',#{searchKey},'%')
  456. OR stock_id LIKE concat('%',#{searchKey},'%')
  457. OR pay_type LIKE concat('%',#{searchKey},'%')
  458. OR money LIKE concat('%',#{searchKey},'%')
  459. OR pay_money LIKE concat('%',#{searchKey},'%')
  460. OR status_flag LIKE concat('%',#{searchKey},'%')
  461. OR pay_time LIKE concat('%',#{searchKey},'%')
  462. OR user_id LIKE concat('%',#{searchKey},'%')
  463. OR remark LIKE concat('%',#{searchKey},'%')
  464. <!--generatedEnd-->
  465. </trim>
  466. </if>
  467. <if test="advancedQuery != null and !&quot;&quot;.equals(advancedQuery)">
  468. <foreach item="item" index="index" collection="advancedQuery.split('_;')">
  469. <choose>
  470. <when test="item.indexOf('like') != -1">
  471. <foreach item="itemDetail" index="detailIndex" collection="item.split('_,')">
  472. <if test="detailIndex == 3">
  473. concat('%',#{itemDetail},'%')
  474. </if>
  475. <if test="detailIndex &lt; 3">
  476. ${itemDetail}
  477. </if>
  478. </foreach>
  479. </when>
  480. <otherwise>
  481. <foreach item="itemDetail" index="detailIndex" collection="item.split('_,')">
  482. <if test="detailIndex == 3">
  483. #{itemDetail}
  484. </if>
  485. <if test="detailIndex &lt; 3">
  486. ${itemDetail}
  487. </if>
  488. </foreach>
  489. </otherwise>
  490. </choose>
  491. </foreach>
  492. </if>
  493. </where>
  494. ORDER BY
  495. <if test="orderByStr != null and !&quot;&quot;.equals(orderByStr)">
  496. <trim suffixOverrides=",">
  497. <foreach item="item" index="index" separator="," collection="orderByStr.split('_;')">
  498. <foreach item="itemDetail" index="detailIndex" collection="item.split('_,')">
  499. ${itemDetail}
  500. </foreach>
  501. </foreach>
  502. </trim>
  503. ,
  504. </if>
  505. id DESC
  506. </select>
  507. <select id="queryReportPayCodeOrder" parameterType="java.util.Map"
  508. resultType="com.izouma.awesomeadmin.model.PayCodeOrder">
  509. SELECT
  510. channel,
  511. SUM(money) AS money
  512. FROM
  513. pay_code_order
  514. WHERE
  515. del_flag = 'N'
  516. AND status_flag = 1
  517. <if test="searchBeginTime != null and !&quot;&quot;.equals(searchBeginTime)">
  518. and pay_time <![CDATA[ >= ]]> #{searchBeginTime}
  519. </if>
  520. <if test="searchEndTime != null and !&quot;&quot;.equals(searchEndTime)">
  521. and pay_time <![CDATA[ <= ]]> #{searchEndTime}
  522. </if>
  523. GROUP BY
  524. channel
  525. </select>
  526. <select id="queryAutoCancelPayCodeOrderList" parameterType="java.util.Map"
  527. resultType="com.izouma.awesomeadmin.model.PayCodeOrder">
  528. SELECT
  529. *
  530. FROM pay_code_order
  531. <where>
  532. AND del_flag = 'N'
  533. AND status_flag = 0
  534. AND DATE_SUB(
  535. CURRENT_TIMESTAMP (),
  536. INTERVAL 30 MINUTE
  537. ) <![CDATA[ >= ]]> create_time
  538. </where>
  539. </select>
  540. <select id="queryPayCodeOrder" parameterType="java.util.Map"
  541. resultMap="OnePayCodeOrderResult">
  542. SELECT
  543. <include refid="Base_Column_List"/>
  544. FROM pay_code_order
  545. <where>
  546. AND del_flag = 'N'
  547. <!--generatedStart-->
  548. <if test="id != null and !&quot;&quot;.equals(id)">
  549. AND id = #{id}
  550. </if>
  551. <if test="delFlag != null and !&quot;&quot;.equals(delFlag)">
  552. AND del_flag = #{delFlag}
  553. </if>
  554. <if test="updateTime != null and !&quot;&quot;.equals(updateTime)">
  555. AND update_time = #{updateTime}
  556. </if>
  557. <if test="updateUser != null and !&quot;&quot;.equals(updateUser)">
  558. AND update_user = #{updateUser}
  559. </if>
  560. <if test="createTime != null and !&quot;&quot;.equals(createTime)">
  561. AND create_time = #{createTime}
  562. </if>
  563. <if test="createUser != null and !&quot;&quot;.equals(createUser)">
  564. AND create_user = #{createUser}
  565. </if>
  566. <if test="orderCode != null and !&quot;&quot;.equals(orderCode)">
  567. AND order_code = #{orderCode}
  568. </if>
  569. <if test="typeFlag != null and !&quot;&quot;.equals(typeFlag)">
  570. AND type_flag = #{typeFlag}
  571. </if>
  572. <if test="codeId != null and !&quot;&quot;.equals(codeId)">
  573. AND code_id = #{codeId}
  574. </if>
  575. <if test="stockId != null and !&quot;&quot;.equals(stockId)">
  576. AND stock_id = #{stockId}
  577. </if>
  578. <if test="payType != null and !&quot;&quot;.equals(payType)">
  579. AND pay_type = #{payType}
  580. </if>
  581. <if test="money != null and !&quot;&quot;.equals(money)">
  582. AND money = #{money}
  583. </if>
  584. <if test="payMoney != null and !&quot;&quot;.equals(payMoney)">
  585. AND pay_money = #{payMoney}
  586. </if>
  587. <if test="statusFlag != null and !&quot;&quot;.equals(statusFlag)">
  588. AND status_flag = #{statusFlag}
  589. </if>
  590. <if test="payTime != null and !&quot;&quot;.equals(payTime)">
  591. AND pay_time = #{payTime}
  592. </if>
  593. <if test="userId != null and !&quot;&quot;.equals(userId)">
  594. AND user_id = #{userId}
  595. </if>
  596. <if test="remark != null and !&quot;&quot;.equals(remark)">
  597. AND remark = #{remark}
  598. </if>
  599. <if test="productId != null and !&quot;&quot;.equals(productId)">
  600. AND product_id = #{productId}
  601. </if>
  602. <if test="channel != null and !&quot;&quot;.equals(channel)">
  603. AND channel = #{channel}
  604. </if>
  605. <!--generatedEnd-->
  606. </where>
  607. LIMIT 1
  608. </select>
  609. <update id="delete">
  610. UPDATE pay_code_order SET del_flag = 'Y'
  611. WHERE
  612. <if test="id != null and !&quot;&quot;.equals(id)">
  613. id = #{id,jdbcType=INTEGER}
  614. </if>
  615. <if test="idStr != null and !&quot;&quot;.equals(idStr)">
  616. id IN (${idStr})
  617. </if>
  618. </update>
  619. <select id="query" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.PayCodeOrder">
  620. SELECT
  621. <include refid="Base_Column_List"/>
  622. FROM pay_code_order
  623. <where>
  624. AND del_flag = 'N'
  625. <!--generatedStart-->
  626. <!--generatedEnd-->
  627. </where>
  628. ORDER BY id DESC
  629. </select>
  630. <select id="getTotalPayMoney" parameterType="java.util.Map"
  631. resultType="decimal">
  632. SELECT
  633. SUM(pay_money) AS money
  634. FROM
  635. pay_code_order
  636. WHERE
  637. del_flag = 'N'
  638. AND status_flag = 1
  639. <if test="codeId != null and !&quot;&quot;.equals(codeId)">
  640. and code_id = #{codeId}
  641. </if>
  642. <if test="stockId != null and !&quot;&quot;.equals(stockId)">
  643. and stock_id = #{stockId}
  644. </if>
  645. <if test="searchBeginTime != null and !&quot;&quot;.equals(searchBeginTime)">
  646. and pay_time <![CDATA[ >= ]]> #{searchBeginTime}
  647. </if>
  648. <if test="searchEndTime != null and !&quot;&quot;.equals(searchEndTime)">
  649. and pay_time <![CDATA[ <= ]]> #{searchEndTime}
  650. </if>
  651. </select>
  652. <resultMap id="PagePayCodeOrderResult" type="com.izouma.awesomeadmin.model.PayCodeOrder" extends="BaseResultMap">
  653. <association property="productInfo"
  654. javaType="com.izouma.awesomeadmin.model.ProductInfo"
  655. select="com.izouma.awesomeadmin.dao.ProductInfoMapper.queryProductInfo"
  656. column="{ id = product_id }"/>
  657. </resultMap>
  658. <resultMap id="OnePayCodeOrderResult" type="com.izouma.awesomeadmin.model.PayCodeOrder" extends="BaseResultMap">
  659. <association property="productInfo"
  660. javaType="com.izouma.awesomeadmin.model.ProductInfo"
  661. select="com.izouma.awesomeadmin.dao.ProductInfoMapper.queryProductInfo"
  662. column="{ id = product_id }"/>
  663. <association property="payCodeInfo"
  664. javaType="com.izouma.awesomeadmin.model.PayCodeInfo"
  665. select="com.izouma.awesomeadmin.dao.PayCodeInfoMapper.queryPayCodeInfo"
  666. column="{ id = code_id }"/>
  667. <association property="payCodeStock"
  668. javaType="com.izouma.awesomeadmin.model.PayCodeStock"
  669. select="com.izouma.awesomeadmin.dao.PayCodeStockMapper.queryPayCodeStock"
  670. column="{ id = stock_id }"/>
  671. </resultMap>
  672. </mapper>