TOrderBillNewMapper.xml 26 KB

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