OutboundMapper.xml 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  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.ivt.OutboundMapper">
  4. <!-- 通用设置 -->
  5. <!-- 通用查询列 -->
  6. <sql id="Base_Column_List">
  7. out_id, out_no, out_type, from_id, from_no, org_id, staff_id, cus_id, sup_id, out_status, outing_qty, outing_amt, out_qty, out_amt, return_qty, return_amt, out_date, remarks, annex_paths, make_staff, make_time, receivable_id, payable_id, 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.response.ivt.OutboundResponse">
  11. <id column="out_id" property="outId"/>
  12. <result column="out_no" property="outNo"/>
  13. <result column="out_type" property="outType"/>
  14. <result column="from_id" property="fromId" typeHandler="UuidTypeHandler"/>
  15. <result column="from_no" property="fromNo"/>
  16. <result column="org_id" property="orgId" typeHandler="UuidTypeHandler"/>
  17. <result column="staff_id" property="staffId" typeHandler="UuidTypeHandler"/>
  18. <result column="cus_id" property="cusId" typeHandler="UuidTypeHandler"/>
  19. <result column="sup_id" property="supId" typeHandler="UuidTypeHandler"/>
  20. <result column="out_status" property="outStatus"/>
  21. <result column="outing_qty" property="outingQty"/>
  22. <result column="outing_amt" property="outingAmt"/>
  23. <result column="out_qty" property="outQty"/>
  24. <result column="out_amt" property="outAmt"/>
  25. <result column="return_qty" property="returnQty"/>
  26. <result column="return_amt" property="returnAmt"/>
  27. <result column="out_date" property="outDate" typeHandler="TimestampTypeHandler"/>
  28. <result column="remarks" property="remarks"/>
  29. <result column="annex_paths" property="annexPaths" typeHandler="JsonTypeHandler"/>
  30. <result column="make_staff" property="makeStaff" typeHandler="UuidTypeHandler"/>
  31. <result column="make_time" property="makeTime" typeHandler="TimestampTypeHandler"/>
  32. <result column="receivable_id" property="receivableId" typeHandler="UuidTypeHandler"/>
  33. <result column="payable_id" property="payableId" typeHandler="UuidTypeHandler"/>
  34. <result column="flg_valid" property="flgValid"/>
  35. <result column="cp_id" property="cpId"/>
  36. <result column="op_create_time" property="opCreateTime" typeHandler="TimestampTypeHandler"/>
  37. <result column="op_create_user_id" property="opCreateUserId" typeHandler="UuidTypeHandler"/>
  38. <result column="op_update_time" property="opUpdateTime" typeHandler="TimestampTypeHandler"/>
  39. <result column="op_update_user_id" property="opUpdateUserId" typeHandler="UuidTypeHandler"/>
  40. <result column="op_app_code" property="opAppCode"/>
  41. <result column="op_timestamp" property="opTimestamp" typeHandler="TimestampTypeHandler"/>
  42. <result column="op_db_user" property="opDbUser"/>
  43. </resultMap>
  44. <!-- 通用条件列 -->
  45. <sql id="Condition">
  46. <where>
  47. <if test="outNo != null and outNo != ''">
  48. AND out_no = #{outNo}
  49. </if>
  50. <if test="outType != null and outType != ''">
  51. AND out_type = #{outType}
  52. </if>
  53. <if test="fromId != null and fromId != ''">
  54. AND from_id = #{fromId}
  55. </if>
  56. <if test="fromNo != null and fromNo != ''">
  57. AND from_no = #{fromNo}
  58. </if>
  59. <if test="orgId != null and orgId != ''">
  60. AND org_id = #{orgId}
  61. </if>
  62. <if test="staffId != null and staffId != ''">
  63. AND staff_id = #{staffId}
  64. </if>
  65. <if test="cusId != null and cusId != ''">
  66. AND cus_id = #{cusId}
  67. </if>
  68. <if test="supId != null and supId != ''">
  69. AND sup_id = #{supId}
  70. </if>
  71. <if test="outStatus != null and outStatus != ''">
  72. AND out_status = #{outStatus}
  73. </if>
  74. <if test="outingQty != null">
  75. AND outing_qty = #{outingQty}
  76. </if>
  77. <if test="outingAmt != null">
  78. AND outing_amt = #{outingAmt}
  79. </if>
  80. <if test="outQty != null">
  81. AND out_qty = #{outQty}
  82. </if>
  83. <if test="outAmt != null">
  84. AND out_amt = #{outAmt}
  85. </if>
  86. <if test="returnQty != null">
  87. AND return_qty = #{returnQty}
  88. </if>
  89. <if test="returnAmt != null">
  90. AND return_amt = #{returnAmt}
  91. </if>
  92. <if test="outDate != null">
  93. AND out_date = #{outDate}
  94. </if>
  95. <if test="remarks != null and remarks != ''">
  96. AND remarks = #{remarks}
  97. </if>
  98. <if test="annexPaths != null and annexPaths != ''">
  99. AND annex_paths = #{annexPaths}
  100. </if>
  101. <if test="makeStaff != null and makeStaff != ''">
  102. AND make_staff = #{makeStaff}
  103. </if>
  104. <if test="makeTime != null">
  105. AND make_time = #{makeTime}
  106. </if>
  107. <if test="receivableId != null and receivableId != ''">
  108. AND receivable_id = #{receivableId}
  109. </if>
  110. <if test="payableId != null and payableId != ''">
  111. AND payable_id = #{payableId}
  112. </if>
  113. <if test="flgValid != null">
  114. AND flg_valid = #{flgValid}
  115. </if>
  116. <if test="cpId != null">
  117. AND cp_id = #{cpId}
  118. </if>
  119. <if test="opCreateTime != null">
  120. AND op_create_time = #{opCreateTime}
  121. </if>
  122. <if test="opCreateUserId != null and opCreateUserId != ''">
  123. AND op_create_user_id = #{opCreateUserId}
  124. </if>
  125. <if test="opUpdateTime != null">
  126. AND op_update_time = #{opUpdateTime}
  127. </if>
  128. <if test="opUpdateUserId != null and opUpdateUserId != ''">
  129. AND op_update_user_id = #{opUpdateUserId}
  130. </if>
  131. <if test="opAppCode != null and opAppCode != ''">
  132. AND op_app_code = #{opAppCode}
  133. </if>
  134. <if test="opTimestamp != null">
  135. AND op_timestamp = #{opTimestamp}
  136. </if>
  137. <if test="opDbUser != null and opDbUser != ''">
  138. AND op_db_user = #{opDbUser}
  139. </if>
  140. </where>
  141. </sql>
  142. <sql id="idsForeach">
  143. <!-- 根据主键outId批量操作 -->
  144. WHERE out_id in
  145. <foreach collection="ids" index="index" item="item" separator="," open="(" close=")">
  146. #{item}
  147. </foreach>
  148. </sql>
  149. <!-- 查询表t_psi_outbound,(条件查询+分页)列表 -->
  150. <select id="selectByCond" resultMap="BaseResultMap">
  151. SELECT
  152. <include refid="Base_Column_List"/>
  153. FROM t_psi_outbound
  154. <include refid="Condition"/>
  155. <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
  156. limit #{end} offset #{start}
  157. </if>
  158. </select>
  159. <!-- 查询表t_psi_outbound,(条件查询)个数 -->
  160. <select id="countByCond" resultType="Long">
  161. SELECT
  162. count(1)
  163. FROM t_psi_outbound
  164. <include refid="Condition"/>
  165. </select>
  166. <!-- 根据主键查询表t_psi_outbound的一行数据 -->
  167. <select id="selectById" resultMap="BaseResultMap">
  168. SELECT
  169. <include refid="Base_Column_List"/>
  170. FROM t_psi_outbound
  171. WHERE out_id = #{outId}::uuid
  172. </select>
  173. <!-- 根据主键锁定表t_psi_outbound的一行数据 -->
  174. <select id="selectByIdForUpdate" resultMap="BaseResultMap">
  175. SELECT
  176. <include refid="Base_Column_List"/>
  177. FROM t_psi_outbound
  178. WHERE out_id = #{outId}
  179. for update
  180. </select>
  181. <!-- 根据主键锁定表t_psi_outbound的多行数据 -->
  182. <select id="selectByIdsForUpdate" resultMap="BaseResultMap">
  183. SELECT
  184. <include refid="Base_Column_List"/>
  185. FROM t_psi_outbound
  186. <include refid="idsForeach"/>
  187. for update
  188. </select>
  189. <insert id="insertBatch">
  190. insert into t_psi_outbound
  191. (
  192. <trim suffixOverrides=",">
  193. out_no,
  194. out_type,
  195. from_id,
  196. from_no,
  197. org_id,
  198. staff_id,
  199. order_id,
  200. order_no,
  201. into_return_id,
  202. into_return_no,
  203. cus_id,
  204. sup_id,
  205. out_status,
  206. outing_qty,
  207. outing_amt,
  208. out_qty,
  209. out_amt,
  210. return_qty,
  211. return_amt,
  212. out_date,
  213. remarks,
  214. annex_paths,
  215. make_staff,
  216. make_time,
  217. receivable_id,
  218. payable_id,
  219. cp_id,
  220. op_app_code,
  221. </trim>
  222. )
  223. values
  224. <foreach collection="list" index="index" item="item" separator=",">
  225. (
  226. <trim suffixOverrides=",">
  227. #{item.outNo},
  228. #{item.outType},
  229. #{item.fromId}::uuid,
  230. #{item.fromNo},
  231. #{item.orgId}::uuid,
  232. #{item.staffId}::uuid,
  233. #{item.cusId}::uuid,
  234. #{item.supId}::uuid,
  235. #{item.outStatus},
  236. #{item.outingQty},
  237. #{item.outingAmt},
  238. #{item.outQty},
  239. #{item.outAmt},
  240. #{item.returnQty},
  241. #{item.returnAmt},
  242. #{item.outDate},
  243. #{item.remarks},
  244. #{item.annexPaths},
  245. #{item.makeStaff}::uuid,
  246. #{item.makeTime},
  247. #{item.receivableId}::uuid,
  248. #{item.payableId}::uuid,
  249. #{item.cpId},
  250. #{item.opAppCode},
  251. </trim>
  252. )
  253. </foreach>
  254. </insert>
  255. </mapper>