2025-07-18 10:12:48 +08:00
|
|
|
|
<?xml version="1.0" encoding="UTF-8" ?>
|
|
|
|
|
|
<!DOCTYPE mapper
|
|
|
|
|
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
|
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
|
|
|
<mapper namespace="com.klp.mapper.WmsStockMapper">
|
|
|
|
|
|
|
|
|
|
|
|
<resultMap type="com.klp.domain.WmsStock" id="WmsStockResult">
|
|
|
|
|
|
<result property="stockId" column="stock_id"/>
|
|
|
|
|
|
<result property="warehouseId" column="warehouse_id"/>
|
|
|
|
|
|
<result property="itemType" column="item_type"/>
|
|
|
|
|
|
<result property="itemId" column="item_id"/>
|
|
|
|
|
|
<result property="quantity" column="quantity"/>
|
|
|
|
|
|
<result property="unit" column="unit"/>
|
|
|
|
|
|
<result property="batchNo" column="batch_no"/>
|
|
|
|
|
|
<result property="remark" column="remark"/>
|
|
|
|
|
|
<result property="delFlag" column="del_flag"/>
|
|
|
|
|
|
<result property="createTime" column="create_time"/>
|
|
|
|
|
|
<result property="createBy" column="create_by"/>
|
|
|
|
|
|
<result property="updateTime" column="update_time"/>
|
|
|
|
|
|
<result property="updateBy" column="update_by"/>
|
|
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
2025-07-18 17:23:51 +08:00
|
|
|
|
<select id="getStockByItemId" resultType="java.math.BigDecimal">
|
|
|
|
|
|
select sum(quantity) as quantity from wms_stock
|
|
|
|
|
|
where item_id = #{rawMaterialId} and item_type = 'raw_material' and del_flag = 0
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
2025-07-19 17:53:28 +08:00
|
|
|
|
<!-- 分页联查物品名称和编码,支持Wrapper动态条件,返回Page<WmsStockVo> -->
|
|
|
|
|
|
<select id="selectVoPagePlus" resultType="com.klp.domain.vo.WmsStockVo">
|
|
|
|
|
|
SELECT
|
2025-07-19 18:02:29 +08:00
|
|
|
|
s.*,
|
2025-08-01 17:04:32 +08:00
|
|
|
|
w.warehouse_name,
|
2025-07-19 18:02:29 +08:00
|
|
|
|
CASE
|
2025-07-19 17:53:28 +08:00
|
|
|
|
WHEN s.item_type = 'product' THEN p.product_name
|
|
|
|
|
|
WHEN s.item_type = 'raw_material' THEN r.raw_material_name
|
|
|
|
|
|
ELSE NULL
|
|
|
|
|
|
END AS itemName,
|
2025-07-19 18:02:29 +08:00
|
|
|
|
CASE
|
2025-07-19 17:53:28 +08:00
|
|
|
|
WHEN s.item_type = 'product' THEN p.product_code
|
|
|
|
|
|
WHEN s.item_type = 'raw_material' THEN r.raw_material_code
|
|
|
|
|
|
ELSE NULL
|
|
|
|
|
|
END AS itemCode
|
|
|
|
|
|
FROM wms_stock s
|
|
|
|
|
|
LEFT JOIN wms_product p ON s.item_type = 'product' AND s.item_id = p.product_id
|
|
|
|
|
|
LEFT JOIN wms_raw_material r ON s.item_type = 'raw_material' AND s.item_id = r.raw_material_id
|
2025-08-01 17:04:32 +08:00
|
|
|
|
left join wms_warehouse w on s.warehouse_id = w.warehouse_id
|
2025-07-19 17:53:28 +08:00
|
|
|
|
${ew.customSqlSegment}
|
|
|
|
|
|
</select>
|
2025-07-18 10:12:48 +08:00
|
|
|
|
|
|
|
|
|
|
</mapper>
|