#
luxiaotao1123
2021-03-26 186505641e95a73bac6cf3ddfe640acb3d06de6d
src/main/resources/mapper/PriorMapper.xml
@@ -24,23 +24,62 @@
    </resultMap>
    <sql id="pageCondition">
        <if test="loc_no != null and loc_no != ''">
            and mld.loc_no like concat('%',#{loc_no},'%')
        </if>
        <if test="matnr != null and matnr != ''">
            and mld.matnr like concat('%',#{matnr},'%')
        </if>
        <if test="maktx != null and maktx != ''">
            and mld.maktx like concat('%',#{maktx},'%')
        </if>
        <if test="startTime!=null and endTime!=null">
            and mld.update_time between #{startTime} and #{endTime}
        </if>
    </sql>
    <select id="selectSafeStoPage" resultType="zy.cloud.wms.manager.entity.SafeStoDo">
        select * from
        (
            select
            ROW_NUMBER() over (order by mp.create_time desc) as row,
            mp.node_id,
            mp.matnr,
            mp.safe_qua,
            ls.amount,
            (cast(round((ls.amount/(mp.safe_qua*1.0))*100,2) as varchar)+'%') as pe
            from man_prior mp
            inner join
            (
                select
                node_id,
                matnr,
                sum(anfme) as amount
                from man_loc_detl
                group by node_id, matnr
            ) as ls on ls.node_id = mp.node_id and ls.matnr = mp.matnr
            where 1=1
            <include refid="pageCondition"></include>
       ) t where t.row between ((#{pageNumber}-1)*#{pageSize}+1) and (#{pageNumber}*#{pageSize})
    </select>
    <select id="selectSafeStoPageCount" resultType="java.lang.Integer">
        select
        mp.node_id,
        mp.matnr,
        mp.safe_qua,
        ls.amount,
        (cast(round((ls.amount/(mp.safe_qua*1.0))*100,2) as varchar)+'%') as pe
        count(1) as count
        from man_prior mp
        inner join
        (
            select
            node_id,
            matnr,
            sum(anfme) as amount
            from man_loc_detl
            group by node_id, matnr
        select
        node_id,
        matnr,
        sum(anfme) as amount
        from man_loc_detl
        group by node_id, matnr
        ) as ls on ls.node_id = mp.node_id and ls.matnr = mp.matnr
        where 1=1
        <include refid="pageCondition"></include>
    </select>
</mapper>