应用中心,增加分类搜索,增加返回值创建人名称
This commit is contained in:
parent
752a6ffe6b
commit
cd81efe140
@ -75,8 +75,8 @@ public class ApplicationController {
|
||||
@Operation(summary = "获得大模型应用分页")
|
||||
@PreAuthorize("@ss.hasPermission('llm:application:query')")
|
||||
public CommonResult<PageResult<ApplicationRespVO>> getApplicationPage(@Valid ApplicationPageReqVO pageReqVO) {
|
||||
PageResult<ApplicationDO> pageResult = applicationService.getApplicationPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, ApplicationRespVO.class));
|
||||
PageResult<ApplicationRespVO> pageResult = applicationService.getApplicationPage(pageReqVO);
|
||||
return success(pageResult);
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@ -86,10 +86,9 @@ public class ApplicationController {
|
||||
public void exportApplicationExcel(@Valid ApplicationPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<ApplicationDO> list = applicationService.getApplicationPage(pageReqVO).getList();
|
||||
List<ApplicationRespVO> list = applicationService.getApplicationPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "大模型应用.xls", "数据", ApplicationRespVO.class,
|
||||
BeanUtils.toBean(list, ApplicationRespVO.class));
|
||||
ExcelUtils.write(response, "大模型应用.xls", "数据", ApplicationRespVO.class, list);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -18,4 +18,6 @@ public class ApplicationPageReqVO extends PageParam {
|
||||
@Schema(description = "应用名称", example = "赵六")
|
||||
private String appName;
|
||||
|
||||
}
|
||||
@Schema(description = "应用分类", example = "1")
|
||||
private Long appCategory;
|
||||
}
|
||||
|
@ -75,4 +75,10 @@ public class ApplicationRespVO {
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
||||
@Schema(description = "创建人id")
|
||||
private String creator;
|
||||
|
||||
@Schema(description = "创建人")
|
||||
private String creatorName;
|
||||
|
||||
}
|
||||
|
@ -20,8 +20,9 @@ public interface ApplicationMapper extends BaseMapperX<ApplicationDO> {
|
||||
default PageResult<ApplicationDO> selectPage(ApplicationPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<ApplicationDO>()
|
||||
.likeIfPresent(ApplicationDO::getAppName, reqVO.getAppName())
|
||||
.eqIfPresent(ApplicationDO::getAppCategory, reqVO.getAppCategory())
|
||||
.eq(ApplicationDO::getDeleted,false)
|
||||
.orderByDesc(ApplicationDO::getId));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -50,6 +50,6 @@ public interface ApplicationService {
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 大模型应用分页
|
||||
*/
|
||||
PageResult<ApplicationDO> getApplicationPage(ApplicationPageReqVO pageReqVO);
|
||||
PageResult<ApplicationRespVO> getApplicationPage(ApplicationPageReqVO pageReqVO);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
package cn.iocoder.yudao.module.llm.service.application;
|
||||
|
||||
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.update.LambdaUpdateWrapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
@ -7,6 +9,8 @@ import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import cn.iocoder.yudao.module.llm.controller.admin.application.vo.*;
|
||||
import cn.iocoder.yudao.module.llm.dal.dataobject.application.ApplicationDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
@ -30,6 +34,10 @@ public class ApplicationServiceImpl implements ApplicationService {
|
||||
@Resource
|
||||
private ApplicationMapper applicationMapper;
|
||||
|
||||
@Resource
|
||||
private AdminUserApi adminUserApi;
|
||||
|
||||
|
||||
@Override
|
||||
public Long createApplication(ApplicationSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
@ -71,8 +79,15 @@ public class ApplicationServiceImpl implements ApplicationService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<ApplicationDO> getApplicationPage(ApplicationPageReqVO pageReqVO) {
|
||||
return applicationMapper.selectPage(pageReqVO);
|
||||
public PageResult<ApplicationRespVO> getApplicationPage(ApplicationPageReqVO pageReqVO) {
|
||||
PageResult<ApplicationDO> applicationDOPageResult = applicationMapper.selectPage(pageReqVO);
|
||||
PageResult<ApplicationRespVO> result = BeanUtils.toBean(applicationDOPageResult, ApplicationRespVO.class);
|
||||
List<Long> ids = applicationDOPageResult.getList().stream().map(applicationDO -> Long.parseLong(applicationDO.getCreator())).collect(Collectors.toList());
|
||||
Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(ids);
|
||||
for (ApplicationRespVO applicationRespVO : result.getList()) {
|
||||
applicationRespVO.setCreatorName(userMap.get(Long.parseLong(applicationRespVO.getCreator())).getNickname());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user