FreezeMapper.xml 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  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.FreezeMapper">
  4. <!-- 通用设置 -->
  5. <!-- 通用查询列 -->
  6. <sql id="Base_Column_List">
  7. freeze_id, freeze_no, cus_id, org_id, staff_id, freeze_status, freeze_date, auto_unfreeze_date, sum_quantity, 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,annex_paths
  8. </sql>
  9. <!-- 冻结一览查询列 -->
  10. <sql id="Base_Column_List_Respons">
  11. fre.freeze_id,fre.freeze_no,fre.cus_id,fre.org_id,fre.staff_id,fre.freeze_status
  12. ,sys.f_get_name_i18n(tdk.kind_name_i18n, #{i18n} ) AS "freezeStatusName"
  13. ,fre.freeze_date,fre.auto_unfreeze_date ,fre.sum_quantity, fre.remarks, fre.make_staff
  14. , fre.make_time, fre.flg_valid,fre.cp_id,cus.cus_phone
  15. ,cus.cus_name,staff.staff_name,org.org_name,mstaff.staff_name AS "makeStaffName"
  16. ,fre.annex_paths
  17. </sql>
  18. <!-- 通用查询映射结果 -->
  19. <resultMap id="BaseResultMapResponse" type="com.dk.mdm.model.response.ivt.FreezeResponse">
  20. <id column="freeze_id" property="freezeId"/>
  21. <result column="freeze_no" property="freezeNo"/>
  22. <result column="cus_id" property="cusId" typeHandler="UuidTypeHandler"/>
  23. <result column="org_id" property="orgId" typeHandler="UuidTypeHandler"/>
  24. <result column="staff_id" property="staffId" typeHandler="UuidTypeHandler"/>
  25. <result column="freeze_status" property="freezeStatus"/>
  26. <result column="freeze_date" property="freezeDate" typeHandler="TimestampTypeHandler"/>
  27. <result column="auto_unfreeze_date" property="autoUnfreezeDate" typeHandler="TimestampTypeHandler"/>
  28. <result column="sum_quantity" property="sumQuantity"/>
  29. <result column="remarks" property="remarks"/>
  30. <result column="make_staff" property="makeStaff" typeHandler="UuidTypeHandler"/>
  31. <result column="make_time" property="makeTime" typeHandler="TimestampTypeHandler"/>
  32. <result column="flg_valid" property="flgValid"/>
  33. <result column="cp_id" property="cpId"/>
  34. <result column="op_create_time" property="opCreateTime" typeHandler="TimestampTypeHandler"/>
  35. <result column="op_create_user_id" property="opCreateUserId" typeHandler="UuidTypeHandler"/>
  36. <result column="op_update_time" property="opUpdateTime" typeHandler="TimestampTypeHandler"/>
  37. <result column="op_update_user_id" property="opUpdateUserId" typeHandler="UuidTypeHandler"/>
  38. <result column="op_app_code" property="opAppCode"/>
  39. <result column="annex_paths" property="annexPaths" typeHandler="JsonTypeHandler"/>
  40. <result column="op_timestamp" property="opTimestamp" typeHandler="TimestampTypeHandler"/>
  41. <result column="op_db_user" property="opDbUser"/>
  42. </resultMap>
  43. <!-- 通用查询映射结果 -->
  44. <resultMap id="BaseResultMap" type="com.dk.mdm.model.pojo.ivt.Freeze">
  45. <id column="freeze_id" property="freezeId"/>
  46. <result column="freeze_no" property="freezeNo"/>
  47. <result column="cus_id" property="cusId" typeHandler="UuidTypeHandler"/>
  48. <result column="org_id" property="orgId" typeHandler="UuidTypeHandler"/>
  49. <result column="staff_id" property="staffId" typeHandler="UuidTypeHandler"/>
  50. <result column="freeze_status" property="freezeStatus"/>
  51. <result column="freeze_date" property="freezeDate" typeHandler="TimestampTypeHandler"/>
  52. <result column="auto_unfreeze_date" property="autoUnfreezeDate" typeHandler="TimestampTypeHandler"/>
  53. <result column="sum_quantity" property="sumQuantity"/>
  54. <result column="remarks" property="remarks"/>
  55. <result column="make_staff" property="makeStaff" typeHandler="UuidTypeHandler"/>
  56. <result column="make_time" property="makeTime" typeHandler="TimestampTypeHandler"/>
  57. <result column="flg_valid" property="flgValid"/>
  58. <result column="cp_id" property="cpId"/>
  59. <result column="op_create_time" property="opCreateTime" typeHandler="TimestampTypeHandler"/>
  60. <result column="op_create_user_id" property="opCreateUserId" typeHandler="UuidTypeHandler"/>
  61. <result column="op_update_time" property="opUpdateTime" typeHandler="TimestampTypeHandler"/>
  62. <result column="op_update_user_id" property="opUpdateUserId" typeHandler="UuidTypeHandler"/>
  63. <result column="annex_paths" property="annexPaths" typeHandler="JsonTypeHandler"/>
  64. <result column="op_app_code" property="opAppCode"/>
  65. <result column="op_timestamp" property="opTimestamp" typeHandler="TimestampTypeHandler"/>
  66. <result column="op_db_user" property="opDbUser"/>
  67. </resultMap>
  68. <!-- 通用条件列 -->
  69. <sql id="Condition">
  70. <where>
  71. <if test="freezeNo != null and freezeNo != ''">
  72. AND fre.freeze_no LIKE concat('%',my_ex.likequery(#{freezeNo}),'%')
  73. </if>
  74. <if test="cusId != null and cusId != ''">
  75. AND fre.cus_id = #{cusId}
  76. </if>
  77. <if test="orgId != null and orgId != ''">
  78. AND fre.org_id = #{orgId}
  79. </if>
  80. <if test="staffId != null and staffId != ''">
  81. AND fre.staff_id = #{staffId}
  82. </if>
  83. <if test="freezeStatus != null and freezeStatus != ''">
  84. AND fre.freeze_status = #{freezeStatus}
  85. </if>
  86. <if test="freezeDate != null">
  87. AND fre.freeze_date = #{freezeDate}
  88. </if>
  89. <if test="autoUnfreezeDate != null">
  90. AND fre.auto_unfreeze_date = #{autoUnfreezeDate}
  91. </if>
  92. <if test="remarks != null and remarks != ''">
  93. AND fre.remarks = #{remarks}
  94. </if>
  95. <if test="cpId != null">
  96. AND fre.cp_id = #{cpId}
  97. </if>
  98. <if test="flgValidList != null and flgValidList.size>0">
  99. AND fre.flg_valid =any(#{flgValidList, typeHandler=BooleanListTypeHandler})
  100. </if>
  101. <if test="orgIdList != null and orgIdList.size>0">
  102. AND fre.org_id = any(#{orgIdList, typeHandler=UuidListTypeHandler})
  103. </if>
  104. <if test="staffIdList != null and staffIdList.size>0">
  105. AND fre.staff_id = any(#{staffIdList, typeHandler=UuidListTypeHandler})
  106. </if>
  107. <if test="cusName != null and cusName != ''">
  108. AND cus.cus_name LIKE concat('%',my_ex.likequery(#{cusName}),'%')
  109. </if>
  110. <if test="freezeStatusList != null and freezeStatusList.size() > 0">
  111. AND fre.freeze_status = any(#{freezeStatusList, typeHandler=UuidListTypeHandler})
  112. </if>
  113. </where>
  114. </sql>
  115. <!-- 查询表t_psi_freeze,(条件查询+分页)列表 -->
  116. <select id="selectByCond" resultMap="BaseResultMapResponse">
  117. SELECT
  118. <include refid="Base_Column_List_Respons"/>
  119. FROM dkic_b.t_psi_freeze AS fre
  120. lEFT JOIN dkic_b.t_mst_customer AS cus ON cus.cus_id=fre.cus_id
  121. lEFT JOIN dkic_b.t_mst_staff AS staff ON staff.staff_id=fre.staff_id
  122. lEFT JOIN dkic_b.t_mst_org AS org ON org.org_id=fre.org_id
  123. lEFT JOIN dkic_b.t_mst_staff AS mstaff ON mstaff.staff_id=fre.make_staff
  124. LEFT JOIN sys.t_data_kind AS tdk ON tdk.kind_code = fre.freeze_status
  125. <include refid="Condition"/>
  126. <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
  127. limit #{end} offset #{start}
  128. </if>
  129. </select>
  130. <!-- 查询表t_psi_freeze,(条件查询)个数 -->
  131. <select id="countByCond" resultType="Long">
  132. SELECT
  133. count(1)
  134. FROM dkic_b.t_psi_freeze AS fre
  135. <include refid="Condition"/>
  136. </select>
  137. <!-- 根据主键查询表t_psi_freeze的一行数据 -->
  138. <select id="selectById" resultMap="BaseResultMapResponse">
  139. SELECT
  140. <include refid="Base_Column_List_Respons"/>
  141. FROM dkic_b.t_psi_freeze AS fre
  142. lEFT JOIN dkic_b.t_mst_customer AS cus ON cus.cus_id=fre.cus_id
  143. lEFT JOIN dkic_b.t_mst_staff AS staff ON staff.staff_id=fre.staff_id
  144. lEFT JOIN dkic_b.t_mst_org AS org ON org.org_id=fre.org_id
  145. lEFT JOIN dkic_b.t_mst_staff AS mstaff ON mstaff.staff_id=fre.make_staff
  146. LEFT JOIN sys.t_data_kind AS tdk ON tdk.kind_code = fre.freeze_status
  147. WHERE fre.freeze_id = #{id}::uuid
  148. </select>
  149. <!-- 根据主键锁定表t_psi_freeze的一行数据 -->
  150. <select id="selectByIdForUpdate" resultMap="BaseResultMap">
  151. SELECT
  152. <include refid="Base_Column_List"/>
  153. FROM t_psi_freeze
  154. WHERE freeze_id = #{freezeId}
  155. for update
  156. </select>
  157. </mapper>