mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-23 07:41:53 +08:00
增加chat role 可见性修改
This commit is contained in:
parent
c44f558e3d
commit
591002f059
@ -73,22 +73,37 @@ public class ChatRoleServiceImpl implements ChatRoleService {
|
||||
ChatRoleVisibilityEnum.valueOfType(req.getVisibility());
|
||||
ChatRoleSourceEnum.valueOfType(req.getRoleSource());
|
||||
// 检查角色是否存在
|
||||
AiChatRoleDO aiChatRoleDO = aiChatRoleMapper.selectById(req.getId());
|
||||
if (aiChatRoleDO == null) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.AI_CHAT_ROLE_NOT_EXIST);
|
||||
}
|
||||
validateChatRoleExists(req.getId());
|
||||
// 转换do
|
||||
AiChatRoleDO updateChatRole = ChatRoleConvert.INSTANCE.convertAiChatRoleDO(req);
|
||||
aiChatRoleMapper.updateById(updateChatRole);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void updateVisibility(ChatRoleUpdateVisibilityReq req) {
|
||||
|
||||
// 转换enum,并校验enum
|
||||
ChatRoleVisibilityEnum.valueOfType(req.getVisibility());
|
||||
// 检查角色是否存在
|
||||
validateChatRoleExists(req.getId());
|
||||
// 更新
|
||||
aiChatRoleMapper.updateById(new AiChatRoleDO()
|
||||
.setId(req.getId())
|
||||
.setVisibility(req.getVisibility())
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(Long chatRoleId) {
|
||||
|
||||
}
|
||||
|
||||
private AiChatRoleDO validateChatRoleExists(Long id) {
|
||||
AiChatRoleDO aiChatRoleDO = aiChatRoleMapper.selectById(id);
|
||||
if (aiChatRoleDO == null) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.AI_CHAT_ROLE_NOT_EXIST);
|
||||
}
|
||||
return aiChatRoleDO;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.ai.vo;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@ -15,6 +16,11 @@ import lombok.experimental.Accessors;
|
||||
@Accessors(chain = true)
|
||||
public class ChatRoleUpdateVisibilityReq extends PageParam {
|
||||
|
||||
@Schema(description = "查询")
|
||||
private String search;
|
||||
@NotNull
|
||||
@Schema(description = "编号")
|
||||
private Long id;
|
||||
|
||||
@NotNull
|
||||
@Schema(description = "发布状态,0表示仅自己可见,1表示公开,2表示禁用")
|
||||
private String visibility;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user