feat(recycle-bin): 实现回收站功能
- 在数据库中添加逻辑删除字段和相关索引- 新增回收站相关实体类和接口 - 实现回收站列表查询、项目恢复、永久删除和清空回收站等功能 - 前端集成回收站接口,支持回收站页面操作
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
package com.test.bijihoudaun.controller;
|
||||
|
||||
import com.test.bijihoudaun.common.response.R;
|
||||
import com.test.bijihoudaun.entity.TrashItemVo;
|
||||
import com.test.bijihoudaun.service.TrashService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/trash")
|
||||
@Tag(name = "回收站管理")
|
||||
public class TrashController {
|
||||
|
||||
@Autowired
|
||||
private TrashService trashService;
|
||||
|
||||
@GetMapping
|
||||
@Operation(summary = "获取回收站列表")
|
||||
public R<List<TrashItemVo>> getTrashItems() {
|
||||
return R.success(trashService.getTrashItems());
|
||||
}
|
||||
|
||||
@PostMapping("/restore/{type}/{id}")
|
||||
@Operation(summary = "恢复项目")
|
||||
public R<Void> restoreItem(@PathVariable String type, @PathVariable String id) {
|
||||
trashService.restoreItem(id, type);
|
||||
return R.success();
|
||||
}
|
||||
|
||||
@DeleteMapping("/permanently/{type}/{id}")
|
||||
@Operation(summary = "永久删除项目")
|
||||
public R<Void> permanentlyDeleteItem(@PathVariable String type, @PathVariable String id) {
|
||||
trashService.permanentlyDeleteItem(id, type);
|
||||
return R.success();
|
||||
}
|
||||
|
||||
@DeleteMapping("/clean")
|
||||
@Operation(summary = "清空回收站")
|
||||
public R<Void> cleanTrash() {
|
||||
trashService.cleanTrash();
|
||||
return R.success();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user