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; }