commit
8b8f9a020a
@ -11,7 +11,7 @@ public interface IUserFileService extends IService<UserFile> {
|
||||
List<UserFile> selectUserFileByNameAndPath(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);
|
||||
void replaceUserFilePath(String filePath, String oldFilePath, Long userId);
|
||||
|
||||
IPage<FileListVo> userFileList(Long userId, String filePath, Long beginCount, Long pageCount);
|
||||
void updateFilepathByFilepath(String oldfilePath, String newfilePath, String fileName, String extendName, long userId);
|
||||
void userFileCopy(String oldfilePath, String newfilePath, String fileName, String extendName, long userId);
|
||||
|
@ -176,10 +176,13 @@ public class FileController {
|
||||
.eq(UserFile::getUserFileId, renameFileDto.getUserFileId());
|
||||
userFileService.update(lambdaUpdateWrapper);
|
||||
if (1 == userFile.getIsDir()) {
|
||||
userFileService.replaceUserFilePath(userFile.getFilePath() + renameFileDto.getFileName() + "/",
|
||||
userFile.getFilePath() + userFile.getFileName() + "/", sessionUserBean.getUserId());
|
||||
}
|
||||
List<UserFile> list = userFileService.selectFileListLikeRightFilePath(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());
|
||||
return RestResult.success();
|
||||
}
|
||||
|
@ -9,7 +9,8 @@ import javax.persistence.*;
|
||||
|
||||
@Data
|
||||
@Table(name = "userfile", uniqueConstraints = {
|
||||
@UniqueConstraint(name = "fileindex", columnNames = {"fileName", "filePath", "extendName", "deleteFlag", "userId"})})
|
||||
@UniqueConstraint(name = "fileindex", columnNames = { "userId", "filePath", "fileName", "extendName", "deleteFlag"})}
|
||||
)
|
||||
@Entity
|
||||
@TableName("userfile")
|
||||
public class UserFile {
|
||||
|
@ -8,7 +8,6 @@ import com.qiwenshare.file.vo.file.FileListVo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
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 updateFilepathByFilepath(String oldfilePath, String newfilePath, long userId);
|
||||
|
@ -81,10 +81,6 @@ public class UserFileService extends ServiceImpl<UserFileMapper, UserFile> impl
|
||||
return userFileMapper.selectList(lambdaQueryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void replaceUserFilePath(String filePath, String oldFilePath, Long userId) {
|
||||
userFileMapper.replaceFilePath(filePath, oldFilePath, userId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<FileListVo> userFileList(Long userId, String filePath, Long currentPage, Long pageCount) {
|
||||
|
@ -6,10 +6,6 @@
|
||||
|
||||
<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">
|
||||
|
Loading…
Reference in New Issue
Block a user