自动化立体仓库 - WMS系统
1
zhang
2025-11-18 9609e2b096fac01efaa56958042b4175bbc25d5b
src/main/resources/mapper/ViewStockUseMapper.xml
@@ -2,7 +2,16 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zy.asrs.mapper.ReportQueryMapper">
   <resultMap id="ViewStockUseMap" type="com.zy.asrs.entity.ViewStockUseBean">
      <result property="row1" column="row1"/>
      <result property="total_qty" column="total_qty"/>
      <result property="full_qty" column="full_qty"/>
      <result property="null_qty" column="null_qty"/>
      <result property="forbid_qty" column="forbid_qty"/>
      <result property="empty_qty" column="empty_qty"/>
      <result property="full_rate" column="full_rate"/>
      <result property="occ_rate" column="occ_rate"/>
   </resultMap>
<!-- mapper不支持sql语句嵌套时,采用sql片段包含方式,解决xml标签问题 -->
<sql id="viewStockUseConditionSql">   
      <if test="row1!=null and row1!='' ">
@@ -11,7 +20,7 @@
</sql>
<!-- 分页查询所有信息 -->
<select id="queryViewStockUseList" parameterType="com.zy.asrs.entity.ViewStockUseBean" resultType="com.zy.asrs.entity.ViewStockUseBean">
<select id="queryViewStockUseList" parameterType="com.zy.asrs.entity.ViewStockUseBean" resultMap="ViewStockUseMap">
select top (#{pageSize}) * from asr_stk_use_view 
<where>
   row1 not in (select top ((#{pageNumber}-1)*#{pageSize}) row1 from asr_stk_use_view 
@@ -50,5 +59,67 @@
   ]]>
</where>
</select>
    <select id="selectWorkCountIn" resultType="com.zy.asrs.entity.ViewWorkCountInView">
      SELECT *
      FROM (
      select
         ROW_NUMBER() OVER(Order by a.oneday desc) as row
      , *
      FROM(
      SELECT * FROM asr_wrkin_count_view
               WHERE
               1 = 1 AND
               (oneday > #{start}
               AND
            oneday &lt; #{end})
               <if test="matnr != null and matnr !=''">
                and matnr = #{matnr}
             </if>
              ) a ) b
      WHERE 1=1 and b.row between ((#{curr}-1)*#{limit}+1) and (#{curr}*#{limit})
   </select>
   <select id="selectWorkCountInTotal" resultType="java.lang.Integer">
      SELECT COUNT(*) FROM asr_wrkin_count_view
      WHERE 1= 1 AND
      (oneday > #{start}
      AND
      oneday &lt; #{end})
      <if test="matnr != null and matnr !='' ">
         and matnr = #{matnr}
      </if>
   </select>
   <select id="selectWorkCountOut" resultType="com.zy.asrs.entity.ViewWorkCountInView">
      SELECT *
      FROM (
             select
                ROW_NUMBER() OVER(Order by a.oneday desc) as row
      , *
             FROM(
                   SELECT * FROM asr_wrkout_count_view
      WHERE
      1 = 1 AND
      (oneday > #{start}
      AND
      oneday &lt; #{end})
      <if test="matnr != null and matnr !=''">
         and matnr = #{matnr}
      </if>
      ) a ) b
      WHERE 1=1 and b.row between ((#{curr}-1)*#{limit}+1) and (#{curr}*#{limit})
   </select>
   <select id="selectWorkCountOutTotal" resultType="java.lang.Integer">
      SELECT COUNT(*) FROM asr_wrkout_count_view
      WHERE 1= 1 AND
      (oneday > #{start}
      AND
      oneday &lt; #{end})
      <if test="matnr != null and matnr !='' ">
         and matnr = #{matnr}
      </if>
   </select>
</mapper>