You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
1.9 KiB
XML

<?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="org.dromara.wms.mapper.WmsInventoryMapper">
<select id="materailCount" resultType="java.math.BigDecimal"
parameterType="org.dromara.wms.domain.WmsInventory">
SELECT
ISNULL(SUM(x.inventory_qty),0)
FROM
hwmom.dbo.wms_inventory x
where
x.material_id = #{entity.materialId}
</select>
<select id="listInventoryAlarm" resultType="org.dromara.wms.domain.vo.WmsInventoryVo"
parameterType="org.dromara.wms.domain.bo.WmsInventoryBo">
SELECT
x.material_id,
SUM(x.inventory_qty) inventory_qty,
x.warehouse_id,
MAX(b.min_stock_amount) min_stock_amount,
MAX(b.max_stock_amount) max_stock_amount,
MAX(c.warehouse_code) warehouse_code,
MAX(d.material_code) material_code,
MAX(x.lock_state) lock_state,
MAX(x.inventory_status) inventory_status,
MAX(x.material_categories) material_categories,
MAX(x.location_code) locationCode,
MAX(x.batch_code) batchCode
FROM
hwmom.dbo.wms_inventory x
left join base_material_info b on
x.material_id = b.material_id
left join wms_base_warehouse c on
x.warehouse_id = c.warehouse_id
left join base_material_info d
on
x.material_id = d.material_id
<where>
<if test="entity.materialId != null ">and x.material_id = #{entity.materialId}</if>
<if test="entity.warehouseId != null and entity.warehouseId != ''">and x.warehouse_id = #{entity.warehouseId}</if>
</where>
group by
x.warehouse_id ,
x.material_id
</select>
</mapper>