Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
ioc_sixiang_license
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zengtianlai3
ioc_sixiang_license
Commits
0f376084
Commit
0f376084
authored
Feb 02, 2023
by
ma
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完善查询设备列表
parent
a9761422
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
17 additions
and
7 deletions
+17
-7
DeviceController.java
...java/iot/sixiang/license/controller/DeviceController.java
+8
-1
DeviceManager.java
...c/main/java/iot/sixiang/license/device/DeviceManager.java
+2
-2
DeviceMapper.java
...rc/main/java/iot/sixiang/license/mapper/DeviceMapper.java
+1
-1
DeviceService.java
.../main/java/iot/sixiang/license/service/DeviceService.java
+1
-1
DeviceServiceImpl.java
...a/iot/sixiang/license/service/impl/DeviceServiceImpl.java
+2
-2
DeviceMapper.xml
license/src/main/resources/mapper/DeviceMapper.xml
+3
-0
No files found.
license/src/main/java/iot/sixiang/license/controller/DeviceController.java
View file @
0f376084
...
...
@@ -11,6 +11,8 @@ import io.swagger.annotations.ApiImplicitParams;
import
io.swagger.annotations.ApiOperation
;
import
iot.sixiang.license.device.DeviceManager
;
import
iot.sixiang.license.entity.DeviceBlack
;
import
iot.sixiang.license.handler.IotLicenseException
;
import
iot.sixiang.license.jwt.UserUtils
;
import
iot.sixiang.license.log.BusinessType
;
import
iot.sixiang.license.log.MyLog
;
import
iot.sixiang.license.model.BaseResult
;
...
...
@@ -21,6 +23,7 @@ import iot.sixiang.license.model.vo.DeviceVo;
import
iot.sixiang.license.service.DeviceBlackService
;
import
iot.sixiang.license.service.DeviceService
;
import
iot.sixiang.license.xss.XssUtil
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.WebDataBinder
;
import
org.springframework.web.bind.annotation.GetMapping
;
...
...
@@ -108,7 +111,11 @@ public class DeviceController {
@RequestParam
(
value
=
"status"
,
required
=
false
)
Integer
status
)
{
appName
=
XssUtil
.
checkXSS
(
appName
);
userName
=
XssUtil
.
checkXSS
(
userName
);
PageInfoModel
<
DeviceVo
>
records
=
deviceService
.
getDeviceList
(
pageNo
,
pageSize
,
appName
,
userName
,
sn
,
status
);
String
userId
=
UserUtils
.
getLoginUserId
();
if
(
StringUtils
.
isEmpty
(
userId
))
{
throw
new
IotLicenseException
(
403
,
"请重新登录"
);
}
PageInfoModel
<
DeviceVo
>
records
=
deviceService
.
getDeviceList
(
pageNo
,
pageSize
,
Integer
.
parseInt
(
userId
),
appName
,
userName
,
sn
,
status
);
int
total
=
records
.
getTotal
();
int
pages
=
total
/
pageSize
;
//pages为总页数
int
mod
=
total
%
pageSize
;
...
...
license/src/main/java/iot/sixiang/license/device/DeviceManager.java
View file @
0f376084
...
...
@@ -54,7 +54,7 @@ public class DeviceManager {
public
void
initDevices
()
{
allDevice
=
new
HashMap
<>();
PageInfoModel
<
DeviceVo
>
records
=
deviceService
.
getDeviceList
(
1
,
10000
,
""
,
""
,
null
,
null
);
PageInfoModel
<
DeviceVo
>
records
=
deviceService
.
getDeviceList
(
1
,
10000
,
null
,
""
,
""
,
null
,
null
);
List
<
DeviceVo
>
deviceList
=
records
.
getResult
();
for
(
DeviceVo
deviceVo
:
deviceList
)
{
...
...
@@ -151,7 +151,7 @@ public class DeviceManager {
}
public
PageInfoModel
<
DeviceDetailVo
>
getDeviceDetailList
(
int
pageNo
,
int
pageSize
,
String
appName
,
String
userName
)
{
PageInfoModel
<
DeviceVo
>
records
=
deviceService
.
getDeviceList
(
pageNo
,
pageSize
,
appName
,
userName
,
null
,
null
);
PageInfoModel
<
DeviceVo
>
records
=
deviceService
.
getDeviceList
(
pageNo
,
pageSize
,
null
,
appName
,
userName
,
null
,
null
);
List
<
DeviceVo
>
deviceVos
=
records
.
getResult
();
PageInfoModel
<
DeviceDetailVo
>
detailVoPageInfoModel
=
new
PageInfoModel
<>();
List
<
DeviceDetailVo
>
detailVos
=
new
ArrayList
<>();
...
...
license/src/main/java/iot/sixiang/license/mapper/DeviceMapper.java
View file @
0f376084
...
...
@@ -13,7 +13,7 @@ import java.util.List;
* @since 2022-06-08
*/
public
interface
DeviceMapper
extends
BaseMapper
<
Device
>
{
List
<
DeviceVo
>
getDeviceList
(
String
appName
,
String
userName
,
String
sn
,
Integer
status
);
List
<
DeviceVo
>
getDeviceList
(
String
appName
,
String
userName
,
Integer
userId
,
String
sn
,
Integer
status
);
boolean
addDevice
(
String
sn
,
String
appId
);
...
...
license/src/main/java/iot/sixiang/license/service/DeviceService.java
View file @
0f376084
...
...
@@ -17,7 +17,7 @@ import iot.sixiang.license.model.vo.DeviceVo;
* @since 2022-06-08
*/
public
interface
DeviceService
extends
IService
<
Device
>
{
PageInfoModel
<
DeviceVo
>
getDeviceList
(
int
pageNo
,
int
pageSize
,
String
appName
,
String
userName
,
String
sn
,
Integer
status
);
PageInfoModel
<
DeviceVo
>
getDeviceList
(
int
pageNo
,
int
pageSize
,
Integer
userId
,
String
appName
,
String
userName
,
String
sn
,
Integer
status
);
boolean
addDevice
(
String
appId
,
int
count
);
...
...
license/src/main/java/iot/sixiang/license/service/impl/DeviceServiceImpl.java
View file @
0f376084
...
...
@@ -40,11 +40,11 @@ public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impleme
private
DeviceMapper
deviceMapper
;
@Override
public
PageInfoModel
<
DeviceVo
>
getDeviceList
(
int
pageNo
,
int
pageSize
,
String
appName
,
String
userName
,
String
sn
,
Integer
status
)
{
public
PageInfoModel
<
DeviceVo
>
getDeviceList
(
int
pageNo
,
int
pageSize
,
Integer
userId
,
String
appName
,
String
userName
,
String
sn
,
Integer
status
)
{
if
(
pageNo
==
0
||
pageSize
==
0
)
{
throw
new
IotLicenseException
(
ResultCode
.
VALIDATE_FAILED
.
getCode
(),
ResultCode
.
VALIDATE_FAILED
.
getMsg
());
}
List
<
DeviceVo
>
deviceTypes
=
deviceMapper
.
getDeviceList
(
appName
,
userName
,
sn
,
status
);
List
<
DeviceVo
>
deviceTypes
=
deviceMapper
.
getDeviceList
(
appName
,
userName
,
userId
,
sn
,
status
);
deviceTypes
=
deviceTypes
.
stream
().
sorted
(
Comparator
.
comparing
(
DeviceVo:
:
getCreateTime
,
Comparator
.
reverseOrder
())).
collect
(
Collectors
.
toList
());
List
<
DeviceVo
>
result
=
new
ArrayList
<>();
int
begin
=
(
pageNo
-
1
)
*
pageSize
;
...
...
license/src/main/resources/mapper/DeviceMapper.xml
View file @
0f376084
...
...
@@ -8,6 +8,9 @@
JOIN apply AS app ON de.app_id = app.app_id
JOIN `user` AS us ON us.user_id = app.user_id
where 1=1
<if
test=
"null != userId"
>
and us.user_id = #{userId}
</if>
<if
test=
"null != appName and '' != appName"
>
and app_name like concat('%',#{appName},'%')
</if>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment