QW-182 文件夹名称带单引号等其他符号时,批量-删除文件夹报错

This commit is contained in:
马超 2020-05-12 23:36:34 +08:00
parent 9576070352
commit e211032cdd
2 changed files with 11 additions and 1 deletions

View File

@ -74,6 +74,11 @@ public class FileService implements IFileService {
@Override
public List<FileBean> selectFileTreeListLikeFilePath(String filePath) {
FileBean fileBean = new FileBean();
filePath = filePath.replace("\\", "\\\\\\\\");
filePath = filePath.replace("'", "\\'");
filePath = filePath.replace("%", "\\%");
filePath = filePath.replace("_", "\\_");
fileBean.setFilepath(filePath);
return fileMapper.selectFileTreeListLikeFilePath(fileBean);
@ -142,6 +147,11 @@ public class FileService implements IFileService {
oldfilepath = oldfilepath + filename + "/";
newfilepath = newfilepath + filename + "/";
oldfilepath = oldfilepath.replace("\\", "\\\\\\\\");
oldfilepath = oldfilepath.replace("'", "\\'");
oldfilepath = oldfilepath.replace("%", "\\%");
oldfilepath = oldfilepath.replace("_", "\\_");
if (extendname == null) { //为null说明是目录则需要移动子目录
fileMapper.updateFilepathByFilepath(oldfilepath, newfilepath);
}

View File

@ -93,7 +93,7 @@
<select id="selectFilePathTreeByUserid" parameterType="com.mac.scp.domain.FileBean" resultType="com.mac.scp.domain.FileBean">
SELECT * FROM file
WHERE isdir = 1 and userid=${userid}
WHERE isdir = 1 and userid=#{userid}
</select>
<!-- <select id="selectFileByExtendName" resultType="com.mac.scp.domain.FileBean" parameterType="java.lang.String">-->