TOrderPaymentMapper.xml 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460
  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.TOrderPaymentMapper">
  4. <resultMap id="BaseResultMap" type="com.goafanti.common.model.TOrderPayment">
  5. <!--
  6. WARNING - @mbg.generated
  7. This element is automatically generated by MyBatis Generator, do not modify.
  8. This element was generated on Tue Jul 20 09:16:18 CST 2021.
  9. -->
  10. <id column="id" jdbcType="INTEGER" property="id" />
  11. <result column="tid" jdbcType="INTEGER" property="tid" />
  12. <result column="node_id" jdbcType="INTEGER" property="nodeId" />
  13. <result column="choose_type" jdbcType="INTEGER" property="chooseType" />
  14. <result column="payment_type" jdbcType="INTEGER" property="paymentType" />
  15. <result column="company_name" jdbcType="VARCHAR" property="companyName" />
  16. <result column="quantity" jdbcType="INTEGER" property="quantity" />
  17. <result column="payment_status" jdbcType="INTEGER" property="paymentStatus" />
  18. <result column="status" jdbcType="INTEGER" property="status" />
  19. <result column="application_amount" jdbcType="DECIMAL" property="applicationAmount" />
  20. <result column="payment_amount" jdbcType="DECIMAL" property="paymentAmount" />
  21. <result column="remarks" jdbcType="VARCHAR" property="remarks" />
  22. <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
  23. <result column="aid" jdbcType="VARCHAR" property="aid" />
  24. <result column="aname" jdbcType="VARCHAR" property="aname" />
  25. <result column="tpc_id" jdbcType="INTEGER" property="tpcId" />
  26. <result column="process_status" jdbcType="INTEGER" property="processStatus" />
  27. </resultMap>
  28. <sql id="Base_Column_List">
  29. <!--
  30. WARNING - @mbg.generated
  31. This element is automatically generated by MyBatis Generator, do not modify.
  32. This element was generated on Tue Jul 20 09:16:18 CST 2021.
  33. -->
  34. id, tid, node_id, choose_type, payment_type, company_name, quantity, payment_status,
  35. `status`, application_amount, payment_amount, remarks, create_time, aid, aname, tpc_id,
  36. process_status
  37. </sql>
  38. <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
  39. <!--
  40. WARNING - @mbg.generated
  41. This element is automatically generated by MyBatis Generator, do not modify.
  42. This element was generated on Tue Jul 20 09:16:18 CST 2021.
  43. -->
  44. select
  45. <include refid="Base_Column_List" />
  46. from t_order_payment
  47. where id = #{id,jdbcType=INTEGER}
  48. </select>
  49. <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
  50. <!--
  51. WARNING - @mbg.generated
  52. This element is automatically generated by MyBatis Generator, do not modify.
  53. This element was generated on Tue Jul 20 09:16:18 CST 2021.
  54. -->
  55. delete from t_order_payment
  56. where id = #{id,jdbcType=INTEGER}
  57. </delete>
  58. <insert id="insert" parameterType="com.goafanti.common.model.TOrderPayment">
  59. <!--
  60. WARNING - @mbg.generated
  61. This element is automatically generated by MyBatis Generator, do not modify.
  62. This element was generated on Tue Jul 20 09:16:18 CST 2021.
  63. -->
  64. insert into t_order_payment (id, tid, node_id,
  65. choose_type, payment_type, company_name,
  66. quantity, payment_status, `status`,
  67. application_amount, payment_amount, remarks,
  68. create_time, aid, aname,
  69. tpc_id, process_status)
  70. values (#{id,jdbcType=INTEGER}, #{tid,jdbcType=INTEGER}, #{nodeId,jdbcType=INTEGER},
  71. #{chooseType,jdbcType=INTEGER}, #{paymentType,jdbcType=INTEGER}, #{companyName,jdbcType=VARCHAR},
  72. #{quantity,jdbcType=INTEGER}, #{paymentStatus,jdbcType=INTEGER}, #{status,jdbcType=INTEGER},
  73. #{applicationAmount,jdbcType=DECIMAL}, #{paymentAmount,jdbcType=DECIMAL}, #{remarks,jdbcType=VARCHAR},
  74. #{createTime,jdbcType=TIMESTAMP}, #{aid,jdbcType=VARCHAR}, #{aname,jdbcType=VARCHAR},
  75. #{tpcId,jdbcType=INTEGER}, #{processStatus,jdbcType=INTEGER})
  76. </insert>
  77. <insert id="insertSelective" parameterType="com.goafanti.common.model.TOrderPayment">
  78. <!--
  79. WARNING - @mbg.generated
  80. This element is automatically generated by MyBatis Generator, do not modify.
  81. This element was generated on Tue Jul 20 09:16:18 CST 2021.
  82. -->
  83. insert into t_order_payment
  84. <trim prefix="(" suffix=")" suffixOverrides=",">
  85. <if test="id != null">
  86. id,
  87. </if>
  88. <if test="tid != null">
  89. tid,
  90. </if>
  91. <if test="nodeId != null">
  92. node_id,
  93. </if>
  94. <if test="chooseType != null">
  95. choose_type,
  96. </if>
  97. <if test="paymentType != null">
  98. payment_type,
  99. </if>
  100. <if test="companyName != null">
  101. company_name,
  102. </if>
  103. <if test="quantity != null">
  104. quantity,
  105. </if>
  106. <if test="paymentStatus != null">
  107. payment_status,
  108. </if>
  109. <if test="status != null">
  110. `status`,
  111. </if>
  112. <if test="applicationAmount != null">
  113. application_amount,
  114. </if>
  115. <if test="paymentAmount != null">
  116. payment_amount,
  117. </if>
  118. <if test="remarks != null">
  119. remarks,
  120. </if>
  121. <if test="createTime != null">
  122. create_time,
  123. </if>
  124. <if test="aid != null">
  125. aid,
  126. </if>
  127. <if test="aname != null">
  128. aname,
  129. </if>
  130. <if test="tpcId != null">
  131. tpc_id,
  132. </if>
  133. <if test="processStatus != null">
  134. process_status,
  135. </if>
  136. </trim>
  137. <trim prefix="values (" suffix=")" suffixOverrides=",">
  138. <if test="id != null">
  139. #{id,jdbcType=INTEGER},
  140. </if>
  141. <if test="tid != null">
  142. #{tid,jdbcType=INTEGER},
  143. </if>
  144. <if test="nodeId != null">
  145. #{nodeId,jdbcType=INTEGER},
  146. </if>
  147. <if test="chooseType != null">
  148. #{chooseType,jdbcType=INTEGER},
  149. </if>
  150. <if test="paymentType != null">
  151. #{paymentType,jdbcType=INTEGER},
  152. </if>
  153. <if test="companyName != null">
  154. #{companyName,jdbcType=VARCHAR},
  155. </if>
  156. <if test="quantity != null">
  157. #{quantity,jdbcType=INTEGER},
  158. </if>
  159. <if test="paymentStatus != null">
  160. #{paymentStatus,jdbcType=INTEGER},
  161. </if>
  162. <if test="status != null">
  163. #{status,jdbcType=INTEGER},
  164. </if>
  165. <if test="applicationAmount != null">
  166. #{applicationAmount,jdbcType=DECIMAL},
  167. </if>
  168. <if test="paymentAmount != null">
  169. #{paymentAmount,jdbcType=DECIMAL},
  170. </if>
  171. <if test="remarks != null">
  172. #{remarks,jdbcType=VARCHAR},
  173. </if>
  174. <if test="createTime != null">
  175. #{createTime,jdbcType=TIMESTAMP},
  176. </if>
  177. <if test="aid != null">
  178. #{aid,jdbcType=VARCHAR},
  179. </if>
  180. <if test="aname != null">
  181. #{aname,jdbcType=VARCHAR},
  182. </if>
  183. <if test="tpcId != null">
  184. #{tpcId,jdbcType=INTEGER},
  185. </if>
  186. <if test="processStatus != null">
  187. #{processStatus,jdbcType=INTEGER},
  188. </if>
  189. </trim>
  190. </insert>
  191. <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.TOrderPayment">
  192. <!--
  193. WARNING - @mbg.generated
  194. This element is automatically generated by MyBatis Generator, do not modify.
  195. This element was generated on Tue Jul 20 09:16:18 CST 2021.
  196. -->
  197. update t_order_payment
  198. <set>
  199. <if test="tid != null">
  200. tid = #{tid,jdbcType=INTEGER},
  201. </if>
  202. <if test="nodeId != null">
  203. node_id = #{nodeId,jdbcType=INTEGER},
  204. </if>
  205. <if test="chooseType != null">
  206. choose_type = #{chooseType,jdbcType=INTEGER},
  207. </if>
  208. <if test="paymentType != null">
  209. payment_type = #{paymentType,jdbcType=INTEGER},
  210. </if>
  211. <if test="companyName != null">
  212. company_name = #{companyName,jdbcType=VARCHAR},
  213. </if>
  214. <if test="quantity != null">
  215. quantity = #{quantity,jdbcType=INTEGER},
  216. </if>
  217. <if test="paymentStatus != null">
  218. payment_status = #{paymentStatus,jdbcType=INTEGER},
  219. </if>
  220. <if test="status != null">
  221. `status` = #{status,jdbcType=INTEGER},
  222. </if>
  223. <if test="applicationAmount != null">
  224. application_amount = #{applicationAmount,jdbcType=DECIMAL},
  225. </if>
  226. <if test="paymentAmount != null">
  227. payment_amount = #{paymentAmount,jdbcType=DECIMAL},
  228. </if>
  229. <if test="remarks != null">
  230. remarks = #{remarks,jdbcType=VARCHAR},
  231. </if>
  232. <if test="createTime != null">
  233. create_time = #{createTime,jdbcType=TIMESTAMP},
  234. </if>
  235. <if test="aid != null">
  236. aid = #{aid,jdbcType=VARCHAR},
  237. </if>
  238. <if test="aname != null">
  239. aname = #{aname,jdbcType=VARCHAR},
  240. </if>
  241. <if test="tpcId != null">
  242. tpc_id = #{tpcId,jdbcType=INTEGER},
  243. </if>
  244. <if test="processStatus != null">
  245. process_status = #{processStatus,jdbcType=INTEGER},
  246. </if>
  247. </set>
  248. where id = #{id,jdbcType=INTEGER}
  249. </update>
  250. <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.TOrderPayment">
  251. <!--
  252. WARNING - @mbg.generated
  253. This element is automatically generated by MyBatis Generator, do not modify.
  254. This element was generated on Tue Jul 20 09:16:18 CST 2021.
  255. -->
  256. update t_order_payment
  257. set tid = #{tid,jdbcType=INTEGER},
  258. node_id = #{nodeId,jdbcType=INTEGER},
  259. choose_type = #{chooseType,jdbcType=INTEGER},
  260. payment_type = #{paymentType,jdbcType=INTEGER},
  261. company_name = #{companyName,jdbcType=VARCHAR},
  262. quantity = #{quantity,jdbcType=INTEGER},
  263. payment_status = #{paymentStatus,jdbcType=INTEGER},
  264. `status` = #{status,jdbcType=INTEGER},
  265. application_amount = #{applicationAmount,jdbcType=DECIMAL},
  266. payment_amount = #{paymentAmount,jdbcType=DECIMAL},
  267. remarks = #{remarks,jdbcType=VARCHAR},
  268. create_time = #{createTime,jdbcType=TIMESTAMP},
  269. aid = #{aid,jdbcType=VARCHAR},
  270. aname = #{aname,jdbcType=VARCHAR},
  271. tpc_id = #{tpcId,jdbcType=INTEGER},
  272. process_status = #{processStatus,jdbcType=INTEGER}
  273. where id = #{id,jdbcType=INTEGER}
  274. </update>
  275. <insert id="insertSelectiveGetId" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.TOrderPayment" useGeneratedKeys="true">
  276. insert into t_order_payment
  277. <trim prefix="(" suffix=")" suffixOverrides=",">
  278. <if test="id != null">
  279. id,
  280. </if>
  281. <if test="tid != null">
  282. tid,
  283. </if>
  284. <if test="nodeId != null">
  285. node_id,
  286. </if>
  287. <if test="chooseType != null">
  288. choose_type,
  289. </if>
  290. <if test="paymentType != null">
  291. payment_type,
  292. </if>
  293. <if test="companyName != null">
  294. company_name,
  295. </if>
  296. <if test="quantity != null">
  297. quantity,
  298. </if>
  299. <if test="paymentStatus != null">
  300. payment_status,
  301. </if>
  302. <if test="status != null">
  303. `status`,
  304. </if>
  305. <if test="applicationAmount != null">
  306. application_amount,
  307. </if>
  308. <if test="paymentAmount != null">
  309. payment_amount,
  310. </if>
  311. <if test="remarks != null">
  312. remarks,
  313. </if>
  314. <if test="createTime != null">
  315. create_time,
  316. </if>
  317. <if test="aid != null">
  318. aid,
  319. </if>
  320. <if test="aname != null">
  321. aname,
  322. </if>
  323. <if test="tpcId != null">
  324. tpc_id,
  325. </if>
  326. <if test="processStatus != null">
  327. process_status,
  328. </if>
  329. </trim>
  330. <trim prefix="values (" suffix=")" suffixOverrides=",">
  331. <if test="id != null">
  332. #{id,jdbcType=INTEGER},
  333. </if>
  334. <if test="tid != null">
  335. #{tid,jdbcType=INTEGER},
  336. </if>
  337. <if test="nodeId != null">
  338. #{nodeId,jdbcType=INTEGER},
  339. </if>
  340. <if test="chooseType != null">
  341. #{chooseType,jdbcType=INTEGER},
  342. </if>
  343. <if test="paymentType != null">
  344. #{paymentType,jdbcType=INTEGER},
  345. </if>
  346. <if test="companyName != null">
  347. #{companyName,jdbcType=VARCHAR},
  348. </if>
  349. <if test="quantity != null">
  350. #{quantity,jdbcType=INTEGER},
  351. </if>
  352. <if test="paymentStatus != null">
  353. #{paymentStatus,jdbcType=INTEGER},
  354. </if>
  355. <if test="status != null">
  356. #{status,jdbcType=INTEGER},
  357. </if>
  358. <if test="applicationAmount != null">
  359. #{applicationAmount,jdbcType=DECIMAL},
  360. </if>
  361. <if test="paymentAmount != null">
  362. #{paymentAmount,jdbcType=DECIMAL},
  363. </if>
  364. <if test="remarks != null">
  365. #{remarks,jdbcType=VARCHAR},
  366. </if>
  367. <if test="createTime != null">
  368. #{createTime,jdbcType=TIMESTAMP},
  369. </if>
  370. <if test="aid != null">
  371. #{aid,jdbcType=VARCHAR},
  372. </if>
  373. <if test="aname != null">
  374. #{aname,jdbcType=VARCHAR},
  375. </if>
  376. <if test="tpcId != null">
  377. #{tpcId,jdbcType=INTEGER},
  378. </if>
  379. <if test="processStatus != null">
  380. #{processStatus,jdbcType=INTEGER},
  381. </if>
  382. </trim>
  383. <selectKey keyProperty="id" order="AFTER" resultType="int">
  384. SELECT LAST_INSERT_ID()
  385. </selectKey>
  386. </insert>
  387. <select id="selectByidGetDetails" resultType="com.goafanti.organization.bo.outOrderPayment">
  388. select a.id,a.tid,a.node_id nodeId,a.payment_type paymentType,a.company_name companyName,a.quantity,
  389. a.payment_status paymentStatus,a.status,a.payment_amount paymentAmount,a.remarks ,d.finance_name examineName,
  390. d.finance_name financeName ,c.order_no orderNo,a.application_amount applicationAmount
  391. from t_order_payment a
  392. left join t_order_task c on a.tid=c.id left join t_order_mid d on c.order_no=d.order_no where a.id= #{id}
  393. </select>
  394. <select id="selectByTid" resultType="com.goafanti.organization.bo.outOrderPayment">
  395. select a.id,a.tid,a.node_id nodeId,a.payment_type paymentType,a.company_name companyName,a.quantity,choose_type chooseType,tpc.id tpcId,
  396. a.payment_status paymentStatus, a.status,a.payment_amount paymentAmount,a.remarks ,tpc.company_name tpcName,d.finance_name financeName ,
  397. c.order_no orderNo,date_format(a.create_time,'%Y-%m-%d %H:%i:%s')createTimes,a.application_amount applicationAmount
  398. from t_order_payment a left join t_order_task c on a.tid=c.id left join t_order_mid d on c.order_no=d.order_no
  399. left join third_party_company tpc on tpc.id=a.tpc_id where a.tid= #{tid}
  400. <if test="chooseType != null">
  401. and a.choose_type = #{chooseType}
  402. </if>
  403. <if test="type==1">
  404. and a.status in(0,1,2,3)
  405. </if>
  406. </select>
  407. <select id="selectList" resultType="com.goafanti.organization.bo.outOrderPayment">
  408. select a.id,a.tid,a.node_id nodeId,a.payment_type paymentType,a.company_name companyName,a.quantity,
  409. a.payment_status paymentStatus, a.status,a.payment_amount paymentAmount,a.remarks , b.quantity NodeQuantity,
  410. b.party_amount NodePartyAmount,b.total_amount NodeTotalAmount,d.finance_name financeName ,c.order_no orderNo
  411. ,a.application_amount applicationAmount
  412. from t_order_payment a left join payment_node b on a.node_id=b.id
  413. left join t_order_task c on b.tid=c.id left join t_order_mid d on c.order_no=d.order_no where a.status in(0,1,2,3)
  414. <if test="tpcId != null">
  415. and a.tpc_id= #{tpcId}
  416. </if>
  417. <if test="nodeId != null">
  418. and a.node_id= #{nodeId}
  419. </if>
  420. <if test="chooseType != null">
  421. and a.choose_type= #{chooseType}
  422. </if>
  423. </select>
  424. <update id="updateByids">
  425. update t_order_payment set process_status= #{processStatus}
  426. where id in
  427. <foreach close=")" collection="list" index="" item="item" open="(" separator=",">
  428. #{item}
  429. </foreach>
  430. </update>
  431. <select id="selectByCid" resultType="java.lang.Integer">
  432. select count(*) from t_order_payment where tpc_id = #{tpcId}
  433. </select>
  434. <select id="selectCountByFinance" resultType="com.goafanti.common.model.FinanceCount">
  435. select x.aid,x.dates dateTime,count(*) paymentCount,sum(if(x.status=0,1,0))paymentUnauditedCount
  436. from (select d.finance_id aid,a.status ,DATE_FORMAT(a.create_time , '%Y-%m-%d') dates
  437. from t_order_payment a left join t_order_task b on a.tid =b.id
  438. left join t_order_new c on b.order_no =c.order_no
  439. left join department d on c.order_dep =d.id
  440. where c.delete_sign in (0,2,3) and a.status in (0,2,3)
  441. and d.finance_id = #{aid})x
  442. group by x.aid,x.dates
  443. </select>
  444. <delete id="deleteByParam">
  445. delete from t_order_payment
  446. where 1=1
  447. and tid= #{tid}
  448. <if test="chooseType !=null">
  449. and choose_type = #{chooseType}
  450. </if>
  451. </delete>
  452. </mapper>