BUGFIX:1. 排序优化,添加唯一约束和重试

2.like前先查询是否有被like
This commit is contained in:
2025-10-13 17:35:27 +08:00
parent 6ac9680c64
commit 19c08f4237
4 changed files with 112 additions and 40 deletions

View File

@@ -22,4 +22,22 @@ public interface CollectionSortMapper extends CommonMapper<CollectionSort> {
@Select("SELECT * FROM collection_sort WHERE parent_id IN (SELECT id FROM collection_sort WHERE relation_id = #{relationId})")
List<CollectionSort> queryCollectionSortsIsNotDesignByUserLikeRelationId(@Param("relationId") Long relationId);
@Update({
"<script>",
"UPDATE collection_sort",
"SET sort = sort - 1",
"WHERE project_id = #{projectId}",
"AND sort > #{deletedSort}",
"<if test='parentId != null'>",
"AND parent_id = #{parentId}",
"</if>",
"<if test='parentId == null'>",
"AND parent_id IS NULL",
"</if>",
"</script>"
})
void decrementSortAfterDelete(@Param("projectId") Long projectId,
@Param("parentId") Long parentId,
@Param("deletedSort") int deletedSort);
}