mirror of
https://github.com/continew-org/continew-admin.git
synced 2025-09-10 20:57:14 +08:00
优化:优化日志表结构(新增 module 所属模块字段);优化日志引擎部分代码;使用 defaultIfNull() 和 blankToDefault 替换部分三元运算符代码(便于阅读及理解);将 BaseEntity 重命名为 BaseDO
This commit is contained in:
@@ -31,6 +31,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
import cn.hutool.core.lang.tree.Tree;
|
||||
|
||||
import top.charles7c.cnadmin.common.model.vo.R;
|
||||
import top.charles7c.cnadmin.monitor.annotation.Log;
|
||||
import top.charles7c.cnadmin.system.model.query.DeptQuery;
|
||||
import top.charles7c.cnadmin.system.model.vo.DeptVO;
|
||||
import top.charles7c.cnadmin.system.service.DeptService;
|
||||
@@ -49,6 +50,7 @@ public class CommonController {
|
||||
|
||||
private final DeptService deptService;
|
||||
|
||||
@Log(ignore = true)
|
||||
@Operation(summary = "查询部门树", description = "查询树结构的部门列表")
|
||||
@GetMapping("/tree/dept")
|
||||
public R<List<Tree<Long>>> deptTree(@Validated DeptQuery query) {
|
||||
|
@@ -30,6 +30,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
import top.charles7c.cnadmin.common.model.query.PageQuery;
|
||||
import top.charles7c.cnadmin.common.model.vo.PageDataVO;
|
||||
import top.charles7c.cnadmin.common.model.vo.R;
|
||||
import top.charles7c.cnadmin.monitor.annotation.Log;
|
||||
import top.charles7c.cnadmin.monitor.model.query.LoginLogQuery;
|
||||
import top.charles7c.cnadmin.monitor.model.query.OperationLogQuery;
|
||||
import top.charles7c.cnadmin.monitor.model.query.SystemLogQuery;
|
||||
@@ -53,6 +54,7 @@ public class LogController {
|
||||
|
||||
private final LogService logService;
|
||||
|
||||
@Log(module = "登录日志")
|
||||
@Operation(summary = "分页查询登录日志列表")
|
||||
@GetMapping("/login")
|
||||
public R<PageDataVO<LoginLogVO>> list(@Validated LoginLogQuery query, @Validated PageQuery pageQuery) {
|
||||
@@ -60,6 +62,7 @@ public class LogController {
|
||||
return R.ok(pageDataVO);
|
||||
}
|
||||
|
||||
@Log(module = "操作日志")
|
||||
@Operation(summary = "分页查询操作日志列表")
|
||||
@GetMapping("/operation")
|
||||
public R<PageDataVO<OperationLogVO>> list(@Validated OperationLogQuery query, @Validated PageQuery pageQuery) {
|
||||
@@ -67,6 +70,7 @@ public class LogController {
|
||||
return R.ok(pageDataVO);
|
||||
}
|
||||
|
||||
@Log(module = "系统日志")
|
||||
@Operation(summary = "分页查询系统日志列表")
|
||||
@GetMapping("/system")
|
||||
public R<PageDataVO<SystemLogVO>> list(@Validated SystemLogQuery query, @Validated PageQuery pageQuery) {
|
||||
@@ -74,6 +78,7 @@ public class LogController {
|
||||
return R.ok(pageDataVO);
|
||||
}
|
||||
|
||||
@Log(module = "系统日志")
|
||||
@Operation(summary = "查看系统日志详情")
|
||||
@GetMapping("/system/{logId}")
|
||||
public R<SystemLogDetailVO> detail(@PathVariable Long logId) {
|
||||
|
@@ -58,7 +58,7 @@ import top.charles7c.cnadmin.monitor.model.vo.*;
|
||||
@RequestMapping("/monitor/online/user")
|
||||
public class OnlineUserController {
|
||||
|
||||
@Operation(summary = "分页查询在线用户列表")
|
||||
@Operation(summary = "分页查询列表")
|
||||
@GetMapping
|
||||
public R<PageDataVO<OnlineUserVO>> list(@Validated OnlineUserQuery query, @Validated PageQuery pageQuery) {
|
||||
List<LoginUser> loginUserList = new ArrayList<>();
|
||||
|
@@ -46,7 +46,7 @@ import top.charles7c.cnadmin.system.service.DeptService;
|
||||
public class DeptController extends BaseController<DeptService, DeptVO, DeptVO, DeptQuery, DeptRequest> {
|
||||
|
||||
@Override
|
||||
@Operation(summary = "查询部门列表树")
|
||||
@Operation(summary = "查询列表树")
|
||||
public R<List<DeptVO>> list(@Validated DeptQuery query) {
|
||||
List<DeptVO> list = baseService.list(query);
|
||||
return R.ok(baseService.buildListTree(list));
|
||||
|
@@ -43,15 +43,16 @@ CREATE TABLE IF NOT EXISTS `sys_user` (
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `sys_log` (
|
||||
`log_id` bigint(20) unsigned AUTO_INCREMENT COMMENT '日志ID',
|
||||
`description` varchar(255) DEFAULT NULL COMMENT '日志描述',
|
||||
`request_url` varchar(512) NOT NULL DEFAULT '' COMMENT '请求URL',
|
||||
`request_method` varchar(10) DEFAULT NULL COMMENT '请求方式',
|
||||
`request_headers` text COMMENT '请求头',
|
||||
`description` varchar(255) NOT NULL COMMENT '日志描述',
|
||||
`module` varchar(255) NOT NULL COMMENT '所属模块',
|
||||
`request_url` varchar(512) NOT NULL COMMENT '请求URL',
|
||||
`request_method` varchar(10) NOT NULL COMMENT '请求方式',
|
||||
`request_headers` text DEFAULT NULL COMMENT '请求头',
|
||||
`request_body` text DEFAULT NULL COMMENT '请求体',
|
||||
`status_code` int(11) unsigned DEFAULT NULL COMMENT '状态码',
|
||||
`status_code` int(11) unsigned NOT NULL COMMENT '状态码',
|
||||
`response_headers` text DEFAULT NULL COMMENT '响应头',
|
||||
`response_body` mediumtext DEFAULT NULL COMMENT '响应体',
|
||||
`elapsed_time` bigint(20) unsigned DEFAULT NULL COMMENT '请求耗时(ms)',
|
||||
`elapsed_time` bigint(20) unsigned NOT NULL COMMENT '请求耗时(ms)',
|
||||
`status` tinyint(1) unsigned DEFAULT 1 COMMENT '操作状态(1成功 2失败)',
|
||||
`client_ip` varchar(255) DEFAULT NULL COMMENT '客户端IP',
|
||||
`location` varchar(512) DEFAULT NULL COMMENT 'IP归属地',
|
||||
|
Reference in New Issue
Block a user