RecPayItemMapper.xml 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  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.RecPayItemMapper">
  4. <!-- 通用设置 -->
  5. <!-- 通用查询列 -->
  6. <sql id="Base_Column_List">
  7. item_id , rp_id, mac_id, amt_rec, amt_pay, acc_item_id, acc_date, remarks, make_staff, make_time, flg_valid, cp_id, op_create_time, op_create_user_id, op_update_time, op_update_user_id, op_app_code, op_timestamp, op_db_user
  8. </sql>
  9. <!-- 通用查询映射结果 -->
  10. <resultMap id="BaseResultMap" type="com.dk.mdm.model.pojo.mac.RecPayItem">
  11. <id column="item_id" property="itemId"/>
  12. <result column="rp_id" property="rpId" typeHandler="UuidTypeHandler"/>
  13. <result column="mac_id" property="macId" typeHandler="UuidTypeHandler"/>
  14. <result column="amt_rec" property="amtRec"/>
  15. <result column="amt_pay" property="amtPay"/>
  16. <result column="acc_item_id" property="accItemId"/>
  17. <result column="acc_date" property="accDate" typeHandler="TimestampTypeHandler"/>
  18. <result column="remarks" property="remarks"/>
  19. <result column="make_staff" property="makeStaff" typeHandler="UuidTypeHandler"/>
  20. <result column="make_time" property="makeTime" typeHandler="TimestampTypeHandler"/>
  21. <result column="flg_valid" property="flgValid"/>
  22. <result column="cp_id" property="cpId"/>
  23. </resultMap>
  24. <!-- Response查询映射结果 -->
  25. <resultMap id="BaseResultMapResponse" type="com.dk.mdm.model.response.mac.RecPayItemResponse">
  26. <id column="item_id" property="itemId"/>
  27. <result column="rp_id" property="rpId" typeHandler="UuidTypeHandler"/>
  28. <result column="mac_id" property="macId" typeHandler="UuidTypeHandler"/>
  29. <result column="amt_rec" property="amtRec"/>
  30. <result column="amt_pay" property="amtPay"/>
  31. <result column="acc_item_id" property="accItemId"/>
  32. <result column="acc_date" property="accDate" typeHandler="TimestampTypeHandler"/>
  33. <result column="remarks" property="remarks"/>
  34. <result column="make_staff" property="makeStaff" typeHandler="UuidTypeHandler"/>
  35. <result column="make_time" property="makeTime" typeHandler="TimestampTypeHandler"/>
  36. <result column="flg_valid" property="flgValid"/>
  37. <result column="cp_id" property="cpId"/>
  38. </resultMap>
  39. <!-- 通用条件列 -->
  40. <sql id="Condition">
  41. <where>
  42. <if test="rpId != null and rpId != ''">
  43. AND t.rp_id = #{rpId}::uuid
  44. </if>
  45. <if test="macId != null and macId != ''">
  46. AND t.mac_id = #{macId}
  47. </if>
  48. <if test="amtRec != null">
  49. AND t.amt_rec = #{amtRec}
  50. </if>
  51. <if test="amtPay != null">
  52. AND t.amt_pay = #{amtPay}
  53. </if>
  54. <if test="accItemId != null">
  55. AND t.acc_item_id = #{accItemId}
  56. </if>
  57. <if test="accDate != null">
  58. AND t.acc_date = #{accDate}
  59. </if>
  60. <if test="remarks != null and remarks != ''">
  61. AND t.remarks = #{remarks}
  62. </if>
  63. <if test="makeStaff != null and makeStaff != ''">
  64. AND t.make_staff = #{makeStaff}
  65. </if>
  66. <if test="makeTime != null">
  67. AND t.make_time = #{makeTime}
  68. </if>
  69. <if test="flgValid != null">
  70. AND t.flg_valid = #{flgValid}
  71. </if>
  72. <if test="cpId != null">
  73. AND t.cp_id = #{cpId}
  74. </if>
  75. </where>
  76. </sql>
  77. <sql id="idsForeach">
  78. <!-- 根据主键itemId批量操作 -->
  79. WHERE item_id in
  80. <foreach collection="ids" index="index" item="item" separator="," open="(" close=")">
  81. #{item}
  82. </foreach>
  83. </sql>
  84. <!-- 查询表t_mac_rec_pay_item,(条件查询+分页)列表 -->
  85. <select id="selectByCond" resultMap="BaseResultMapResponse">
  86. SELECT t.item_id,
  87. t.rp_id,
  88. t.mac_id,
  89. tmma.mac_name as "macName",
  90. t.amt_rec,
  91. t.amt_pay,
  92. t.acc_item_id,
  93. t.acc_date,
  94. t.remarks,
  95. t.make_staff,
  96. t.make_time,
  97. t.flg_valid,
  98. t.cp_id
  99. FROM t_mac_rec_pay_item as t
  100. inner join dkic_b.t_mst_money_account tmma on tmma.mac_id = t.mac_id
  101. <include refid="Condition"/>
  102. <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
  103. limit #{end} offset #{start}
  104. </if>
  105. </select>
  106. <!-- 查询表t_mac_rec_pay_item,(条件查询)个数 -->
  107. <select id="countByCond" resultType="Long">
  108. SELECT
  109. count(1)
  110. FROM t_mac_rec_pay_item as t
  111. inner join dkic_b.t_mst_money_account tmma on tmma.mac_id = t.mac_id
  112. <include refid="Condition"/>
  113. </select>
  114. <!-- 根据主键查询表t_mac_rec_pay_item的一行数据 -->
  115. <select id="selectById" resultMap="BaseResultMap">
  116. SELECT
  117. <include refid="Base_Column_List"/>
  118. FROM t_mac_rec_pay_item
  119. WHERE item_id = #{itemId}::uuid
  120. </select>
  121. <!-- 根据主键锁定表t_mac_rec_pay_item的一行数据 -->
  122. <select id="selectByIdForUpdate" resultMap="BaseResultMap">
  123. SELECT
  124. <include refid="Base_Column_List"/>
  125. FROM t_mac_rec_pay_item
  126. WHERE item_id = #{id}::uuid
  127. for update
  128. </select>
  129. <!-- 根据主键锁定表t_mac_rec_pay_item的多行数据 -->
  130. <select id="selectByIdsForUpdate" resultMap="BaseResultMap">
  131. SELECT
  132. <include refid="Base_Column_List"/>
  133. FROM t_mac_rec_pay_item
  134. <include refid="idsForeach"/>
  135. for update
  136. </select>
  137. <insert id="insertBatch">
  138. insert into t_mac_rec_pay_item
  139. (
  140. <trim suffixOverrides=",">
  141. rp_id,
  142. mac_id,
  143. amt_rec,
  144. amt_pay,
  145. acc_item_id,
  146. acc_date,
  147. remarks,
  148. make_staff,
  149. make_time,
  150. cp_id,
  151. op_app_code,
  152. </trim>
  153. )
  154. values
  155. <foreach collection="list" index="index" item="item" separator=",">
  156. (
  157. <trim suffixOverrides=",">
  158. #{item.rpId}::uuid,
  159. #{item.macId}::uuid,
  160. #{item.amtRec},
  161. #{item.amtPay},
  162. #{item.accItemId},
  163. #{item.accDate},
  164. #{item.remarks},
  165. #{item.makeStaff}::uuid,
  166. #{item.makeTime},
  167. #{item.cpId},
  168. #{item.opAppCode},
  169. </trim>
  170. )
  171. </foreach>
  172. </insert>
  173. </mapper>