自动化立体仓库 - WCS系统
*
lsh
8 天以前 787ac0c93db67a3ead8e8dd306ad631ac8dd8a56
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
<?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="com.zy.asrs.mapper.ReportQueryMapper">
 
<!-- mapper不支持sql语句嵌套时,采用sql片段包含方式,解决xml标签问题 -->
<sql id="viewStockUseConditionSql">    
        <if test="row1!=null and row1!='' ">
            and row1 like '%' + #{row1} + '%'
        </if>
</sql>
 
<!-- 分页查询所有信息 -->
<select id="queryViewStockUseList" parameterType="com.zy.asrs.entity.ViewStockUseBean" resultType="com.zy.asrs.entity.ViewStockUseBean">
select top (#{pageSize}) * from asr_stk_use_view 
<where>
    row1 not in (select top ((#{pageNumber}-1)*#{pageSize}) row1 from asr_stk_use_view 
    <where>
        1=1
        <include refid="viewStockUseConditionSql"></include>        
    </where>
    order by row1 asc)
    <include refid="viewStockUseConditionSql"></include>
    <![CDATA[
        order by row1 asc
    ]]>
</where>
</select>
 
<select id="getViewStockUseCount" parameterType="com.zy.asrs.entity.ViewStockUseBean"    resultType="Integer">
select count(1) from asr_stk_use_view
<where>
<![CDATA[
    1=1
]]>
<include refid="viewStockUseConditionSql"></include>
</where>
</select>
 
<!-- 不分页查询所有信息,用于excel导出 -->
<select id="getViewStockUseAll" parameterType="com.zy.asrs.entity.ViewStockUseBean" resultType="com.zy.asrs.entity.ViewStockUseBean">
select * from asr_stk_use_view 
<where>
    <![CDATA[
         1=1
     ]]>
    <include refid="viewStockUseConditionSql"></include>
    <![CDATA[
        order by row1 asc
    ]]>
</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>