查询物料库存数量;

This commit is contained in:
王奎兴
2026-04-08 15:57:47 +08:00
parent bf9b441fbc
commit d9e3b7cf2a
2 changed files with 46 additions and 40 deletions
@@ -242,5 +242,7 @@ public class MaterialBaseInfoPO extends BaseVOEntity {
@ApiModelProperty("临期预警数量") @ApiModelProperty("临期预警数量")
@Excel(name = "临期预警数量") @Excel(name = "临期预警数量")
private Integer expirationWarningCount; private Integer expirationWarningCount;
//库存件数
private BigDecimal stockQuantity;
} }
@@ -60,7 +60,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<sql id="selectMaterialBaseInfoPo"> <sql id="selectMaterialBaseInfoPo">
select material_base_info_id, organization_id, organization_name, top_organization_id, shipper_id, shipper_code, shipper_name, material_code, material_name, bar_code, material_classify_code, material_classify_name, material_type, material_type_name, pack_id, pack_code, pack_name, unit_code, unit_name, brand_id, brand_code, brand_name, shelf_life, weight_limit, volume_limit, material_shape, material_shape_name, material_size, material_length, material_width, material_height, remark, nullify, create_time, create_by, create_by_name, update_time, update_by, update_by_name, del_flag, common, sku_code, unit_price, currency, origin_country, hs_code, declaration_unit, statutory_unit, statutory_second_unit, specification_model as specification_model from material_base_info select a.material_base_info_id, a.organization_id, a.organization_name, a.top_organization_id, a.shipper_id, a.shipper_code, a.shipper_name, a.material_code, a.material_name, a.bar_code, a.material_classify_code,
material_classify_name, a.material_type, a.material_type_name, a.pack_id, a.pack_code, a.pack_name, a.unit_code, a.unit_name, a.brand_id, a.brand_code, a.brand_name, a.shelf_life, a.weight_limit, a.volume_limit, a.material_shape,
material_shape_name, a.material_size, a.material_length, a.material_width, a.material_height, a.remark, a.nullify, a.create_time, a.create_by, a.create_by_name, a.update_time, a.update_by, a.update_by_name, a.del_flag, a.common,
sku_code, a.unit_price, a.currency, a.origin_country, a.hs_code, a.declaration_unit, a.statutory_unit, a.statutory_second_unit,
specification_model as specification_model,sum(b.INVENTORY_QUANTITY) as inventoryQuantity from material_base_info a left join MATERIAL_INVENTORY b on a.material_base_info_id = b.material_base_info_id
</sql> </sql>
<sql id="JoinMaterialBaseInfoPo"> <sql id="JoinMaterialBaseInfoPo">
@@ -84,114 +88,114 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<sql id="selectMaterialBaseInfoPo1"> <sql id="selectMaterialBaseInfoPo1">
<where> <where>
<if test="organizationId != null "> <if test="organizationId != null ">
and organization_id = #{organizationId} and a.organization_id = #{organizationId}
</if> </if>
<if test="materialBaseInfoId != null and materialBaseInfoId != ''"> <if test="materialBaseInfoId != null and materialBaseInfoId != ''">
and material_base_info_id = #{materialBaseInfoId} and a.material_base_info_id = #{materialBaseInfoId}
</if> </if>
<if test="organizationName != null and organizationName != ''"> <if test="organizationName != null and organizationName != ''">
and organization_name like concat('%', #{organizationName}, '%') and a.organization_name like concat('%', #{organizationName}, '%')
</if> </if>
<if test="topOrganizationId != null "> <if test="topOrganizationId != null ">
and top_organization_id = #{topOrganizationId} and a.top_organization_id = #{topOrganizationId}
</if> </if>
<if test="shipperId != null "> <if test="shipperId != null ">
and shipper_id = #{shipperId} and a.shipper_id = #{shipperId}
</if> </if>
<if test="shipperCode != null and shipperCode != ''"> <if test="shipperCode != null and shipperCode != ''">
and shipper_code like concat('%', #{shipperCode}, '%') and a.shipper_code like concat('%', #{shipperCode}, '%')
</if> </if>
<if test="shipperName != null and shipperName != ''"> <if test="shipperName != null and shipperName != ''">
and shipper_name like concat('%', #{shipperName}, '%') and a.shipper_name like concat('%', #{shipperName}, '%')
</if> </if>
<if test="materialCode != null and materialCode != ''"> <if test="materialCode != null and materialCode != ''">
and material_code like concat('%', #{materialCode}, '%') and a.material_code like concat('%', #{materialCode}, '%')
</if> </if>
<if test="materialName != null and materialName != ''"> <if test="materialName != null and materialName != ''">
and material_name like concat('%', #{materialName}, '%') and a.material_name like concat('%', #{materialName}, '%')
</if> </if>
<if test="unitName != null and unitName != ''"> <if test="unitName != null and unitName != ''">
and unit_name like concat('%', #{unitName}, '%') and a.unit_name like concat('%', #{unitName}, '%')
</if> </if>
<if test="barCode != null and barCode != ''"> <if test="barCode != null and barCode != ''">
and bar_code like concat('%',#{barCode},'%') and a.bar_code like concat('%',#{barCode},'%')
</if> </if>
<if test="materialClassifyCode != null and materialClassifyCode.size() > 0"> <if test="materialClassifyCode != null and materialClassifyCode.size() > 0">
<foreach collection="materialClassifyCode" item="code" open="and (" separator="or" close=")"> <foreach collection="materialClassifyCode" item="code" open="and (" separator="or" close=")">
FIND_IN_SET(#{code}, material_classify_code) > 0 FIND_IN_SET(#{code}, a.material_classify_code) > 0
</foreach> </foreach>
</if> </if>
<if test="materialClassifyName != null and materialClassifyName.size() > 0"> <if test="materialClassifyName != null and materialClassifyName.size() > 0">
<foreach collection="materialClassifyName" item="name" open="and (" separator="or" close=")"> <foreach collection="materialClassifyName" item="name" open="and (" separator="or" close=")">
material_classify_name like concat('%', #{name}, '%') a.material_classify_name like concat('%', #{name}, '%')
</foreach> </foreach>
</if> </if>
<if test="materialType != null and materialType != ''"> <if test="materialType != null and materialType != ''">
and material_type = #{materialType} and a.material_type = #{materialType}
</if> </if>
<if test="materialTypeName != null and materialTypeName != ''"> <if test="materialTypeName != null and materialTypeName != ''">
and material_type_name like concat('%', #{materialTypeName}, '%') and a.material_type_name like concat('%', #{materialTypeName}, '%')
</if> </if>
<if test="packId != null "> <if test="packId != null ">
and pack_id = #{packId} and a.pack_id = #{packId}
</if> </if>
<if test="packCode != null and packCode != ''"> <if test="packCode != null and packCode != ''">
and pack_code = #{packCode} and a.pack_code = #{packCode}
</if> </if>
<if test="packName != null and packName != ''"> <if test="packName != null and packName != ''">
and pack_name like concat('%', #{packName}, '%') and a.pack_name like concat('%', #{packName}, '%')
</if> </if>
<if test="brandId != null "> <if test="brandId != null ">
and brand_id = #{brandId} and a.brand_id = #{brandId}
</if> </if>
<if test="brandCode != null and brandCode != ''"> <if test="brandCode != null and brandCode != ''">
and brand_code = #{brandCode} and a.brand_code = #{brandCode}
</if> </if>
<if test="brandName != null and brandName != ''"> <if test="brandName != null and brandName != ''">
and brand_name like concat('%', #{brandName}, '%') and a.brand_name like concat('%', #{brandName}, '%')
</if> </if>
<if test="shelfLife != null "> <if test="shelfLife != null ">
and shelf_life = #{shelfLife} and a.shelf_life = #{shelfLife}
</if> </if>
<if test="weightLimit != null "> <if test="weightLimit != null ">
and weight_limit = #{weightLimit} and a.weight_limit = #{weightLimit}
</if> </if>
<if test="volumeLimit != null "> <if test="volumeLimit != null ">
and volume_limit = #{volumeLimit} and a.volume_limit = #{volumeLimit}
</if> </if>
<if test="materialShape != null and materialShape != ''"> <if test="materialShape != null and materialShape != ''">
and material_shape = #{materialShape} and a.material_shape = #{materialShape}
</if> </if>
<if test="materialShapeName != null and materialShapeName != ''"> <if test="materialShapeName != null and materialShapeName != ''">
and material_shape_name like concat('%', #{materialShapeName}, '%') and a.material_shape_name like concat('%', #{materialShapeName}, '%')
</if> </if>
<if test="materialSize != null and materialSize != ''"> <if test="materialSize != null and materialSize != ''">
and material_size = #{materialSize} and a.material_size = #{materialSize}
</if> </if>
<if test="materialLength != null "> <if test="materialLength != null ">
and material_length = #{materialLength} and a.material_length = #{materialLength}
</if> </if>
<if test="materialWidth != null "> <if test="materialWidth != null ">
and material_width = #{materialWidth} and a.material_width = #{materialWidth}
</if> </if>
<if test="materialHeight != null "> <if test="materialHeight != null ">
and material_height = #{materialHeight} and a.material_height = #{materialHeight}
</if> </if>
<if test="nullify != null "> <if test="nullify != null ">
and nullify = #{nullify} and a.nullify = #{nullify}
</if> </if>
<if test="createByName != null and createByName != ''"> <if test="createByName != null and createByName != ''">
and create_by_name like concat('%', #{createByName}, '%') and a.create_by_name like concat('%', #{createByName}, '%')
</if> </if>
<if test="updateByName != null and updateByName != ''"> <if test="updateByName != null and updateByName != ''">
and update_by_name like concat('%', #{updateByName}, '%') and a.update_by_name like concat('%', #{updateByName}, '%')
</if> </if>
<if test="compoundOrQuery != null and compoundOrQuery != ''"> <if test="compoundOrQuery != null and compoundOrQuery != ''">
and ( instr(material_name, #{compoundOrQuery}) > 0 and ( instr(a.material_name, #{compoundOrQuery}) > 0
or or
instr(material_code, #{compoundOrQuery}) > 0 instr(a.material_code, #{compoundOrQuery}) > 0
or or
instr(bar_code, #{compoundOrQuery}) > 0 instr(a.bar_code, #{compoundOrQuery}) > 0
) )
</if> </if>
<if test="batchId != null"> <if test="batchId != null">
@@ -210,8 +214,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
or common = 1 )</otherwise> or common = 1 )</otherwise>
</choose> </choose>
<choose> <choose>
<when test="delFlag != null"> and del_flag = #{delFlag} </when> <when test="delFlag != null"> and a.del_flag = #{delFlag} </when>
<otherwise> and del_flag = 1 </otherwise> <otherwise> and a.del_flag = 1 </otherwise>
</choose> </choose>
</where> </where>
</sql> </sql>