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
d1fe33b5
authored
Sep 05, 2023
by
lzy
Browse files
Options
_('Browse Files')
Download
Plain Diff
Merge branch 'dev' of git.xmmakeit.com:huangjiay/iot-platform-server into dev
parents
10629dd5
e9cdaa44
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
504 additions
and
3 deletions
db/inti-elder.sql
saas-module/src/main/java/com/makeit/controller/saas/SaasDeviceController.java
server-common/src/main/resources/locale/business_messages.properties
server-generator/src/main/java/com/makeit/com/makeit/controller/PlatDeviceController.java
server-generator/src/main/java/com/makeit/com/makeit/controller/PlatDeviceOtherController.java
server-generator/src/test/java/CodeGenerator.java
server-service/src/main/java/com/makeit/dto/platform/device/PlatDeviceDetailDTO.java
server-service/src/main/java/com/makeit/entity/platform/device/PlatDevice.java
server-service/src/main/java/com/makeit/entity/platform/device/PlatDeviceOther.java
server-service/src/main/java/com/makeit/mapper/platform/device/PlatDeviceMapper.java
server-service/src/main/java/com/makeit/mapper/platform/device/PlatDeviceOtherMapper.java
server-service/src/main/java/com/makeit/service/platform/auth/impl/PlatUserServiceImpl.java
server-service/src/main/java/com/makeit/service/platform/device/PlatDeviceOtherService.java
server-service/src/main/java/com/makeit/service/platform/device/PlatDeviceService.java
server-service/src/main/java/com/makeit/service/platform/device/impl/PlatDeviceOtherServiceImpl.java
server-service/src/main/java/com/makeit/service/platform/device/impl/PlatDeviceServiceImpl.java
db/inti-elder.sql
View file @
d1fe33b5
...
...
@@ -233,4 +233,54 @@ CREATE TABLE `plat_alarm_config`
)
ENGINE
=
INNODB
DEFAULT
CHARSET
=
utf8mb4
COMMENT
=
'告警配置'
;
CREATE
TABLE
`plat_device`
(
`id`
varchar
(
64
)
NOT
NULL
COMMENT
'id'
,
ori_device_id
varchar
(
64
)
NOT
NULL
COMMENT
'原始设备ID'
,
name
varchar
(
100
)
NOT
NULL
COMMENT
'设备名称'
,
product_name
varchar
(
100
)
NOT
NULL
COMMENT
'产品名称'
,
firmware_version
varchar
(
100
)
NOT
NULL
COMMENT
'固件版本'
,
registration_date
datetime
NOT
NULL
COMMENT
'注册时间'
,
last_online_data
datetime
NOT
NULL
COMMENT
'最后上线时间'
,
description
VARCHAR
(
1024
)
DEFAULT
NULL
COMMENT
'说明'
,
status
char
(
1
)
NOT
NULL
COMMENT
'状态 数据字典 1 在线 0离线'
,
org_id
varchar
(
64
)
NULL
COMMENT
'组织id'
,
city_org_id
varchar
(
64
)
NULL
COMMENT
'城市组织id'
,
district_org_id
varchar
(
64
)
NULL
COMMENT
'区组织id'
,
street_org_id
varchar
(
64
)
NULL
COMMENT
'街道组织id'
,
org_path
varchar
(
64
)
NULL
COMMENT
'组织路径'
,
`create_by`
varchar
(
64
)
DEFAULT
NULL
COMMENT
'创建者'
,
`create_date`
datetime
DEFAULT
NULL
COMMENT
'创建时间'
,
`update_by`
varchar
(
64
)
DEFAULT
NULL
COMMENT
'更新者'
,
`update_date`
datetime
DEFAULT
NULL
COMMENT
'更新时间'
,
del_flag
char
(
1
)
not
null
comment
' 删除标志 0否 1是 '
,
`tenant_id`
varchar
(
64
)
DEFAULT
NULL
COMMENT
' 租户id '
,
PRIMARY
KEY
(
`id`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb4
COMMENT
=
'设备'
;
CREATE
TABLE
`plat_device_other`
(
`id`
varchar
(
64
)
NOT
NULL
COMMENT
'id'
,
device_id
varchar
(
64
)
NOT
NULL
COMMENT
'设备id'
,
ori_device_id
varchar
(
64
)
NOT
NULL
COMMENT
'原始设备id'
,
installation
varchar
(
64
)
NULL
COMMENT
'设备安装方式'
,
indicator_light
varchar
(
64
)
NULL
COMMENT
'开关指示灯'
,
attribute
varchar
(
3000
)
NULL
COMMENT
'设备属性json'
,
wifi_name
varchar
(
200
)
NOT
NULL
COMMENT
'wifi名称'
,
wifi_password
varchar
(
200
)
NOT
NULL
COMMENT
'wifi密码'
,
protocol_address
varchar
(
100
)
NOT
NULL
COMMENT
'协议地址'
,
protocol_port
varchar
(
100
)
NOT
NULL
COMMENT
'协议端口'
,
protocol_account
varchar
(
200
)
NOT
NULL
COMMENT
'协议账号'
,
protocol_password
varchar
(
200
)
NOT
NULL
COMMENT
'协议密码'
,
`create_by`
varchar
(
64
)
DEFAULT
NULL
COMMENT
'创建者'
,
`create_date`
datetime
DEFAULT
NULL
COMMENT
'创建时间'
,
`update_by`
varchar
(
64
)
DEFAULT
NULL
COMMENT
'更新者'
,
`update_date`
datetime
DEFAULT
NULL
COMMENT
'更新时间'
,
del_flag
char
(
1
)
not
null
comment
' 删除标志 0否 1是 '
,
`tenant_id`
varchar
(
64
)
DEFAULT
NULL
COMMENT
' 租户id '
,
PRIMARY
KEY
(
`id`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb4
COMMENT
=
'设备其他信息'
;
saas-module/src/main/java/com/makeit/controller/saas/SaasDeviceController.java
0 → 100644
View file @
d1fe33b5
package
com
.
makeit
.
controller
.
saas
;
import
com.makeit.common.dto.BaseIdDTO
;
import
com.makeit.common.page.PageReqDTO
;
import
com.makeit.common.page.PageVO
;
import
com.makeit.common.response.ApiResponseEntity
;
import
com.makeit.common.response.ApiResponseUtils
;
import
com.makeit.dto.platform.device.PlatDeviceDetailDTO
;
import
com.makeit.entity.platform.device.PlatDevice
;
import
com.makeit.service.platform.device.PlatDeviceService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
@Api
(
tags
=
"租户管理-租户设备管理"
)
@RestController
@RequestMapping
(
"/saas/device"
)
public
class
SaasDeviceController
{
@Autowired
private
PlatDeviceService
platDeviceService
;
@ApiOperation
(
"列表"
)
@PostMapping
(
"page"
)
public
ApiResponseEntity
<
PageVO
<
PlatDevice
>>
page
(
@RequestBody
PageReqDTO
<
PlatDevice
>
pageReqDTO
)
{
return
ApiResponseUtils
.
success
(
platDeviceService
.
page
(
pageReqDTO
));
}
@ApiOperation
(
"设备信息"
)
@PostMapping
(
"detail"
)
public
ApiResponseEntity
<
PlatDeviceDetailDTO
>
detail
(
@RequestBody
BaseIdDTO
baseIdDTO
)
{
return
ApiResponseUtils
.
success
(
platDeviceService
.
getDetailDTO
(
baseIdDTO
.
getId
()));
}
@ApiOperation
(
"设备编辑"
)
@PostMapping
(
"edit"
)
public
ApiResponseEntity
<
Void
>
edit
(
@RequestBody
PlatDevice
platDevice
)
{
return
ApiResponseUtils
.
success
(
platDeviceService
.
edit
(
platDevice
));
}
@ApiOperation
(
"实时数据"
)
@PostMapping
(
"realTimeDate"
)
public
ApiResponseEntity
<
PlatDevice
>
realTimeDate
(
@RequestBody
PlatDevice
platDevice
)
{
//todo
return
null
;
}
@ApiOperation
(
"数据分析"
)
@PostMapping
(
"dataAnalysis"
)
public
ApiResponseEntity
<
PlatDevice
>
dataAnalysis
(
@RequestBody
PlatDevice
platDevice
)
{
//todo
return
null
;
}
}
server-common/src/main/resources/locale/business_messages.properties
View file @
d1fe33b5
...
...
@@ -54,7 +54,7 @@ SYSTEM.ERROR.TMP.TOKEN.BLANK=验证码不匹配
SYSTEM.ERROR.TOKEN.BLANK.OR.NOT.EXIST
=
token失效或不存在
SYSTEM.ERROR.NO.PERMISSION
=
无权限访问
SYSTEM.ERROR.TENANT.ID.NOT.BLANK
=
厂别
id不能为空
SYSTEM.ERROR.TENANT.ID.NOT.BLANK
=
租户
id不能为空
SYSTEM.ERROR.TENANT.NOT.EXIST
=
该厂别不存在或者被禁用
SYSTEM.ERROR.DUPLICATE.REQUEST
=
请勿重复请求
...
...
server-generator/src/main/java/com/makeit/com/makeit/controller/PlatDeviceController.java
0 → 100644
View file @
d1fe33b5
package
com
.
makeit
.
com
.
makeit
.
controller
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
/**
* <p>
* 设备 前端控制器
* </p>
*
* @author eugene young
* @since 2023-09-05
*/
@RestController
@RequestMapping
(
"/plat-device"
)
public
class
PlatDeviceController
{
}
server-generator/src/main/java/com/makeit/com/makeit/controller/PlatDeviceOtherController.java
0 → 100644
View file @
d1fe33b5
package
com
.
makeit
.
com
.
makeit
.
controller
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
/**
* <p>
* 设备其他信息 前端控制器
* </p>
*
* @author eugene young
* @since 2023-09-05
*/
@RestController
@RequestMapping
(
"/plat-device-other"
)
public
class
PlatDeviceOtherController
{
}
server-generator/src/test/java/CodeGenerator.java
View file @
d1fe33b5
...
...
@@ -106,7 +106,7 @@ public class CodeGenerator {
// 使用重点 下列字段填写表名 运行方法
// strategy.setInclude("edu_teacher","..."); // 多表-逆向工程
strategy
.
setInclude
(
"plat_
alarm_config
"
);
strategy
.
setInclude
(
"plat_
device"
,
"plat_device_other
"
);
strategy
.
setNaming
(
NamingStrategy
.
underline_to_camel
);
//数据库表映射到实体的命名策略
strategy
.
setTablePrefix
(
pc
.
getModuleName
()
+
"_"
);
//生成实体属性时去掉表"_"前缀并且第一个字母大写 如:gmt_create -> gmtCreate
...
...
server-service/src/main/java/com/makeit/dto/platform/device/PlatDeviceDetailDTO.java
0 → 100644
View file @
d1fe33b5
package
com
.
makeit
.
dto
.
platform
.
device
;
import
com.makeit.entity.platform.device.PlatDevice
;
import
com.makeit.entity.platform.device.PlatDeviceOther
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
@Data
public
class
PlatDeviceDetailDTO
{
@ApiModelProperty
(
value
=
"基本信息"
)
private
PlatDevice
platDevice
;
@ApiModelProperty
(
value
=
"其他信息"
)
private
PlatDeviceOther
platDeviceOther
;
}
server-service/src/main/java/com/makeit/entity/platform/device/PlatDevice.java
0 → 100644
View file @
d1fe33b5
package
com
.
makeit
.
entity
.
platform
.
device
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
java.time.LocalDateTime
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.makeit.common.entity.BaseBusEntity
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
/**
* <p>
* 设备
* </p>
*
* @author eugene young
* @since 2023-09-05
*/
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@ApiModel
(
value
=
"PlatDevice对象"
,
description
=
"设备"
)
public
class
PlatDevice
extends
BaseBusEntity
{
private
static
final
long
serialVersionUID
=
1L
;
@ApiModelProperty
(
value
=
"原始设备ID"
)
private
String
oriDeviceId
;
@ApiModelProperty
(
value
=
"设备名称"
)
private
String
name
;
@ApiModelProperty
(
value
=
"产品名称"
)
private
String
productName
;
@ApiModelProperty
(
value
=
"固件版本"
)
private
String
firmwareVersion
;
@ApiModelProperty
(
value
=
"注册时间"
)
private
LocalDateTime
registrationDate
;
@ApiModelProperty
(
value
=
"最后上线时间"
)
private
LocalDateTime
lastOnlineData
;
@ApiModelProperty
(
value
=
"说明"
)
private
String
description
;
@ApiModelProperty
(
value
=
"状态 数据字典 1 在线 0离线"
)
private
String
status
;
@ApiModelProperty
(
value
=
"组织id"
)
private
String
orgId
;
@ApiModelProperty
(
value
=
"城市组织id"
)
private
String
cityOrgId
;
@ApiModelProperty
(
value
=
"区组织id"
)
private
String
districtOrgId
;
@ApiModelProperty
(
value
=
"街道组织id"
)
private
String
streetOrgId
;
@ApiModelProperty
(
value
=
"组织路径"
)
private
String
orgPath
;
}
server-service/src/main/java/com/makeit/entity/platform/device/PlatDeviceOther.java
0 → 100644
View file @
d1fe33b5
package
com
.
makeit
.
entity
.
platform
.
device
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.makeit.common.entity.BaseBusEntity
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
/**
* <p>
* 设备其他信息
* </p>
*
* @author eugene young
* @since 2023-09-05
*/
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@ApiModel
(
value
=
"PlatDeviceOther对象"
,
description
=
"设备其他信息"
)
public
class
PlatDeviceOther
extends
BaseBusEntity
{
private
static
final
long
serialVersionUID
=
1L
;
@ApiModelProperty
(
value
=
"设备id"
)
private
String
deviceId
;
@ApiModelProperty
(
value
=
"原始设备id"
)
private
String
oriDeviceId
;
@ApiModelProperty
(
value
=
"设备安装方式"
)
private
String
installation
;
@ApiModelProperty
(
value
=
"开关指示灯"
)
private
String
indicatorLight
;
@ApiModelProperty
(
value
=
"设备属性json"
)
private
String
attribute
;
@ApiModelProperty
(
value
=
"wifi名称"
)
private
String
wifiName
;
@ApiModelProperty
(
value
=
"wifi密码"
)
private
String
wifiPassword
;
@ApiModelProperty
(
value
=
"协议地址"
)
private
String
protocolAddress
;
@ApiModelProperty
(
value
=
"协议端口"
)
private
String
protocolPort
;
@ApiModelProperty
(
value
=
"协议账号"
)
private
String
protocolAccount
;
@ApiModelProperty
(
value
=
"协议密码"
)
private
String
protocolPassword
;
}
server-service/src/main/java/com/makeit/mapper/platform/device/PlatDeviceMapper.java
0 → 100644
View file @
d1fe33b5
package
com
.
makeit
.
mapper
.
platform
.
device
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.makeit.entity.platform.device.PlatDevice
;
/**
* <p>
* 设备 Mapper 接口
* </p>
*
* @author eugene young
* @since 2023-09-05
*/
public
interface
PlatDeviceMapper
extends
BaseMapper
<
PlatDevice
>
{
}
server-service/src/main/java/com/makeit/mapper/platform/device/PlatDeviceOtherMapper.java
0 → 100644
View file @
d1fe33b5
package
com
.
makeit
.
mapper
.
platform
.
device
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.makeit.entity.platform.device.PlatDeviceOther
;
/**
* <p>
* 设备其他信息 Mapper 接口
* </p>
*
* @author eugene young
* @since 2023-09-05
*/
public
interface
PlatDeviceOtherMapper
extends
BaseMapper
<
PlatDeviceOther
>
{
}
server-service/src/main/java/com/makeit/service/platform/auth/impl/PlatUserServiceImpl.java
View file @
d1fe33b5
...
...
@@ -30,6 +30,7 @@ import com.makeit.enums.CommonEnum;
import
com.makeit.enums.IsTenantAccountEnum
;
import
com.makeit.enums.biz.auth.SysEnum
;
import
com.makeit.exception.BusinessException
;
import
com.makeit.global.aspect.tenant.TenantIdIgnore
;
import
com.makeit.global.aspect.tenant.TenantIdUtil
;
import
com.makeit.mapper.platform.auth.PlatUserMapper
;
import
com.makeit.module.admin.dto.plat.PlatMenuDTOVO
;
...
...
@@ -130,7 +131,10 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser>
.
like
(
StringUtils
.
isNotBlank
(
dto
.
getAccount
()),
PlatUser:
:
getAccount
,
dto
.
getAccount
())
.
like
(
StringUtils
.
isNotBlank
(
dto
.
getUsername
()),
PlatUser:
:
getUsername
,
dto
.
getUsername
())
.
like
(
StringUtils
.
isNotBlank
(
dto
.
getMobile
()),
PlatUser:
:
getMobile
,
dto
.
getMobile
())
.
eq
(
StringUtils
.
isNotBlank
(
dto
.
getStatus
()),
PlatUser:
:
getStatus
,
dto
.
getStatus
());
.
eq
(
StringUtils
.
isNotBlank
(
dto
.
getStatus
()),
PlatUser:
:
getStatus
,
dto
.
getStatus
())
.
eq
(
StringUtils
.
isNotBlank
(
dto
.
getTenantId
()),
PlatUser:
:
getTenantId
,
dto
.
getTenantId
())
.
like
(
StringUtils
.
isNotBlank
(
dto
.
getOrgId
()),
PlatUser:
:
getOrgPath
,
dto
.
getOrgId
())
;
if
(
consumer
!=
null
)
{
consumer
.
accept
(
lambdaQueryWrapper
);
...
...
@@ -334,6 +338,7 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser>
}
@Override
@TenantIdIgnore
public
PlatUserLoginVO
login
(
LoginDTO
loginDTO
)
{
if
(
StringUtils
.
isBlank
(
loginDTO
.
getAccount
()))
{
throw
new
BusinessException
(
CodeMessageEnum
.
SYSTEM_ERROR
);
...
...
server-service/src/main/java/com/makeit/service/platform/device/PlatDeviceOtherService.java
0 → 100644
View file @
d1fe33b5
package
com
.
makeit
.
service
.
platform
.
device
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.makeit.entity.platform.device.PlatDeviceOther
;
/**
* <p>
* 设备其他信息 服务类
* </p>
*
* @author eugene young
* @since 2023-09-05
*/
public
interface
PlatDeviceOtherService
extends
IService
<
PlatDeviceOther
>
{
}
server-service/src/main/java/com/makeit/service/platform/device/PlatDeviceService.java
0 → 100644
View file @
d1fe33b5
package
com
.
makeit
.
service
.
platform
.
device
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.makeit.common.page.PageReqDTO
;
import
com.makeit.common.page.PageVO
;
import
com.makeit.dto.platform.device.PlatDeviceDetailDTO
;
import
com.makeit.entity.platform.device.PlatDevice
;
/**
* <p>
* 设备 服务类
* </p>
*
* @author eugene young
* @since 2023-09-05
*/
public
interface
PlatDeviceService
extends
IService
<
PlatDevice
>
{
/**
* 分页-saas端
* @param pageReqDTO
* @return
*/
PageVO
<
PlatDevice
>
page
(
PageReqDTO
<
PlatDevice
>
pageReqDTO
);
/**
* 设备信息
* @param deviceId
* @return
*/
PlatDeviceDetailDTO
getDetailDTO
(
String
deviceId
);
/**
* 编辑
* @param platDevice
*/
void
edit
(
PlatDevice
platDevice
);
}
server-service/src/main/java/com/makeit/service/platform/device/impl/PlatDeviceOtherServiceImpl.java
0 → 100644
View file @
d1fe33b5
package
com
.
makeit
.
service
.
platform
.
device
.
impl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.makeit.entity.platform.device.PlatDeviceOther
;
import
com.makeit.mapper.platform.device.PlatDeviceOtherMapper
;
import
com.makeit.service.platform.device.PlatDeviceOtherService
;
import
org.springframework.stereotype.Service
;
/**
* <p>
* 设备其他信息 服务实现类
* </p>
*
* @author eugene young
* @since 2023-09-05
*/
@Service
public
class
PlatDeviceOtherServiceImpl
extends
ServiceImpl
<
PlatDeviceOtherMapper
,
PlatDeviceOther
>
implements
PlatDeviceOtherService
{
}
server-service/src/main/java/com/makeit/service/platform/device/impl/PlatDeviceServiceImpl.java
0 → 100644
View file @
d1fe33b5
package
com
.
makeit
.
service
.
platform
.
device
.
impl
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.makeit.common.entity.BaseBusEntity
;
import
com.makeit.common.entity.BaseEntity
;
import
com.makeit.common.page.PageReqDTO
;
import
com.makeit.common.page.PageVO
;
import
com.makeit.dto.platform.device.PlatDeviceDetailDTO
;
import
com.makeit.entity.platform.device.PlatDevice
;
import
com.makeit.entity.platform.device.PlatDeviceOther
;
import
com.makeit.global.aspect.tenant.TenantIdIgnore
;
import
com.makeit.mapper.platform.device.PlatDeviceMapper
;
import
com.makeit.service.platform.device.PlatDeviceOtherService
;
import
com.makeit.service.platform.device.PlatDeviceService
;
import
com.makeit.utils.data.convert.PageUtil
;
import
com.makeit.utils.old.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
/**
* <p>
* 设备 服务实现类
* </p>
*
* @author eugene young
* @since 2023-09-05
*/
@Service
public
class
PlatDeviceServiceImpl
extends
ServiceImpl
<
PlatDeviceMapper
,
PlatDevice
>
implements
PlatDeviceService
{
@Autowired
private
PlatDeviceOtherService
platDeviceOtherService
;
@Override
@TenantIdIgnore
public
PageVO
<
PlatDevice
>
page
(
PageReqDTO
<
PlatDevice
>
pageReqDTO
)
{
PlatDevice
param
=
pageReqDTO
.
getData
();
Page
<
PlatDevice
>
page
=
PageUtil
.
toMpPage
(
pageReqDTO
);
LambdaQueryWrapper
<
PlatDevice
>
lambdaQueryWrapper
=
getLambdaQueryWrapper
(
param
);
Page
<
PlatDevice
>
devicePage
=
page
(
page
,
lambdaQueryWrapper
);
return
PageUtil
.
toPageVO
(
devicePage
);
}
/**
* 设备信息
*
* @param deviceId
* @return
*/
@Override
public
PlatDeviceDetailDTO
getDetailDTO
(
String
deviceId
)
{
PlatDevice
platDevice
=
getById
(
deviceId
);
if
(
platDevice
==
null
){
return
null
;
}
LambdaQueryWrapper
<
PlatDeviceOther
>
deviceOtherLambdaQueryWrapper
=
new
LambdaQueryWrapper
<>();
deviceOtherLambdaQueryWrapper
.
eq
(
PlatDeviceOther:
:
getDeviceId
,
platDevice
.
getId
());
PlatDeviceOther
platDeviceOther
=
platDeviceOtherService
.
getOne
(
deviceOtherLambdaQueryWrapper
,
false
);
PlatDeviceDetailDTO
detailDTO
=
new
PlatDeviceDetailDTO
();
detailDTO
.
setPlatDevice
(
platDevice
);
detailDTO
.
setPlatDeviceOther
(
platDeviceOther
);
return
detailDTO
;
}
private
LambdaQueryWrapper
<
PlatDevice
>
getLambdaQueryWrapper
(
PlatDevice
param
)
{
return
new
LambdaQueryWrapper
<
PlatDevice
>()
.
eq
(
StringUtils
.
isNotBlank
(
param
.
getOriDeviceId
()),
PlatDevice:
:
getOriDeviceId
,
param
.
getOriDeviceId
())
.
like
(
StringUtils
.
isNotBlank
(
param
.
getName
()),
PlatDevice:
:
getName
,
param
.
getName
())
.
eq
(
StringUtils
.
isNotBlank
(
param
.
getStatus
()),
PlatDevice:
:
getStatus
,
param
.
getStatus
())
.
like
(
StringUtils
.
isNotBlank
(
param
.
getProductName
()),
PlatDevice:
:
getProductName
,
param
.
getProductName
())
.
eq
(
StringUtils
.
isNotBlank
(
param
.
getTenantId
()),
BaseBusEntity:
:
getTenantId
,
param
.
getTenantId
())
.
orderByDesc
(
BaseEntity:
:
getUpdateDate
);
}
/**
* 编辑
*
* @param platDevice
*/
@Override
@Transactional
public
void
edit
(
PlatDevice
platDevice
)
{
LambdaUpdateWrapper
<
PlatDevice
>
updateWrapper
=
Wrappers
.
lambdaUpdate
(
PlatDevice
.
class
)
.
eq
(
BaseEntity:
:
getId
,
platDevice
.
getId
())
.
set
(
PlatDevice:
:
getOriDeviceId
,
platDevice
.
getOriDeviceId
())
.
set
(
PlatDevice:
:
getName
,
platDevice
.
getName
())
.
set
(
PlatDevice:
:
getProductName
,
platDevice
.
getProductName
())
.
set
(
PlatDevice:
:
getDescription
,
platDevice
.
getDescription
());
this
.
update
(
updateWrapper
);
}
}
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