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
1ce984ba
Commit
1ce984ba
authored
Nov 03, 2023
by
YG8999
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
设备网关日志代码
parent
87146584
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
503 additions
and
0 deletions
+503
-0
DeviceLogController.java
...java/share/web/controller/system/DeviceLogController.java
+104
-0
DeviceLog.java
...e-system/src/main/java/share/system/domain/DeviceLog.java
+71
-0
DeviceLogMapper.java
...em/src/main/java/share/system/mapper/DeviceLogMapper.java
+62
-0
DeviceLogService.java
.../src/main/java/share/system/service/DeviceLogService.java
+62
-0
DeviceLogServiceImpl.java
.../java/share/system/service/impl/DeviceLogServiceImpl.java
+97
-0
DeviceLogMapper.xml
...stem/src/main/resources/mapper/system/DeviceLogMapper.xml
+107
-0
No files found.
share-admin/src/main/java/share/web/controller/system/DeviceLogController.java
0 → 100644
View file @
1ce984ba
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.DeviceLog
;
import
share.system.service.DeviceLogService
;
import
share.common.utils.poi.ExcelUtil
;
import
share.common.core.page.TableDataInfo
;
/**
* 设备操作日志Controller
*
* @author wuwenlong
* @date 2023-11-03
*/
@RestController
@RequestMapping
(
"/system/log"
)
public
class
DeviceLogController
extends
BaseController
{
@Autowired
private
DeviceLogService
deviceLogService
;
/**
* 查询设备操作日志列表
*/
@PreAuthorize
(
"@ss.hasPermi('system:log:list')"
)
@GetMapping
(
"/list"
)
public
TableDataInfo
list
(
DeviceLog
deviceLog
)
{
startPage
();
List
<
DeviceLog
>
list
=
deviceLogService
.
selectDeviceLogList
(
deviceLog
);
return
getDataTable
(
list
);
}
/**
* 导出设备操作日志列表
*/
@PreAuthorize
(
"@ss.hasPermi('system:log:export')"
)
@Log
(
title
=
"设备操作日志"
,
businessType
=
BusinessType
.
EXPORT
)
@PostMapping
(
"/export"
)
public
void
export
(
HttpServletResponse
response
,
DeviceLog
deviceLog
)
{
List
<
DeviceLog
>
list
=
deviceLogService
.
selectDeviceLogList
(
deviceLog
);
ExcelUtil
<
DeviceLog
>
util
=
new
ExcelUtil
<
DeviceLog
>(
DeviceLog
.
class
);
util
.
exportExcel
(
response
,
list
,
"设备操作日志数据"
);
}
/**
* 获取设备操作日志详细信息
*/
@PreAuthorize
(
"@ss.hasPermi('system:log:query')"
)
@GetMapping
(
value
=
"/{id}"
)
public
AjaxResult
getInfo
(
@PathVariable
(
"id"
)
Long
id
)
{
return
success
(
deviceLogService
.
selectDeviceLogById
(
id
));
}
/**
* 新增设备操作日志
*/
@PreAuthorize
(
"@ss.hasPermi('system:log:add')"
)
@Log
(
title
=
"设备操作日志"
,
businessType
=
BusinessType
.
INSERT
)
@PostMapping
public
AjaxResult
add
(
@RequestBody
DeviceLog
deviceLog
)
{
return
toAjax
(
deviceLogService
.
insertDeviceLog
(
deviceLog
));
}
/**
* 修改设备操作日志
*/
@PreAuthorize
(
"@ss.hasPermi('system:log:edit')"
)
@Log
(
title
=
"设备操作日志"
,
businessType
=
BusinessType
.
UPDATE
)
@PutMapping
public
AjaxResult
edit
(
@RequestBody
DeviceLog
deviceLog
)
{
return
toAjax
(
deviceLogService
.
updateDeviceLog
(
deviceLog
));
}
/**
* 删除设备操作日志
*/
@PreAuthorize
(
"@ss.hasPermi('system:log:remove')"
)
@Log
(
title
=
"设备操作日志"
,
businessType
=
BusinessType
.
DELETE
)
@DeleteMapping
(
"/{ids}"
)
public
AjaxResult
remove
(
@PathVariable
Long
[]
ids
)
{
return
toAjax
(
deviceLogService
.
deleteDeviceLogByIds
(
ids
));
}
}
share-system/src/main/java/share/system/domain/DeviceLog.java
0 → 100644
View file @
1ce984ba
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_log
*
* @author wuwenlong
* @date 2023-11-03
*/
@Data
public
class
DeviceLog
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
1L
;
/** 主键 */
private
Long
id
;
/** 设备mac */
@Excel
(
name
=
"设备mac"
)
private
String
devMac
;
/** 设备id */
@Excel
(
name
=
"设备id"
)
private
String
devId
;
/** 请求的序列号 */
@Excel
(
name
=
"请求的序列号"
)
private
String
seq
;
/** 消息类型:1-下发,2-上报 */
@Excel
(
name
=
"消息类型:1-下发,2-上报"
)
private
String
mqttType
;
/** 消息描述:开门、开灯、网关设备绑定等 */
@Excel
(
name
=
"消息描述:开门、开灯、网关设备绑定等"
)
private
String
mqttDescribe
;
/** 消息主体参数 */
@Excel
(
name
=
"消息主体参数"
)
private
String
payload
;
/** 消息主题 */
@Excel
(
name
=
"消息主题"
)
private
String
topic
;
@Override
public
String
toString
()
{
return
new
ToStringBuilder
(
this
,
ToStringStyle
.
MULTI_LINE_STYLE
)
.
append
(
"id"
,
getId
())
.
append
(
"devMac"
,
getDevMac
())
.
append
(
"devId"
,
getDevId
())
.
append
(
"seq"
,
getSeq
())
.
append
(
"mqttType"
,
getMqttType
())
.
append
(
"mqttDescribe"
,
getMqttDescribe
())
.
append
(
"payload"
,
getPayload
())
.
append
(
"topic"
,
getTopic
())
.
append
(
"createBy"
,
getCreateBy
())
.
append
(
"createTime"
,
getCreateTime
())
.
append
(
"updateBy"
,
getUpdateBy
())
.
append
(
"updateTime"
,
getUpdateTime
())
.
append
(
"remark"
,
getRemark
())
.
toString
();
}
}
share-system/src/main/java/share/system/mapper/DeviceLogMapper.java
0 → 100644
View file @
1ce984ba
package
share
.
system
.
mapper
;
import
java.util.List
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
share.system.domain.DeviceLog
;
/**
* 设备操作日志Mapper接口
*
* @author wuwenlong
* @date 2023-11-03
*/
public
interface
DeviceLogMapper
extends
BaseMapper
<
DeviceLog
>
{
/**
* 查询设备操作日志
*
* @param id 设备操作日志主键
* @return 设备操作日志
*/
public
DeviceLog
selectDeviceLogById
(
Long
id
);
/**
* 查询设备操作日志列表
*
* @param deviceLog 设备操作日志
* @return 设备操作日志集合
*/
public
List
<
DeviceLog
>
selectDeviceLogList
(
DeviceLog
deviceLog
);
/**
* 新增设备操作日志
*
* @param deviceLog 设备操作日志
* @return 结果
*/
public
int
insertDeviceLog
(
DeviceLog
deviceLog
);
/**
* 修改设备操作日志
*
* @param deviceLog 设备操作日志
* @return 结果
*/
public
int
updateDeviceLog
(
DeviceLog
deviceLog
);
/**
* 删除设备操作日志
*
* @param id 设备操作日志主键
* @return 结果
*/
public
int
deleteDeviceLogById
(
Long
id
);
/**
* 批量删除设备操作日志
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public
int
deleteDeviceLogByIds
(
Long
[]
ids
);
}
share-system/src/main/java/share/system/service/DeviceLogService.java
0 → 100644
View file @
1ce984ba
package
share
.
system
.
service
;
import
java.util.List
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
share.system.domain.DeviceLog
;
/**
* 设备操作日志Service接口
*
* @author wuwenlong
* @date 2023-11-03
*/
public
interface
DeviceLogService
extends
IService
<
DeviceLog
>
{
/**
* 查询设备操作日志
*
* @param id 设备操作日志主键
* @return 设备操作日志
*/
public
DeviceLog
selectDeviceLogById
(
Long
id
);
/**
* 查询设备操作日志列表
*
* @param deviceLog 设备操作日志
* @return 设备操作日志集合
*/
public
List
<
DeviceLog
>
selectDeviceLogList
(
DeviceLog
deviceLog
);
/**
* 新增设备操作日志
*
* @param deviceLog 设备操作日志
* @return 结果
*/
public
int
insertDeviceLog
(
DeviceLog
deviceLog
);
/**
* 修改设备操作日志
*
* @param deviceLog 设备操作日志
* @return 结果
*/
public
int
updateDeviceLog
(
DeviceLog
deviceLog
);
/**
* 批量删除设备操作日志
*
* @param ids 需要删除的设备操作日志主键集合
* @return 结果
*/
public
int
deleteDeviceLogByIds
(
Long
[]
ids
);
/**
* 删除设备操作日志信息
*
* @param id 设备操作日志主键
* @return 结果
*/
public
int
deleteDeviceLogById
(
Long
id
);
}
share-system/src/main/java/share/system/service/impl/DeviceLogServiceImpl.java
0 → 100644
View file @
1ce984ba
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.DeviceLogMapper
;
import
share.system.domain.DeviceLog
;
import
share.system.service.DeviceLogService
;
/**
* 设备操作日志Service业务层处理
*
* @author wuwenlong
* @date 2023-11-03
*/
@Service
public
class
DeviceLogServiceImpl
extends
ServiceImpl
<
DeviceLogMapper
,
DeviceLog
>
implements
DeviceLogService
{
@Autowired
private
DeviceLogMapper
deviceLogMapper
;
/**
* 查询设备操作日志
*
* @param id 设备操作日志主键
* @return 设备操作日志
*/
@Override
public
DeviceLog
selectDeviceLogById
(
Long
id
)
{
return
deviceLogMapper
.
selectDeviceLogById
(
id
);
}
/**
* 查询设备操作日志列表
*
* @param deviceLog 设备操作日志
* @return 设备操作日志
*/
@Override
public
List
<
DeviceLog
>
selectDeviceLogList
(
DeviceLog
deviceLog
)
{
return
deviceLogMapper
.
selectDeviceLogList
(
deviceLog
);
}
/**
* 新增设备操作日志
*
* @param deviceLog 设备操作日志
* @return 结果
*/
@Override
public
int
insertDeviceLog
(
DeviceLog
deviceLog
)
{
deviceLog
.
setCreateTime
(
DateUtils
.
getNowDate
());
return
deviceLogMapper
.
insertDeviceLog
(
deviceLog
);
}
/**
* 修改设备操作日志
*
* @param deviceLog 设备操作日志
* @return 结果
*/
@Override
public
int
updateDeviceLog
(
DeviceLog
deviceLog
)
{
deviceLog
.
setUpdateTime
(
DateUtils
.
getNowDate
());
return
deviceLogMapper
.
updateDeviceLog
(
deviceLog
);
}
/**
* 批量删除设备操作日志
*
* @param ids 需要删除的设备操作日志主键
* @return 结果
*/
@Override
public
int
deleteDeviceLogByIds
(
Long
[]
ids
)
{
return
deviceLogMapper
.
deleteDeviceLogByIds
(
ids
);
}
/**
* 删除设备操作日志信息
*
* @param id 设备操作日志主键
* @return 结果
*/
@Override
public
int
deleteDeviceLogById
(
Long
id
)
{
return
deviceLogMapper
.
deleteDeviceLogById
(
id
);
}
}
share-system/src/main/resources/mapper/system/DeviceLogMapper.xml
0 → 100644
View file @
1ce984ba
<?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.DeviceLogMapper"
>
<resultMap
type=
"DeviceLog"
id=
"DeviceLogResult"
>
<result
property=
"id"
column=
"id"
/>
<result
property=
"devMac"
column=
"dev_mac"
/>
<result
property=
"devId"
column=
"dev_id"
/>
<result
property=
"seq"
column=
"seq"
/>
<result
property=
"mqttType"
column=
"mqtt_type"
/>
<result
property=
"mqttDescribe"
column=
"mqtt_describe"
/>
<result
property=
"payload"
column=
"payload"
/>
<result
property=
"topic"
column=
"topic"
/>
<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"
/>
</resultMap>
<sql
id=
"selectDeviceLogVo"
>
select id, dev_mac, dev_id, seq, mqtt_type, mqtt_describe, payload, topic, create_by, create_time, update_by, update_time, remark from s_device_log
</sql>
<select
id=
"selectDeviceLogList"
parameterType=
"DeviceLog"
resultMap=
"DeviceLogResult"
>
<include
refid=
"selectDeviceLogVo"
/>
<where>
<if
test=
"devMac != null and devMac != ''"
>
and dev_mac = #{devMac}
</if>
<if
test=
"devId != null and devId != ''"
>
and dev_id = #{devId}
</if>
<if
test=
"seq != null and seq != ''"
>
and seq = #{seq}
</if>
<if
test=
"mqttType != null and mqttType != ''"
>
and mqtt_type = #{mqttType}
</if>
<if
test=
"mqttDescribe != null and mqttDescribe != ''"
>
and mqtt_describe = #{mqttDescribe}
</if>
<if
test=
"payload != null and payload != ''"
>
and payload = #{payload}
</if>
<if
test=
"topic != null and topic != ''"
>
and topic = #{topic}
</if>
</where>
</select>
<select
id=
"selectDeviceLogById"
parameterType=
"Long"
resultMap=
"DeviceLogResult"
>
<include
refid=
"selectDeviceLogVo"
/>
where id = #{id}
</select>
<insert
id=
"insertDeviceLog"
parameterType=
"DeviceLog"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into s_device_log
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"devMac != null"
>
dev_mac,
</if>
<if
test=
"devId != null"
>
dev_id,
</if>
<if
test=
"seq != null"
>
seq,
</if>
<if
test=
"mqttType != null"
>
mqtt_type,
</if>
<if
test=
"mqttDescribe != null"
>
mqtt_describe,
</if>
<if
test=
"payload != null"
>
payload,
</if>
<if
test=
"topic != null"
>
topic,
</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>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"devMac != null"
>
#{devMac},
</if>
<if
test=
"devId != null"
>
#{devId},
</if>
<if
test=
"seq != null"
>
#{seq},
</if>
<if
test=
"mqttType != null"
>
#{mqttType},
</if>
<if
test=
"mqttDescribe != null"
>
#{mqttDescribe},
</if>
<if
test=
"payload != null"
>
#{payload},
</if>
<if
test=
"topic != null"
>
#{topic},
</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>
</trim>
</insert>
<update
id=
"updateDeviceLog"
parameterType=
"DeviceLog"
>
update s_device_log
<trim
prefix=
"SET"
suffixOverrides=
","
>
<if
test=
"devMac != null"
>
dev_mac = #{devMac},
</if>
<if
test=
"devId != null"
>
dev_id = #{devId},
</if>
<if
test=
"seq != null"
>
seq = #{seq},
</if>
<if
test=
"mqttType != null"
>
mqtt_type = #{mqttType},
</if>
<if
test=
"mqttDescribe != null"
>
mqtt_describe = #{mqttDescribe},
</if>
<if
test=
"payload != null"
>
payload = #{payload},
</if>
<if
test=
"topic != null"
>
topic = #{topic},
</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>
</trim>
where id = #{id}
</update>
<delete
id=
"deleteDeviceLogById"
parameterType=
"Long"
>
delete from s_device_log where id = #{id}
</delete>
<delete
id=
"deleteDeviceLogByIds"
parameterType=
"String"
>
delete from s_device_log 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