jiazx0107@163.com
2023-05-17 620eab6cca2bc9ef9ea6d3067a0a5ba1deadbd1c
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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
<?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.ld.igds.phone.mapper.PhoneCommonMapper">
 
    <!-- 根据用户名获取用户信息 -->
    <select id="phoneGetUser" parameterType="java.lang.String" resultType="com.bstek.bdf2.core.model.DefaultUser">
        select
        USERNAME_ as username,
        COMPANY_ID_ as companyId,
        PASSWORD_ as password,
        SALT_ as salt,
        CNAME_ as cname,
        MALE_ as male,
        ENABLED_ as enabled,
        ADMINISTRATOR_ as administrator,
        BIRTHDAY_ as birthday,
        MOBILE_ as mobile,
        EMAIL_ as email,
        CREATE_DATE_ as createDate
        from BDF2_USER
        where  USERNAME_ = #{param}
    </select>
 
    <!-- 根据用户名修改用户信息 -->
    <update id="phoneUpdateUser" parameterType="com.ld.igds.phone.param.ParamUser">
        update BDF2_USER
        <set>
            PASSWORD_ = #{param.password},
            SALT_ = #{param.salt},
            <if test="param.newCname != null and param.newCname != ''">CNAME_ = #{param.newCname},</if>
            <if test="param.newMobile != null and param.newMobile != ''">MOBILE_ = #{param.newMobile},</if>
        </set>
        where USERNAME_ = #{param.username}
        and COMPANY_ID_ = #{param.companyId}
    </update>
 
    <select id="phoneListWeather" parameterType="java.lang.String" resultType="com.ld.igds.phone.dto.DtoWeather">
        select
        ID_ as id,
        COMPANY_ID_ as companyId,
        TEMP_ as temp,
        HUMIDITY_ as humidity,
        WIND_SPEED_ as windSpeed,
        WIND_DIRECTION_ as windDirection,
        WEATHER_ as weather,
        RAINFALL_ as rainfall,
        UPDATE_TIME_ as updateTime
        from D_WEATHER_INFO
        where COMPANY_ID_ = #{param}
        order by UPDATE_TIME_ DESC
        limit 10
    </select>
 
    <!-- 获取警告列表信息 -->
    <select id="phoneListWarn" parameterType="com.ld.igds.phone.param.ParamWarn" resultType="com.ld.igds.phone.dto.Dto5003">
        select
        ID_ as id,
        COMPANY_ID_ as companyId,
        DEPT_ID_ as deptId,
        DEPOT_ID_ as depotId,
        SER_ID_ as serId,
        NAME_ as name,
        BIZ_TYPE_ as bizType,
        TYPE_ as type,
        LEVEL_ as level,
        STATUS_ as status,
        INFO_ as info,
        TIME_ as time,
        COMPLETE_USER_ as completeUser,
        COMPLETE_TIME_ as completeTime,
        REMARK_ as remark
        from D_M_WARN_INFO
        <where>
            <if test="param.companyId != null and param.companyId != '' ">AND COMPANY_ID_ = #{param.companyId}</if>
            <if test="param.deptId != null and param.deptId != '' ">AND DEPT_ID_ = #{param.deptId}</if>
            <if test="param.start != null">AND
                TIME_ <![CDATA[ > ]]>#{param.start,jdbcType=TIMESTAMP}
            </if>
            <if test="param.end != null">AND
                TIME_ <![CDATA[ < ]]>#{param.end,jdbcType=TIMESTAMP}
            </if>
        </where>
        order by TIME_
    </select>
 
    <update id="updateWarn" parameterType="com.ld.igds.phone.param.ParamWarn">
        update D_M_WARN_INFO
        <set>
            COMPLETE_TIME_ = #{param.completeTime},
            <if test="param.completeUser != null and param.completeUser != ''">COMPLETE_USER_ = #{param.completeUser},</if>
            <if test="param.status != null and param.status != ''">STATUS_ = #{param.status},</if>
        </set>
        where ID_ = #{param.id}
    </update>
 
    <!-- 获取仓库信息 -->
    <select id="phoneListDepot" parameterType="java.lang.String" resultType="com.ld.igds.phone.dto.DtoDepot">
        select
        ID_ as depotId,
        COMPANY_ID_ as companyId,
        NAME_ as depotName,
        DEPOT_TYPE_ as depotType,
        DEPOT_STATUS_ as depotStatus,
        STORAGE_MAX_ as storageMax,
        STORAGE_REAL_ as storageReal,
        FOOD_TYPE_ as foodType,
        FOOD_VARIETY_ as foodVariety,
        FOOD_LEVEL_ as foodLevel,
        FOOD_LOCATION_ as foodLocation,
        PER_WET_ as perWet,
        PER_IMPURITY_ as perImpurity,
        STORE_KEEPER_ as storeKeeper,
        STORE_KEEPER_NAME_ as storeKeeperName,
        STORE_DATE_ as storeDate,
        FOOD_YEAR_ as foodYear,
        REMARK_ as remark
        from D_DEPOT
        where COMPANY_ID_ = #{companyId}
        and DEPT_ID_ = #{deptId}
    </select>
 
 
    <!-- 获取出入库记录信息 -->
    <select id="phoneListInoutRecord" parameterType="com.ld.igds.phone.param.ParamInoutRecord"
            resultType="com.ld.igds.phone.dto.DtoInoutRecord">
        select
        ID_ as id,
        COMPANY_ID_ as companyId,
        INTEL_CARD_ as intelCard,
        PLATE_NUM_ as plateNum,
        DEPOT_ID_ as depotId,
        TYPE_ as type,
        CUSTOMER_ID_ as customerId,
        CUSTOMER_NAME_ as customerName,
        FOOD_VARIETY_ as foodVariety,
        SETTLE_WEIGHT_ as settleWeight,
        COMPLETE_TIME_ as completeTime
        from D_INOUT_RECORD
        <where>
            <if test="param.companyId != null and param.companyId != '' ">AND COMPANY_ID_ = #{param.companyId}</if>
            <if test="param.deptId != null and param.deptId != '' ">AND DEPT_ID_ = #{param.deptId}</if>
            <if test="param.type != null and param.type != '' ">AND TYPE_ = #{param.type}</if>
            <if test="param.date != null">AND
                COMPLETE_TIME_ <![CDATA[ > ]]>#{param.date,jdbcType=TIMESTAMP}
            </if>
            <if test="param.end != null">AND
                COMPLETE_TIME_ <![CDATA[ < ]]>#{param.end,jdbcType=TIMESTAMP}
            </if>
            AND PROGRESS_ = 'RECORD'
            AND RECORD_STATUS_ != 'ERROR'
            AND RECORD_STATUS_ != 'DEL'
            ORDER BY ID_
        </where>
    </select>
 
    <!--根据车牌获取个数 -->
    <select id="validateByPlateNum" parameterType="com.ld.igds.phone.param.ParamInout"
            resultType="java.lang.Integer">
        select count(1) from D_INOUT_RECORD
        <where>
            <if test="param.companyId != null and param.companyId != '' ">
                AND COMPANY_ID_ = #{param.companyId}
            </if>
            <if test="param.plateNum != null and param.plateNum != '' ">
                AND PLATE_NUM_ = #{param.plateNum}
            </if>
            and PROGRESS_ &lt;&gt; 'RECORD' and RECORD_STATUS_ != 'DEL' and RECORD_STATUS_ != 'ERROR'
        </where>
    </select>
 
    <!--根据一卡通和车牌获取个数 -->
    <select id="validateByInterCard" parameterType="com.ld.igds.phone.param.ParamInout"
            resultType="java.lang.Integer">
        select count(1) from D_INOUT_RECORD
        <where>
            <if test="param.companyId != null">AND COMPANY_ID_ = #{param.companyId}</if>
            <if test="param.intelCard != null and param.plateNum != null">
                AND ( INTEL_CARD_ = #{param.intelCard} OR PLATE_NUM_ = #{param.plateNum} )
            </if>
            and PROGRESS_ &lt;&gt; 'RECORD' and RECORD_STATUS_ != 'DEL' and  RECORD_STATUS_ != 'ERROR'
        </where>
    </select>
 
    <!-- 根据组织编码、仓库号、设备类型查询设备 -->
    <select id="phoneListDevice" parameterType="com.ld.igds.phone.param.ParamDevice"
            resultType="com.ld.igds.phone.dto.DtoDevice">
        select
        ID_ as id,
        COMPANY_ID_ as companyId,
        DEPOT_ID_ as depotId,
        NAME_ as name,
        PASS_CODE_ as passCode,
        SER_ID_ as serId,
        TYPE_ as type,
        STATUS_ as status
        from D_DEVICE
        <where>
            <if test="param.companyId != null and param.companyId != '' ">AND COMPANY_ID_ = #{param.companyId}</if>
            <if test="param.depotId != null and param.depotId != '' ">AND DEPOT_ID_ = #{param.depotId}</if>
            AND
            (
            <if test="param.type != null and param.type != '' ">TYPE_ = #{param.type}</if>
            <if test="param.type1 != null and param.type1 != '' ">OR TYPE_ = #{param.type1}</if>
            <if test="param.type2 != null and param.type2 != '' ">OR TYPE_ = #{param.type2}</if>
            <if test="param.type3 != null and param.type3 != '' ">OR TYPE_ = #{param.type3}</if>
            )
        </where>
        ORDER BY NAME_
    </select>
 
    <select id="phoneListCamera" parameterType="java.lang.String" resultType="com.ld.igds.phone.dto.DtoCamera">
        select
        TYPE_ as type,
        NAME_ as name,
        LOGIN_ID_ as loginId,
        PWD_ as pwd,
        IP_IN_ as ipIn,
        PORT_IN_C_ as portInC,
        PORT_IN_V_ as portInV,
        MEDIA_ADDR_ as mediaAddr
        from
        D_SEC_CAMERA
        <where>
            <if test="companyId != null and companyId != '' ">AND COMPANY_ID_ = #{companyId}</if>
        </where>
        ORDER BY NAME_
    </select>
 
    <!--    远程抄表-->
    <select id="getEnergyMeter" parameterType="com.ld.igds.phone.param.ParamEnergyMeter"
            resultType="com.ld.igds.phone.dto.DtoEnergyMeter">
        select
        ID_ as id,
        COMPANY_ID_ as companyId,
        DEPOT_ID_ as depotId,
        UPDATE_TIME_ as updateTime,
        TYPE_ as type,
        UA_ as ua,
        UB_ as ub,
        UC_ as uc,
        IA_ as ia,
        IB_ as ib,
        IC_ as ic,
--         PA_ as pa,
--         PB_ as pb,
--         PC_ as pc,
--         PFA_ as pfa,
--         PFB_ as pfb,
--         PFC_ as pfc,
        F_ as f,
        EP_ as ep,
        EP_INC_ as epInc,
        EQ_ as eq,
        EQ_INC_ as eqInc,
        ES_ as es,
        ES_INC_ as esInc
        from
        D_ENERGY
        <where>
            <if test="param.companyId != null and param.companyId != '' ">
                AND COMPANY_ID_ = #{param.companyId}
            </if>
            <if test="param.start != null">AND
                UPDATE_TIME_ <![CDATA[ > ]]>#{param.start,jdbcType=TIMESTAMP}
            </if>
            <if test="param.end != null">AND
                UPDATE_TIME_ <![CDATA[ < ]]>#{param.end,jdbcType=TIMESTAMP}
            </if>
        </where>
        ORDER BY UPDATE_TIME_ desc
    </select>
 
 
    <select id="getDeptList" resultType="com.ld.igds.phone.dto.DtoDept" parameterType="java.lang.String">
        select
        ID_ as id,
        NAME_ as name,
        COMPANY_ID_ as companyId,
        PARENT_ID_ as parentId
        from
        BDF2_DEPT
        where COMPANY_ID_ = #{companyId}
        and PARENT_ID_ like #{parentId}
 
    </select>
 
    <select id="getDicList" resultType="com.ld.igds.phone.dto.DtoDic" parameterType="java.lang.String">
        select
        CODE_ as code,
        NAME_ as name,
        COMPANY_ID_ as companyId,
        PARENT_CODE as parentCode
        from
        D_DIC_TRIGGER
        where COMPANY_ID_ = #{companyId}
        and PARENT_CODE = #{parentCode}
    </select>
 
 
    <!-- 获取巡更记录信息 -->
    <select id="phoneListPatrolRecord" parameterType="com.ld.igds.phone.param.ParamPatrolRecord"
            resultType="com.ld.igds.phone.dto.DtoPatrolRecord">
        select
        ID_ as id,
        COMPANY_ID_ as companyId,
        DEPT_ID_ as deptId,
        DEVICE_ID_ as deviceId,
        USER_NAME_ as userName,
        POINT_ID_ as pointId,
        POINT_NAME_ as pointName,
        CREATE_TIME_ as createTime,
        LONGITUDE_ as longitude,
        LATITUDE_ as latitude,
        IMG_NAME_ as imgName
        from D_SEC_PATROL_RECORD
        <where>
            <if test="param.id != null and param.id != '' ">AND ID_ = #{param.id}</if>
            <if test="param.companyId != null and param.companyId != '' ">AND COMPANY_ID_ = #{param.companyId}</if>
            <if test="param.deptId != null and param.deptId != '' ">AND DEPT_ID_ = #{param.deptId}</if>
            <if test="param.userName != null and param.userName != '' ">AND USER_NAME_ = #{param.userName}</if>
            <if test="param.date != null">AND
                CREATE_TIME_ <![CDATA[ >= ]]>#{param.date,jdbcType=TIMESTAMP}
            </if>
            <if test="param.end != null">AND
                CREATE_TIME_ <![CDATA[ <= ]]>#{param.end,jdbcType=TIMESTAMP}
            </if>
            ORDER BY CREATE_TIME_ DESC
        </where>
    </select>
 
</mapper>