mirror of
https://gitee.com/fit2cloud-feizhiyun/MeterSphere.git
synced 2024-12-03 04:28:51 +08:00
refactor(文件管理): 兼容历史数据处理
This commit is contained in:
parent
540028cdab
commit
aa712d30ca
@ -253,9 +253,11 @@ public class FileMetadataService {
|
||||
if (fileMetadataMapper.selectByPrimaryKey(fileMetadata.getId()) != null) {
|
||||
fileMetadata.setUpdateTime(System.currentTimeMillis());
|
||||
fileMetadata.setUpdateUser(SessionUtils.getUserId());
|
||||
fileMetadata.setPath(FileUtils.getFilePath(fileMetadata));
|
||||
// 历史数据的路径不做更新
|
||||
if (StringUtils.isNotEmpty(fileMetadata.getStorage()) && StringUtils.isEmpty(fileMetadata.getResourceType())) {
|
||||
fileMetadata.setPath(FileUtils.getFilePath(fileMetadata));
|
||||
}
|
||||
fileMetadataMapper.updateByPrimaryKeySelective(fileMetadata);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -343,6 +345,7 @@ public class FileMetadataService {
|
||||
FileMetadataExample fileMetadata = new FileMetadataExample();
|
||||
fileMetadata.createCriteria().andProjectIdIn(projectIds).andLoadJarEqualTo(true);
|
||||
List<FileMetadata> files = fileMetadataMapper.selectByExample(fileMetadata);
|
||||
files = files.stream().filter(s -> StringUtils.isNotEmpty(s.getPath())).collect(Collectors.toList());
|
||||
return files.stream().map(FileMetadata::getPath).collect(Collectors.toList());
|
||||
}
|
||||
return new LinkedList<>();
|
||||
|
Loading…
Reference in New Issue
Block a user