feat(trash): 优化回收站物品恢复和永久删除逻辑

- 在 GroupingMapper 和 MarkdownFileMapper 中添加物理删除和恢复的 SQL 操作
- 优化 HomePage组件中的删除操作,删除后刷新分组树并回到主视图
- 在 TrashServiceImpl 中实现物品恢复和永久删除的业务逻辑- 为 TrashItemVo 中的 deletedAt 字段添加 JSON 格式化注解
This commit is contained in:
ikmkj
2025-08-01 00:14:34 +08:00
parent c448ababa9
commit b0a714df83
6 changed files with 38 additions and 28 deletions

View File

@@ -2,8 +2,13 @@ package com.test.bijihoudaun.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.test.bijihoudaun.entity.Grouping;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import java.util.List;
@@ -12,4 +17,10 @@ public interface GroupingMapper extends BaseMapper<Grouping> {
@Select("SELECT * FROM grouping WHERE is_deleted = 1")
List<Grouping> selectDeleted();
@Delete("DELETE FROM grouping WHERE id = #{id}")
void physicalDeleteById(@Param("id") Long id);
@Update("UPDATE grouping SET is_deleted = 0, deleted_at = NULL, deleted_by = NULL WHERE id = #{id}")
void restoreById(@Param("id") Long id);
}