|
@@ -57,6 +57,7 @@ import java.util.ArrayList;
|
|
|
import java.util.Arrays;
|
|
|
import java.util.List;
|
|
|
import java.util.concurrent.*;
|
|
|
+import java.util.regex.Pattern;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
@Service
|
|
@@ -367,6 +368,7 @@ public class FileService {
|
|
|
return Mapped.ERROR("没有选择任何分组");
|
|
|
} else {
|
|
|
String generated = fileListInput.getGenerated();
|
|
|
+ String fileName = fileListInput.getFileName();
|
|
|
Future<Long> longFuture = this.fileService.countTotalByModelId(modelId, generated);
|
|
|
Future<String> modelNameFuture = this.fileService.retrieveModelname(modelId);
|
|
|
int page = fileListInput.getPage();
|
|
@@ -378,10 +380,20 @@ public class FileService {
|
|
|
} else if ("false".equals(generated)) {
|
|
|
criteria.and("generated").is(Boolean.FALSE);
|
|
|
}
|
|
|
- Query query = new Query(criteria);
|
|
|
- query.with(Sort.by(Order.desc("uploadDate")));
|
|
|
+
|
|
|
+ if (fileName != null && !fileName.isEmpty()) {
|
|
|
+ // 使用正则表达式进行模糊匹配,i 表示不区分大小写
|
|
|
+ Pattern pattern = Pattern.compile(".*" + Pattern.quote(fileName) + ".*", Pattern.CASE_INSENSITIVE);
|
|
|
+ criteria.and("filename").regex(pattern);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 创建查询对象并执行查询
|
|
|
+ Query query = new Query(criteria)
|
|
|
+ .with(Sort.by(Sort.Direction.DESC, "uploadDate")) // 保留排序逻辑
|
|
|
+ .skip(skip)
|
|
|
+ .limit(pageSize);
|
|
|
List<LogicalFile> resultList =
|
|
|
- this.mongoTemplate.find(query.skip(skip).limit(pageSize), LogicalFile.class);
|
|
|
+ this.mongoTemplate.find(query, LogicalFile.class);
|
|
|
Long total;
|
|
|
try {
|
|
|
total = longFuture.get();
|