RecPayMapper.xml 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528
  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.dk.mdm.mapper.mac.RecPayMapper">
  4. <!-- 通用设置 -->
  5. <!-- 通用查询列 -->
  6. <sql id="Base_Column_List">
  7. rp_id, rp_no, rp_type, object_id, org_id, staff_id, sum_amt_rec, sum_amt_pay, sum_should_handle, sum_use_receipt_residue, sum_use_payment_residue, sum_amt_receivable_handle, sum_amt_payable_handle, sum_waive_amt, acc_date, annex_paths, remarks, biznis_type, biznis_id, biznis_no, flg_order_handle, flg_lock, make_staff, make_time, flg_valid, cp_id
  8. </sql>
  9. <!-- 通用查询映射结果 -->
  10. <resultMap id="BaseResultMap" type="com.dk.mdm.model.pojo.mac.RecPay">
  11. <id column="rp_id" property="rpId"/>
  12. <result column="rp_no" property="rpNo"/>
  13. <result column="rp_type" property="rpType"/>
  14. <result column="object_id" property="objectId" typeHandler="UuidTypeHandler"/>
  15. <result column="org_id" property="orgId" typeHandler="UuidTypeHandler"/>
  16. <result column="staff_id" property="staffId" typeHandler="UuidTypeHandler"/>
  17. <result column="sum_amt_rec" property="sumAmtRec"/>
  18. <result column="sum_amt_pay" property="sumAmtPay"/>
  19. <result column="sum_should_handle" property="sumShouldHandle"/>
  20. <result column="sum_use_receipt_residue" property="sumUseReceiptResidue"/>
  21. <result column="sum_use_payment_residue" property="sumUsePaymentResidue"/>
  22. <result column="sum_amt_receivable_handle" property="sumAmtReceivableHandle"/>
  23. <result column="sum_amt_payable_handle" property="sumAmtPayableHandle"/>
  24. <result column="sum_waive_amt" property="sumWaiveAmt"/>
  25. <result column="acc_date" property="accDate" typeHandler="TimestampTypeHandler"/>
  26. <result column="remarks" property="remarks"/>
  27. <result column="annex_paths" property="annexPaths" typeHandler="JsonTypeHandler"/>
  28. <result column="biznis_type" property="biznisType"/>
  29. <result column="biznis_id" property="biznisId" typeHandler="UuidTypeHandler"/>
  30. <result column="biznis_no" property="biznisNo"/>
  31. <result column="flg_order_handle" property="flgOrderHandle"/>
  32. <result column="flg_lock" property="flgLock"/>
  33. <result column="make_staff" property="makeStaff" typeHandler="UuidTypeHandler"/>
  34. <result column="make_time" property="makeTime" typeHandler="TimestampTypeHandler"/>
  35. <result column="flg_valid" property="flgValid"/>
  36. <result column="cp_id" property="cpId"/>
  37. </resultMap>
  38. <!-- Response查询映射结果 -->
  39. <resultMap id="BaseResultMapResponse" type="com.dk.mdm.model.response.mac.RecPayResponse">
  40. <id column="rp_id" property="rpId"/>
  41. <result column="rp_no" property="rpNo"/>
  42. <result column="rp_type" property="rpType"/>
  43. <result column="object_id" property="objectId" typeHandler="UuidTypeHandler"/>
  44. <result column="org_id" property="orgId" typeHandler="UuidTypeHandler"/>
  45. <result column="staff_id" property="staffId" typeHandler="UuidTypeHandler"/>
  46. <result column="sum_amt_rec" property="sumAmtRec"/>
  47. <result column="sum_amt_pay" property="sumAmtPay"/>
  48. <result column="sum_should_handle" property="sumShouldHandle"/>
  49. <result column="sum_use_receipt_residue" property="sumUseReceiptResidue"/>
  50. <result column="sum_use_payment_residue" property="sumUsePaymentResidue"/>
  51. <result column="sum_amt_receivable_handle" property="sumAmtReceivableHandle"/>
  52. <result column="sum_amt_payable_handle" property="sumAmtPayableHandle"/>
  53. <result column="sum_waive_amt" property="sumWaiveAmt"/>
  54. <result column="acc_date" property="accDate" typeHandler="TimestampTypeHandler"/>
  55. <result column="remarks" property="remarks"/>
  56. <result column="annex_paths" property="annexPaths" typeHandler="JsonTypeHandler"/>
  57. <result column="biznis_type" property="biznisType"/>
  58. <result column="biznis_id" property="biznisId" typeHandler="UuidTypeHandler"/>
  59. <result column="biznis_no" property="biznisNo"/>
  60. <result column="flg_order_handle" property="flgOrderHandle"/>
  61. <result column="flg_lock" property="flgLock"/>
  62. <result column="make_staff" property="makeStaff" typeHandler="UuidTypeHandler"/>
  63. <result column="make_time" property="makeTime" typeHandler="TimestampTypeHandler"/>
  64. <result column="flg_valid" property="flgValid"/>
  65. <result column="cp_id" property="cpId"/>
  66. <result column="receivable_residue" property="receivableResidue"/>
  67. <result column="receipt_residue" property="receiptResidue"/>
  68. <result column="payable_residue" property="payableResidue"/>
  69. <result column="payment_residue" property="paymentResidue"/>
  70. </resultMap>
  71. <!-- 通用条件列 -->
  72. <sql id="Condition">
  73. <if test="rpNo != null and rpNo != ''">
  74. AND t.rp_no LIKE concat('%',my_ex.likequery(#{rpNo}),'%')
  75. </if>
  76. <if test="rpType != null and rpType != ''">
  77. AND t.rp_type = #{rpType}
  78. </if>
  79. <if test="objectId != null and objectId != ''">
  80. AND t.object_id = #{objectId}::uuid
  81. </if>
  82. <if test="orgId != null and orgId != ''">
  83. AND t.org_id = #{orgId}::uuid
  84. </if>
  85. <if test="staffId != null and staffId != ''">
  86. AND t.staff_id = #{staffId}::uuid
  87. </if>
  88. <if test="sumAmtRec != null">
  89. AND t.sum_amt_rec = #{sumAmtRec}
  90. </if>
  91. <if test="sumAmtPay != null">
  92. AND t.sum_amt_pay = #{sumAmtPay}
  93. </if>
  94. <if test="sumShouldHandle != null">
  95. AND t.sum_should_handle = #{sumShouldHandle}
  96. </if>
  97. <if test="sumUseReceiptResidue != null">
  98. AND t.sum_use_receipt_residue = #{sumUseReceiptResidue}
  99. </if>
  100. <if test="sumUsePaymentResidue != null">
  101. AND t.sum_use_payment_residue = #{sumUsePaymentResidue}
  102. </if>
  103. <if test="sumAmtReceivableHandle != null">
  104. AND t.sum_amt_receivable_handle = #{sumAmtReceivableHandle}
  105. </if>
  106. <if test="sumAmtPayableHandle != null">
  107. AND t.sum_amt_payable_handle = #{sumAmtPayableHandle}
  108. </if>
  109. <if test="sumWaiveAmt != null">
  110. AND t.sum_waive_amt = #{sumWaiveAmt}
  111. </if>
  112. <if test="accDate != null">
  113. AND t.acc_date = #{accDate}
  114. </if>
  115. <if test="remarks != null and remarks != ''">
  116. AND t.remarks = #{remarks}
  117. </if>
  118. <if test="annexPaths != null and annexPaths != ''">
  119. AND t.annex_paths = #{annexPaths}
  120. </if>
  121. <if test="biznisType != null and biznisType != ''">
  122. AND t.biznis_type = #{biznisType}
  123. </if>
  124. <if test="biznisId != null and biznisId != ''">
  125. AND t.biznis_id = #{biznisId}::uuid
  126. </if>
  127. <if test="biznisNo != null and biznisNo != ''">
  128. AND t.biznis_no = #{biznisNo}
  129. </if>
  130. <if test="flgOrderHandle != null">
  131. AND t.flg_order_handle = #{flgOrderHandle}
  132. </if>
  133. <if test="flgLock != null">
  134. AND t.flg_lock = #{flgLock}
  135. </if>
  136. <if test="makeStaff != null and makeStaff != ''">
  137. AND t.make_staff = #{makeStaff}
  138. </if>
  139. <if test="makeTime != null">
  140. AND t.make_time = #{makeTime}
  141. </if>
  142. <if test="cpId != null">
  143. AND t.cp_id = #{cpId}
  144. </if>
  145. <if test="cusPhone != null and cusPhone != ''">
  146. AND tmc.cus_phone LIKE concat('%',my_ex.likequery(#{cusPhone}),'%')
  147. </if>
  148. <if test="cusName != null and cusName != ''">
  149. AND tmc.cus_name LIKE concat('%',my_ex.likequery(#{cusName}),'%')
  150. </if>
  151. <if test="orgIdList != null and orgIdList.size() > 0">
  152. AND t.org_id =any(#{orgIdList, typeHandler=UuidListTypeHandler})
  153. </if>
  154. <if test="staffIdList != null and staffIdList.size() > 0">
  155. AND t.staff_id =any(#{staffIdList, typeHandler=UuidListTypeHandler})
  156. </if>
  157. <if test="makeTimeStart != null and makeTimeEnd != null">
  158. AND t.make_time &gt;= #{makeTimeStart}::timestamp with time zone
  159. AND t.make_time &lt; #{makeTimeEnd}::timestamp with time zone + interval '1 day'
  160. </if>
  161. <if test="flgValidList != null and flgValidList.size()>0">
  162. AND t.flg_valid =any(#{flgValidList, typeHandler=BooleanListTypeHandler})
  163. </if>
  164. <if test="supName != null and supName != ''">
  165. AND tmp.sup_name LIKE concat('%',my_ex.likequery(#{supName}),'%')
  166. </if>
  167. <if test="rpTypeList != null and rpTypeList.size() > 0">
  168. AND t.rp_type =any(#{rpTypeList, typeHandler=StringListTypeHandler})
  169. </if>
  170. <if test="staffIds != null and staffIds.size() > 0">
  171. AND t.staff_id =any(#{staffIdList, typeHandler=UuidListTypeHandler})
  172. </if>
  173. <if test="createtimeStart != null and createtimeEnd != null">
  174. AND t.op_create_time &gt;= #{createtimeStart}::timestamp with time zone
  175. AND t.op_create_time &lt; #{createtimeEnd}::timestamp with time zone + interval '1 day'
  176. </if>
  177. <!-- <if test="searchText != null">-->
  178. <!-- AND ( t.rp_no like concat('%', my_ex.likequery(#{searchText}) , '%')-->
  179. <!-- OR tmc.cus_code like concat('%', my_ex.likequery(#{searchText}) , '%')-->
  180. <!-- OR tmc.cus_name like concat('%', my_ex.likequery(#{searchText}) , '%')-->
  181. <!-- OR tmc.cus_phone like concat('%', my_ex.likequery(#{searchText}) , '%')-->
  182. <!-- OR tmc.address_full like concat('%', my_ex.likequery(#{searchText}) , '%')-->
  183. <!-- OR t.remarks like concat('%', my_ex.likequery(#{searchText}) , '%')-->
  184. <!-- )-->
  185. <!-- </if>-->
  186. <if test="staffName != null and staffName != ''">
  187. AND tms.staff_name LIKE concat('%',my_ex.likequery(#{staffName}),'%')
  188. </if>
  189. <if test="orgName != null and orgName != ''">
  190. AND tmo.org_name LIKE concat('%',my_ex.likequery(#{orgName}),'%')
  191. </if>
  192. </sql>
  193. <sql id="idsForeach">
  194. <!-- 根据主键rpId批量操作 -->
  195. WHERE rp_id in
  196. <foreach collection="ids" index="index" item="item" separator="," open="(" close=")">
  197. #{item}
  198. </foreach>
  199. </sql>
  200. <!-- 查询表t_mac_rec_pay,(条件查询+分页)列表 -->
  201. <select id="selectByCond" resultMap="BaseResultMapResponse">
  202. select t.rp_id,
  203. t.rp_no,
  204. t.rp_type,
  205. sys.f_get_name_i18n(tdk1.kind_name_i18n, #{i18n}) as "rpTypeName",
  206. t.object_id,
  207. tmc.cus_code as "cusCode",
  208. tmc.cus_name as "cusName",
  209. tmc.cus_phone as "cusPhone",
  210. tmc.address_full as "addressFull",
  211. t.org_id,
  212. tmo.org_name as "orgName",
  213. t.staff_id,
  214. tms.staff_name as "staffName",
  215. t.sum_amt_rec,
  216. t.sum_amt_pay,
  217. t.sum_should_handle,
  218. t.sum_use_receipt_residue,
  219. t.sum_use_payment_residue,
  220. t.sum_amt_receivable_handle,
  221. t.sum_amt_payable_handle,
  222. t.sum_waive_amt,
  223. t.acc_date,
  224. t.remarks,
  225. t.annex_paths,
  226. t.biznis_type,
  227. t.biznis_id,
  228. t.biznis_no,
  229. t.flg_order_handle,
  230. t.flg_lock,
  231. t.make_staff,
  232. makestaff.staff_name as "makeStaffName",
  233. t.make_time,
  234. t.flg_valid,
  235. t.cp_id,
  236. tma.receivable_residue,
  237. tma.receipt_residue
  238. from dkic_b.t_mac_rec_pay as t
  239. left join dkic_b.t_mst_customer tmc on tmc.cus_id = t.object_id
  240. left join sys.t_data_kind as tdk1 on tdk1.kind_code = t.rp_type
  241. left join dkic_b.t_mst_org tmo on tmo.org_id = t.org_id
  242. left join dkic_b.t_mst_staff tms on tms.staff_id = t.staff_id
  243. left join dkic_b.t_mst_staff as makestaff on makestaff.staff_id = t.make_staff
  244. LEFT JOIN dkic_b.t_mac_account tma on tma.object_id = t.object_id and tma.object_type in ('对象类型-客户')
  245. where t.rp_type in ('收付款类型-收款', '收付款类型-退收款')
  246. <include refid="Condition"/>
  247. <if test="searchText !=null and searchText != ''">
  248. AND (
  249. t.rp_no LIKE concat('%',my_ex.likequery(#{searchText}),'%')
  250. or tmc.cus_phone LIKE concat('%',my_ex.likequery(#{searchText}),'%')
  251. or tmc.cus_name LIKE concat('%',my_ex.likequery(#{searchText}),'%')
  252. or tmo.org_name LIKE concat('%',my_ex.likequery(#{searchText}),'%')
  253. or tms.staff_name LIKE concat('%',my_ex.likequery(#{searchText}),'%')
  254. )
  255. </if>
  256. order by t.op_create_time desc
  257. <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
  258. limit #{end} offset #{start}
  259. </if>
  260. </select>
  261. <!-- 查询表t_mac_rec_pay,(条件查询)个数 -->
  262. <select id="countByCond" resultType="Long">
  263. SELECT count(1)
  264. from dkic_b.t_mac_rec_pay as t
  265. left join dkic_b.t_mst_customer tmc on tmc.cus_id = t.object_id
  266. left join sys.t_data_kind as tdk1 on tdk1.kind_code = t.rp_type
  267. left join dkic_b.t_mst_org tmo on tmo.org_id = t.org_id
  268. left join dkic_b.t_mst_staff tms on tms.staff_id = t.staff_id
  269. left join dkic_b.t_mst_staff as makestaff on makestaff.staff_id = t.make_staff
  270. where t.rp_type in ('收付款类型-收款', '收付款类型-退收款')
  271. <include refid="Condition"/>
  272. <if test="searchText !=null and searchText != ''">
  273. AND (
  274. t.rp_no LIKE concat('%',my_ex.likequery(#{searchText}),'%')
  275. or tmc.cus_phone LIKE concat('%',my_ex.likequery(#{searchText}),'%')
  276. or tmc.cus_name LIKE concat('%',my_ex.likequery(#{searchText}),'%')
  277. or tmo.org_name LIKE concat('%',my_ex.likequery(#{searchText}),'%')
  278. or tms.staff_name LIKE concat('%',my_ex.likequery(#{searchText}),'%')
  279. )
  280. </if>
  281. </select>
  282. <!-- 根据主键查询表t_mac_rec_pay的一行数据 -->
  283. <select id="selectById" resultMap="BaseResultMapResponse">
  284. select t.rp_id,
  285. t.rp_no,
  286. t.rp_type,
  287. sys.f_get_name_i18n(tdk1.kind_name_i18n, #{i18n}) as "rpTypeName",
  288. t.object_id,
  289. tmc.cus_code as "cusCode",
  290. tmc.cus_name as "cusName",
  291. tmc.cus_phone as "cusPhone",
  292. tmc.address_full as "addressFull",
  293. t.org_id,
  294. tmo.org_name as "orgName",
  295. t.staff_id,
  296. tms.staff_name as "staffName",
  297. t.sum_amt_rec,
  298. t.sum_amt_pay,
  299. t.sum_should_handle,
  300. t.sum_use_receipt_residue,
  301. t.sum_use_payment_residue,
  302. t.sum_amt_receivable_handle,
  303. t.sum_amt_payable_handle,
  304. t.sum_waive_amt,
  305. t.acc_date,
  306. t.remarks,
  307. t.annex_paths,
  308. t.biznis_type,
  309. t.biznis_id,
  310. t.biznis_no,
  311. t.flg_order_handle,
  312. t.flg_lock,
  313. t.make_staff,
  314. makestaff.staff_name as "makeStaffName",
  315. t.make_time,
  316. t.flg_valid,
  317. t.cp_id
  318. from dkic_b.t_mac_rec_pay as t
  319. left join dkic_b.t_mst_customer tmc on tmc.cus_id = t.object_id
  320. left join sys.t_data_kind as tdk1 on tdk1.kind_code = t.rp_type
  321. left join dkic_b.t_mst_org tmo on tmo.org_id = t.org_id
  322. left join dkic_b.t_mst_staff tms on tms.staff_id = t.staff_id
  323. left join dkic_b.t_mst_staff as makestaff on makestaff.staff_id = t.make_staff
  324. where t.rp_id = #{id}::uuid
  325. </select>
  326. <!-- 根据主键锁定表t_mac_rec_pay的一行数据 -->
  327. <select id="selectByIdForUpdate" resultMap="BaseResultMap">
  328. SELECT
  329. <include refid="Base_Column_List"/>
  330. FROM dkic_b.t_mac_rec_pay
  331. WHERE flg_valid
  332. and rp_id = #{id}::uuid
  333. for update
  334. </select>
  335. <!-- 根据主键锁定表t_mac_rec_pay的一行数据 -->
  336. <select id="selectByBiznisIdForUpdate" resultMap="BaseResultMap">
  337. SELECT
  338. <include refid="Base_Column_List"/>
  339. FROM dkic_b.t_mac_rec_pay
  340. WHERE flg_valid
  341. and biznis_id = #{id}::uuid
  342. and flg_order_handle = #{flgOrderHandle}
  343. for update
  344. </select>
  345. <!-- 根据主键锁定表t_mac_rec_pay的一行数据 -->
  346. <select id="selectByBiznisId" resultMap="BaseResultMap">
  347. SELECT
  348. <include refid="Base_Column_List"/>
  349. FROM dkic_b.t_mac_rec_pay
  350. WHERE flg_valid
  351. and biznis_id = #{id}::uuid
  352. </select>
  353. <!-- 根据主键锁定表t_mac_rec_pay的多行数据 -->
  354. <select id="selectByIdsForUpdate" resultMap="BaseResultMap">
  355. SELECT
  356. <include refid="Base_Column_List"/>
  357. FROM dkic_b.t_mac_rec_pay
  358. <include refid="idsForeach"/>
  359. for update
  360. </select>
  361. <insert id="insertBatch">
  362. insert into dkic_b.t_mac_rec_pay
  363. (
  364. <trim suffixOverrides=",">
  365. rp_no,
  366. rp_type,
  367. object_id,
  368. org_id,
  369. staff_id,
  370. sum_amt_rec,
  371. sum_amt_pay,
  372. sum_should_handle,
  373. sum_use_receipt_residue,
  374. sum_use_payment_residue,
  375. sum_amt_receivable_handle,
  376. sum_amt_payable_handle,
  377. sum_waive_amt,
  378. acc_date,
  379. remarks,
  380. annex_paths,
  381. biznis_type,
  382. biznis_id,
  383. biznis_no,
  384. flg_order_handle,
  385. flg_lock,
  386. make_staff,
  387. make_time,
  388. cp_id,
  389. op_app_code,
  390. </trim>
  391. )
  392. values
  393. <foreach collection="list" index="index" item="item" separator=",">
  394. (
  395. <trim suffixOverrides=",">
  396. #{item.rpNo},
  397. #{item.rpType},
  398. #{item.objectId}::uuid,
  399. #{item.orgId}::uuid,
  400. #{item.staffId}::uuid,
  401. #{item.sumAmtRec},
  402. #{item.sumAmtPay},
  403. #{item.sumShouldHandle},
  404. #{item.sumUseReceiptResidue},
  405. #{item.sumUsePaymentResidue},
  406. #{item.sumAmtReceivableHandle},
  407. #{item.sumAmtPayableHandle},
  408. #{item.sumWaiveAmt},
  409. #{item.accDate},
  410. #{item.remarks},
  411. #{item.annexPaths},
  412. #{item.biznisType},
  413. #{item.biznisId}::uuid,
  414. #{item.biznisNo},
  415. #{item.flgOrderHandle},
  416. #{item.flgLock},
  417. #{item.makeStaff}::uuid,
  418. #{item.makeTime},
  419. #{item.cpId},
  420. #{item.opAppCode},
  421. </trim>
  422. )
  423. </foreach>
  424. </insert>
  425. <!-- 查询表t_mac_rec_pay,(条件查询+分页)列表 -->
  426. <select id="selectPaymentByCond" resultMap="BaseResultMapResponse">
  427. select t.rp_id,
  428. t.rp_no,
  429. t.rp_type,
  430. sys.f_get_name_i18n(tdk1.kind_name_i18n, #{i18n}) as "rpTypeName",
  431. t.object_id,
  432. tmp.sup_code as "supCode",
  433. tmp.sup_name as "supName",
  434. t.org_id,
  435. tmo.org_name as "orgName",
  436. t.staff_id,
  437. tms.staff_name as "staffName",
  438. t.sum_amt_rec,
  439. t.sum_amt_pay,
  440. t.sum_should_handle,
  441. t.sum_use_receipt_residue,
  442. t.sum_use_payment_residue,
  443. t.sum_amt_receivable_handle,
  444. t.sum_amt_payable_handle,
  445. t.sum_waive_amt,
  446. t.acc_date,
  447. t.remarks,
  448. t.annex_paths,
  449. t.biznis_type,
  450. t.biznis_id,
  451. t.biznis_no,
  452. t.flg_order_handle,
  453. t.flg_lock,
  454. t.make_staff,
  455. makestaff.staff_name as "makeStaffName",
  456. t.make_time,
  457. t.flg_valid,
  458. t.cp_id,
  459. tma.payable_residue,
  460. tma.payment_residue
  461. from dkic_b.t_mac_rec_pay as t
  462. Left join dkic_b.t_mst_supplier tmp on tmp.sup_id = t.object_id
  463. left join sys.t_data_kind as tdk1 on tdk1.kind_code = t.rp_type
  464. left join dkic_b.t_mst_org tmo on tmo.org_id = t.org_id
  465. left join dkic_b.t_mst_staff tms on tms.staff_id = t.staff_id
  466. left join dkic_b.t_mst_staff as makestaff on makestaff.staff_id = t.make_staff
  467. LEFT JOIN dkic_b.t_mac_account tma on tma.object_id = t.object_id and tma.object_type in ('对象类型-供应商')
  468. where t.rp_type in ('收付款类型-付款', '收付款类型-退付款')
  469. <include refid="Condition"/>
  470. <if test="searchText !=null and searchText != ''">
  471. AND (
  472. t.rp_no LIKE concat('%',my_ex.likequery(#{searchText}),'%')
  473. or tmo.org_name LIKE concat('%',my_ex.likequery(#{searchText}),'%')
  474. or tmp.sup_name LIKE concat('%',my_ex.likequery(#{searchText}),'%')
  475. or tms.staff_name LIKE concat('%',my_ex.likequery(#{searchText}),'%')
  476. )
  477. </if>
  478. order by t.op_create_time desc
  479. <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
  480. limit #{end} offset #{start}
  481. </if>
  482. </select>
  483. <!-- 查询表t_mac_rec_pay,(条件查询)个数 -->
  484. <select id="countPaymentByCond" resultType="Long">
  485. SELECT count(1)
  486. from dkic_b.t_mac_rec_pay as t
  487. Left join dkic_b.t_mst_supplier tmp on tmp.sup_id = t.object_id
  488. left join sys.t_data_kind as tdk1 on tdk1.kind_code = t.rp_type
  489. left join dkic_b.t_mst_org tmo on tmo.org_id = t.org_id
  490. left join dkic_b.t_mst_staff tms on tms.staff_id = t.staff_id
  491. left join dkic_b.t_mst_staff as makestaff on makestaff.staff_id = t.make_staff
  492. where t.rp_type in ('收付款类型-付款', '收付款类型-退付款')
  493. <include refid="Condition"/>
  494. <if test="searchText !=null and searchText != ''">
  495. AND (
  496. t.rp_no LIKE concat('%',my_ex.likequery(#{searchText}),'%')
  497. or tmo.org_name LIKE concat('%',my_ex.likequery(#{searchText}),'%')
  498. or tmp.sup_name LIKE concat('%',my_ex.likequery(#{searchText}),'%')
  499. or tms.staff_name LIKE concat('%',my_ex.likequery(#{searchText}),'%')
  500. )
  501. </if>
  502. </select>
  503. <!-- 删除收款单 -->
  504. <delete id="deleteById">
  505. DELETE FROM dkic_b.t_mac_rec_pay
  506. WHERE rp_id = #{id}::uuid;
  507. </delete>
  508. </mapper>