From 3826f7f885b8c1a3911a69170745e4a7a4a9a0e6 Mon Sep 17 00:00:00 2001 From: qinjie <463333974@qq.com> Date: Thu, 5 Dec 2024 17:17:12 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A5=E5=BF=97=E7=AE=A1=E7=90=86=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../isu/gaswellwatch/controller/DictionaryController.java | 5 +++++ .../controller/UserOperationRecordController.java | 4 ++-- .../com/isu/gaswellwatch/entity/UserOperationRecord.java | 5 ++++- .../com/isu/gaswellwatch/thread/AsyncLogTaskFactory.java | 4 ++-- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/isu/gaswellwatch/controller/DictionaryController.java b/src/main/java/com/isu/gaswellwatch/controller/DictionaryController.java index 4b05191..6ca460e 100644 --- a/src/main/java/com/isu/gaswellwatch/controller/DictionaryController.java +++ b/src/main/java/com/isu/gaswellwatch/controller/DictionaryController.java @@ -1,8 +1,10 @@ package com.isu.gaswellwatch.controller; +import com.isu.gaswellwatch.annotation.OperationLog; import com.isu.gaswellwatch.entity.Dictionary; import com.isu.gaswellwatch.entity.Response; +import com.isu.gaswellwatch.enums.LogType; import com.isu.gaswellwatch.service.DictionaryService; import jakarta.annotation.Resource; import jakarta.validation.Valid; @@ -22,18 +24,21 @@ public class DictionaryController { @PostMapping("/add") + @OperationLog(description = "新增字典", type = LogType.ADD) public Response add(@RequestBody @Valid Dictionary dictionary){ dictionaryService.add(dictionary); return Response.succeed(); } @PostMapping("/edit") + @OperationLog(description = "修改字典", type = LogType.UPDATE) public Response edit(@RequestBody @Valid Dictionary dictionary){ dictionaryService.edit(dictionary); return Response.succeed(); } @GetMapping("/delete") + @OperationLog(description = "删除字典", type = LogType.DELETE) public Response delete(@RequestParam Long id){ dictionaryService.delete(id); return Response.succeed(); diff --git a/src/main/java/com/isu/gaswellwatch/controller/UserOperationRecordController.java b/src/main/java/com/isu/gaswellwatch/controller/UserOperationRecordController.java index 01f53fc..ac1432e 100644 --- a/src/main/java/com/isu/gaswellwatch/controller/UserOperationRecordController.java +++ b/src/main/java/com/isu/gaswellwatch/controller/UserOperationRecordController.java @@ -25,8 +25,8 @@ public class UserOperationRecordController { private UserOperationRecordService operationRecordService; @GetMapping("/page") - public Response> page(@RequestParam Integer currentPage, - @RequestParam Integer pageSize, + public Response> page(@RequestParam(defaultValue = "1") Integer currentPage, + @RequestParam(defaultValue = "10") Integer pageSize, @RequestParam(required = false) Integer type, @RequestParam(required = false) String username, @RequestParam(required = false) String nickname, diff --git a/src/main/java/com/isu/gaswellwatch/entity/UserOperationRecord.java b/src/main/java/com/isu/gaswellwatch/entity/UserOperationRecord.java index 3d0e7c6..b5acd22 100644 --- a/src/main/java/com/isu/gaswellwatch/entity/UserOperationRecord.java +++ b/src/main/java/com/isu/gaswellwatch/entity/UserOperationRecord.java @@ -28,7 +28,10 @@ public class UserOperationRecord extends Model implements S * 操作类型 */ private Integer type; - + /** + * 日志标题 + */ + private String name; /** * 用户名 */ diff --git a/src/main/java/com/isu/gaswellwatch/thread/AsyncLogTaskFactory.java b/src/main/java/com/isu/gaswellwatch/thread/AsyncLogTaskFactory.java index 5fbdc43..486b6bf 100644 --- a/src/main/java/com/isu/gaswellwatch/thread/AsyncLogTaskFactory.java +++ b/src/main/java/com/isu/gaswellwatch/thread/AsyncLogTaskFactory.java @@ -29,9 +29,9 @@ public class AsyncLogTaskFactory { if(operationRecordService.CACHE.isEmpty()){ return; } - List operationRecords = new ArrayList<>(operationRecordService.CACHE_BASE_CAPACITY); + List operationRecords = new ArrayList<>(UserOperationRecordServiceImpl.CACHE_BASE_CAPACITY); try { - for (int i = 1; i <= operationRecordService.CACHE_BASE_CAPACITY; i++) { + for (int i = 1; i <= UserOperationRecordServiceImpl.CACHE_BASE_CAPACITY; i++) { if (operationRecordService.CACHE.isEmpty()) { break; }