Commit 314a015a2ef2dccc69607cbe8b1367653b227d0d

Authored by cherishsince
1 parent 78bb2d1d

【优化】角色分类列表 group

yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/dal/mysql/AiChatRoleMapper.java
@@ -50,8 +50,9 @@ public interface AiChatRoleMapper extends BaseMapperX<AiChatRoleDO> { @@ -50,8 +50,9 @@ public interface AiChatRoleMapper extends BaseMapperX<AiChatRoleDO> {
50 50
51 default List<AiChatRoleDO> selectListGroupByCategory(Integer status) { 51 default List<AiChatRoleDO> selectListGroupByCategory(Integer status) {
52 return selectList(new LambdaQueryWrapperX<AiChatRoleDO>() 52 return selectList(new LambdaQueryWrapperX<AiChatRoleDO>()
  53 + .select(AiChatRoleDO::getCategory)
53 .eq(AiChatRoleDO::getStatus, status) 54 .eq(AiChatRoleDO::getStatus, status)
54 - .apply("GROUP BY category")); 55 + .groupBy(AiChatRoleDO::getCategory));
55 } 56 }
56 57
57 } 58 }
yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/service/model/AiChatRoleServiceImpl.java
@@ -132,7 +132,7 @@ public class AiChatRoleServiceImpl implements AiChatRoleService { @@ -132,7 +132,7 @@ public class AiChatRoleServiceImpl implements AiChatRoleService {
132 @Override 132 @Override
133 public List<String> getChatRoleCategoryList() { 133 public List<String> getChatRoleCategoryList() {
134 List<AiChatRoleDO> list = chatRoleMapper.selectListGroupByCategory(CommonStatusEnum.ENABLE.getStatus()); 134 List<AiChatRoleDO> list = chatRoleMapper.selectListGroupByCategory(CommonStatusEnum.ENABLE.getStatus());
135 - return convertList(list, AiChatRoleDO::getName); 135 + return convertList(list, AiChatRoleDO::getCategory);
136 } 136 }
137 137
138 } 138 }