ReceivableHandleItemMapper.xml 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  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.ReceivableHandleItemMapper">
  4. <!-- 通用设置 -->
  5. <!-- 通用查询列 -->
  6. <sql id="Base_Column_List">
  7. item_id, handle_id, handle_date, object_id, rec1_type, rec1_id, rec1_handle_amt, rec1_waive_amt, rec2_type, rec2_id, rec2_handle_amt, remarks, 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.ReceivableHandleItem">
  11. <id column="item_id" property="itemId"/>
  12. <result column="handle_id" property="handleId"/>
  13. <result column="handle_date" property="handleDate" typeHandler="TimestampTypeHandler"/>
  14. <result column="object_id" property="objectId" typeHandler="UuidTypeHandler"/>
  15. <result column="rec1_type" property="rec1Type"/>
  16. <result column="rec1_id" property="rec1Id" typeHandler="UuidTypeHandler"/>
  17. <result column="rec1_handle_amt" property="rec1HandleAmt"/>
  18. <result column="rec1_waive_amt" property="rec1WaiveAmt"/>
  19. <result column="rec2_type" property="rec2Type"/>
  20. <result column="rec2_id" property="rec2Id" typeHandler="UuidTypeHandler"/>
  21. <result column="rec2_handle_amt" property="rec2HandleAmt"/>
  22. <result column="remarks" property="remarks"/>
  23. <result column="flg_valid" property="flgValid"/>
  24. <result column="cp_id" property="cpId"/>
  25. <result column="op_create_time" property="opCreateTime" typeHandler="TimestampTypeHandler"/>
  26. <result column="op_create_user_id" property="opCreateUserId" typeHandler="UuidTypeHandler"/>
  27. <result column="op_update_time" property="opUpdateTime" typeHandler="TimestampTypeHandler"/>
  28. <result column="op_update_user_id" property="opUpdateUserId" typeHandler="UuidTypeHandler"/>
  29. <result column="op_app_code" property="opAppCode"/>
  30. <result column="op_timestamp" property="opTimestamp" typeHandler="TimestampTypeHandler"/>
  31. <result column="op_db_user" property="opDbUser"/>
  32. </resultMap>
  33. <!-- 通用条件列 -->
  34. <sql id="Condition">
  35. <where>
  36. <if test="handleId != null and handleId != ''">
  37. AND handle_id = #{handleId}
  38. </if>
  39. <if test="handleDate != null">
  40. AND handle_date = #{handleDate}
  41. </if>
  42. <if test="objectId != null and objectId != ''">
  43. AND object_id = #{objectId}
  44. </if>
  45. <if test="rec1Type != null and rec1Type != ''">
  46. AND rec1_type = #{rec1Type}
  47. </if>
  48. <if test="rec1Id != null and rec1Id != ''">
  49. AND rec1_id = #{rec1Id}
  50. </if>
  51. <if test="rec1HandleAmt != null">
  52. AND rec1_handle_amt = #{rec1HandleAmt}
  53. </if>
  54. <if test="rec1WaiveAmt != null">
  55. AND rec1_waive_amt = #{rec1WaiveAmt}
  56. </if>
  57. <if test="rec2Type != null and rec2Type != ''">
  58. AND rec2_type = #{rec2Type}
  59. </if>
  60. <if test="rec2Id != null and rec2Id != ''">
  61. AND rec2_id = #{rec2Id}
  62. </if>
  63. <if test="rec2HandleAmt != null">
  64. AND rec2_handle_amt = #{rec2HandleAmt}
  65. </if>
  66. <if test="remarks != null and remarks != ''">
  67. AND remarks = #{remarks}
  68. </if>
  69. <if test="flgValid != null">
  70. AND flg_valid = #{flgValid}
  71. </if>
  72. <if test="cpId != null">
  73. AND cp_id = #{cpId}
  74. </if>
  75. <if test="opCreateTime != null">
  76. AND op_create_time = #{opCreateTime}
  77. </if>
  78. <if test="opCreateUserId != null and opCreateUserId != ''">
  79. AND op_create_user_id = #{opCreateUserId}
  80. </if>
  81. <if test="opUpdateTime != null">
  82. AND op_update_time = #{opUpdateTime}
  83. </if>
  84. <if test="opUpdateUserId != null and opUpdateUserId != ''">
  85. AND op_update_user_id = #{opUpdateUserId}
  86. </if>
  87. <if test="opAppCode != null and opAppCode != ''">
  88. AND op_app_code = #{opAppCode}
  89. </if>
  90. <if test="opTimestamp != null">
  91. AND op_timestamp = #{opTimestamp}
  92. </if>
  93. <if test="opDbUser != null and opDbUser != ''">
  94. AND op_db_user = #{opDbUser}
  95. </if>
  96. </where>
  97. </sql>
  98. <sql id="idsForeach">
  99. <!-- 根据主键itemId批量操作 -->
  100. WHERE item_id in
  101. <foreach collection="ids" index="index" item="item" separator="," open="(" close=")">
  102. #{item}
  103. </foreach>
  104. </sql>
  105. <!-- 查询表t_mac_receivable_handle_item,(条件查询+分页)列表 -->
  106. <select id="selectByCond" resultMap="BaseResultMap">
  107. SELECT
  108. <include refid="Base_Column_List"/>
  109. FROM t_mac_receivable_handle_item
  110. <include refid="Condition"/>
  111. <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
  112. limit #{end} offset #{start}
  113. </if>
  114. </select>
  115. <!-- 查询表t_mac_receivable_handle_item,(条件查询)个数 -->
  116. <select id="countByCond" resultType="Long">
  117. SELECT
  118. count(1)
  119. FROM t_mac_receivable_handle_item
  120. <include refid="Condition"/>
  121. </select>
  122. <!-- 根据主键查询表t_mac_receivable_handle_item的一行数据 -->
  123. <select id="selectById" resultMap="BaseResultMap">
  124. SELECT
  125. <include refid="Base_Column_List"/>
  126. FROM t_mac_receivable_handle_item
  127. WHERE item_id = #{itemId}::uuid
  128. </select>
  129. <!-- 根据主键锁定表t_mac_receivable_handle_item的一行数据 -->
  130. <select id="selectByIdForUpdate" resultMap="BaseResultMap">
  131. SELECT
  132. <include refid="Base_Column_List"/>
  133. FROM t_mac_receivable_handle_item
  134. WHERE item_id = #{itemId}
  135. for update
  136. </select>
  137. <!-- 根据主键锁定表t_mac_receivable_handle_item的多行数据 -->
  138. <select id="selectByIdsForUpdate" resultMap="BaseResultMap">
  139. SELECT
  140. <include refid="Base_Column_List"/>
  141. FROM t_mac_receivable_handle_item
  142. <include refid="idsForeach"/>
  143. for update
  144. </select>
  145. <insert id="insertBatch">
  146. insert into t_mac_receivable_handle_item
  147. (
  148. <trim suffixOverrides=",">
  149. handle_id,
  150. handle_date,
  151. object_id,
  152. rec1_type,
  153. rec1_id,
  154. rec1_handle_amt,
  155. rec1_waive_amt,
  156. rec2_type,
  157. rec2_id,
  158. rec2_handle_amt,
  159. remarks,
  160. cp_id,
  161. op_app_code,
  162. </trim>
  163. )
  164. values
  165. <foreach collection="list" index="index" item="item" separator=",">
  166. (
  167. <trim suffixOverrides=",">
  168. #{item.handleId},
  169. #{item.handleDate},
  170. #{item.objectId}::uuid,
  171. #{item.rec1Type},
  172. #{item.rec1Id}::uuid,
  173. #{item.rec1HandleAmt},
  174. #{item.rec1WaiveAmt},
  175. #{item.rec2Type},
  176. #{item.rec2Id}::uuid,
  177. #{item.rec2HandleAmt},
  178. #{item.remarks},
  179. #{item.cpId},
  180. #{item.opAppCode},
  181. </trim>
  182. )
  183. </foreach>
  184. </insert>
  185. </mapper>