!104 代码合并

Merge pull request !104 from MAC/develop
This commit is contained in:
MAC 2022-03-03 15:32:45 +00:00 committed by Gitee
commit 8b8f9a020a
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
6 changed files with 9 additions and 14 deletions

View File

@ -11,7 +11,7 @@ public interface IUserFileService extends IService<UserFile> {
List<UserFile> selectUserFileByNameAndPath(String fileName, String filePath, Long userId); List<UserFile> selectUserFileByNameAndPath(String fileName, String filePath, Long userId);
boolean isDirExist(String fileName, String filePath, long userId); boolean isDirExist(String fileName, String filePath, long userId);
List<UserFile> selectSameUserFile(String fileName, String filePath, String extendName, Long userId); List<UserFile> selectSameUserFile(String fileName, String filePath, String extendName, Long userId);
void replaceUserFilePath(String filePath, String oldFilePath, Long userId);
IPage<FileListVo> userFileList(Long userId, String filePath, Long beginCount, Long pageCount); IPage<FileListVo> userFileList(Long userId, String filePath, Long beginCount, Long pageCount);
void updateFilepathByFilepath(String oldfilePath, String newfilePath, String fileName, String extendName, long userId); void updateFilepathByFilepath(String oldfilePath, String newfilePath, String fileName, String extendName, long userId);
void userFileCopy(String oldfilePath, String newfilePath, String fileName, String extendName, long userId); void userFileCopy(String oldfilePath, String newfilePath, String fileName, String extendName, long userId);

View File

@ -176,10 +176,13 @@ public class FileController {
.eq(UserFile::getUserFileId, renameFileDto.getUserFileId()); .eq(UserFile::getUserFileId, renameFileDto.getUserFileId());
userFileService.update(lambdaUpdateWrapper); userFileService.update(lambdaUpdateWrapper);
if (1 == userFile.getIsDir()) { if (1 == userFile.getIsDir()) {
userFileService.replaceUserFilePath(userFile.getFilePath() + renameFileDto.getFileName() + "/", List<UserFile> list = userFileService.selectFileListLikeRightFilePath(userFile.getFilePath() + userFile.getFileName() + "/", sessionUserBean.getUserId());
userFile.getFilePath() + userFile.getFileName() + "/", sessionUserBean.getUserId());
}
for (UserFile newUserFile : list) {
newUserFile.setFilePath(newUserFile.getFilePath().replaceFirst(userFile.getFilePath() + userFile.getFileName() + "/", userFile.getFilePath() + renameFileDto.getFileName() + "/"));
userFileService.updateById(newUserFile);
}
}
fileDealComp.uploadESByUserFileId(renameFileDto.getUserFileId()); fileDealComp.uploadESByUserFileId(renameFileDto.getUserFileId());
return RestResult.success(); return RestResult.success();
} }

View File

@ -9,7 +9,8 @@ import javax.persistence.*;
@Data @Data
@Table(name = "userfile", uniqueConstraints = { @Table(name = "userfile", uniqueConstraints = {
@UniqueConstraint(name = "fileindex", columnNames = {"fileName", "filePath", "extendName", "deleteFlag", "userId"})}) @UniqueConstraint(name = "fileindex", columnNames = { "userId", "filePath", "fileName", "extendName", "deleteFlag"})}
)
@Entity @Entity
@TableName("userfile") @TableName("userfile")
public class UserFile { public class UserFile {

View File

@ -8,7 +8,6 @@ import com.qiwenshare.file.vo.file.FileListVo;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
public interface UserFileMapper extends BaseMapper<UserFile> { public interface UserFileMapper extends BaseMapper<UserFile> {
void replaceFilePath(@Param("filePath") String filePath, @Param("oldFilePath") String oldFilePath, @Param("userId") Long userId);
void updateFilepathByPathAndName(String oldfilePath, String newfilePath, String fileName, String extendName, long userId); void updateFilepathByPathAndName(String oldfilePath, String newfilePath, String fileName, String extendName, long userId);
void updateFilepathByFilepath(String oldfilePath, String newfilePath, long userId); void updateFilepathByFilepath(String oldfilePath, String newfilePath, long userId);

View File

@ -81,10 +81,6 @@ public class UserFileService extends ServiceImpl<UserFileMapper, UserFile> impl
return userFileMapper.selectList(lambdaQueryWrapper); return userFileMapper.selectList(lambdaQueryWrapper);
} }
@Override
public void replaceUserFilePath(String filePath, String oldFilePath, Long userId) {
userFileMapper.replaceFilePath(filePath, oldFilePath, userId);
}
@Override @Override
public IPage<FileListVo> userFileList(Long userId, String filePath, Long currentPage, Long pageCount) { public IPage<FileListVo> userFileList(Long userId, String filePath, Long currentPage, Long pageCount) {

View File

@ -6,10 +6,6 @@
<mapper namespace="com.qiwenshare.file.mapper.UserFileMapper"> <mapper namespace="com.qiwenshare.file.mapper.UserFileMapper">
<update id="replaceFilePath">
UPDATE userfile SET filepath=REPLACE(filepath, #{oldFilePath}, #{filePath})
WHERE filepath LIKE N'${oldFilePath}%' and userId = #{userId};
</update>
<select id="selectPageVo" parameterType="com.qiwenshare.file.domain.UserFile" resultType="com.qiwenshare.file.vo.file.FileListVo"> <select id="selectPageVo" parameterType="com.qiwenshare.file.domain.UserFile" resultType="com.qiwenshare.file.vo.file.FileListVo">