feat(character): 添加用户人设接口及排序管理
新增 /character/addUserCharacter 端点,支持用户将人设加入个人列表并自动维护排序数组。引入 KeyboardUserCharacterAddDTO、KeyboardUserSortMapper 及相关错误码,实现事务级插入与排序更新。
This commit is contained in:
@@ -4,6 +4,7 @@ import cn.dev33.satoken.stp.StpUtil;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.yolo.keyborad.common.BaseResponse;
|
||||
import com.yolo.keyborad.common.ResultUtils;
|
||||
import com.yolo.keyborad.model.dto.userCharacter.KeyboardUserCharacterAddDTO;
|
||||
import com.yolo.keyborad.model.dto.userCharacter.KeyboardUserCharacterDTO;
|
||||
import com.yolo.keyborad.model.dto.userCharacter.KeyboardUserCharacterSortUpdateDTO;
|
||||
import com.yolo.keyborad.model.entity.KeyboardCharacter;
|
||||
@@ -49,7 +50,7 @@ public class CharacterController {
|
||||
@Operation(summary = "人设详情", description = "人设详情接口")
|
||||
public BaseResponse<KeyboardCharacterRespVO> detail(@RequestParam("id") Long id) {
|
||||
KeyboardCharacter character = characterService.getById(id);
|
||||
return ResultUtils.success(BeanUtil.copyProperties(character ,KeyboardCharacterRespVO.class));
|
||||
return ResultUtils.success(BeanUtil.copyProperties(character, KeyboardCharacterRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/listByTag")
|
||||
@@ -67,10 +68,16 @@ public class CharacterController {
|
||||
|
||||
|
||||
@PostMapping("/updateUserCharacterSort")
|
||||
@Operation(summary = "更新用户人设排序",description = "更新用户人设排序接口")
|
||||
@Operation(summary = "更新用户人设排序", description = "更新用户人设排序接口")
|
||||
public BaseResponse<Boolean> updateUserCharacterSort(@RequestBody KeyboardUserCharacterSortUpdateDTO sortUpdateDTO) {
|
||||
characterService.updateSort(sortUpdateDTO);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
}
|
||||
@PostMapping("/addUserCharacter")
|
||||
@Operation(summary = "添加用户人设", description = "添加用户人设接口")
|
||||
public BaseResponse<Boolean> addUserCharacter(@RequestBody KeyboardUserCharacterAddDTO addDTO) {
|
||||
characterService.addUserCharacter(addDTO);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user