FreezeItemMapper.xml 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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.FreezeItemMapper">
  4. <!-- 通用设置 -->
  5. <!-- 通用查询列 -->
  6. <sql id="Base_Column_List">
  7. item_id, freeze_id, item_index, sku_id, freeze_qty, unfreeze_qty, surplus_qty, remarks, inv_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.FreezeItemResponse">
  11. <id column="item_id" property="itemId"/>
  12. <result column="freeze_id" property="freezeId" typeHandler="UuidTypeHandler"/>
  13. <result column="item_index" property="itemIndex"/>
  14. <result column="sku_id" property="skuId" typeHandler="UuidTypeHandler"/>
  15. <result column="freeze_qty" property="freezeQty"/>
  16. <result column="unfreeze_qty" property="unfreezeQty"/>
  17. <result column="surplus_qty" property="surplusQty"/>
  18. <result column="remarks" property="remarks"/>
  19. <result column="inv_id" property="invId" typeHandler="UuidTypeHandler"/>
  20. <result column="flg_valid" property="flgValid"/>
  21. <result column="cp_id" property="cpId"/>
  22. <result column="op_create_time" property="opCreateTime" typeHandler="TimestampTypeHandler"/>
  23. <result column="op_create_user_id" property="opCreateUserId" typeHandler="UuidTypeHandler"/>
  24. <result column="op_update_time" property="opUpdateTime" typeHandler="TimestampTypeHandler"/>
  25. <result column="op_update_user_id" property="opUpdateUserId" typeHandler="UuidTypeHandler"/>
  26. <result column="op_app_code" property="opAppCode"/>
  27. <result column="op_timestamp" property="opTimestamp" typeHandler="TimestampTypeHandler"/>
  28. <result column="op_db_user" property="opDbUser"/>
  29. </resultMap>
  30. <!-- 通用条件列 -->
  31. <sql id="Condition">
  32. <where>
  33. <if test="freezeId != null and freezeId != ''">
  34. AND freeze_id = #{freezeId}
  35. </if>
  36. <if test="itemIndex != null">
  37. AND item_index = #{itemIndex}
  38. </if>
  39. <if test="skuId != null and skuId != ''">
  40. AND sku_id = #{skuId}
  41. </if>
  42. <if test="freezeQty != null">
  43. AND freeze_qty = #{freezeQty}
  44. </if>
  45. <if test="unfreezeQty != null">
  46. AND unfreeze_qty = #{unfreezeQty}
  47. </if>
  48. <if test="surplusQty != null">
  49. AND surplus_qty = #{surplusQty}
  50. </if>
  51. <if test="remarks != null and remarks != ''">
  52. AND remarks = #{remarks}
  53. </if>
  54. <if test="invId != null and invId != ''">
  55. AND inv_id = #{invId}
  56. </if>
  57. <if test="flgValid != null">
  58. AND flg_valid = #{flgValid}
  59. </if>
  60. <if test="cpId != null">
  61. AND cp_id = #{cpId}
  62. </if>
  63. <if test="opCreateTime != null">
  64. AND op_create_time = #{opCreateTime}
  65. </if>
  66. <if test="opCreateUserId != null and opCreateUserId != ''">
  67. AND op_create_user_id = #{opCreateUserId}
  68. </if>
  69. <if test="opUpdateTime != null">
  70. AND op_update_time = #{opUpdateTime}
  71. </if>
  72. <if test="opUpdateUserId != null and opUpdateUserId != ''">
  73. AND op_update_user_id = #{opUpdateUserId}
  74. </if>
  75. <if test="opAppCode != null and opAppCode != ''">
  76. AND op_app_code = #{opAppCode}
  77. </if>
  78. <if test="opTimestamp != null">
  79. AND op_timestamp = #{opTimestamp}
  80. </if>
  81. <if test="opDbUser != null and opDbUser != ''">
  82. AND op_db_user = #{opDbUser}
  83. </if>
  84. </where>
  85. </sql>
  86. <!-- 查询表t_psi_freeze_item,(条件查询+分页)列表 -->
  87. <select id="selectByCond" resultMap="BaseResultMap">
  88. SELECT
  89. <include refid="Base_Column_List"/>
  90. FROM dkic_b.t_psi_freeze_item
  91. <include refid="Condition"/>
  92. <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
  93. limit #{end} offset #{start}
  94. </if>
  95. </select>
  96. <!-- 查询表t_psi_freeze_item,(条件查询)个数 -->
  97. <select id="countByCond" resultType="Long">
  98. SELECT
  99. count(1)
  100. FROM dkic_b.t_psi_freeze_item
  101. <include refid="Condition"/>
  102. </select>
  103. <!-- 根据主键查询表t_psi_freeze_item的一行数据 -->
  104. <select id="selectById" resultMap="BaseResultMap">
  105. SELECT
  106. <include refid="Base_Column_List"/>
  107. FROM dkic_b.t_psi_freeze_item
  108. WHERE item_id = #{itemId}::uuid
  109. </select>
  110. <!-- 根据商品ID和仓库ID查询库存信息-->
  111. <select id="selectInvById" resultMap="BaseResultMap">
  112. SELECT
  113. inv.inv_qty,inv.freeze_qty,inv.usable_qty,inv.outing_qty
  114. FROM dkic_b.t_psi_inventory AS inv
  115. WHERE inv.inv_id=#{invId}
  116. for update
  117. </select>
  118. </mapper>