feattrash: 优化删除功能和回收站逻辑

- 修改 Markdown 文件和分组的删除逻辑,使用软删除方式
- 更新回收站相关接口和页面展示
-优化前端保存逻辑,支持新建文件和更新文件
- 调整后端 API 接口,使用更合适的 HTTP 方法
This commit is contained in:
ikmkj
2025-07-31 23:58:13 +08:00
parent 1491cfc330
commit c448ababa9
10 changed files with 67 additions and 34 deletions

View File

@@ -3,7 +3,13 @@ package com.test.bijihoudaun.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.test.bijihoudaun.entity.Grouping;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import java.util.List;
@Mapper
public interface GroupingMapper extends BaseMapper<Grouping> {
@Select("SELECT * FROM grouping WHERE is_deleted = 1")
List<Grouping> selectDeleted();
}

View File

@@ -15,6 +15,7 @@ public interface MarkdownFileMapper extends BaseMapper<MarkdownFile> {
@Select("SELECT mf.*, g.grouping as groupingName " +
"FROM markdown_file mf " +
"LEFT JOIN grouping g ON mf.grouping_id = g.id " +
"WHERE mf.is_deleted = 0 " +
"ORDER BY mf.updated_at DESC " +
"LIMIT #{limit}")
List<MarkdownFileVO> selectRecentWithGrouping(@Param("limit") int limit);
@@ -22,7 +23,10 @@ public interface MarkdownFileMapper extends BaseMapper<MarkdownFile> {
@Select("SELECT mf.*, g.grouping as groupingName " +
"FROM markdown_file mf " +
"LEFT JOIN grouping g ON mf.grouping_id = g.id " +
"WHERE mf.grouping_id = #{groupingId} " +
"WHERE mf.grouping_id = #{groupingId} AND mf.is_deleted = 0 " +
"ORDER BY mf.updated_at DESC")
List<MarkdownFileVO> selectByGroupingIdWithGrouping(@Param("groupingId") String groupingId);
@Select("SELECT * FROM markdown_file WHERE is_deleted = 1")
List<MarkdownFile> selectDeleted();
}