1
7 天以前 aeaf3e43e425ef0de84c1819f318f20e90471f90
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
<?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.WrkMastStaMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.zy.asrs.entity.WrkMastSta">
        <id column="id" property="id" />
        <result column="wrk_no" property="wrkNo" />
        <result column="wrk_start" property="wrkStart" />
        <result column="wrk_end" property="wrkEnd" />
        <result column="sta_start" property="staStart" />
        <result column="sta_end" property="staEnd" />
        <result column="create_time" property="createTime" />
        <result column="update_time" property="updateTime" />
        <result column="type" property="type" />
        <result column="wrk_sts" property="wrkSts" />
        <result column="line_number" property="lineNumber" />
        <result column="wrk_type" property="wrkType" />
        <result column="bign_time" property="bignTime" />
        <result column="work_sta" property="workSta"/>
        <result column="rgv_no" property="rgvNo"/>
        <result column="mk" property="mk"/>
 
    </resultMap>
 
    <select id="selectAllWrkMastStaList" resultMap="BaseResultMap">
        select * from asr_wrk_mast_sta
        where 1=1
        and wrk_sts=0
        <if test="type!=null">
            and type = #{type}
        </if>
        order by line_number,id
    </select>
 
    <select id="selectByWrkNo" resultMap="BaseResultMap">
        select top 1 * from asr_wrk_mast_sta
        where 1=1
        and wrk_no = #{workNo}
    </select>
 
    <select id="selectByWrkNoPut" resultMap="BaseResultMap">
        select top 1 * from asr_wrk_mast_sta
        where 1=1
          and wrk_no = #{workNo}
          and wrk_sts = 1
    </select>
 
<!--    <select id="selectNoInterfere" resultMap="BaseResultMap">-->
<!--        select top 1 * from asr_wrk_mast_sta-->
<!--        where 1=1-->
<!--        and (sta_start in-->
<!--        <foreach item="item" collection="staStarts" index="index" separator="," open="(" close=")">-->
<!--            #{item}-->
<!--        </foreach>-->
<!--        or sta_start = 0-->
<!--        )-->
<!--        and (sta_end in-->
<!--        <foreach item="item" collection="staEnds" index="index" separator="," open="(" close=")">-->
<!--            #{item}-->
<!--        </foreach>-->
<!--        or sta_end = 0-->
<!--        )-->
<!--        and wrk_sts=0-->
<!--        order by line_number,id-->
<!--    </select>-->
 
    <select id="selectNoInterfereList" resultMap="BaseResultMap">
        select * from asr_wrk_mast_sta
        where 1=1
        and (sta_start in
        <foreach item="item" collection="staStarts" index="index" separator="," open="(" close=")">
            #{item}
        </foreach>
        or sta_start = 0
        )
        and (sta_end in
        <foreach item="item" collection="staEnds" index="index" separator="," open="(" close=")">
            #{item}
        </foreach>
        or sta_end = 0
        )
        and wrk_sts=0
        order by line_number,id
    </select>
 
    <select id="selectNoInterfere" resultMap="BaseResultMap">
        select * from asr_wrk_mast_sta
        where 1=1
        and (sta_start in
        <foreach item="item" collection="staStarts" index="index" separator="," open="(" close=")">
            #{item}
        </foreach>
        or sta_start = 0
        )
        and (sta_end in
        <foreach item="item" collection="staEnds" index="index" separator="," open="(" close=")">
            #{item}
        </foreach>
        or sta_end = 0
        )
        and wrk_sts=0
        and wrk_no = #{workNo}
        order by line_number,id
    </select>
 
    <select id="selectNoInterfereToCrn" resultMap="BaseResultMap">
        select * from asr_wrk_mast_sta
        where 1=1
        and (sta_start in
        <foreach item="item" collection="staStarts" index="index" separator="," open="(" close=")">
            #{item}
        </foreach>
        or sta_start = 0
        )
        or sta_end = 0
        )
        and sta_end in (2018,1018)
        and wrk_sts=0
        and wrk_no = #{workNo}
        order by line_number,id
    </select>
    <select id="selectByWorkSta" resultMap="BaseResultMap">
        select top 1 * from asr_wrk_mast_sta
        where work_sta = #{workSta}
        and rgv_no = #{rgvNo}
    </select>
 
    <select id="selectByWorkStaList" resultMap="BaseResultMap">
        select * from asr_wrk_mast_sta
        where work_sta = #{workSta}
          and rgv_no = #{rgvNo}
        order by update_time
    </select>
 
    <select id="selectAllWrkCount" resultType="java.lang.Integer">
        select count(1) from asr_wrk_mast_sta
        where 1=1
        <if test="type!=null">
            and type = #{type}
        </if>
    </select>
 
    <select id="selectAllWrkStsCount" resultType="java.lang.Integer">
        select count(1) from asr_wrk_mast_sta
        where 1=1
        <if test="type!=null">
            and type = #{type}
        </if>
        <if test="wrkSts!=null">
            and wrk_sts = #{wrkSts}
        </if>
    </select>
    <select id="selectLockWrk" resultMap="BaseResultMap">
        select * from asr_wrk_mast_sta
        where mk = 1
        and rgv_no = #{rgvNo}
    </select>
 
 
 
 
</mapper>