添加排序

This commit is contained in:
wanxiaoli 2026-05-18 13:33:12 +08:00
parent 0d46da0e07
commit 0e92f8e57b
2 changed files with 6 additions and 5 deletions

View File

@ -113,7 +113,7 @@ public class AlgorithmModelController {
} }
if (versionTag != null && !versionTag.isEmpty()) qw.eq("version_tag", versionTag); if (versionTag != null && !versionTag.isEmpty()) qw.eq("version_tag", versionTag);
if (isCurrent != null && !isCurrent.isEmpty()) qw.eq("is_current", isCurrent); if (isCurrent != null && !isCurrent.isEmpty()) qw.eq("is_current", isCurrent);
qw.orderByDesc("updated_at"); qw.orderByDesc("is_current").orderByDesc("updated_at");
Page<AlgorithmModel> page = new Page<>(pageNum, pageSize, true); Page<AlgorithmModel> page = new Page<>(pageNum, pageSize, true);
return algorithmModelService.page(page, qw); return algorithmModelService.page(page, qw);
} }

View File

@ -146,13 +146,14 @@ public class MaterialController {
@PreAuthorize("hasAuthority('material:export')") @PreAuthorize("hasAuthority('material:export')")
@Log(value = "导出物料", module = "物料管理") @Log(value = "导出物料", module = "物料管理")
@GetMapping("/export") @GetMapping("/export")
public ResponseEntity<byte[]> exportMaterialsV2(@RequestParam String projectId, public ResponseEntity<byte[]> exportMaterialsV2(@RequestParam(required = false) String projectId,
@RequestParam(required = false) List<String> ids, @RequestParam(required = false) List<String> ids,
@RequestParam(required = false) String nameLike) { @RequestParam(required = false) String nameLike) {
if (projectId != null && !projectId.isBlank() && !"-1".equals(projectId)) { String pid = (projectId == null || projectId.isBlank()) ? "-1" : projectId;
projectAccessHelper.assertCanReadProject(projectId); if (!"-1".equals(pid)) {
projectAccessHelper.assertCanReadProject(pid);
} }
byte[] bytes = materialService.exportMaterialsV2(projectId, ids, nameLike); byte[] bytes = materialService.exportMaterialsV2(pid, ids, nameLike);
String fn = "materials.xlsx"; String fn = "materials.xlsx";
return ResponseEntity.ok() return ResponseEntity.ok()
.header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=" + fn) .header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=" + fn)