TOrderBillNewMapper.xml 29 KB

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