mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-27 01:32:03 +08:00
【调整】调整AI角色模块
This commit is contained in:
parent
c124681c3a
commit
f0a1666e84
@ -12,7 +12,7 @@ import lombok.Getter;
|
|||||||
*/
|
*/
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@Getter
|
@Getter
|
||||||
public enum AiChatRoleClassifyEnum {
|
public enum AiChatRoleCategoryEnum {
|
||||||
|
|
||||||
WRITING("writing", "写作"),
|
WRITING("writing", "写作"),
|
||||||
|
|
||||||
@ -21,17 +21,17 @@ public enum AiChatRoleClassifyEnum {
|
|||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
private String classify;
|
private String category;
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
|
|
||||||
public static AiChatRoleClassifyEnum valueOfClassify(String classify) {
|
public static AiChatRoleCategoryEnum valueOfCategory(String category) {
|
||||||
for (AiChatRoleClassifyEnum itemEnum : AiChatRoleClassifyEnum.values()) {
|
for (AiChatRoleCategoryEnum itemEnum : AiChatRoleCategoryEnum.values()) {
|
||||||
if (itemEnum.getClassify().equals(classify)) {
|
if (itemEnum.getCategory().equals(category)) {
|
||||||
return itemEnum;
|
return itemEnum;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
throw new IllegalArgumentException("Invalid MessageType value: " + classify);
|
throw new IllegalArgumentException("Invalid MessageType value: " + category);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,36 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.ai.enums;
|
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Getter;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* chat角色 可见范围
|
|
||||||
*
|
|
||||||
* @author fansili
|
|
||||||
* @time 2024/4/24 16:44
|
|
||||||
* @since 1.0
|
|
||||||
*/
|
|
||||||
@AllArgsConstructor
|
|
||||||
@Getter
|
|
||||||
public enum AiChatRoleEnableEnum {
|
|
||||||
|
|
||||||
OPEN("open", "公开"),
|
|
||||||
CLOSE("close", "关闭"),
|
|
||||||
|
|
||||||
;
|
|
||||||
|
|
||||||
private String type;
|
|
||||||
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
|
|
||||||
public static AiChatRoleEnableEnum valueOfType(String type) {
|
|
||||||
for (AiChatRoleEnableEnum itemEnum : AiChatRoleEnableEnum.values()) {
|
|
||||||
if (itemEnum.getType().equals(type)) {
|
|
||||||
return itemEnum;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
throw new IllegalArgumentException("Invalid MessageType value: " + type);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -20,7 +20,7 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
*/
|
*/
|
||||||
@Tag(name = "A4-chat角色")
|
@Tag(name = "A4-chat角色")
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/ai/chat")
|
@RequestMapping("/ai/chat/role")
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class AiChatRoleController {
|
public class AiChatRoleController {
|
||||||
@ -28,37 +28,35 @@ public class AiChatRoleController {
|
|||||||
private final AiChatRoleService chatRoleService;
|
private final AiChatRoleService chatRoleService;
|
||||||
|
|
||||||
@Operation(summary = "chat角色 - 角色列表")
|
@Operation(summary = "chat角色 - 角色列表")
|
||||||
@GetMapping("/role/list")
|
@GetMapping("/list")
|
||||||
public PageResult<AiChatRoleListRes> list(@Validated @ModelAttribute AiChatRoleListReq req) {
|
public PageResult<AiChatRoleListRes> list(@Validated @ModelAttribute AiChatRoleListReq req) {
|
||||||
return chatRoleService.list(req);
|
return chatRoleService.list(req);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "chat角色 - 添加")
|
@Operation(summary = "chat角色 - 添加")
|
||||||
@PutMapping("/role")
|
@PutMapping("/add")
|
||||||
public CommonResult<Void> add(@Validated @RequestBody AiChatRoleAddReq req) {
|
public CommonResult<Void> add(@Validated @RequestBody AiChatRoleAddReqVO req) {
|
||||||
chatRoleService.add(req);
|
chatRoleService.add(req);
|
||||||
return CommonResult.success(null);
|
return CommonResult.success(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "chat角色 - 修改")
|
@Operation(summary = "chat角色 - 修改")
|
||||||
@PostMapping("/role/{id}")
|
@PostMapping("/update")
|
||||||
public CommonResult<Void> update(@PathVariable("id") Long id,
|
public CommonResult<Void> update(@Validated @RequestBody AiChatRoleUpdateReqVO req) {
|
||||||
@Validated @RequestBody AiChatRoleUpdateReq req) {
|
chatRoleService.update(req);
|
||||||
chatRoleService.update(id, req);
|
|
||||||
return CommonResult.success(null);
|
return CommonResult.success(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "chat角色 - 修改可见性")
|
@Operation(summary = "chat角色 - 修改可见性")
|
||||||
@PostMapping("/role/{id}/update-enable")
|
@PostMapping("/update-public-status")
|
||||||
public CommonResult<Void> updateEnable(@PathVariable("id") Long id,
|
public CommonResult<Void> updatePublicStatus(@Validated @RequestBody AiChatRoleUpdatePublicStatusReqVO req) {
|
||||||
@Validated @RequestBody AiChatRoleUpdateVisibilityReq req) {
|
chatRoleService.updatePublicStatus(req);
|
||||||
chatRoleService.updateEnable(id, req);
|
|
||||||
return CommonResult.success(null);
|
return CommonResult.success(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "chat角色 - 删除")
|
@Operation(summary = "chat角色 - 删除")
|
||||||
@DeleteMapping("/role/{id}")
|
@DeleteMapping("/delete")
|
||||||
public CommonResult<Void> delete(@PathVariable("id") Long id) {
|
public CommonResult<Void> delete(@RequestParam("id") Long id) {
|
||||||
chatRoleService.delete(id);
|
chatRoleService.delete(id);
|
||||||
return CommonResult.success(null);
|
return CommonResult.success(null);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package cn.iocoder.yudao.module.ai.controller.admin.model.vo.role;
|
package cn.iocoder.yudao.module.ai.controller.admin.model.vo.role;
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@ -14,21 +13,40 @@ import lombok.experimental.Accessors;
|
|||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
public class AiChatRoleAddReq extends PageParam {
|
public class AiChatRoleAddReqVO {
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@Schema(description = "角色名,角色的显示名称")
|
@Schema(description = "角色名,角色的显示名称")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
@NotNull
|
@Schema(description = "头像")
|
||||||
@Schema(description = "角色介绍,详细描述角色的功能或用途")
|
private String avatar;
|
||||||
private String introduce;
|
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@Schema(description = "分类,角色所属的类别,如娱乐、创作等")
|
@Schema(description = "分类,角色所属的类别,如娱乐、创作等")
|
||||||
private String classify;
|
private String category;
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Schema(description = "角色描述")
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
@Schema(description = "角色欢迎语")
|
||||||
|
private String welcomeMessage;
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Schema(description = "角色设定(消息)")
|
||||||
|
private String systemMessage;
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Schema(description = "模型编号")
|
||||||
|
private Long modelId;
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@Schema(description = "开启状态 open、close")
|
@Schema(description = "开启状态 open、close")
|
||||||
private String enable;
|
private Boolean publicStatus;
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Schema(description = "排序")
|
||||||
|
private Integer sort;
|
||||||
|
|
||||||
}
|
}
|
@ -14,9 +14,14 @@ import lombok.experimental.Accessors;
|
|||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
public class AiChatRoleUpdateVisibilityReq extends PageParam {
|
public class AiChatRoleUpdatePublicStatusReqVO extends PageParam {
|
||||||
|
|
||||||
@NotNull
|
|
||||||
|
@NotNull(message = "角色编号不能为空")
|
||||||
|
@Schema(description = "角色编号")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@NotNull(message = "开启状态不能为空")
|
||||||
@Schema(description = "开启状态 open、close")
|
@Schema(description = "开启状态 open、close")
|
||||||
private String enable;
|
private Boolean publicStatus;
|
||||||
}
|
}
|
@ -1,34 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.ai.controller.admin.model.vo.role;
|
|
||||||
|
|
||||||
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;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* chat 角色 - 更新
|
|
||||||
*
|
|
||||||
* @fansili
|
|
||||||
* @since v1.0
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@Accessors(chain = true)
|
|
||||||
public class AiChatRoleUpdateReq extends PageParam {
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Schema(description = "角色名,角色的显示名称")
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Schema(description = "角色介绍,详细描述角色的功能或用途")
|
|
||||||
private String introduce;
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Schema(description = "分类,角色所属的类别,如娱乐、创作等")
|
|
||||||
private String classify;
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Schema(description = "开启状态 open、close")
|
|
||||||
private String enable;
|
|
||||||
}
|
|
@ -0,0 +1,62 @@
|
|||||||
|
package cn.iocoder.yudao.module.ai.controller.admin.model.vo.role;
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* chat 角色 - 更新
|
||||||
|
*
|
||||||
|
* @fansili
|
||||||
|
* @since v1.0
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public class AiChatRoleUpdateReqVO extends PageParam {
|
||||||
|
|
||||||
|
|
||||||
|
@NotNull(message = "角色编号不能为空")
|
||||||
|
@Schema(description = "角色编号")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Schema(description = "角色名,角色的显示名称")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Schema(description = "头像")
|
||||||
|
private String avatar;
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Schema(description = "分类,角色所属的类别,如娱乐、创作等")
|
||||||
|
private String category;
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Schema(description = "角色描述")
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
@Schema(description = "角色欢迎语")
|
||||||
|
private String welcomeMessage;
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Schema(description = "角色设定(消息)")
|
||||||
|
private String systemMessage;
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Schema(description = "模型编号")
|
||||||
|
private Long modelId;
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Schema(description = "开启状态 open、close")
|
||||||
|
private Boolean publicStatus;
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Schema(description = "排序")
|
||||||
|
private Integer sort;
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Schema(description = "状态")
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
}
|
@ -1,9 +1,9 @@
|
|||||||
package cn.iocoder.yudao.module.ai.convert;
|
package cn.iocoder.yudao.module.ai.convert;
|
||||||
|
|
||||||
import cn.iocoder.yudao.module.ai.dal.dataobject.model.AiChatRoleDO;
|
import cn.iocoder.yudao.module.ai.dal.dataobject.model.AiChatRoleDO;
|
||||||
import cn.iocoder.yudao.module.ai.controller.admin.model.vo.role.AiChatRoleAddReq;
|
import cn.iocoder.yudao.module.ai.controller.admin.model.vo.role.AiChatRoleAddReqVO;
|
||||||
import cn.iocoder.yudao.module.ai.controller.admin.model.vo.role.AiChatRoleRes;
|
import cn.iocoder.yudao.module.ai.controller.admin.model.vo.role.AiChatRoleRes;
|
||||||
import cn.iocoder.yudao.module.ai.controller.admin.model.vo.role.AiChatRoleUpdateReq;
|
import cn.iocoder.yudao.module.ai.controller.admin.model.vo.role.AiChatRoleUpdateReqVO;
|
||||||
import cn.iocoder.yudao.module.ai.controller.admin.model.vo.role.AiChatRoleListRes;
|
import cn.iocoder.yudao.module.ai.controller.admin.model.vo.role.AiChatRoleListRes;
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
import org.mapstruct.factory.Mappers;
|
import org.mapstruct.factory.Mappers;
|
||||||
@ -36,7 +36,7 @@ public interface AiChatRoleConvert {
|
|||||||
* @param req
|
* @param req
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
AiChatRoleDO convertAiChatRoleDO(AiChatRoleAddReq req);
|
AiChatRoleDO convertAiChatRoleDO(AiChatRoleAddReqVO req);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 转换 - AiChatRoleDO
|
* 转换 - AiChatRoleDO
|
||||||
@ -44,7 +44,7 @@ public interface AiChatRoleConvert {
|
|||||||
* @param req
|
* @param req
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
AiChatRoleDO convertAiChatRoleDO(AiChatRoleUpdateReq req);
|
AiChatRoleDO convertAiChatRoleDO(AiChatRoleUpdateReqVO req);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 转换 - AiChatRoleRes
|
* 转换 - AiChatRoleRes
|
||||||
|
@ -26,24 +26,22 @@ public interface AiChatRoleService {
|
|||||||
* @param req
|
* @param req
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
void add(AiChatRoleAddReq req);
|
void add(AiChatRoleAddReqVO req);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* chat角色 - 修改
|
* chat角色 - 修改
|
||||||
*
|
*
|
||||||
* @param id
|
|
||||||
* @param req
|
* @param req
|
||||||
*/
|
*/
|
||||||
void update(Long id, AiChatRoleUpdateReq req);
|
void update(AiChatRoleUpdateReqVO req);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* chat角色 - 修改可见性
|
* chat角色 - 修改可见性
|
||||||
*
|
*
|
||||||
* @param id
|
|
||||||
* @param req
|
* @param req
|
||||||
*/
|
*/
|
||||||
void updateEnable(Long id, AiChatRoleUpdateVisibilityReq req);
|
void updatePublicStatus(AiChatRoleUpdatePublicStatusReqVO req);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* chat角色 - 删除
|
* chat角色 - 删除
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package cn.iocoder.yudao.module.ai.service.impl;
|
package cn.iocoder.yudao.module.ai.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||||
import cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil;
|
import cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
@ -9,9 +10,9 @@ import cn.iocoder.yudao.module.ai.ErrorCodeConstants;
|
|||||||
import cn.iocoder.yudao.module.ai.controller.admin.model.vo.role.*;
|
import cn.iocoder.yudao.module.ai.controller.admin.model.vo.role.*;
|
||||||
import cn.iocoder.yudao.module.ai.convert.AiChatRoleConvert;
|
import cn.iocoder.yudao.module.ai.convert.AiChatRoleConvert;
|
||||||
import cn.iocoder.yudao.module.ai.dal.dataobject.model.AiChatRoleDO;
|
import cn.iocoder.yudao.module.ai.dal.dataobject.model.AiChatRoleDO;
|
||||||
import cn.iocoder.yudao.module.ai.enums.AiChatRoleClassifyEnum;
|
|
||||||
import cn.iocoder.yudao.module.ai.enums.AiChatRoleEnableEnum;
|
|
||||||
import cn.iocoder.yudao.module.ai.dal.mysql.AiChatRoleMapper;
|
import cn.iocoder.yudao.module.ai.dal.mysql.AiChatRoleMapper;
|
||||||
|
import cn.iocoder.yudao.module.ai.enums.AiChatRoleCategoryEnum;
|
||||||
|
import cn.iocoder.yudao.module.ai.service.AiChatModalService;
|
||||||
import cn.iocoder.yudao.module.ai.service.AiChatRoleService;
|
import cn.iocoder.yudao.module.ai.service.AiChatRoleService;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@ -31,6 +32,7 @@ import java.util.List;
|
|||||||
public class AiChatRoleServiceImpl implements AiChatRoleService {
|
public class AiChatRoleServiceImpl implements AiChatRoleService {
|
||||||
|
|
||||||
private final AiChatRoleMapper aiChatRoleMapper;
|
private final AiChatRoleMapper aiChatRoleMapper;
|
||||||
|
private final AiChatModalService aiChatModalService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageResult<AiChatRoleListRes> list(AiChatRoleListReq req) {
|
public PageResult<AiChatRoleListRes> list(AiChatRoleListReq req) {
|
||||||
@ -52,42 +54,43 @@ public class AiChatRoleServiceImpl implements AiChatRoleService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void add(AiChatRoleAddReq req) {
|
public void add(AiChatRoleAddReqVO req) {
|
||||||
// 转换enum,并校验enum
|
// 转换enum,并校验enum
|
||||||
AiChatRoleClassifyEnum.valueOfClassify(req.getClassify());
|
AiChatRoleCategoryEnum.valueOfCategory(req.getCategory());
|
||||||
AiChatRoleEnableEnum.valueOfType(req.getEnable());
|
// 校验模型是否存在
|
||||||
|
aiChatModalService.validateExists(req.getModelId());
|
||||||
// 转换do
|
// 转换do
|
||||||
AiChatRoleDO insertAiChatRoleDO = AiChatRoleConvert.INSTANCE.convertAiChatRoleDO(req);
|
AiChatRoleDO insertAiChatRoleDO = AiChatRoleConvert.INSTANCE.convertAiChatRoleDO(req);
|
||||||
insertAiChatRoleDO.setUserId(SecurityFrameworkUtils.getLoginUserId());
|
insertAiChatRoleDO.setUserId(SecurityFrameworkUtils.getLoginUserId());
|
||||||
insertAiChatRoleDO.setUseCount(0);
|
insertAiChatRoleDO.setStatus(CommonStatusEnum.ENABLE.getStatus());
|
||||||
// 保存
|
// 保存
|
||||||
aiChatRoleMapper.insert(insertAiChatRoleDO);
|
aiChatRoleMapper.insert(insertAiChatRoleDO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update(Long id, AiChatRoleUpdateReq req) {
|
public void update(AiChatRoleUpdateReqVO req) {
|
||||||
// 转换enum,并校验enum
|
|
||||||
AiChatRoleClassifyEnum.valueOfClassify(req.getClassify());
|
|
||||||
AiChatRoleEnableEnum.valueOfType(req.getEnable());
|
|
||||||
// 检查角色是否存在
|
// 检查角色是否存在
|
||||||
validateExists(id);
|
validateExists(req.getId());
|
||||||
|
// 转换enum,并校验enum
|
||||||
|
AiChatRoleCategoryEnum.valueOfCategory(req.getCategory());
|
||||||
|
// 校验模型是否存在
|
||||||
|
aiChatModalService.validateExists(req.getModelId());
|
||||||
// 转换do
|
// 转换do
|
||||||
AiChatRoleDO updateChatRole = AiChatRoleConvert.INSTANCE.convertAiChatRoleDO(req);
|
AiChatRoleDO updateChatRole = AiChatRoleConvert.INSTANCE.convertAiChatRoleDO(req);
|
||||||
updateChatRole.setId(id);
|
updateChatRole.setId(req.getId());
|
||||||
aiChatRoleMapper.updateById(updateChatRole);
|
aiChatRoleMapper.updateById(updateChatRole);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEnable(Long id, AiChatRoleUpdateVisibilityReq req) {
|
public void updatePublicStatus(AiChatRoleUpdatePublicStatusReqVO req) {
|
||||||
// 转换enum,并校验enum
|
|
||||||
AiChatRoleEnableEnum.valueOfType(req.getEnable());
|
|
||||||
// 检查角色是否存在
|
// 检查角色是否存在
|
||||||
validateExists(id);
|
validateExists(req.getId());
|
||||||
// 更新
|
// 更新
|
||||||
aiChatRoleMapper.updateById(new AiChatRoleDO()
|
aiChatRoleMapper.updateById(
|
||||||
.setId(id)
|
new AiChatRoleDO()
|
||||||
.setEnable(req.getEnable())
|
.setId(req.getId())
|
||||||
|
.setPublicStatus(req.getPublicStatus())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user