解决复制和移动文件时文件内容丢失的bug
This commit is contained in:
parent
b634a4396f
commit
7139f5350c
|
|
@ -24,6 +24,11 @@ public interface EdFileInfoMapper extends BaseMapper<EdFileInfo> {
|
|||
.eq(EdFileInfo::getId, id));
|
||||
}
|
||||
|
||||
default EdFileInfo selectById1(String id) {
|
||||
return this.selectOne(Wrappers.lambdaQuery(EdFileInfo.class)
|
||||
.eq(EdFileInfo::getId, id));
|
||||
}
|
||||
|
||||
@Select("select max(id) from ed_file_info where length(id) = 6")
|
||||
String maxPrjId();
|
||||
|
||||
|
|
|
|||
|
|
@ -979,7 +979,7 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
|||
|
||||
Assert.isTrue(FileRepeatEnum.contains(strategy), "解决重名文件参数错误");
|
||||
// 获取原文件mysql模型
|
||||
EdFileInfo srcFileInfo = this.baseMapper.selectById(id);
|
||||
EdFileInfo srcFileInfo = this.baseMapper.selectById1(id);
|
||||
// 判断目标路径下是否有同名文件,如果所有的同名文件:1)如果所有文件都已经被作废,则该文件为新文件,版本号从100开始。2)如果有没有被作废的文件,则冲突处理方式按---1-跳过冲突文件 2-做版本更新 3-重命名,文件名加"_1"
|
||||
long count = this.baseMapper.selectCount(Wrappers.lambdaQuery(EdFileInfo.class)
|
||||
.eq(EdFileInfo::getParentId, targetFolderId)
|
||||
|
|
@ -1024,7 +1024,7 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
|||
} else if (strategy == REVERSION.code) {
|
||||
// 做版本更新
|
||||
List<EdFileInfo> sameFileInfos = this.baseMapper.selectList(Wrappers.lambdaQuery(EdFileInfo.class)
|
||||
.select(EdFileInfo.class, file -> !StrUtil.equals(file.getColumn(), "file_content"))
|
||||
.select()
|
||||
.eq(EdFileInfo::getParentId, targetFolderId)
|
||||
.eq(EdFileInfo::getFileName, srcFileInfo.getFileName())
|
||||
.eq(EdFileInfo::getFileType, srcFileInfo.getFileType()));
|
||||
|
|
@ -1080,7 +1080,7 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
|||
public ElectromagneticResult<?> copyFile(String id, String targetFolderId, Integer strategy, int dataOwnCode) {
|
||||
Assert.isTrue(FileRepeatEnum.contains(strategy), "解决重名文件参数错误");
|
||||
// 获取原文件mysql模型
|
||||
EdFileInfo srcFileInfo = this.baseMapper.selectById(id);
|
||||
EdFileInfo srcFileInfo = this.baseMapper.selectById1(id);
|
||||
// 判断目标路径下是否有同名文件,如果所有的同名文件:1)如果所有文件都已经被作废,则该文件为新文件,版本号从100开始。2)如果有没有被作废的文件,则冲突处理方式按---1-跳过冲突文件 2-做版本更新 3-重命名,文件名加"_1"
|
||||
long count = this.baseMapper.selectCount(Wrappers.lambdaQuery(EdFileInfo.class)
|
||||
.eq(EdFileInfo::getParentId, targetFolderId)
|
||||
|
|
@ -1193,7 +1193,7 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
|||
if (strategy == REVERSION.code) {
|
||||
// 做版本更新
|
||||
LambdaQueryWrapper<EdFileInfo> queryWrapper = Wrappers.lambdaQuery(EdFileInfo.class)
|
||||
.select(EdFileInfo.class, file -> !StrUtil.equals(file.getColumn(), "file_content"))
|
||||
.select()
|
||||
.eq(EdFileInfo::getParentId, targetFolderId)
|
||||
.eq(EdFileInfo::getFileName, srcFileInfo.getFileName())
|
||||
.eq(EdFileInfo::getFileType, srcFileInfo.getFileType());
|
||||
|
|
|
|||
Loading…
Reference in New Issue