This commit is contained in:
ls
2025-02-22 14:04:17 +08:00
parent 94bea76d83
commit 847831c58f
2 changed files with 19 additions and 10 deletions

View File

@@ -51,15 +51,14 @@ public class NasaDataRecordController extends JeecgController<NasaDataRecord, IN
//@AutoLog(value = "NASA数据管理-分页列表查询")
@Operation(summary = "NASA数据管理-分页列表查询")
@GetMapping(value = "/list")
public Result<NasaDataRecordPage> queryPageList(NasaDataRecord nasaDataRecord,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
HttpServletRequest req) {
public Result<IPage<NasaDataRecord>> queryPageList(NasaDataRecord nasaDataRecord,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<NasaDataRecord> queryWrapper = QueryGenerator.initQueryWrapper(nasaDataRecord, req.getParameterMap());
Page<NasaDataRecord> page = new Page<NasaDataRecord>(pageNo, pageSize);
IPage<NasaDataRecord> pageList = nasaDataRecordService.page(page, queryWrapper);
long totalCountLhs = 0;
long totalCountXhy = 0;
for (NasaDataRecord nr : pageList.getRecords()) {
String fileList = nr.getFileList();
if (StringUtils.isNotBlank(fileList)) {
@@ -68,11 +67,22 @@ public class NasaDataRecordController extends JeecgController<NasaDataRecord, IN
list.forEach(files::putAll);
nr.setFileMap(files);
}
totalCountLhs += Optional.ofNullable(nr.getTotalCountLhs()).orElse(0l);
totalCountXhy += Optional.ofNullable(nr.getTotalCountNasa()).orElse(0l);
}
return Result.OK(pageList);
}
@GetMapping(value = "/statistics")
public Result<NasaDataRecordPage> queryPageList(NasaDataRecord nasaDataRecord) {
NasaDataRecordPage result = new NasaDataRecordPage();
result.setPageList(pageList);
List<NasaDataRecord> list = nasaDataRecordService.list();
long totalCountLhs = list.stream().filter(Objects::nonNull) // 排除 null 对象
.mapToLong(NasaDataRecord::getTotalCountLhs) // 将对象映射为 long 字段
.filter(Objects::nonNull) // 排除 myField 为 null 的情况
.sum();
long totalCountXhy = list.stream().filter(Objects::nonNull) // 排除 null 对象
.mapToLong(NasaDataRecord::getTotalCountNasa) // 将对象映射为 long 字段
.filter(Objects::nonNull) // 排除 myField 为 null 的情况
.sum();
result.setLhsCount(totalCountLhs);
result.setLhsTotal(totalCountLhs);
result.setXhyCount(totalCountXhy);

View File

@@ -15,7 +15,6 @@ import org.jeecg.modules.database.entity.NasaDataRecord;
@Data
public class NasaDataRecordPage {
private IPage<NasaDataRecord> pageList;
private long lhsCount;
private long lhsTotal;
private long xhyCount;