修改应用中心的应用分类

This commit is contained in:
sunxiqing 2025-01-02 14:53:46 +08:00
parent 49aea9b285
commit 5b4c00053d

View File

@ -6,7 +6,10 @@ import cn.iocoder.yudao.module.llm.controller.admin.application.vo.ApplicationPa
import cn.iocoder.yudao.module.llm.controller.admin.application.vo.ApplicationRespVO;
import cn.iocoder.yudao.module.llm.controller.admin.application.vo.ApplicationSaveReqVO;
import cn.iocoder.yudao.module.llm.dal.dataobject.application.ApplicationDO;
import cn.iocoder.yudao.module.llm.dal.dataobject.label.LabelDO;
import cn.iocoder.yudao.module.llm.dal.mysql.application.ApplicationMapper;
import cn.iocoder.yudao.module.llm.dal.mysql.label.LabelMapper;
import cn.iocoder.yudao.module.llm.service.label.LabelService;
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@ -36,6 +39,8 @@ public class ApplicationServiceImpl implements ApplicationService {
@Resource
private AdminUserApi adminUserApi;
@Resource
private LabelMapper labelMapper;
@Override
@ -75,7 +80,16 @@ public class ApplicationServiceImpl implements ApplicationService {
@Override
public ApplicationDO getApplication(Long id) {
return applicationMapper.selectById(id);
ApplicationDO applicationDO = applicationMapper.selectById(id);
if (applicationDO.getAppLabel() != null && !applicationDO.getAppLabel().equals("")) {
String[] split = applicationDO.getAppLabel().split(",");
LambdaQueryWrapper<LabelDO> wrapper = new LambdaQueryWrapper<LabelDO>()
.in(LabelDO::getId, split);
List<LabelDO> labelDOS = labelMapper.selectList(wrapper);
List<String> collect = labelDOS.stream().map(LabelDO::getLabelName).collect(Collectors.toList());
applicationDO.setAppLabel(String.join(",", collect));
}
return applicationDO;
}
@Override
@ -113,6 +127,14 @@ public class ApplicationServiceImpl implements ApplicationService {
Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(ids);
for (ApplicationRespVO applicationRespVO : result) {
applicationRespVO.setCreatorName(userMap.get(Long.parseLong(applicationRespVO.getCreator())).getNickname());
if (applicationRespVO.getAppLabel() != null && !applicationRespVO.getAppLabel().equals("")) {
String[] split = applicationRespVO.getAppLabel().split(",");
LambdaQueryWrapper<LabelDO> wrapper = new LambdaQueryWrapper<LabelDO>()
.in(LabelDO::getId, split);
List<LabelDO> labelDOS = labelMapper.selectList(wrapper);
List<String> collect = labelDOS.stream().map(LabelDO::getLabelName).collect(Collectors.toList());
applicationRespVO.setAppLabel(String.join(",", collect));
}
}
return result;
}