| | |
| | | |
| | | if (jobName != null && !jobName.isEmpty()) { |
| | | List<String> jobIds = waylineJobService.getJobIds(jobName); |
| | | queryWrapper.in(MediaFileEntity::getJobId, jobIds); |
| | | // 检查 jobIds 列表是否为空 |
| | | if (jobIds.isEmpty()) { |
| | | // 如果为空,则直接返回空的分页数据 |
| | | return new PaginationData<>(Collections.emptyList(), new Pagination(pageObj)); |
| | | } |
| | | |
| | | queryWrapper.in(MediaFileEntity::getJobId, jobIds); |
| | | } |
| | | if (type != null && !type.isEmpty()) { |
| | | if ("图片".equals(type)) { |
| | |
| | | queryWrapper.likeLeft(MediaFileEntity::getFileName, ".mp4"); |
| | | } |
| | | } |
| | | queryWrapper.orderByDesc(MediaFileEntity::getCreateTime); |
| | | queryWrapper.last("ORDER BY JSON_EXTRACT(metadata, '$.createdTime') DESC"); |
| | | // 执行分页查询 |
| | | Page<MediaFileEntity> resultPage = mapper.selectPage(pageObj, queryWrapper); |
| | | |
| | |
| | | return builder.build(); |
| | | } |
| | | |
| | | public static void uploadFile(String endpoint, String accessKey, String secretKey, String bucketName, String objectName, File file) { |
| | | public static void uploadFile(String endpoint, String accessKey, String secretKey, String bucketName, String objectName, File file ) { |
| | | try { |
| | | // 创建MinIO客户端实例 |
| | | MinioClient minioClient = MinioClient.builder() |
| | |
| | | .bucket(bucketName) |
| | | .object(objectName) |
| | | .stream(fileInputStream, file.length(), -1) |
| | | .contentType("image/jpeg") |
| | | .build() |
| | | ); |
| | | fileInputStream.close(); |