OtherPayableMapper.xml 7.7 KB

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