feat(character): 添加用户人设接口及排序管理

新增 /character/addUserCharacter 端点,支持用户将人设加入个人列表并自动维护排序数组。引入 KeyboardUserCharacterAddDTO、KeyboardUserSortMapper 及相关错误码,实现事务级插入与排序更新。
This commit is contained in:
2025-12-04 16:17:29 +08:00
parent 4e6a5a6e18
commit fe19fb8ca2
10 changed files with 151 additions and 31 deletions

View File

@@ -18,4 +18,5 @@ public interface KeyboardUserCharacterMapper extends BaseMapper<KeyboardUserChar
void updateSortByIdAndUserId(@Param("sort") Integer[] sort,@Param("userId") long userId);
List<Long> selectSortByUserId(@Param("userId") Long userId);
}

View File

@@ -0,0 +1,28 @@
package com.yolo.keyborad.mapper;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import java.util.List;
public interface KeyboardUserSortMapper {
/**
* 查询某个用户的人设排序(按顺序展开成列表)
*/
List<Long> selectSortByUserId(@Param("userId") Long userId);
/**
* 更新用户排序数组
*/
int updateSortByUserId(@Param("userId") Long userId,
@Param("sort") Long[] sort);
/**
* 插入一条新的用户排序记录
*/
int insertUserSort(@Param("userId") Long userId,
@Param("sort") Long[] sort);
}