TOrderBillNewMapper.xml 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696
  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.goafanti.common.dao.TOrderBillNewMapper">
  4. <resultMap id="BaseResultMap" type="com.goafanti.common.model.TOrderBillNew">
  5. <!--
  6. WARNING - @mbg.generated
  7. This element is automatically generated by MyBatis Generator, do not modify.
  8. This element was generated on Wed Feb 19 08:54:03 CST 2020.
  9. -->
  10. <id column="bill_no" jdbcType="VARCHAR" property="billNo" />
  11. <result column="order_no" jdbcType="VARCHAR" property="orderNo" />
  12. <result column="creater" jdbcType="VARCHAR" property="creater" />
  13. <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
  14. <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
  15. <result column="payee_id" jdbcType="VARCHAR" property="payeeId" />
  16. <result column="payer_id" jdbcType="VARCHAR" property="payerId" />
  17. <result column="transaction_amount" jdbcType="DECIMAL" property="transactionAmount" />
  18. <result column="transaction_subject" jdbcType="INTEGER" property="transactionSubject" />
  19. <result column="transaction_channel" jdbcType="INTEGER" property="transactionChannel" />
  20. <result column="remarks" jdbcType="VARCHAR" property="remarks" />
  21. <result column="confirm_sign" jdbcType="INTEGER" property="confirmSign" />
  22. <result column="delete_sign" jdbcType="TINYINT" property="deleteSign" />
  23. <result column="financial_pay_no" jdbcType="VARCHAR" property="financialPayNo" />
  24. <result column="financial_pay_time" jdbcType="TIMESTAMP" property="financialPayTime" />
  25. <result column="type" jdbcType="INTEGER" property="type" />
  26. <result column="delete_time" jdbcType="TIMESTAMP" property="deleteTime" />
  27. <result column="refund_time" jdbcType="TIMESTAMP" property="refundTime" />
  28. </resultMap>
  29. <sql id="Example_Where_Clause">
  30. <!--
  31. WARNING - @mbg.generated
  32. This element is automatically generated by MyBatis Generator, do not modify.
  33. This element was generated on Wed Feb 19 08:54:03 CST 2020.
  34. -->
  35. <where>
  36. <foreach collection="oredCriteria" item="criteria" separator="or">
  37. <if test="criteria.valid">
  38. <trim prefix="(" prefixOverrides="and" suffix=")">
  39. <foreach collection="criteria.criteria" item="criterion">
  40. <choose>
  41. <when test="criterion.noValue">
  42. and ${criterion.condition}
  43. </when>
  44. <when test="criterion.singleValue">
  45. and ${criterion.condition} #{criterion.value}
  46. </when>
  47. <when test="criterion.betweenValue">
  48. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  49. </when>
  50. <when test="criterion.listValue">
  51. and ${criterion.condition}
  52. <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
  53. #{listItem}
  54. </foreach>
  55. </when>
  56. </choose>
  57. </foreach>
  58. </trim>
  59. </if>
  60. </foreach>
  61. </where>
  62. </sql>
  63. <sql id="Update_By_Example_Where_Clause">
  64. <!--
  65. WARNING - @mbg.generated
  66. This element is automatically generated by MyBatis Generator, do not modify.
  67. This element was generated on Wed Feb 19 08:54:03 CST 2020.
  68. -->
  69. <where>
  70. <foreach collection="example.oredCriteria" item="criteria" separator="or">
  71. <if test="criteria.valid">
  72. <trim prefix="(" prefixOverrides="and" suffix=")">
  73. <foreach collection="criteria.criteria" item="criterion">
  74. <choose>
  75. <when test="criterion.noValue">
  76. and ${criterion.condition}
  77. </when>
  78. <when test="criterion.singleValue">
  79. and ${criterion.condition} #{criterion.value}
  80. </when>
  81. <when test="criterion.betweenValue">
  82. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  83. </when>
  84. <when test="criterion.listValue">
  85. and ${criterion.condition}
  86. <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
  87. #{listItem}
  88. </foreach>
  89. </when>
  90. </choose>
  91. </foreach>
  92. </trim>
  93. </if>
  94. </foreach>
  95. </where>
  96. </sql>
  97. <sql id="Base_Column_List">
  98. <!--
  99. WARNING - @mbg.generated
  100. This element is automatically generated by MyBatis Generator, do not modify.
  101. This element was generated on Wed Feb 19 08:54:03 CST 2020.
  102. -->
  103. bill_no, order_no, creater, create_time, update_time, payee_id, payer_id, transaction_amount,
  104. transaction_subject, transaction_channel, remarks, confirm_sign, delete_sign, financial_pay_no,
  105. financial_pay_time, type, delete_time, refund_time
  106. </sql>
  107. <select id="selectByExample" parameterType="com.goafanti.common.model.TOrderBillNewExample" resultMap="BaseResultMap">
  108. <!--
  109. WARNING - @mbg.generated
  110. This element is automatically generated by MyBatis Generator, do not modify.
  111. This element was generated on Wed Feb 19 08:54:03 CST 2020.
  112. -->
  113. select
  114. <if test="distinct">
  115. distinct
  116. </if>
  117. <include refid="Base_Column_List" />
  118. from t_order_bill_new
  119. <if test="_parameter != null">
  120. <include refid="Example_Where_Clause" />
  121. </if>
  122. <if test="orderByClause != null">
  123. order by ${orderByClause}
  124. </if>
  125. </select>
  126. <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
  127. <!--
  128. WARNING - @mbg.generated
  129. This element is automatically generated by MyBatis Generator, do not modify.
  130. This element was generated on Wed Feb 19 08:54:03 CST 2020.
  131. -->
  132. select
  133. <include refid="Base_Column_List" />
  134. from t_order_bill_new
  135. where bill_no = #{billNo,jdbcType=VARCHAR}
  136. </select>
  137. <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
  138. <!--
  139. WARNING - @mbg.generated
  140. This element is automatically generated by MyBatis Generator, do not modify.
  141. This element was generated on Wed Feb 19 08:54:03 CST 2020.
  142. -->
  143. delete from t_order_bill_new
  144. where bill_no = #{billNo,jdbcType=VARCHAR}
  145. </delete>
  146. <delete id="deleteByExample" parameterType="com.goafanti.common.model.TOrderBillNewExample">
  147. <!--
  148. WARNING - @mbg.generated
  149. This element is automatically generated by MyBatis Generator, do not modify.
  150. This element was generated on Wed Feb 19 08:54:03 CST 2020.
  151. -->
  152. delete from t_order_bill_new
  153. <if test="_parameter != null">
  154. <include refid="Example_Where_Clause" />
  155. </if>
  156. </delete>
  157. <insert id="insert" parameterType="com.goafanti.common.model.TOrderBillNew">
  158. <!--
  159. WARNING - @mbg.generated
  160. This element is automatically generated by MyBatis Generator, do not modify.
  161. This element was generated on Wed Feb 19 08:54:03 CST 2020.
  162. -->
  163. insert into t_order_bill_new (bill_no, order_no, creater,
  164. create_time, update_time, payee_id,
  165. payer_id, transaction_amount, transaction_subject,
  166. transaction_channel, remarks, confirm_sign,
  167. delete_sign, financial_pay_no, financial_pay_time,
  168. type, delete_time, refund_time
  169. )
  170. values (#{billNo,jdbcType=VARCHAR}, #{orderNo,jdbcType=VARCHAR}, #{creater,jdbcType=VARCHAR},
  171. #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{payeeId,jdbcType=VARCHAR},
  172. #{payerId,jdbcType=VARCHAR}, #{transactionAmount,jdbcType=DECIMAL}, #{transactionSubject,jdbcType=INTEGER},
  173. #{transactionChannel,jdbcType=INTEGER}, #{remarks,jdbcType=VARCHAR}, #{confirmSign,jdbcType=INTEGER},
  174. #{deleteSign,jdbcType=TINYINT}, #{financialPayNo,jdbcType=VARCHAR}, #{financialPayTime,jdbcType=TIMESTAMP},
  175. #{type,jdbcType=INTEGER}, #{deleteTime,jdbcType=TIMESTAMP}, #{refundTime,jdbcType=TIMESTAMP}
  176. )
  177. </insert>
  178. <insert id="insertSelective" parameterType="com.goafanti.common.model.TOrderBillNew">
  179. <!--
  180. WARNING - @mbg.generated
  181. This element is automatically generated by MyBatis Generator, do not modify.
  182. This element was generated on Wed Feb 19 08:54:03 CST 2020.
  183. -->
  184. insert into t_order_bill_new
  185. <trim prefix="(" suffix=")" suffixOverrides=",">
  186. <if test="billNo != null">
  187. bill_no,
  188. </if>
  189. <if test="orderNo != null">
  190. order_no,
  191. </if>
  192. <if test="creater != null">
  193. creater,
  194. </if>
  195. <if test="createTime != null">
  196. create_time,
  197. </if>
  198. <if test="updateTime != null">
  199. update_time,
  200. </if>
  201. <if test="payeeId != null">
  202. payee_id,
  203. </if>
  204. <if test="payerId != null">
  205. payer_id,
  206. </if>
  207. <if test="transactionAmount != null">
  208. transaction_amount,
  209. </if>
  210. <if test="transactionSubject != null">
  211. transaction_subject,
  212. </if>
  213. <if test="transactionChannel != null">
  214. transaction_channel,
  215. </if>
  216. <if test="remarks != null">
  217. remarks,
  218. </if>
  219. <if test="confirmSign != null">
  220. confirm_sign,
  221. </if>
  222. <if test="deleteSign != null">
  223. delete_sign,
  224. </if>
  225. <if test="financialPayNo != null">
  226. financial_pay_no,
  227. </if>
  228. <if test="financialPayTime != null">
  229. financial_pay_time,
  230. </if>
  231. <if test="type != null">
  232. type,
  233. </if>
  234. <if test="deleteTime != null">
  235. delete_time,
  236. </if>
  237. <if test="refundTime != null">
  238. refund_time,
  239. </if>
  240. </trim>
  241. <trim prefix="values (" suffix=")" suffixOverrides=",">
  242. <if test="billNo != null">
  243. #{billNo,jdbcType=VARCHAR},
  244. </if>
  245. <if test="orderNo != null">
  246. #{orderNo,jdbcType=VARCHAR},
  247. </if>
  248. <if test="creater != null">
  249. #{creater,jdbcType=VARCHAR},
  250. </if>
  251. <if test="createTime != null">
  252. #{createTime,jdbcType=TIMESTAMP},
  253. </if>
  254. <if test="updateTime != null">
  255. #{updateTime,jdbcType=TIMESTAMP},
  256. </if>
  257. <if test="payeeId != null">
  258. #{payeeId,jdbcType=VARCHAR},
  259. </if>
  260. <if test="payerId != null">
  261. #{payerId,jdbcType=VARCHAR},
  262. </if>
  263. <if test="transactionAmount != null">
  264. #{transactionAmount,jdbcType=DECIMAL},
  265. </if>
  266. <if test="transactionSubject != null">
  267. #{transactionSubject,jdbcType=INTEGER},
  268. </if>
  269. <if test="transactionChannel != null">
  270. #{transactionChannel,jdbcType=INTEGER},
  271. </if>
  272. <if test="remarks != null">
  273. #{remarks,jdbcType=VARCHAR},
  274. </if>
  275. <if test="confirmSign != null">
  276. #{confirmSign,jdbcType=INTEGER},
  277. </if>
  278. <if test="deleteSign != null">
  279. #{deleteSign,jdbcType=TINYINT},
  280. </if>
  281. <if test="financialPayNo != null">
  282. #{financialPayNo,jdbcType=VARCHAR},
  283. </if>
  284. <if test="financialPayTime != null">
  285. #{financialPayTime,jdbcType=TIMESTAMP},
  286. </if>
  287. <if test="type != null">
  288. #{type,jdbcType=INTEGER},
  289. </if>
  290. <if test="deleteTime != null">
  291. #{deleteTime,jdbcType=TIMESTAMP},
  292. </if>
  293. <if test="refundTime != null">
  294. #{refundTime,jdbcType=TIMESTAMP},
  295. </if>
  296. </trim>
  297. </insert>
  298. <select id="countByExample" parameterType="com.goafanti.common.model.TOrderBillNewExample" resultType="java.lang.Long">
  299. <!--
  300. WARNING - @mbg.generated
  301. This element is automatically generated by MyBatis Generator, do not modify.
  302. This element was generated on Wed Feb 19 08:54:03 CST 2020.
  303. -->
  304. select count(*) from t_order_bill_new
  305. <if test="_parameter != null">
  306. <include refid="Example_Where_Clause" />
  307. </if>
  308. </select>
  309. <update id="updateByExampleSelective" parameterType="map">
  310. <!--
  311. WARNING - @mbg.generated
  312. This element is automatically generated by MyBatis Generator, do not modify.
  313. This element was generated on Wed Feb 19 08:54:03 CST 2020.
  314. -->
  315. update t_order_bill_new
  316. <set>
  317. <if test="record.billNo != null">
  318. bill_no = #{record.billNo,jdbcType=VARCHAR},
  319. </if>
  320. <if test="record.orderNo != null">
  321. order_no = #{record.orderNo,jdbcType=VARCHAR},
  322. </if>
  323. <if test="record.creater != null">
  324. creater = #{record.creater,jdbcType=VARCHAR},
  325. </if>
  326. <if test="record.createTime != null">
  327. create_time = #{record.createTime,jdbcType=TIMESTAMP},
  328. </if>
  329. <if test="record.updateTime != null">
  330. update_time = #{record.updateTime,jdbcType=TIMESTAMP},
  331. </if>
  332. <if test="record.payeeId != null">
  333. payee_id = #{record.payeeId,jdbcType=VARCHAR},
  334. </if>
  335. <if test="record.payerId != null">
  336. payer_id = #{record.payerId,jdbcType=VARCHAR},
  337. </if>
  338. <if test="record.transactionAmount != null">
  339. transaction_amount = #{record.transactionAmount,jdbcType=DECIMAL},
  340. </if>
  341. <if test="record.transactionSubject != null">
  342. transaction_subject = #{record.transactionSubject,jdbcType=INTEGER},
  343. </if>
  344. <if test="record.transactionChannel != null">
  345. transaction_channel = #{record.transactionChannel,jdbcType=INTEGER},
  346. </if>
  347. <if test="record.remarks != null">
  348. remarks = #{record.remarks,jdbcType=VARCHAR},
  349. </if>
  350. <if test="record.confirmSign != null">
  351. confirm_sign = #{record.confirmSign,jdbcType=INTEGER},
  352. </if>
  353. <if test="record.deleteSign != null">
  354. delete_sign = #{record.deleteSign,jdbcType=TINYINT},
  355. </if>
  356. <if test="record.financialPayNo != null">
  357. financial_pay_no = #{record.financialPayNo,jdbcType=VARCHAR},
  358. </if>
  359. <if test="record.financialPayTime != null">
  360. financial_pay_time = #{record.financialPayTime,jdbcType=TIMESTAMP},
  361. </if>
  362. <if test="record.type != null">
  363. type = #{record.type,jdbcType=INTEGER},
  364. </if>
  365. <if test="record.deleteTime != null">
  366. delete_time = #{record.deleteTime,jdbcType=TIMESTAMP},
  367. </if>
  368. <if test="record.refundTime != null">
  369. refund_time = #{record.refundTime,jdbcType=TIMESTAMP},
  370. </if>
  371. </set>
  372. <if test="_parameter != null">
  373. <include refid="Update_By_Example_Where_Clause" />
  374. </if>
  375. </update>
  376. <update id="updateByExample" parameterType="map">
  377. <!--
  378. WARNING - @mbg.generated
  379. This element is automatically generated by MyBatis Generator, do not modify.
  380. This element was generated on Wed Feb 19 08:54:03 CST 2020.
  381. -->
  382. update t_order_bill_new
  383. set bill_no = #{record.billNo,jdbcType=VARCHAR},
  384. order_no = #{record.orderNo,jdbcType=VARCHAR},
  385. creater = #{record.creater,jdbcType=VARCHAR},
  386. create_time = #{record.createTime,jdbcType=TIMESTAMP},
  387. update_time = #{record.updateTime,jdbcType=TIMESTAMP},
  388. payee_id = #{record.payeeId,jdbcType=VARCHAR},
  389. payer_id = #{record.payerId,jdbcType=VARCHAR},
  390. transaction_amount = #{record.transactionAmount,jdbcType=DECIMAL},
  391. transaction_subject = #{record.transactionSubject,jdbcType=INTEGER},
  392. transaction_channel = #{record.transactionChannel,jdbcType=INTEGER},
  393. remarks = #{record.remarks,jdbcType=VARCHAR},
  394. confirm_sign = #{record.confirmSign,jdbcType=INTEGER},
  395. delete_sign = #{record.deleteSign,jdbcType=TINYINT},
  396. financial_pay_no = #{record.financialPayNo,jdbcType=VARCHAR},
  397. financial_pay_time = #{record.financialPayTime,jdbcType=TIMESTAMP},
  398. type = #{record.type,jdbcType=INTEGER},
  399. delete_time = #{record.deleteTime,jdbcType=TIMESTAMP},
  400. refund_time = #{record.refundTime,jdbcType=TIMESTAMP}
  401. <if test="_parameter != null">
  402. <include refid="Update_By_Example_Where_Clause" />
  403. </if>
  404. </update>
  405. <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.TOrderBillNew">
  406. <!--
  407. WARNING - @mbg.generated
  408. This element is automatically generated by MyBatis Generator, do not modify.
  409. This element was generated on Wed Feb 19 08:54:03 CST 2020.
  410. -->
  411. update t_order_bill_new
  412. <set>
  413. <if test="orderNo != null">
  414. order_no = #{orderNo,jdbcType=VARCHAR},
  415. </if>
  416. <if test="creater != null">
  417. creater = #{creater,jdbcType=VARCHAR},
  418. </if>
  419. <if test="createTime != null">
  420. create_time = #{createTime,jdbcType=TIMESTAMP},
  421. </if>
  422. <if test="updateTime != null">
  423. update_time = #{updateTime,jdbcType=TIMESTAMP},
  424. </if>
  425. <if test="payeeId != null">
  426. payee_id = #{payeeId,jdbcType=VARCHAR},
  427. </if>
  428. <if test="payerId != null">
  429. payer_id = #{payerId,jdbcType=VARCHAR},
  430. </if>
  431. <if test="transactionAmount != null">
  432. transaction_amount = #{transactionAmount,jdbcType=DECIMAL},
  433. </if>
  434. <if test="transactionSubject != null">
  435. transaction_subject = #{transactionSubject,jdbcType=INTEGER},
  436. </if>
  437. <if test="transactionChannel != null">
  438. transaction_channel = #{transactionChannel,jdbcType=INTEGER},
  439. </if>
  440. <if test="remarks != null">
  441. remarks = #{remarks,jdbcType=VARCHAR},
  442. </if>
  443. <if test="confirmSign != null">
  444. confirm_sign = #{confirmSign,jdbcType=INTEGER},
  445. </if>
  446. <if test="deleteSign != null">
  447. delete_sign = #{deleteSign,jdbcType=TINYINT},
  448. </if>
  449. <if test="financialPayNo != null">
  450. financial_pay_no = #{financialPayNo,jdbcType=VARCHAR},
  451. </if>
  452. <if test="financialPayTime != null">
  453. financial_pay_time = #{financialPayTime,jdbcType=TIMESTAMP},
  454. </if>
  455. <if test="type != null">
  456. type = #{type,jdbcType=INTEGER},
  457. </if>
  458. <if test="deleteTime != null">
  459. delete_time = #{deleteTime,jdbcType=TIMESTAMP},
  460. </if>
  461. <if test="refundTime != null">
  462. refund_time = #{refundTime,jdbcType=TIMESTAMP},
  463. </if>
  464. </set>
  465. where bill_no = #{billNo,jdbcType=VARCHAR}
  466. </update>
  467. <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.TOrderBillNew">
  468. <!--
  469. WARNING - @mbg.generated
  470. This element is automatically generated by MyBatis Generator, do not modify.
  471. This element was generated on Wed Feb 19 08:54:03 CST 2020.
  472. -->
  473. update t_order_bill_new
  474. set order_no = #{orderNo,jdbcType=VARCHAR},
  475. creater = #{creater,jdbcType=VARCHAR},
  476. create_time = #{createTime,jdbcType=TIMESTAMP},
  477. update_time = #{updateTime,jdbcType=TIMESTAMP},
  478. payee_id = #{payeeId,jdbcType=VARCHAR},
  479. payer_id = #{payerId,jdbcType=VARCHAR},
  480. transaction_amount = #{transactionAmount,jdbcType=DECIMAL},
  481. transaction_subject = #{transactionSubject,jdbcType=INTEGER},
  482. transaction_channel = #{transactionChannel,jdbcType=INTEGER},
  483. remarks = #{remarks,jdbcType=VARCHAR},
  484. confirm_sign = #{confirmSign,jdbcType=INTEGER},
  485. delete_sign = #{deleteSign,jdbcType=TINYINT},
  486. financial_pay_no = #{financialPayNo,jdbcType=VARCHAR},
  487. financial_pay_time = #{financialPayTime,jdbcType=TIMESTAMP},
  488. type = #{type,jdbcType=INTEGER},
  489. delete_time = #{deleteTime,jdbcType=TIMESTAMP},
  490. refund_time = #{refundTime,jdbcType=TIMESTAMP}
  491. where bill_no = #{billNo,jdbcType=VARCHAR}
  492. </update>
  493. <!-- 根据订单编号获得已交款 -->
  494. <select id="getAmountByOid" parameterType="java.lang.String" resultType="java.math.BigDecimal">
  495. select ifnull(sum(transaction_amount),0) amout from t_order_bill_new
  496. where delete_sign = 0 and order_no = #{_parameter,jdbcType=VARCHAR}
  497. </select>
  498. <!-- 根据流水编号获得流水详情 -->
  499. <select id="getOneRefundFlow" parameterType="java.lang.String" resultType="com.goafanti.common.model.TOrderBillNew">
  500. select
  501. b.bill_no as billNo, b.order_no as orderNo, b.creater, b.create_time as createTime, b.update_time as updateTime,
  502. b.payee_id as payeeId, b.payer_id as payerId, b.transaction_amount as transactionAmount,
  503. b.transaction_subject as transactionSubject, b.transaction_channel as transactionChannel,
  504. b.remarks, b.confirm_sign confirmSign, b.delete_sign deleteSign, b.financial_pay_no as financialPayNo,
  505. b.financial_pay_time as financialPayTimes, u.nickname as payerName, a.nickname as payeeName
  506. from t_order_bill_new b
  507. left join `user` u on b.payer_id = u.id
  508. left join `user` a on b.payee_id = a.id
  509. where b.delete_sign = 0 and bill_no = #{_parameter,jdbcType=VARCHAR}
  510. </select>
  511. <!-- 根据订单编号查看该订单相关的所有流水 -->
  512. <select id="getOneOrderAllRefundFlow" parameterType="java.lang.String" resultType="com.goafanti.common.model.TOrderBillNew">
  513. select
  514. b.bill_no as billNo, b.order_no as orderNo, b.creater, b.create_time as createTime, b.update_time as updateTime,
  515. b.payee_id as payeeId, b.payer_id as payerId, b.transaction_amount as transactionAmount,
  516. b.transaction_subject as transactionSubject, b.transaction_channel as transactionChannel,
  517. b.remarks, b.confirm_sign confirmSign, b.delete_sign deleteSign, b.financial_pay_no as financialPayNo,
  518. b.financial_pay_time as financialPayTimes, u.nickname as payerName, a.nickname as payeeName
  519. from t_order_bill_new b
  520. left join `user` u on b.payer_id = u.id
  521. left join `user` a on b.payee_id = a.id
  522. where b.delete_sign = 0 and order_no = #{_parameter,jdbcType=VARCHAR}
  523. </select>
  524. <!-- 查看自己创建的流水数据 -->
  525. <select id="myBillList" parameterType="Map" resultType="com.goafanti.common.model.TOrderBillNew">
  526. select b.bill_no as billNo, b.order_no as orderNo, b.transaction_amount as transactionAmount,
  527. date_format(b.create_time, '%Y-%m-%d %H:%I:%S') as createTimes, b.payer_id as payerId, b.payee_id as payeeId,
  528. tm.buyer_name as payerName, b.remarks, o.contract_no contractNo, b.transaction_subject as transactionSubject,
  529. b.transaction_channel as transactionChannel, b.delete_sign deleteSign, date_format(b.financial_pay_time, '%Y-%m-%d') as financialPayTimes,
  530. b.financial_pay_no as financialPayNo, date_format(b.refund_time, '%Y-%m-%d') refundTimes, b.creater, ad.name as createrName,
  531. tm.salesman_name saleName, b.type, date_format(b.delete_time, '%Y-%m-%d %H:%I:%S') as deleteTimes
  532. from t_order_bill_new b
  533. left join `user` u on b.payer_id = u.id
  534. left join `user` a on b.payee_id = a.id
  535. left join admin ad on b.creater = ad.id
  536. left join t_order_new o on o.order_no = b.order_no
  537. left join t_order_mid tm on tm.order_no=b.order_no
  538. left join department d on o.order_dep = d.id
  539. where 1=1
  540. <if test="fids != null and fids.size() &gt; 0">
  541. and d.finance_id in
  542. <foreach close=")" collection="fids" index="" item="item" open="(" separator=",">
  543. #{item}
  544. </foreach>
  545. </if>
  546. <if test="b.orderNo != null and b.orderNo != &quot;&quot;">
  547. and b.order_no = #{b.orderNo,jdbcType=VARCHAR}
  548. </if>
  549. <if test="b.departmentId != null and b.departmentId != &quot;&quot;">
  550. and o.order_dep = #{b.departmentId,jdbcType=VARCHAR}
  551. </if>
  552. <if test="b.creater != null and b.creater != &quot;&quot;">
  553. and b.creater = #{b.creater,jdbcType=VARCHAR}
  554. </if>
  555. <if test="b.payerName != null and b.payerName != &quot;&quot;">
  556. <bind name="nn" value="'%' + b.payerName + '%'" />
  557. and tm.buyer_name like #{nn,jdbcType=VARCHAR}
  558. </if>
  559. <if test="b.payeeName != null and b.payeeName != &quot;&quot;">
  560. <bind name="n" value="'%' + b.payeeName + '%'" />
  561. and a.nickname like #{n,jdbcType=VARCHAR}
  562. </if>
  563. <if test="b.startTime != null and b.startTime != &quot;&quot; and b.endTime != null and b.endTime != &quot;&quot;">
  564. <bind name="a" value="b.startTime + ' 00:00:00'" />
  565. <bind name="e" value="b.endTime + ' 23:59:59'" />
  566. and b.create_time between #{a,jdbcType=VARCHAR} and #{e,jdbcType=VARCHAR}
  567. </if>
  568. order by b.create_time desc
  569. <if test="page_sql!=null">
  570. ${page_sql}
  571. </if>
  572. </select>
  573. <select id="myBillCount" parameterType="Map" resultType="java.lang.Integer">
  574. select count(*)
  575. from t_order_bill_new b
  576. left join `user` u on b.payer_id = u.id
  577. left join `user` a on b.payee_id = a.id
  578. left join admin ad on b.creater = ad.id
  579. left join t_order_new o on o.order_no = b.order_no
  580. left join t_order_mid tm on tm.order_no=b.order_no
  581. left join department d on o.order_dep = d.id
  582. where 1=1
  583. <if test="fids != null and fids.size() &gt; 0">
  584. and d.finance_id in
  585. <foreach close=")" collection="fids" index="" item="item" open="(" separator=",">
  586. #{item}
  587. </foreach>
  588. </if>
  589. <if test="b.orderNo != null and b.orderNo != &quot;&quot;">
  590. and b.order_no = #{b.orderNo,jdbcType=VARCHAR}
  591. </if>
  592. <if test="b.creater != null and b.creater != &quot;&quot;">
  593. and b.creater = #{b.creater,jdbcType=VARCHAR}
  594. </if>
  595. <if test="b.departmentId != null and b.departmentId != &quot;&quot;">
  596. and o.order_dep = #{b.departmentId,jdbcType=VARCHAR}
  597. </if>
  598. <if test="b.payerName != null and b.payerName != &quot;&quot;">
  599. <bind name="nn" value="'%' + b.payerName + '%'" />
  600. and tm.buyer_name like #{nn,jdbcType=VARCHAR}
  601. </if>
  602. <if test="b.payeeName != null and b.payeeName != &quot;&quot;">
  603. <bind name="n" value="'%' + b.payeeName + '%'" />
  604. and a.nickname like #{n,jdbcType=VARCHAR}
  605. </if>
  606. <if test="b.startTime != null and b.startTime != &quot;&quot; and b.endTime != null and b.endTime != &quot;&quot;">
  607. <bind name="a" value="b.startTime + ' 00:00:00'" />
  608. <bind name="e" value="b.endTime + ' 23:59:59'" />
  609. and b.create_time between #{a,jdbcType=VARCHAR} and #{e,jdbcType=VARCHAR}
  610. </if>
  611. </select>
  612. <!-- 带条件的流水部门 -->
  613. <select id="getDeptBySome" parameterType="com.goafanti.common.model.TOrderBillNew" resultType="com.goafanti.common.model.TOrderBillNew">
  614. select distinct
  615. d.id as departmentId, d.name as departmentName
  616. from t_order_bill_new b
  617. left join `user` u on b.payer_id = u.id
  618. left join `user` a on b.payee_id = a.id
  619. left join t_order_new o on o.order_no = b.order_no
  620. left join admin oa on oa.id = o.salesman_id
  621. left join department d on oa.department_id = d.id
  622. where
  623. b.delete_sign = 0
  624. <if test="payerName != null and payerName != &quot;&quot;">
  625. <bind name="nn" value="'%' + payerName + '%'" />
  626. and u.nickname like #{nn,jdbcType=VARCHAR}
  627. </if>
  628. <if test="payeeName != null and payeeName != &quot;&quot;">
  629. <bind name="n" value="'%' + payeeName + '%'" />
  630. and a.nickname like #{n,jdbcType=VARCHAR}
  631. </if>
  632. <if test="startTime != null and startTime != &quot;&quot; and endTime != null and endTime != &quot;&quot;">
  633. <bind name="a" value="startTime + ' 00:00:00'" />
  634. <bind name="e" value="endTime + ' 23:59:59'" />
  635. and b.create_time between #{a,jdbcType=VARCHAR} and #{e,jdbcType=VARCHAR}
  636. </if>
  637. </select>
  638. <!-- 获得流水记录 -->
  639. <select id="getBillData" parameterType="com.goafanti.common.model.TOrderBillNew" resultType="com.goafanti.common.model.TOrderBillNew">
  640. select
  641. b.bill_no as billNo, b.order_no as orderNo, b.transaction_amount as transactionAmount,
  642. u.nickname as payerName, a.nickname as payeeName,
  643. b.transaction_subject as transactionSubject, b.transaction_channel as transactionChannel,
  644. b.financial_pay_time as financialPayTimes,b.financial_pay_no as financialPayNo,
  645. b.creater, ad.name as createrName, oa.name as saleName, b.create_time as createTime
  646. from t_order_bill_new b
  647. left join `user` u on b.payer_id = u.id
  648. left join `user` a on b.payee_id = a.id
  649. left join admin ad on b.creater = ad.id
  650. left join t_order_new o on o.order_no = b.order_no
  651. left join admin oa on oa.id = o.salesman_id
  652. where b.delete_sign = 0
  653. <if test="payerName != null and payerName != &quot;&quot;">
  654. <bind name="nn" value="'%' + payerName + '%'" />
  655. and u.nickname like #{nn,jdbcType=VARCHAR}
  656. </if>
  657. <if test="payeeName != null and payeeName != &quot;&quot;">
  658. <bind name="n" value="'%' + payeeName + '%'" />
  659. and a.nickname like #{n,jdbcType=VARCHAR}
  660. </if>
  661. <if test="departmentId != null and departmentId != &quot;&quot; ">
  662. and oa.department_id = #{departmentId,jdbcType=VARCHAR}
  663. </if>
  664. <if test="startTime != null and startTime != &quot;&quot; and endTime != null and endTime != &quot;&quot;">
  665. <bind name="a" value="startTime + ' 00:00:00'" />
  666. <bind name="e" value="endTime + ' 23:59:59'" />
  667. and b.create_time between #{a,jdbcType=VARCHAR} and #{e,jdbcType=VARCHAR}
  668. </if>
  669. order by b.order_no, b.creater , b.financial_pay_time
  670. </select>
  671. <select id="conutAmountByOrderNo" resultType="java.math.BigDecimal">
  672. select ifnull(sum(a.transaction_amount),0) amount from t_order_bill_new a
  673. where a.order_no= #{orderNo,jdbcType=VARCHAR};
  674. </select>
  675. <select id="selectByOrderNo" resultType="com.goafanti.order.bo.BillBo">
  676. select date_format(a.financial_pay_time,'%Y-%m-%d') payTime,a.transaction_amount transactionAmount,b.name aName from t_order_bill_new a
  677. left join admin b on a.creater=b.id
  678. where order_no= #{orderNo,jdbcType=VARCHAR};
  679. </select>
  680. <insert id="insertBatch" parameterType="com.goafanti.common.model.TOrderBillNew">
  681. insert into t_order_bill_new (bill_no, order_no, creater,
  682. create_time, update_time, payee_id,
  683. payer_id, transaction_amount, transaction_subject,
  684. transaction_channel, remarks, confirm_sign,
  685. delete_sign, financial_pay_no, financial_pay_time,
  686. type)values
  687. <foreach collection="list" index="index" item="item" separator=",">
  688. (#{item.billNo,jdbcType=VARCHAR}, #{item.orderNo,jdbcType=VARCHAR}, #{item.creater,jdbcType=VARCHAR},
  689. #{item.createTime,jdbcType=TIMESTAMP}, #{item.updateTime,jdbcType=TIMESTAMP}, #{item.payeeId,jdbcType=VARCHAR},
  690. #{item.payerId,jdbcType=VARCHAR}, #{item.transactionAmount,jdbcType=DECIMAL}, #{item.transactionSubject,jdbcType=INTEGER},
  691. #{item.transactionChannel,jdbcType=INTEGER}, #{item.remarks,jdbcType=VARCHAR}, #{item.confirmSign,jdbcType=INTEGER},
  692. #{item.deleteSign,jdbcType=TINYINT}, #{item.financialPayNo,jdbcType=VARCHAR}, #{item.financialPayTime,jdbcType=TIMESTAMP},
  693. #{item.type,jdbcType=INTEGER})
  694. </foreach>
  695. </insert>
  696. </mapper>