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
f3f9905e
authored
Dec 18, 2023
by
罗志长
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
feat: 平台端设备管理列表新增关联长者
parent
efe19e6e
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
127 additions
and
1 deletions
server-module/src/main/java/com/makeit/module/controller/device/PlatDeviceController.java
server-service/src/main/java/com/makeit/mapper/platform/device/PlatDeviceMapper.java
server-service/src/main/java/com/makeit/service/platform/device/PlatDeviceService.java
server-service/src/main/java/com/makeit/service/platform/device/impl/PlatDeviceServiceImpl.java
server-service/src/main/java/com/makeit/vo/platform/device/PlatDeviceListVO.java
server-service/src/main/resources/mappers/PlatDeviceMapper.xml
server-module/src/main/java/com/makeit/module/controller/device/PlatDeviceController.java
View file @
f3f9905e
...
...
@@ -51,7 +51,7 @@ public class PlatDeviceController {
@ApiOperation
(
"分页列表"
)
@PostMapping
(
"page"
)
public
ApiResponseEntity
<
PageVO
<
PlatDeviceListVO
>>
page
(
@RequestBody
PageReqDTO
<
PlatDeviceQueryDTO
>
pageReqDTO
)
{
return
ApiResponseUtils
.
success
(
platDeviceService
.
page
(
pageReqDTO
));
return
ApiResponseUtils
.
success
(
platDeviceService
.
p
latP
age
(
pageReqDTO
));
}
@ApiOperation
(
"编辑"
)
...
...
server-service/src/main/java/com/makeit/mapper/platform/device/PlatDeviceMapper.java
View file @
f3f9905e
...
...
@@ -21,5 +21,7 @@ public interface PlatDeviceMapper extends BaseMapper<PlatDevice> {
Page
<
PlatDeviceListVO
>
getDeviceIdsBySpaceId
(
@Param
(
"param"
)
PlatDeviceQueryDTO
param
,
Page
page
);
Page
<
PlatDeviceListVO
>
getDeviceIdsBySpaceIdAndElder
(
@Param
(
"param"
)
PlatDeviceQueryDTO
param
,
Page
page
);
Page
<
PlatDeviceListVO
>
getDevices
(
@Param
(
"param"
)
PlatDataScreenQueryDTO
param
,
Page
<
PlatDevice
>
page
);
}
server-service/src/main/java/com/makeit/service/platform/device/PlatDeviceService.java
View file @
f3f9905e
...
...
@@ -32,6 +32,8 @@ import java.util.List;
*/
public
interface
PlatDeviceService
extends
IService
<
PlatDevice
>
{
PageVO
<
PlatDeviceListVO
>
platPage
(
PageReqDTO
<
PlatDeviceQueryDTO
>
pageReqDTO
);
PageVO
<
PlatDeviceListVO
>
page
(
PageReqDTO
<
PlatDeviceQueryDTO
>
pageReqDTO
);
void
edit
(
PlatDeviceEditDTO
dto
);
...
...
server-service/src/main/java/com/makeit/service/platform/device/impl/PlatDeviceServiceImpl.java
View file @
f3f9905e
...
...
@@ -153,6 +153,64 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev
* @return
*/
@Override
public
PageVO
<
PlatDeviceListVO
>
platPage
(
PageReqDTO
<
PlatDeviceQueryDTO
>
pageReqDTO
)
{
PlatDeviceQueryDTO
dto
=
pageReqDTO
.
getData
();
Page
<
PlatDevice
>
p
=
PageUtil
.
toMpPage
(
pageReqDTO
);
Page
<
PlatDeviceListVO
>
page
=
baseMapper
.
getDeviceIdsBySpaceIdAndElder
(
dto
,
p
);
List
<
PlatDeviceListVO
>
records
=
page
.
getRecords
();
if
(
CollectionUtils
.
isEmpty
(
records
))
{
return
PageVO
.
emptyPage
();
}
List
<
String
>
spaceIdList
=
records
.
stream
().
flatMap
(
vo
->
{
String
spaceParentPath
=
vo
.
getSpaceParentPath
();
String
spp
=
Optional
.
ofNullable
(
spaceParentPath
).
orElse
(
""
);
return
Stream
.
of
(
spp
.
split
(
","
));
}).
collect
(
Collectors
.
toList
());
spaceIdList
.
add
(
"-1"
);
List
<
PlatSpace
>
platSpaces
=
platSpaceService
.
listByIds
(
spaceIdList
);
Map
<
String
,
String
>
spaceIdNameMap
=
platSpaces
.
stream
().
collect
(
Collectors
.
toMap
(
BaseEntity:
:
getId
,
vo
->
vo
.
getName
(),
(
v1
,
v2
)
->
v1
));
for
(
PlatDeviceListVO
record
:
records
)
{
String
spaceParentPath
=
record
.
getSpaceParentPath
();
String
spaceName
=
""
;
if
(
StringUtils
.
isNotBlank
(
spaceParentPath
))
{
String
spaceNameJoin
=
Stream
.
of
(
spaceParentPath
.
split
(
","
)).
map
(
vo
->
spaceIdNameMap
.
get
(
vo
)).
collect
(
Collectors
.
joining
(
"-"
));
spaceName
=
spaceNameJoin
+
"-"
+
record
.
getSpaceName
()
+
"-"
+
record
.
getRoomName
();
}
else
{
if
(
StringUtils
.
isNotEmpty
(
record
.
getSpaceName
()))
{
spaceName
=
record
.
getSpaceName
();
}
if
(
StringUtils
.
isNotEmpty
(
record
.
getRoomName
()))
{
spaceName
+=
"-"
+
record
.
getRoomName
();
}
}
if
(
StringUtils
.
isNotBlank
(
record
.
getBedName
()))
{
spaceName
=
spaceName
+
"-"
+
record
.
getBedName
();
}
record
.
setSpaceName
(
spaceName
);
}
JoinUtil
.
join
(
records
,
platOrgService
,
PlatDeviceListVO:
:
getOrgId
,
PlatOrg:
:
getId
,
(
d
,
o
)
->
{
d
.
setOrgName
(
o
.
getName
());
});
JoinUtil
.
joinSplit
(
records
,
platOrgService
,
PlatDeviceListVO:
:
getOrgPath
,
PlatOrg:
:
getId
,
(
d
,
o
)
->
{
d
.
setOrgPathName
(
StreamUtil
.
join
(
o
,
PlatOrg:
:
getName
));
});
return
PageUtil
.
toPageVO
(
records
,
page
);
}
@Override
public
PageVO
<
PlatDeviceListVO
>
page
(
PageReqDTO
<
PlatDeviceQueryDTO
>
pageReqDTO
)
{
PlatDeviceQueryDTO
dto
=
pageReqDTO
.
getData
();
Page
<
PlatDevice
>
p
=
PageUtil
.
toMpPage
(
pageReqDTO
);
...
...
server-service/src/main/java/com/makeit/vo/platform/device/PlatDeviceListVO.java
View file @
f3f9905e
...
...
@@ -93,6 +93,9 @@ public class PlatDeviceListVO extends BaseTenantDTO {
private
String
roomName
;
private
String
bedName
;
private
String
elderName
;
@ApiModelProperty
(
value
=
"许可证"
)
private
String
deviceLicense
;
...
...
server-service/src/main/resources/mappers/PlatDeviceMapper.xml
View file @
f3f9905e
...
...
@@ -60,6 +60,67 @@
order by pd.update_date desc,pd.id desc
</select>
<select
id=
"getDeviceIdsBySpaceIdAndElder"
resultType=
"com.makeit.vo.platform.device.PlatDeviceListVO"
>
select
distinct
pd.*,
ps.parent_path as spaceParentPath,
ps.name as spaceName,
pr.name as roomName,
pb.name as bedName,
pe.`name` as elderName
from plat_device pd
left join plat_room_bed_device prbd on (pd.id = prbd.device_id and prbd.del_flag = '0')
left join plat_room pr on (pr.id = prbd.room_id and pr.del_flag = '0' )
left join plat_bed pb on ( pb.id = prbd.bed_id and pb.del_flag = '0')
left join plat_space ps on (ps.id = pr.space_id and ps.del_flag = '0')
left join plat_elder pe on (pe.room_id = prbd.room_id and pe.del_flag = '0')
<where>
pd.del_flag = 0
<if
test=
"param.spaceId != null and param.spaceId != ''"
>
and ( FIND_IN_SET(#{param.spaceId},ps.parent_path) or ps.id = #{param.spaceId})
</if>
<if
test=
"param.oriDeviceId != null and param.oriDeviceId != ''"
>
and pd.ori_device_id like concat('%',#{param.oriDeviceId},'%')
</if>
<if
test=
"param.name != null and param.name != ''"
>
and pd.name like concat('%',#{param.name},'%')
</if>
<if
test=
"param.status != null and param.status != '' "
>
and pd.status = #{param.status}
</if>
<if
test=
"param.productName != null and param.productName != '' "
>
and pd.product_name like concat('%',#{param.productName},'%')
</if>
<if
test=
"param.productId != null and param.productId != '' "
>
and pd.product_id = #{param.productId}
</if>
<if
test=
"param.orgId != null and param.orgId != '' "
>
and pd.org_id = #{param.orgId}
</if>
<if
test=
"param.tenantId != null and param.tenantId != ''"
>
and pd.tenant_id = #{param.tenantId}
</if>
<if
test=
"param.active !=null and param.active == 1"
>
and pd.device_license is not null
</if>
<if
test=
"param.active !=null and param.active == 0"
>
and pd.device_license is null
</if>
<if
test=
"param.elderId !=null and param.elderId != ''"
>
and pe.id = #{param.elderId}
</if>
<if
test=
"param.orgIds != null and param.orgIds.size() > 0 "
>
AND pd.org_id in
<foreach
collection=
"param.orgIds"
item=
"item"
separator=
","
open=
"("
close=
")"
index=
""
>
#{item}
</foreach>
</if>
</where>
order by pd.update_date desc,pd.id desc
</select>
<select
id=
"getDevices"
resultType=
"com.makeit.vo.platform.device.PlatDeviceListVO"
>
select
distinct
...
...
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