自动化立体仓库 - WMS系统
李天宇
2024-10-25 c560649e37ab5a5bc29c47a3fa7309dc912b48cb
src/main/resources/mapper/LocDetlMapper.xml
@@ -138,29 +138,45 @@
    <select id="getStockStatis" resultType="com.zy.asrs.entity.LocDetl">
        select * from
        (
            select
            ROW_NUMBER() over (order by sum(a.anfme) desc) as row
            , a.matnr
            , sum(a.anfme) as anfme
            from asr_loc_detl a
            where 1=1
            <include refid="stockOutCondition"></include>
            group by a.matnr
         ) t where t.row between ((#{pageNumber}-1)*#{pageSize}+1) and (#{pageNumber}*#{pageSize})
        select
        ROW_NUMBER() over (order by sum(a.anfme) desc) as row
        , a.matnr
        , sum(a.anfme) as anfme
        from asr_loc_detl a
        where 1=1
        <!-- 动态添加规格和类型的条件 -->
        <if test="specs != null and specs != ''">
            AND a.specs = #{specs}
        </if>
        <if test="brand != null and brand != ''">
            AND a.brand = #{brand}
        </if>
        <include refid="stockOutCondition"></include>
        group by a.matnr
        ) t where t.row between ((#{pageNumber}-1)*#{pageSize}+1) and (#{pageNumber}*#{pageSize})
    </select>
    <select id="getStockStatisCount" parameterType="java.util.Map" resultType="java.lang.Integer">
     select count(1) as count from
        select count(1) as count from
        (
        select
        a.matnr
        from asr_loc_detl a
        where 1=1
        <!-- 动态添加规格和类型的条件 -->
        <if test="specs != null and specs != ''">
            AND a.specs = #{specs}
        </if>
        <if test="brand != null and brand != ''">
            AND a.brand = #{brand}
        </if>
        <include refid="stockOutCondition"></include>
        group by a.matnr
     ) b
        ) b
    </select>
    <select id="getStockStatisExcel" resultType="com.zy.asrs.entity.LocDetl">
        select
        ROW_NUMBER() over (order by sum(a.anfme) desc) as row