Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gxpt_ht
Overview
Overview
Details
Activity
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
pseer
gxpt_ht
Commits
a76a0965
Commit
a76a0965
authored
Nov 03, 2023
by
YG8999
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
设备网关代码
parent
73b221b1
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
1106 additions
and
0 deletions
+1106
-0
DeviceController.java
...in/java/share/web/controller/system/DeviceController.java
+104
-0
DeviceGatewayController.java
.../share/web/controller/system/DeviceGatewayController.java
+104
-0
Device.java
share-system/src/main/java/share/system/domain/Device.java
+91
-0
DeviceGateway.java
...stem/src/main/java/share/system/domain/DeviceGateway.java
+101
-0
DeviceGatewayMapper.java
...rc/main/java/share/system/mapper/DeviceGatewayMapper.java
+62
-0
DeviceMapper.java
...ystem/src/main/java/share/system/mapper/DeviceMapper.java
+62
-0
DeviceGatewayService.java
.../main/java/share/system/service/DeviceGatewayService.java
+62
-0
DeviceService.java
...tem/src/main/java/share/system/service/DeviceService.java
+62
-0
DeviceGatewayServiceImpl.java
...a/share/system/service/impl/DeviceGatewayServiceImpl.java
+97
-0
DeviceServiceImpl.java
...ain/java/share/system/service/impl/DeviceServiceImpl.java
+97
-0
DeviceGatewayMapper.xml
.../src/main/resources/mapper/system/DeviceGatewayMapper.xml
+137
-0
DeviceMapper.xml
...-system/src/main/resources/mapper/system/DeviceMapper.xml
+127
-0
No files found.
share-admin/src/main/java/share/web/controller/system/DeviceController.java
0 → 100644
View file @
a76a0965
package
share
.
web
.
controller
.
system
;
import
java.util.List
;
import
javax.servlet.http.HttpServletResponse
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PutMapping
;
import
org.springframework.web.bind.annotation.DeleteMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
share.common.annotation.Log
;
import
share.common.core.controller.BaseController
;
import
share.common.core.domain.AjaxResult
;
import
share.common.enums.BusinessType
;
import
share.system.domain.Device
;
import
share.system.service.DeviceService
;
import
share.common.utils.poi.ExcelUtil
;
import
share.common.core.page.TableDataInfo
;
/**
* 设备信息Controller
*
* @author wuwenlong
* @date 2023-11-03
*/
@RestController
@RequestMapping
(
"/system/device"
)
public
class
DeviceController
extends
BaseController
{
@Autowired
private
DeviceService
deviceService
;
/**
* 查询设备信息列表
*/
@PreAuthorize
(
"@ss.hasPermi('system:device:list')"
)
@GetMapping
(
"/list"
)
public
TableDataInfo
list
(
Device
device
)
{
startPage
();
List
<
Device
>
list
=
deviceService
.
selectDeviceList
(
device
);
return
getDataTable
(
list
);
}
/**
* 导出设备信息列表
*/
@PreAuthorize
(
"@ss.hasPermi('system:device:export')"
)
@Log
(
title
=
"设备信息"
,
businessType
=
BusinessType
.
EXPORT
)
@PostMapping
(
"/export"
)
public
void
export
(
HttpServletResponse
response
,
Device
device
)
{
List
<
Device
>
list
=
deviceService
.
selectDeviceList
(
device
);
ExcelUtil
<
Device
>
util
=
new
ExcelUtil
<
Device
>(
Device
.
class
);
util
.
exportExcel
(
response
,
list
,
"设备信息数据"
);
}
/**
* 获取设备信息详细信息
*/
@PreAuthorize
(
"@ss.hasPermi('system:device:query')"
)
@GetMapping
(
value
=
"/{id}"
)
public
AjaxResult
getInfo
(
@PathVariable
(
"id"
)
Long
id
)
{
return
success
(
deviceService
.
selectDeviceById
(
id
));
}
/**
* 新增设备信息
*/
@PreAuthorize
(
"@ss.hasPermi('system:device:add')"
)
@Log
(
title
=
"设备信息"
,
businessType
=
BusinessType
.
INSERT
)
@PostMapping
public
AjaxResult
add
(
@RequestBody
Device
device
)
{
return
toAjax
(
deviceService
.
insertDevice
(
device
));
}
/**
* 修改设备信息
*/
@PreAuthorize
(
"@ss.hasPermi('system:device:edit')"
)
@Log
(
title
=
"设备信息"
,
businessType
=
BusinessType
.
UPDATE
)
@PutMapping
public
AjaxResult
edit
(
@RequestBody
Device
device
)
{
return
toAjax
(
deviceService
.
updateDevice
(
device
));
}
/**
* 删除设备信息
*/
@PreAuthorize
(
"@ss.hasPermi('system:device:remove')"
)
@Log
(
title
=
"设备信息"
,
businessType
=
BusinessType
.
DELETE
)
@DeleteMapping
(
"/{ids}"
)
public
AjaxResult
remove
(
@PathVariable
Long
[]
ids
)
{
return
toAjax
(
deviceService
.
deleteDeviceByIds
(
ids
));
}
}
share-admin/src/main/java/share/web/controller/system/DeviceGatewayController.java
0 → 100644
View file @
a76a0965
package
share
.
web
.
controller
.
system
;
import
java.util.List
;
import
javax.servlet.http.HttpServletResponse
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PutMapping
;
import
org.springframework.web.bind.annotation.DeleteMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
share.common.annotation.Log
;
import
share.common.core.controller.BaseController
;
import
share.common.core.domain.AjaxResult
;
import
share.common.enums.BusinessType
;
import
share.system.domain.DeviceGateway
;
import
share.system.service.DeviceGatewayService
;
import
share.common.utils.poi.ExcelUtil
;
import
share.common.core.page.TableDataInfo
;
/**
* 设备网关信息Controller
*
* @author wuwenlong
* @date 2023-11-03
*/
@RestController
@RequestMapping
(
"/system/gateway"
)
public
class
DeviceGatewayController
extends
BaseController
{
@Autowired
private
DeviceGatewayService
deviceGatewayService
;
/**
* 查询设备网关信息列表
*/
@PreAuthorize
(
"@ss.hasPermi('system:gateway:list')"
)
@GetMapping
(
"/list"
)
public
TableDataInfo
list
(
DeviceGateway
deviceGateway
)
{
startPage
();
List
<
DeviceGateway
>
list
=
deviceGatewayService
.
selectDeviceGatewayList
(
deviceGateway
);
return
getDataTable
(
list
);
}
/**
* 导出设备网关信息列表
*/
@PreAuthorize
(
"@ss.hasPermi('system:gateway:export')"
)
@Log
(
title
=
"设备网关信息"
,
businessType
=
BusinessType
.
EXPORT
)
@PostMapping
(
"/export"
)
public
void
export
(
HttpServletResponse
response
,
DeviceGateway
deviceGateway
)
{
List
<
DeviceGateway
>
list
=
deviceGatewayService
.
selectDeviceGatewayList
(
deviceGateway
);
ExcelUtil
<
DeviceGateway
>
util
=
new
ExcelUtil
<
DeviceGateway
>(
DeviceGateway
.
class
);
util
.
exportExcel
(
response
,
list
,
"设备网关信息数据"
);
}
/**
* 获取设备网关信息详细信息
*/
@PreAuthorize
(
"@ss.hasPermi('system:gateway:query')"
)
@GetMapping
(
value
=
"/{id}"
)
public
AjaxResult
getInfo
(
@PathVariable
(
"id"
)
Long
id
)
{
return
success
(
deviceGatewayService
.
selectDeviceGatewayById
(
id
));
}
/**
* 新增设备网关信息
*/
@PreAuthorize
(
"@ss.hasPermi('system:gateway:add')"
)
@Log
(
title
=
"设备网关信息"
,
businessType
=
BusinessType
.
INSERT
)
@PostMapping
public
AjaxResult
add
(
@RequestBody
DeviceGateway
deviceGateway
)
{
return
toAjax
(
deviceGatewayService
.
insertDeviceGateway
(
deviceGateway
));
}
/**
* 修改设备网关信息
*/
@PreAuthorize
(
"@ss.hasPermi('system:gateway:edit')"
)
@Log
(
title
=
"设备网关信息"
,
businessType
=
BusinessType
.
UPDATE
)
@PutMapping
public
AjaxResult
edit
(
@RequestBody
DeviceGateway
deviceGateway
)
{
return
toAjax
(
deviceGatewayService
.
updateDeviceGateway
(
deviceGateway
));
}
/**
* 删除设备网关信息
*/
@PreAuthorize
(
"@ss.hasPermi('system:gateway:remove')"
)
@Log
(
title
=
"设备网关信息"
,
businessType
=
BusinessType
.
DELETE
)
@DeleteMapping
(
"/{ids}"
)
public
AjaxResult
remove
(
@PathVariable
Long
[]
ids
)
{
return
toAjax
(
deviceGatewayService
.
deleteDeviceGatewayByIds
(
ids
));
}
}
share-system/src/main/java/share/system/domain/Device.java
0 → 100644
View file @
a76a0965
package
share
.
system
.
domain
;
import
org.apache.commons.lang3.builder.ToStringBuilder
;
import
org.apache.commons.lang3.builder.ToStringStyle
;
import
share.common.annotation.Excel
;
import
share.common.core.domain.BaseEntity
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableLogic
;
import
lombok.Data
;
/**
* 设备信息对象 s_device
*
* @author wuwenlong
* @date 2023-11-03
*/
@Data
public
class
Device
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
1L
;
/** $column.columnComment */
private
Long
id
;
/** 设备名称 */
@Excel
(
name
=
"设备名称"
)
private
String
devName
;
/** 设备 MAC */
@Excel
(
name
=
"设备 MAC"
)
private
String
devMac
;
/** 设备ID */
@Excel
(
name
=
"设备ID"
)
private
String
devId
;
/** 设备密码 */
@Excel
(
name
=
"设备密码"
)
private
String
devPsw
;
/** 设备版本号 */
@Excel
(
name
=
"设备版本号"
)
private
String
devVer
;
/** 设备类型 */
@Excel
(
name
=
"设备类型 "
)
private
String
devType
;
/** 项目ID */
@Excel
(
name
=
"项目ID"
)
private
String
projtId
;
/** 项目密码 */
@Excel
(
name
=
"项目密码"
)
private
String
projtPsw
;
/** 分组 */
@Excel
(
name
=
"分组"
)
private
String
group
;
/** 设备状态 */
@Excel
(
name
=
"设备状态"
)
private
String
status
;
/** 设备位置 */
@Excel
(
name
=
"设备位置"
)
private
String
devPosition
;
@Override
public
String
toString
()
{
return
new
ToStringBuilder
(
this
,
ToStringStyle
.
MULTI_LINE_STYLE
)
.
append
(
"id"
,
getId
())
.
append
(
"devName"
,
getDevName
())
.
append
(
"devMac"
,
getDevMac
())
.
append
(
"devId"
,
getDevId
())
.
append
(
"devPsw"
,
getDevPsw
())
.
append
(
"devVer"
,
getDevVer
())
.
append
(
"devType"
,
getDevType
())
.
append
(
"projtId"
,
getProjtId
())
.
append
(
"projtPsw"
,
getProjtPsw
())
.
append
(
"group"
,
getGroup
())
.
append
(
"status"
,
getStatus
())
.
append
(
"createBy"
,
getCreateBy
())
.
append
(
"createTime"
,
getCreateTime
())
.
append
(
"updateBy"
,
getUpdateBy
())
.
append
(
"updateTime"
,
getUpdateTime
())
.
append
(
"remark"
,
getRemark
())
.
append
(
"devPosition"
,
getDevPosition
())
.
toString
();
}
}
share-system/src/main/java/share/system/domain/DeviceGateway.java
0 → 100644
View file @
a76a0965
package
share
.
system
.
domain
;
import
org.apache.commons.lang3.builder.ToStringBuilder
;
import
org.apache.commons.lang3.builder.ToStringStyle
;
import
share.common.annotation.Excel
;
import
share.common.core.domain.BaseEntity
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableLogic
;
import
lombok.Data
;
/**
* 设备网关信息对象 s_device_gateway
*
* @author wuwenlong
* @date 2023-11-03
*/
@Data
public
class
DeviceGateway
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
1L
;
/** $column.columnComment */
private
Long
id
;
/** 设备名称 */
@Excel
(
name
=
"设备名称"
)
private
String
devName
;
/** 设备 MAC */
@Excel
(
name
=
"设备 MAC"
)
private
String
devMac
;
/** 设备ID */
@Excel
(
name
=
"设备ID"
)
private
String
devId
;
/** 设备密码 */
@Excel
(
name
=
"设备密码"
)
private
String
devPsw
;
/** 设备版本号 */
@Excel
(
name
=
"设备版本号"
)
private
String
devVer
;
/** 设备类型 */
@Excel
(
name
=
"设备类型 "
)
private
String
devType
;
/** 网络分组 */
@Excel
(
name
=
"网络分组"
)
private
String
group
;
/** 设备状态 */
@Excel
(
name
=
"设备状态"
)
private
String
status
;
/** mqtt服务器IP/域名 */
@Excel
(
name
=
"mqtt服务器IP/域名"
)
private
String
mqttIp
;
/** mqtt服务器端口 */
@Excel
(
name
=
"mqtt服务器端口"
)
private
String
mqttPort
;
/** mqtt用户名 */
@Excel
(
name
=
"mqtt用户名"
)
private
String
mqttUser
;
/** mqtt用户密码 */
@Excel
(
name
=
"mqtt用户密码"
)
private
String
mqttPaswd
;
/** 设备位置 */
@Excel
(
name
=
"设备位置"
)
private
String
devPosition
;
@Override
public
String
toString
()
{
return
new
ToStringBuilder
(
this
,
ToStringStyle
.
MULTI_LINE_STYLE
)
.
append
(
"id"
,
getId
())
.
append
(
"devName"
,
getDevName
())
.
append
(
"devMac"
,
getDevMac
())
.
append
(
"devId"
,
getDevId
())
.
append
(
"devPsw"
,
getDevPsw
())
.
append
(
"devVer"
,
getDevVer
())
.
append
(
"devType"
,
getDevType
())
.
append
(
"group"
,
getGroup
())
.
append
(
"status"
,
getStatus
())
.
append
(
"mqttIp"
,
getMqttIp
())
.
append
(
"mqttPort"
,
getMqttPort
())
.
append
(
"mqttUser"
,
getMqttUser
())
.
append
(
"mqttPaswd"
,
getMqttPaswd
())
.
append
(
"createBy"
,
getCreateBy
())
.
append
(
"createTime"
,
getCreateTime
())
.
append
(
"updateBy"
,
getUpdateBy
())
.
append
(
"updateTime"
,
getUpdateTime
())
.
append
(
"remark"
,
getRemark
())
.
append
(
"devPosition"
,
getDevPosition
())
.
toString
();
}
}
share-system/src/main/java/share/system/mapper/DeviceGatewayMapper.java
0 → 100644
View file @
a76a0965
package
share
.
system
.
mapper
;
import
java.util.List
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
share.system.domain.DeviceGateway
;
/**
* 设备网关信息Mapper接口
*
* @author wuwenlong
* @date 2023-11-03
*/
public
interface
DeviceGatewayMapper
extends
BaseMapper
<
DeviceGateway
>
{
/**
* 查询设备网关信息
*
* @param id 设备网关信息主键
* @return 设备网关信息
*/
public
DeviceGateway
selectDeviceGatewayById
(
Long
id
);
/**
* 查询设备网关信息列表
*
* @param deviceGateway 设备网关信息
* @return 设备网关信息集合
*/
public
List
<
DeviceGateway
>
selectDeviceGatewayList
(
DeviceGateway
deviceGateway
);
/**
* 新增设备网关信息
*
* @param deviceGateway 设备网关信息
* @return 结果
*/
public
int
insertDeviceGateway
(
DeviceGateway
deviceGateway
);
/**
* 修改设备网关信息
*
* @param deviceGateway 设备网关信息
* @return 结果
*/
public
int
updateDeviceGateway
(
DeviceGateway
deviceGateway
);
/**
* 删除设备网关信息
*
* @param id 设备网关信息主键
* @return 结果
*/
public
int
deleteDeviceGatewayById
(
Long
id
);
/**
* 批量删除设备网关信息
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public
int
deleteDeviceGatewayByIds
(
Long
[]
ids
);
}
share-system/src/main/java/share/system/mapper/DeviceMapper.java
0 → 100644
View file @
a76a0965
package
share
.
system
.
mapper
;
import
java.util.List
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
share.system.domain.Device
;
/**
* 设备信息Mapper接口
*
* @author wuwenlong
* @date 2023-11-03
*/
public
interface
DeviceMapper
extends
BaseMapper
<
Device
>
{
/**
* 查询设备信息
*
* @param id 设备信息主键
* @return 设备信息
*/
public
Device
selectDeviceById
(
Long
id
);
/**
* 查询设备信息列表
*
* @param device 设备信息
* @return 设备信息集合
*/
public
List
<
Device
>
selectDeviceList
(
Device
device
);
/**
* 新增设备信息
*
* @param device 设备信息
* @return 结果
*/
public
int
insertDevice
(
Device
device
);
/**
* 修改设备信息
*
* @param device 设备信息
* @return 结果
*/
public
int
updateDevice
(
Device
device
);
/**
* 删除设备信息
*
* @param id 设备信息主键
* @return 结果
*/
public
int
deleteDeviceById
(
Long
id
);
/**
* 批量删除设备信息
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public
int
deleteDeviceByIds
(
Long
[]
ids
);
}
share-system/src/main/java/share/system/service/DeviceGatewayService.java
0 → 100644
View file @
a76a0965
package
share
.
system
.
service
;
import
java.util.List
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
share.system.domain.DeviceGateway
;
/**
* 设备网关信息Service接口
*
* @author wuwenlong
* @date 2023-11-03
*/
public
interface
DeviceGatewayService
extends
IService
<
DeviceGateway
>
{
/**
* 查询设备网关信息
*
* @param id 设备网关信息主键
* @return 设备网关信息
*/
public
DeviceGateway
selectDeviceGatewayById
(
Long
id
);
/**
* 查询设备网关信息列表
*
* @param deviceGateway 设备网关信息
* @return 设备网关信息集合
*/
public
List
<
DeviceGateway
>
selectDeviceGatewayList
(
DeviceGateway
deviceGateway
);
/**
* 新增设备网关信息
*
* @param deviceGateway 设备网关信息
* @return 结果
*/
public
int
insertDeviceGateway
(
DeviceGateway
deviceGateway
);
/**
* 修改设备网关信息
*
* @param deviceGateway 设备网关信息
* @return 结果
*/
public
int
updateDeviceGateway
(
DeviceGateway
deviceGateway
);
/**
* 批量删除设备网关信息
*
* @param ids 需要删除的设备网关信息主键集合
* @return 结果
*/
public
int
deleteDeviceGatewayByIds
(
Long
[]
ids
);
/**
* 删除设备网关信息信息
*
* @param id 设备网关信息主键
* @return 结果
*/
public
int
deleteDeviceGatewayById
(
Long
id
);
}
share-system/src/main/java/share/system/service/DeviceService.java
0 → 100644
View file @
a76a0965
package
share
.
system
.
service
;
import
java.util.List
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
share.system.domain.Device
;
/**
* 设备信息Service接口
*
* @author wuwenlong
* @date 2023-11-03
*/
public
interface
DeviceService
extends
IService
<
Device
>
{
/**
* 查询设备信息
*
* @param id 设备信息主键
* @return 设备信息
*/
public
Device
selectDeviceById
(
Long
id
);
/**
* 查询设备信息列表
*
* @param device 设备信息
* @return 设备信息集合
*/
public
List
<
Device
>
selectDeviceList
(
Device
device
);
/**
* 新增设备信息
*
* @param device 设备信息
* @return 结果
*/
public
int
insertDevice
(
Device
device
);
/**
* 修改设备信息
*
* @param device 设备信息
* @return 结果
*/
public
int
updateDevice
(
Device
device
);
/**
* 批量删除设备信息
*
* @param ids 需要删除的设备信息主键集合
* @return 结果
*/
public
int
deleteDeviceByIds
(
Long
[]
ids
);
/**
* 删除设备信息信息
*
* @param id 设备信息主键
* @return 结果
*/
public
int
deleteDeviceById
(
Long
id
);
}
share-system/src/main/java/share/system/service/impl/DeviceGatewayServiceImpl.java
0 → 100644
View file @
a76a0965
package
share
.
system
.
service
.
impl
;
import
java.util.List
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
share.common.utils.DateUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
share.system.mapper.DeviceGatewayMapper
;
import
share.system.domain.DeviceGateway
;
import
share.system.service.DeviceGatewayService
;
/**
* 设备网关信息Service业务层处理
*
* @author wuwenlong
* @date 2023-11-03
*/
@Service
public
class
DeviceGatewayServiceImpl
extends
ServiceImpl
<
DeviceGatewayMapper
,
DeviceGateway
>
implements
DeviceGatewayService
{
@Autowired
private
DeviceGatewayMapper
deviceGatewayMapper
;
/**
* 查询设备网关信息
*
* @param id 设备网关信息主键
* @return 设备网关信息
*/
@Override
public
DeviceGateway
selectDeviceGatewayById
(
Long
id
)
{
return
deviceGatewayMapper
.
selectDeviceGatewayById
(
id
);
}
/**
* 查询设备网关信息列表
*
* @param deviceGateway 设备网关信息
* @return 设备网关信息
*/
@Override
public
List
<
DeviceGateway
>
selectDeviceGatewayList
(
DeviceGateway
deviceGateway
)
{
return
deviceGatewayMapper
.
selectDeviceGatewayList
(
deviceGateway
);
}
/**
* 新增设备网关信息
*
* @param deviceGateway 设备网关信息
* @return 结果
*/
@Override
public
int
insertDeviceGateway
(
DeviceGateway
deviceGateway
)
{
deviceGateway
.
setCreateTime
(
DateUtils
.
getNowDate
());
return
deviceGatewayMapper
.
insertDeviceGateway
(
deviceGateway
);
}
/**
* 修改设备网关信息
*
* @param deviceGateway 设备网关信息
* @return 结果
*/
@Override
public
int
updateDeviceGateway
(
DeviceGateway
deviceGateway
)
{
deviceGateway
.
setUpdateTime
(
DateUtils
.
getNowDate
());
return
deviceGatewayMapper
.
updateDeviceGateway
(
deviceGateway
);
}
/**
* 批量删除设备网关信息
*
* @param ids 需要删除的设备网关信息主键
* @return 结果
*/
@Override
public
int
deleteDeviceGatewayByIds
(
Long
[]
ids
)
{
return
deviceGatewayMapper
.
deleteDeviceGatewayByIds
(
ids
);
}
/**
* 删除设备网关信息信息
*
* @param id 设备网关信息主键
* @return 结果
*/
@Override
public
int
deleteDeviceGatewayById
(
Long
id
)
{
return
deviceGatewayMapper
.
deleteDeviceGatewayById
(
id
);
}
}
share-system/src/main/java/share/system/service/impl/DeviceServiceImpl.java
0 → 100644
View file @
a76a0965
package
share
.
system
.
service
.
impl
;
import
java.util.List
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
share.common.utils.DateUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
share.system.mapper.DeviceMapper
;
import
share.system.domain.Device
;
import
share.system.service.DeviceService
;
/**
* 设备信息Service业务层处理
*
* @author wuwenlong
* @date 2023-11-03
*/
@Service
public
class
DeviceServiceImpl
extends
ServiceImpl
<
DeviceMapper
,
Device
>
implements
DeviceService
{
@Autowired
private
DeviceMapper
deviceMapper
;
/**
* 查询设备信息
*
* @param id 设备信息主键
* @return 设备信息
*/
@Override
public
Device
selectDeviceById
(
Long
id
)
{
return
deviceMapper
.
selectDeviceById
(
id
);
}
/**
* 查询设备信息列表
*
* @param device 设备信息
* @return 设备信息
*/
@Override
public
List
<
Device
>
selectDeviceList
(
Device
device
)
{
return
deviceMapper
.
selectDeviceList
(
device
);
}
/**
* 新增设备信息
*
* @param device 设备信息
* @return 结果
*/
@Override
public
int
insertDevice
(
Device
device
)
{
device
.
setCreateTime
(
DateUtils
.
getNowDate
());
return
deviceMapper
.
insertDevice
(
device
);
}
/**
* 修改设备信息
*
* @param device 设备信息
* @return 结果
*/
@Override
public
int
updateDevice
(
Device
device
)
{
device
.
setUpdateTime
(
DateUtils
.
getNowDate
());
return
deviceMapper
.
updateDevice
(
device
);
}
/**
* 批量删除设备信息
*
* @param ids 需要删除的设备信息主键
* @return 结果
*/
@Override
public
int
deleteDeviceByIds
(
Long
[]
ids
)
{
return
deviceMapper
.
deleteDeviceByIds
(
ids
);
}
/**
* 删除设备信息信息
*
* @param id 设备信息主键
* @return 结果
*/
@Override
public
int
deleteDeviceById
(
Long
id
)
{
return
deviceMapper
.
deleteDeviceById
(
id
);
}
}
share-system/src/main/resources/mapper/system/DeviceGatewayMapper.xml
0 → 100644
View file @
a76a0965
<?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=
"share.system.mapper.DeviceGatewayMapper"
>
<resultMap
type=
"DeviceGateway"
id=
"DeviceGatewayResult"
>
<result
property=
"id"
column=
"id"
/>
<result
property=
"devName"
column=
"dev_name"
/>
<result
property=
"devMac"
column=
"dev_mac"
/>
<result
property=
"devId"
column=
"dev_id"
/>
<result
property=
"devPsw"
column=
"dev_psw"
/>
<result
property=
"devVer"
column=
"dev_ver"
/>
<result
property=
"devType"
column=
"dev_type"
/>
<result
property=
"group"
column=
"group"
/>
<result
property=
"status"
column=
"status"
/>
<result
property=
"mqttIp"
column=
"mqtt_iP"
/>
<result
property=
"mqttPort"
column=
"mqtt_port"
/>
<result
property=
"mqttUser"
column=
"mqtt_user"
/>
<result
property=
"mqttPaswd"
column=
"mqtt_paswd"
/>
<result
property=
"createBy"
column=
"create_by"
/>
<result
property=
"createTime"
column=
"create_time"
/>
<result
property=
"updateBy"
column=
"update_by"
/>
<result
property=
"updateTime"
column=
"update_time"
/>
<result
property=
"remark"
column=
"remark"
/>
<result
property=
"devPosition"
column=
"dev_position"
/>
</resultMap>
<sql
id=
"selectDeviceGatewayVo"
>
select id, dev_name, dev_mac, dev_id, dev_psw, dev_ver, dev_type, group, status, mqtt_iP, mqtt_port, mqtt_user, mqtt_paswd, create_by, create_time, update_by, update_time, remark, dev_position from s_device_gateway
</sql>
<select
id=
"selectDeviceGatewayList"
parameterType=
"DeviceGateway"
resultMap=
"DeviceGatewayResult"
>
<include
refid=
"selectDeviceGatewayVo"
/>
<where>
<if
test=
"devName != null and devName != ''"
>
and dev_name like concat('%', #{devName}, '%')
</if>
<if
test=
"devMac != null and devMac != ''"
>
and dev_mac = #{devMac}
</if>
<if
test=
"devId != null and devId != ''"
>
and dev_id = #{devId}
</if>
<if
test=
"devPsw != null and devPsw != ''"
>
and dev_psw = #{devPsw}
</if>
<if
test=
"devVer != null and devVer != ''"
>
and dev_ver = #{devVer}
</if>
<if
test=
"devType != null and devType != ''"
>
and dev_type = #{devType}
</if>
<if
test=
"group != null and group != ''"
>
and group = #{group}
</if>
<if
test=
"status != null and status != ''"
>
and status = #{status}
</if>
<if
test=
"mqttIp != null and mqttIp != ''"
>
and mqtt_iP = #{mqttIp}
</if>
<if
test=
"mqttPort != null and mqttPort != ''"
>
and mqtt_port = #{mqttPort}
</if>
<if
test=
"mqttUser != null and mqttUser != ''"
>
and mqtt_user = #{mqttUser}
</if>
<if
test=
"mqttPaswd != null and mqttPaswd != ''"
>
and mqtt_paswd = #{mqttPaswd}
</if>
<if
test=
"devPosition != null and devPosition != ''"
>
and dev_position = #{devPosition}
</if>
</where>
</select>
<select
id=
"selectDeviceGatewayById"
parameterType=
"Long"
resultMap=
"DeviceGatewayResult"
>
<include
refid=
"selectDeviceGatewayVo"
/>
where id = #{id}
</select>
<insert
id=
"insertDeviceGateway"
parameterType=
"DeviceGateway"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into s_device_gateway
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"devName != null"
>
dev_name,
</if>
<if
test=
"devMac != null and devMac != ''"
>
dev_mac,
</if>
<if
test=
"devId != null and devId != ''"
>
dev_id,
</if>
<if
test=
"devPsw != null"
>
dev_psw,
</if>
<if
test=
"devVer != null"
>
dev_ver,
</if>
<if
test=
"devType != null"
>
dev_type,
</if>
<if
test=
"group != null"
>
group,
</if>
<if
test=
"status != null"
>
status,
</if>
<if
test=
"mqttIp != null"
>
mqtt_iP,
</if>
<if
test=
"mqttPort != null"
>
mqtt_port,
</if>
<if
test=
"mqttUser != null"
>
mqtt_user,
</if>
<if
test=
"mqttPaswd != null"
>
mqtt_paswd,
</if>
<if
test=
"createBy != null"
>
create_by,
</if>
<if
test=
"createTime != null"
>
create_time,
</if>
<if
test=
"updateBy != null"
>
update_by,
</if>
<if
test=
"updateTime != null"
>
update_time,
</if>
<if
test=
"remark != null"
>
remark,
</if>
<if
test=
"devPosition != null"
>
dev_position,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"devName != null"
>
#{devName},
</if>
<if
test=
"devMac != null and devMac != ''"
>
#{devMac},
</if>
<if
test=
"devId != null and devId != ''"
>
#{devId},
</if>
<if
test=
"devPsw != null"
>
#{devPsw},
</if>
<if
test=
"devVer != null"
>
#{devVer},
</if>
<if
test=
"devType != null"
>
#{devType},
</if>
<if
test=
"group != null"
>
#{group},
</if>
<if
test=
"status != null"
>
#{status},
</if>
<if
test=
"mqttIp != null"
>
#{mqttIp},
</if>
<if
test=
"mqttPort != null"
>
#{mqttPort},
</if>
<if
test=
"mqttUser != null"
>
#{mqttUser},
</if>
<if
test=
"mqttPaswd != null"
>
#{mqttPaswd},
</if>
<if
test=
"createBy != null"
>
#{createBy},
</if>
<if
test=
"createTime != null"
>
#{createTime},
</if>
<if
test=
"updateBy != null"
>
#{updateBy},
</if>
<if
test=
"updateTime != null"
>
#{updateTime},
</if>
<if
test=
"remark != null"
>
#{remark},
</if>
<if
test=
"devPosition != null"
>
#{devPosition},
</if>
</trim>
</insert>
<update
id=
"updateDeviceGateway"
parameterType=
"DeviceGateway"
>
update s_device_gateway
<trim
prefix=
"SET"
suffixOverrides=
","
>
<if
test=
"devName != null"
>
dev_name = #{devName},
</if>
<if
test=
"devMac != null and devMac != ''"
>
dev_mac = #{devMac},
</if>
<if
test=
"devId != null and devId != ''"
>
dev_id = #{devId},
</if>
<if
test=
"devPsw != null"
>
dev_psw = #{devPsw},
</if>
<if
test=
"devVer != null"
>
dev_ver = #{devVer},
</if>
<if
test=
"devType != null"
>
dev_type = #{devType},
</if>
<if
test=
"group != null"
>
group = #{group},
</if>
<if
test=
"status != null"
>
status = #{status},
</if>
<if
test=
"mqttIp != null"
>
mqtt_iP = #{mqttIp},
</if>
<if
test=
"mqttPort != null"
>
mqtt_port = #{mqttPort},
</if>
<if
test=
"mqttUser != null"
>
mqtt_user = #{mqttUser},
</if>
<if
test=
"mqttPaswd != null"
>
mqtt_paswd = #{mqttPaswd},
</if>
<if
test=
"createBy != null"
>
create_by = #{createBy},
</if>
<if
test=
"createTime != null"
>
create_time = #{createTime},
</if>
<if
test=
"updateBy != null"
>
update_by = #{updateBy},
</if>
<if
test=
"updateTime != null"
>
update_time = #{updateTime},
</if>
<if
test=
"remark != null"
>
remark = #{remark},
</if>
<if
test=
"devPosition != null"
>
dev_position = #{devPosition},
</if>
</trim>
where id = #{id}
</update>
<delete
id=
"deleteDeviceGatewayById"
parameterType=
"Long"
>
delete from s_device_gateway where id = #{id}
</delete>
<delete
id=
"deleteDeviceGatewayByIds"
parameterType=
"String"
>
delete from s_device_gateway where id in
<foreach
item=
"id"
collection=
"array"
open=
"("
separator=
","
close=
")"
>
#{id}
</foreach>
</delete>
</mapper>
\ No newline at end of file
share-system/src/main/resources/mapper/system/DeviceMapper.xml
0 → 100644
View file @
a76a0965
<?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=
"share.system.mapper.DeviceMapper"
>
<resultMap
type=
"Device"
id=
"DeviceResult"
>
<result
property=
"id"
column=
"id"
/>
<result
property=
"devName"
column=
"dev_name"
/>
<result
property=
"devMac"
column=
"dev_mac"
/>
<result
property=
"devId"
column=
"dev_id"
/>
<result
property=
"devPsw"
column=
"dev_psw"
/>
<result
property=
"devVer"
column=
"dev_ver"
/>
<result
property=
"devType"
column=
"dev_type"
/>
<result
property=
"projtId"
column=
"projt_id"
/>
<result
property=
"projtPsw"
column=
"projt_psw"
/>
<result
property=
"group"
column=
"group"
/>
<result
property=
"status"
column=
"status"
/>
<result
property=
"createBy"
column=
"create_by"
/>
<result
property=
"createTime"
column=
"create_time"
/>
<result
property=
"updateBy"
column=
"update_by"
/>
<result
property=
"updateTime"
column=
"update_time"
/>
<result
property=
"remark"
column=
"remark"
/>
<result
property=
"devPosition"
column=
"dev_position"
/>
</resultMap>
<sql
id=
"selectDeviceVo"
>
select id, dev_name, dev_mac, dev_id, dev_psw, dev_ver, dev_type, projt_id, projt_psw, group, status, create_by, create_time, update_by, update_time, remark, dev_position from s_device
</sql>
<select
id=
"selectDeviceList"
parameterType=
"Device"
resultMap=
"DeviceResult"
>
<include
refid=
"selectDeviceVo"
/>
<where>
<if
test=
"devName != null and devName != ''"
>
and dev_name like concat('%', #{devName}, '%')
</if>
<if
test=
"devMac != null and devMac != ''"
>
and dev_mac = #{devMac}
</if>
<if
test=
"devId != null and devId != ''"
>
and dev_id = #{devId}
</if>
<if
test=
"devPsw != null and devPsw != ''"
>
and dev_psw = #{devPsw}
</if>
<if
test=
"devVer != null and devVer != ''"
>
and dev_ver = #{devVer}
</if>
<if
test=
"devType != null and devType != ''"
>
and dev_type = #{devType}
</if>
<if
test=
"projtId != null and projtId != ''"
>
and projt_id = #{projtId}
</if>
<if
test=
"projtPsw != null and projtPsw != ''"
>
and projt_psw = #{projtPsw}
</if>
<if
test=
"group != null and group != ''"
>
and group = #{group}
</if>
<if
test=
"status != null and status != ''"
>
and status = #{status}
</if>
<if
test=
"devPosition != null and devPosition != ''"
>
and dev_position = #{devPosition}
</if>
</where>
</select>
<select
id=
"selectDeviceById"
parameterType=
"Long"
resultMap=
"DeviceResult"
>
<include
refid=
"selectDeviceVo"
/>
where id = #{id}
</select>
<insert
id=
"insertDevice"
parameterType=
"Device"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into s_device
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"devName != null"
>
dev_name,
</if>
<if
test=
"devMac != null and devMac != ''"
>
dev_mac,
</if>
<if
test=
"devId != null and devId != ''"
>
dev_id,
</if>
<if
test=
"devPsw != null"
>
dev_psw,
</if>
<if
test=
"devVer != null"
>
dev_ver,
</if>
<if
test=
"devType != null"
>
dev_type,
</if>
<if
test=
"projtId != null"
>
projt_id,
</if>
<if
test=
"projtPsw != null"
>
projt_psw,
</if>
<if
test=
"group != null"
>
group,
</if>
<if
test=
"status != null"
>
status,
</if>
<if
test=
"createBy != null"
>
create_by,
</if>
<if
test=
"createTime != null"
>
create_time,
</if>
<if
test=
"updateBy != null"
>
update_by,
</if>
<if
test=
"updateTime != null"
>
update_time,
</if>
<if
test=
"remark != null"
>
remark,
</if>
<if
test=
"devPosition != null"
>
dev_position,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"devName != null"
>
#{devName},
</if>
<if
test=
"devMac != null and devMac != ''"
>
#{devMac},
</if>
<if
test=
"devId != null and devId != ''"
>
#{devId},
</if>
<if
test=
"devPsw != null"
>
#{devPsw},
</if>
<if
test=
"devVer != null"
>
#{devVer},
</if>
<if
test=
"devType != null"
>
#{devType},
</if>
<if
test=
"projtId != null"
>
#{projtId},
</if>
<if
test=
"projtPsw != null"
>
#{projtPsw},
</if>
<if
test=
"group != null"
>
#{group},
</if>
<if
test=
"status != null"
>
#{status},
</if>
<if
test=
"createBy != null"
>
#{createBy},
</if>
<if
test=
"createTime != null"
>
#{createTime},
</if>
<if
test=
"updateBy != null"
>
#{updateBy},
</if>
<if
test=
"updateTime != null"
>
#{updateTime},
</if>
<if
test=
"remark != null"
>
#{remark},
</if>
<if
test=
"devPosition != null"
>
#{devPosition},
</if>
</trim>
</insert>
<update
id=
"updateDevice"
parameterType=
"Device"
>
update s_device
<trim
prefix=
"SET"
suffixOverrides=
","
>
<if
test=
"devName != null"
>
dev_name = #{devName},
</if>
<if
test=
"devMac != null and devMac != ''"
>
dev_mac = #{devMac},
</if>
<if
test=
"devId != null and devId != ''"
>
dev_id = #{devId},
</if>
<if
test=
"devPsw != null"
>
dev_psw = #{devPsw},
</if>
<if
test=
"devVer != null"
>
dev_ver = #{devVer},
</if>
<if
test=
"devType != null"
>
dev_type = #{devType},
</if>
<if
test=
"projtId != null"
>
projt_id = #{projtId},
</if>
<if
test=
"projtPsw != null"
>
projt_psw = #{projtPsw},
</if>
<if
test=
"group != null"
>
group = #{group},
</if>
<if
test=
"status != null"
>
status = #{status},
</if>
<if
test=
"createBy != null"
>
create_by = #{createBy},
</if>
<if
test=
"createTime != null"
>
create_time = #{createTime},
</if>
<if
test=
"updateBy != null"
>
update_by = #{updateBy},
</if>
<if
test=
"updateTime != null"
>
update_time = #{updateTime},
</if>
<if
test=
"remark != null"
>
remark = #{remark},
</if>
<if
test=
"devPosition != null"
>
dev_position = #{devPosition},
</if>
</trim>
where id = #{id}
</update>
<delete
id=
"deleteDeviceById"
parameterType=
"Long"
>
delete from s_device where id = #{id}
</delete>
<delete
id=
"deleteDeviceByIds"
parameterType=
"String"
>
delete from s_device where id in
<foreach
item=
"id"
collection=
"array"
open=
"("
separator=
","
close=
")"
>
#{id}
</foreach>
</delete>
</mapper>
\ No newline at end of file
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