日志管理功能
This commit is contained in:
parent
26c0da2796
commit
3826f7f885
|
@ -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<String> add(@RequestBody @Valid Dictionary dictionary){
|
||||
dictionaryService.add(dictionary);
|
||||
return Response.succeed();
|
||||
}
|
||||
|
||||
@PostMapping("/edit")
|
||||
@OperationLog(description = "修改字典", type = LogType.UPDATE)
|
||||
public Response<String> edit(@RequestBody @Valid Dictionary dictionary){
|
||||
dictionaryService.edit(dictionary);
|
||||
return Response.succeed();
|
||||
}
|
||||
|
||||
@GetMapping("/delete")
|
||||
@OperationLog(description = "删除字典", type = LogType.DELETE)
|
||||
public Response<String> delete(@RequestParam Long id){
|
||||
dictionaryService.delete(id);
|
||||
return Response.succeed();
|
||||
|
|
|
@ -25,8 +25,8 @@ public class UserOperationRecordController {
|
|||
private UserOperationRecordService operationRecordService;
|
||||
|
||||
@GetMapping("/page")
|
||||
public Response<Page<UserOperationRecordVO>> page(@RequestParam Integer currentPage,
|
||||
@RequestParam Integer pageSize,
|
||||
public Response<Page<UserOperationRecordVO>> 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,
|
||||
|
|
|
@ -28,7 +28,10 @@ public class UserOperationRecord extends Model<UserOperationRecord> implements S
|
|||
* 操作类型
|
||||
*/
|
||||
private Integer type;
|
||||
|
||||
/**
|
||||
* 日志标题
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
|
|
|
@ -29,9 +29,9 @@ public class AsyncLogTaskFactory {
|
|||
if(operationRecordService.CACHE.isEmpty()){
|
||||
return;
|
||||
}
|
||||
List<UserOperationRecord> operationRecords = new ArrayList<>(operationRecordService.CACHE_BASE_CAPACITY);
|
||||
List<UserOperationRecord> 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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue