|
@@ -24,6 +24,7 @@ import java.time.LocalDateTime;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
@Service
|
|
|
public class FileUpdateInfoServiceImpl implements FileUpdateInfoService {
|
|
@@ -289,12 +290,22 @@ public class FileUpdateInfoServiceImpl implements FileUpdateInfoService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ // 查询数据库中已存在的文件名
|
|
|
+ List<String> existingFileNames = fileUpdateInfoMapper.selectList(null).stream()
|
|
|
+ .map(FileUpdateInfo::getFileName)
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ // 从扫描结果中排除已存在的文件名
|
|
|
+ List<String> newFileNames = fileNames.stream()
|
|
|
+ .filter(fileName -> !existingFileNames.contains(fileName))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
// 对文件名列表进行分页处理
|
|
|
- int total = fileNames.size();
|
|
|
+ int total = newFileNames.size();
|
|
|
int start = (current - 1) * size;
|
|
|
int end = Math.min(start + size, total);
|
|
|
|
|
|
- List<String> pageFileNames = fileNames.subList(start, end);
|
|
|
+ List<String> pageFileNames = newFileNames.subList(start, end);
|
|
|
|
|
|
// 返回分页结果
|
|
|
return new CommonPage<>(pageFileNames, total, size, current);
|