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
| <?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.door.mapper.DoorMapper">
|
| <!-- 获取门禁配置信息 -->
| <select id="getDoorSysConf" parameterType="java.lang.String" resultType="com.ld.igds.models.DoorConf">
| select
| DEPT_ID_ as deptId,
| COMPANY_ID_ as companyId,
| ACCESS_TOKEN_ as accessToken,
| AUDIT1_ as audit1,
| AUDIT2_ as audit2,
| AUDIT3_ as audit3,
| REMARK_ as remark
| from
| D_DOOR_CONF
| where
| COMPANY_ID_ = #{companyId} and
| DEPT_ID_ = #{deptId}
| </select>
|
| <!-- 新增门禁权限信息 -->
| <select id="addDoorAccess" parameterType="com.ld.igds.door.dto.DoorAccessParam">
| insert into
| D_DOOR_ACCESS (
| COMPANY_ID_,
| DEPT_ID_,
| DEPOT_ID_,
| USER_,
| TOKEN_,
| START_,
| END_
| )values (
| #{param.companyId},
| #{param.deptId},
| #{param.depotId},
| #{param.user},
| #{param.token},
| #{param.start},
| #{param.end}
| )
| </select>
|
| <!-- 根据条件更新门禁权限令牌 -->
| <update id="updateDoorAccess" parameterType="com.ld.igds.door.dto.DoorAccessParam">
| update D_DOOR_ACCESS
| set TOKEN_ = #{param.token}
| <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.depotId != null and param.depotId != ''">and DEPOT_ID_ = #{param.depotId}</if>
| <if test="param.user != null and param.user != ''">and USER_ = #{param.user}</if>
| </where>
| </update>
|
| <!-- 验证权限码在有效期内是否存在 -->
| <select id="getCountByToken" parameterType="java.lang.String" resultType="java.lang.Integer">
| SELECT
| COUNT(TOKEN_)
| FROM D_DOOR_ACCESS
| WHERE TOKEN_ = #{token} and (END_ is null or END_ <![CDATA[ >= ]]> now());
| </select>
|
| <!-- 根据条件删除门禁权限 -->
| <delete id="delDoorAccess" parameterType="com.ld.igds.door.dto.DoorAccessParam">
| delete
| from D_DOOR_ACCESS
| <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.depotId != null and param.depotId != ''">and DEPOT_ID_ = #{param.depotId}</if>
| <if test="param.user != null and param.user != ''">and USER_ = #{param.user}</if>
| <if test="param.time != null">and END_ <![CDATA[ <= ]]> #{param.time}</if>
| </where>
| </delete>
|
| <!-- 物联网门禁布防 -->
| <delete id="emptyDoorAccessByDepotId" parameterType="com.ld.igds.door.dto.DoorAccessParam">
| delete
| from D_DOOR_ACCESS
| <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.depotId != null and param.depotId != ''">and DEPOT_ID_ = #{param.depotId}</if>
| <if test="param.time != null">and START_ <![CDATA[ <= ]]> #{param.time}</if>
| <if test="param.time != null">and END_ <![CDATA[ >= ]]> #{param.time}</if>
| </where>
| </delete>
|
| <!-- 根据条件查询门禁权限 -->
| <select id="getDoorAccess" parameterType="com.ld.igds.door.dto.DoorAccessParam" resultType="com.ld.igds.door.dto.DoorAccessData">
| select
| ID_ as id,
| COMPANY_ID_ as companyId,
| DEPT_ID_ as deptId,
| DEPOT_ID_ as depotId,
| USER_ as user,
| TOKEN_ as token,
| START_ as start,
| END_ as end
| from
| D_DOOR_ACCESS
| <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.token != null and param.token != ''">and TOKEN_ = #{param.token}</if>
| </where>
| </select>
|
|
| <!-- 新增门禁权限信息 -->
| <insert id="addDoorRecord" parameterType="com.ld.igds.door.dto.DoorRecordData">
| insert into
| D_DOOR_RECORD (
| ID_,
| APPLY_ID_,
| COMPANY_ID_,
| DEPT_ID_,
| DEPOT_ID_,
| DOOR_NAME_,
| USER_,
| USER_NAME_,
| DOOR_TYPE_,
| IS_NORMAL,
| TIME_,
| INFO_,
| IMG1,
| IMG2,
| IMG3
| )values (
| #{data.id},
| #{data.applyId},
| #{data.companyId},
| #{data.deptId},
| #{data.depotId},
| #{data.doorName},
| #{data.user},
| #{data.userName},
| #{data.doorType},
| #{data.isNormal},
| #{data.time},
| #{data.info},
| #{data.img1},
| #{data.img2},
| #{data.img3}
| )
| </insert>
|
|
| <!-- 根据条件查询门禁权限 -->
| <select id="getDoorRecordById" parameterType="java.lang.Integer" resultType="com.ld.igds.door.dto.DoorRecordData">
| select
| ID_ as id,
| APPLY_ID_ as applyId,
| COMPANY_ID_ as companyId,
| DEPT_ID_ as deptId,
| DEPOT_ID_ as depotId,
| DOOR_NAME_ as doorName,
| USER_ as user,
| USER_NAME_ as userName,
| DOOR_TYPE_ as doorType,
| IS_NORMAL as isNormal,
| TIME_ as time,
| INFO_ as info,
| IMG1 as img1,
| IMG2 as img2,
| IMG3 as img3
| from
| D_DOOR_RECORD
| where ID_ = #{id}
| </select>
|
|
| <!-- 根据条件查询门禁权限 -->
| <select id="getDoorAccessList" parameterType="com.ld.igds.door.dto.DoorAccessParam" resultType="com.ld.igds.door.dto.DoorAccessData">
| select
| ID_ as id,
| COMPANY_ID_ as companyId,
| DEPT_ID_ as deptId,
| DEPOT_ID_ as depotId,
| USER_ as user,
| TOKEN_ as token,
| START_ as start,
| END_ as end
| from
| D_DOOR_ACCESS
| <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.depotId != null and param.depotId != ''">and DEPOT_ID_ = #{param.depotId}</if>
| <if test="param.time != null">and START_ <![CDATA[ <= ]]> #{param.time}</if>
| <if test="param.time != null">and END_ <![CDATA[ >= ]]> #{param.time}</if>
| </where>
| </select>
|
| </mapper>
|
|