日志管理功能
This commit is contained in:
parent
26c0da2796
commit
3826f7f885
|
@ -1,8 +1,10 @@
|
||||||
package com.isu.gaswellwatch.controller;
|
package com.isu.gaswellwatch.controller;
|
||||||
|
|
||||||
|
|
||||||
|
import com.isu.gaswellwatch.annotation.OperationLog;
|
||||||
import com.isu.gaswellwatch.entity.Dictionary;
|
import com.isu.gaswellwatch.entity.Dictionary;
|
||||||
import com.isu.gaswellwatch.entity.Response;
|
import com.isu.gaswellwatch.entity.Response;
|
||||||
|
import com.isu.gaswellwatch.enums.LogType;
|
||||||
import com.isu.gaswellwatch.service.DictionaryService;
|
import com.isu.gaswellwatch.service.DictionaryService;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
|
@ -22,18 +24,21 @@ public class DictionaryController {
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/add")
|
@PostMapping("/add")
|
||||||
|
@OperationLog(description = "新增字典", type = LogType.ADD)
|
||||||
public Response<String> add(@RequestBody @Valid Dictionary dictionary){
|
public Response<String> add(@RequestBody @Valid Dictionary dictionary){
|
||||||
dictionaryService.add(dictionary);
|
dictionaryService.add(dictionary);
|
||||||
return Response.succeed();
|
return Response.succeed();
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/edit")
|
@PostMapping("/edit")
|
||||||
|
@OperationLog(description = "修改字典", type = LogType.UPDATE)
|
||||||
public Response<String> edit(@RequestBody @Valid Dictionary dictionary){
|
public Response<String> edit(@RequestBody @Valid Dictionary dictionary){
|
||||||
dictionaryService.edit(dictionary);
|
dictionaryService.edit(dictionary);
|
||||||
return Response.succeed();
|
return Response.succeed();
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/delete")
|
@GetMapping("/delete")
|
||||||
|
@OperationLog(description = "删除字典", type = LogType.DELETE)
|
||||||
public Response<String> delete(@RequestParam Long id){
|
public Response<String> delete(@RequestParam Long id){
|
||||||
dictionaryService.delete(id);
|
dictionaryService.delete(id);
|
||||||
return Response.succeed();
|
return Response.succeed();
|
||||||
|
|
|
@ -25,8 +25,8 @@ public class UserOperationRecordController {
|
||||||
private UserOperationRecordService operationRecordService;
|
private UserOperationRecordService operationRecordService;
|
||||||
|
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
public Response<Page<UserOperationRecordVO>> page(@RequestParam Integer currentPage,
|
public Response<Page<UserOperationRecordVO>> page(@RequestParam(defaultValue = "1") Integer currentPage,
|
||||||
@RequestParam Integer pageSize,
|
@RequestParam(defaultValue = "10") Integer pageSize,
|
||||||
@RequestParam(required = false) Integer type,
|
@RequestParam(required = false) Integer type,
|
||||||
@RequestParam(required = false) String username,
|
@RequestParam(required = false) String username,
|
||||||
@RequestParam(required = false) String nickname,
|
@RequestParam(required = false) String nickname,
|
||||||
|
|
|
@ -28,7 +28,10 @@ public class UserOperationRecord extends Model<UserOperationRecord> implements S
|
||||||
* 操作类型
|
* 操作类型
|
||||||
*/
|
*/
|
||||||
private Integer type;
|
private Integer type;
|
||||||
|
/**
|
||||||
|
* 日志标题
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
/**
|
/**
|
||||||
* 用户名
|
* 用户名
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -29,9 +29,9 @@ public class AsyncLogTaskFactory {
|
||||||
if(operationRecordService.CACHE.isEmpty()){
|
if(operationRecordService.CACHE.isEmpty()){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
List<UserOperationRecord> operationRecords = new ArrayList<>(operationRecordService.CACHE_BASE_CAPACITY);
|
List<UserOperationRecord> operationRecords = new ArrayList<>(UserOperationRecordServiceImpl.CACHE_BASE_CAPACITY);
|
||||||
try {
|
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()) {
|
if (operationRecordService.CACHE.isEmpty()) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue