Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
黄嘉阳
/
iot-platform-server
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
e0ad53b5
authored
Oct 28, 2023
by
huangjy
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
fix:小程序设备列表数据权限
parent
9ce8647f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
8 deletions
server-module/src/main/java/com/makeit/module/controller/wechat/device/PlatDeviceWechatController.java
server-module/src/main/java/com/makeit/module/controller/wechat/device/PlatDeviceWechatController.java
View file @
e0ad53b5
...
@@ -11,12 +11,15 @@ import com.makeit.dto.platform.device.PlatDeviceQueryDTO;
...
@@ -11,12 +11,15 @@ import com.makeit.dto.platform.device.PlatDeviceQueryDTO;
import
com.makeit.dto.wechat.device.PlatDeviceAttrWechatDTO
;
import
com.makeit.dto.wechat.device.PlatDeviceAttrWechatDTO
;
import
com.makeit.dto.wechat.device.PlatDeviceEditWechatDTO
;
import
com.makeit.dto.wechat.device.PlatDeviceEditWechatDTO
;
import
com.makeit.dto.wechat.device.PlatDeviceSetupDTO
;
import
com.makeit.dto.wechat.device.PlatDeviceSetupDTO
;
import
com.makeit.entity.platform.auth.PlatOrg
;
import
com.makeit.entity.platform.auth.PlatRole
;
import
com.makeit.entity.platform.auth.PlatRole
;
import
com.makeit.enums.HeaderConst
;
import
com.makeit.enums.HeaderConst
;
import
com.makeit.global.annotation.AuthIgnore
;
import
com.makeit.global.annotation.AuthIgnore
;
import
com.makeit.module.iot.vo.DeviceProperties
;
import
com.makeit.module.iot.vo.DeviceProperties
;
import
com.makeit.service.platform.auth.PlatOrgService
;
import
com.makeit.service.platform.auth.PlatRoleService
;
import
com.makeit.service.platform.auth.PlatRoleService
;
import
com.makeit.service.platform.device.PlatDeviceService
;
import
com.makeit.service.platform.device.PlatDeviceService
;
import
com.makeit.utils.data.validate.CollectionUtils
;
import
com.makeit.utils.old.StringUtils
;
import
com.makeit.utils.old.StringUtils
;
import
com.makeit.utils.request.RequestUtil
;
import
com.makeit.utils.request.RequestUtil
;
import
com.makeit.vo.platform.device.PlatDeviceListVO
;
import
com.makeit.vo.platform.device.PlatDeviceListVO
;
...
@@ -31,6 +34,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
...
@@ -31,6 +34,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.List
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
/**
* <p>
* <p>
...
@@ -48,20 +52,17 @@ public class PlatDeviceWechatController {
...
@@ -48,20 +52,17 @@ public class PlatDeviceWechatController {
@Autowired
@Autowired
private
PlatDeviceService
platDeviceService
;
private
PlatDeviceService
platDeviceService
;
@Autowired
@Autowired
private
Plat
RoleService
platRole
Service
;
private
Plat
OrgService
platOrg
Service
;
@ApiOperation
(
"分页列表"
)
@ApiOperation
(
"分页列表"
)
@PostMapping
(
"page"
)
@PostMapping
(
"page"
)
public
ApiResponseEntity
<
PageVO
<
PlatDeviceListVO
>>
page
(
@RequestBody
PageReqDTO
<
PlatDeviceQueryDTO
>
pageReqDTO
)
{
public
ApiResponseEntity
<
PageVO
<
PlatDeviceListVO
>>
page
(
@RequestBody
PageReqDTO
<
PlatDeviceQueryDTO
>
pageReqDTO
)
{
PlatDeviceQueryDTO
dto
=
pageReqDTO
.
getData
();
PlatDeviceQueryDTO
dto
=
pageReqDTO
.
getData
();
String
roleId
=
RequestUtil
.
getHeader
(
HeaderConst
.
ROLE_ID
);
List
<
PlatOrg
>
orgs
=
platOrgService
.
belongToScopeList
(
new
PlatOrg
());
if
(
StringUtils
.
isNotEmpty
(
roleId
))
{
if
(
CollectionUtils
.
isEmpty
(
orgs
))
{
PlatRole
platRole
=
platRoleService
.
getById
(
roleId
);
return
ApiResponseUtils
.
success
(
new
PageVO
<>());
String
dataScope
=
platRole
.
getDataScope
();
if
(
StringUtils
.
isNotEmpty
(
dataScope
))
{
dto
.
setOrgIds
(
Lists
.
newArrayList
(
dataScope
.
split
(
","
)));
}
}
}
dto
.
setOrgIds
(
orgs
.
stream
().
map
(
PlatOrg:
:
getId
).
collect
(
Collectors
.
toList
()));
return
ApiResponseUtils
.
success
(
platDeviceService
.
page
(
pageReqDTO
));
return
ApiResponseUtils
.
success
(
platDeviceService
.
page
(
pageReqDTO
));
}
}
...
...
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