Преглед на файлове

【优化】角色分类列表 group

cherishsince преди 11 месеца
родител
ревизия
314a015a2e

+ 2 - 1
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> {
 
     default List<AiChatRoleDO> selectListGroupByCategory(Integer status) {
         return selectList(new LambdaQueryWrapperX<AiChatRoleDO>()
+                .select(AiChatRoleDO::getCategory)
                 .eq(AiChatRoleDO::getStatus, status)
-                .apply("GROUP BY category"));
+                .groupBy(AiChatRoleDO::getCategory));
     }
 
 }

+ 1 - 1
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 {
     @Override
     public List<String> getChatRoleCategoryList() {
         List<AiChatRoleDO> list = chatRoleMapper.selectListGroupByCategory(CommonStatusEnum.ENABLE.getStatus());
-        return convertList(list, AiChatRoleDO::getName);
+        return convertList(list, AiChatRoleDO::getCategory);
     }
 
 }