commit
469bcc59d3
@ -8,6 +8,7 @@ import com.qiwenshare.file.vo.file.RecoveryFileListVo;
|
||||
import java.util.List;
|
||||
|
||||
public interface IRecoveryFileService extends IService<RecoveryFile> {
|
||||
public void deleteRecoveryFile(UserFile userFile);
|
||||
void deleteRecoveryFile(UserFile userFile);
|
||||
void restorefile(String deleteBatchNum, String filePath, Long sessionUserId);
|
||||
List<RecoveryFileListVo> selectRecoveryFileList();
|
||||
}
|
||||
|
@ -10,5 +10,5 @@ import java.util.List;
|
||||
|
||||
public interface IShareService extends IService<Share> {
|
||||
void batchInsertShareFile(List<ShareFile> shareFiles);
|
||||
List<ShareFileListVO> selectShareFileListByBatchNum(Share share);
|
||||
List<ShareFileListVO> selectShareFileList(String shareBatchNum, String filePath);
|
||||
}
|
||||
|
@ -13,13 +13,13 @@ public interface IUserFileService extends IService<UserFile> {
|
||||
List<UserFile> selectUserFileByNameAndPath(String fileName, String filePath, Long userId);
|
||||
void replaceUserFilePath(String filePath, String oldFilePath, Long userId);
|
||||
List<FileListVo> userFileList(UserFile userFile, Long beginCount, Long pageCount);
|
||||
void updateFilepathByFilepath(String oldfilePath, String newfilePath, String fileName, String extendName);
|
||||
void updateFilepathByFilepath(String oldfilePath, String newfilePath, String fileName, String extendName, long userId);
|
||||
|
||||
List<FileListVo> selectFileByExtendName(List<String> fileNameList, Long beginCount, Long pageCount, long userId);
|
||||
Long selectCountByExtendName(List<String> fileNameList, Long beginCount, Long pageCount, long userId);
|
||||
List<FileListVo> selectFileNotInExtendNames(List<String> fileNameList, Long beginCount, Long pageCount, long userId);
|
||||
Long selectCountNotInExtendNames(List<String> fileNameList, Long beginCount, Long pageCount, long userId);
|
||||
List<UserFile> selectFileTreeListLikeFilePath(String filePath, long userId);
|
||||
List<UserFile> selectFileListLikeRightFilePath(String filePath, long userId);
|
||||
List<UserFile> selectFilePathTreeByUserId(Long userId);
|
||||
void deleteUserFile(Long userFileId, Long sessionUserId);
|
||||
|
||||
|
@ -394,12 +394,14 @@ public class FileController {
|
||||
if (!operationCheck(token).getSuccess()){
|
||||
return operationCheck(token);
|
||||
}
|
||||
|
||||
UserBean sessionUserBean = userService.getUserBeanByToken(token);
|
||||
String oldfilePath = moveFileDto.getOldFilePath();
|
||||
String newfilePath = moveFileDto.getFilePath();
|
||||
String fileName = moveFileDto.getFileName();
|
||||
String extendName = moveFileDto.getExtendName();
|
||||
|
||||
userFileService.updateFilepathByFilepath(oldfilePath, newfilePath, fileName, extendName);
|
||||
userFileService.updateFilepathByFilepath(oldfilePath, newfilePath, fileName, extendName, sessionUserBean.getUserId());
|
||||
return RestResult.success();
|
||||
|
||||
}
|
||||
@ -413,6 +415,7 @@ public class FileController {
|
||||
if (!operationCheck(token).getSuccess()) {
|
||||
return operationCheck(token);
|
||||
}
|
||||
UserBean sessionUserBean = userService.getUserBeanByToken(token);
|
||||
|
||||
String files = batchMoveFileDto.getFiles();
|
||||
String newfilePath = batchMoveFileDto.getFilePath();
|
||||
@ -420,7 +423,7 @@ public class FileController {
|
||||
List<UserFile> fileList = JSON.parseArray(files, UserFile.class);
|
||||
|
||||
for (UserFile userFile : fileList) {
|
||||
userFileService.updateFilepathByFilepath(userFile.getFilePath(), newfilePath, userFile.getFileName(), userFile.getExtendName());
|
||||
userFileService.updateFilepathByFilepath(userFile.getFilePath(), newfilePath, userFile.getFileName(), userFile.getExtendName(), sessionUserBean.getUserId());
|
||||
}
|
||||
|
||||
return RestResult.success().data("批量移动文件成功");
|
||||
|
@ -59,8 +59,6 @@ public class RecoveryFileController {
|
||||
@ResponseBody
|
||||
public RestResult<String> batchDeleteRecoveryFile(@RequestBody BatchDeleteRecoveryFileDTO batchDeleteRecoveryFileDTO, @RequestHeader("token") String token) {
|
||||
|
||||
|
||||
|
||||
List<RecoveryFile> recoveryFileList = JSON.parseArray(batchDeleteRecoveryFileDTO.getRecoveryFileIds(), RecoveryFile.class);
|
||||
for (RecoveryFile recoveryFile : recoveryFileList) {
|
||||
|
||||
@ -91,66 +89,7 @@ public class RecoveryFileController {
|
||||
@ResponseBody
|
||||
public RestResult restoreFile(@RequestBody RestoreFileDTO restoreFileDto, @RequestHeader("token") String token) {
|
||||
UserBean sessionUserBean = userService.getUserBeanByToken(token);
|
||||
LambdaUpdateWrapper<UserFile> userFileLambdaUpdateWrapper = new LambdaUpdateWrapper<>();
|
||||
userFileLambdaUpdateWrapper.set(UserFile::getDeleteFlag, 0)
|
||||
.set(UserFile::getDeleteBatchNum, "")
|
||||
.eq(UserFile::getDeleteBatchNum, restoreFileDto.getDeleteBatchNum());
|
||||
userFileService.update(userFileLambdaUpdateWrapper);
|
||||
|
||||
String filePath = PathUtil.getParentPath(restoreFileDto.getFilePath());
|
||||
while(filePath.indexOf("/") != -1) {
|
||||
String fileName = filePath.substring(filePath.lastIndexOf("/") + 1);
|
||||
filePath = PathUtil.getParentPath(filePath);
|
||||
LambdaQueryWrapper<UserFile> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(UserFile::getFilePath, filePath + "/")
|
||||
.eq(UserFile::getFileName, fileName)
|
||||
.eq(UserFile::getDeleteFlag, 0)
|
||||
.eq(UserFile::getUserId, sessionUserBean.getUserId());
|
||||
List<UserFile> userFileList = userFileService.list(lambdaQueryWrapper);
|
||||
if (userFileList.size() == 0) {
|
||||
UserFile userFile = new UserFile();
|
||||
userFile.setUserId(sessionUserBean.getUserId());
|
||||
userFile.setFileName(fileName);
|
||||
userFile.setFilePath(filePath + "/");
|
||||
userFile.setDeleteFlag(0);
|
||||
userFile.setIsDir(1);
|
||||
userFile.setUploadTime(DateUtil.getCurrentTime());
|
||||
|
||||
userFileService.save(userFile);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
LambdaQueryWrapper<UserFile> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
|
||||
lambdaQueryWrapper.select(UserFile::getFileName, UserFile::getFilePath)
|
||||
.likeRight(UserFile::getFilePath, restoreFileDto.getFilePath())
|
||||
.eq(UserFile::getIsDir, 1)
|
||||
.eq(UserFile::getDeleteFlag, 0)
|
||||
.groupBy(UserFile::getFilePath, UserFile::getFileName)
|
||||
.having("count(fileName) >= 2");
|
||||
List<UserFile> repeatList = userFileService.list(lambdaQueryWrapper);
|
||||
|
||||
for (UserFile userFile : repeatList) {
|
||||
LambdaQueryWrapper<UserFile> lambdaQueryWrapper1 = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper1.eq(UserFile::getFilePath, userFile.getFilePath())
|
||||
.eq(UserFile::getFileName, userFile.getFileName())
|
||||
.eq(UserFile::getDeleteFlag, "0");
|
||||
List<UserFile> userFiles = userFileService.list(lambdaQueryWrapper1);
|
||||
log.info("重复的文件:" + JSON.toJSONString(userFiles));
|
||||
for (int i = 0; i < userFiles.size() - 1; i ++) {
|
||||
log.info("删除文件:" + JSON.toJSONString(userFiles.get(i)));
|
||||
userFileService.removeById(userFiles.get(i).getUserFileId());
|
||||
}
|
||||
}
|
||||
|
||||
log.info(JSON.toJSONString(repeatList));
|
||||
|
||||
LambdaQueryWrapper<RecoveryFile> recoveryFileServiceLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
recoveryFileServiceLambdaQueryWrapper.eq(RecoveryFile::getDeleteBatchNum, restoreFileDto.getDeleteBatchNum());
|
||||
recoveryFileService.remove(recoveryFileServiceLambdaQueryWrapper);
|
||||
|
||||
|
||||
recoveryFileService.restorefile(restoreFileDto.getDeleteBatchNum(), restoreFileDto.getFilePath(), sessionUserBean.getUserId());
|
||||
return RestResult.success().message("还原成功!");
|
||||
}
|
||||
|
||||
|
@ -7,11 +7,11 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.qiwenshare.common.util.DateUtil;
|
||||
import com.qiwenshare.common.result.RestResult;
|
||||
import com.qiwenshare.file.anno.MyLog;
|
||||
import com.qiwenshare.file.api.IShareService;
|
||||
import com.qiwenshare.file.api.IUserService;
|
||||
import com.qiwenshare.file.api.*;
|
||||
import com.qiwenshare.file.domain.Share;
|
||||
import com.qiwenshare.file.domain.ShareFile;
|
||||
import com.qiwenshare.file.domain.UserBean;
|
||||
import com.qiwenshare.file.domain.UserFile;
|
||||
import com.qiwenshare.file.dto.sharefile.*;
|
||||
import com.qiwenshare.file.vo.share.ShareFileListVO;
|
||||
import com.qiwenshare.file.vo.share.ShareFileVO;
|
||||
@ -23,6 +23,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.text.ParseException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
@ -38,6 +39,10 @@ public class ShareController {
|
||||
IUserService userService;
|
||||
@Resource
|
||||
IShareService shareService;
|
||||
@Resource
|
||||
IFileService fileService;
|
||||
@Resource
|
||||
IUserFileService userFileService;
|
||||
|
||||
@Operation(summary = "分享文件", description = "分享文件统一接口", tags = {"share"})
|
||||
@PostMapping(value = "/sharefile")
|
||||
@ -47,7 +52,7 @@ public class ShareController {
|
||||
ShareFileVO shareSecretVO = new ShareFileVO();
|
||||
UserBean sessionUserBean = userService.getUserBeanByToken(token);
|
||||
|
||||
String uuid = UUID.randomUUID().toString();
|
||||
String uuid = UUID.randomUUID().toString().replace("-", "");
|
||||
Share share = new Share();
|
||||
BeanUtil.copyProperties(shareSecretDTO, share);
|
||||
share.setShareTime(DateUtil.getCurrentTime());
|
||||
@ -59,17 +64,65 @@ public class ShareController {
|
||||
shareSecretVO.setExtractionCode(share.getExtractionCode());
|
||||
}
|
||||
|
||||
share.setShareBatchNum(uuid.replace("-", ""));
|
||||
share.setShareBatchNum(uuid);
|
||||
shareService.save(share);
|
||||
|
||||
List<ShareFile> fileList = JSON.parseArray(shareSecretDTO.getFiles(), ShareFile.class);
|
||||
fileList.forEach(p->p.setShareBatchNum(uuid.replace("-", "")));
|
||||
shareService.batchInsertShareFile(fileList);
|
||||
shareSecretVO.setShareBatchNum(uuid.replace("-", ""));
|
||||
List<ShareFile> saveFileList = new ArrayList<>();
|
||||
for (ShareFile shareFile : fileList) {
|
||||
UserFile userFile = userFileService.getById(shareFile.getUserFileId());
|
||||
if (userFile.getIsDir() == 1) {
|
||||
List<UserFile> userfileList = userFileService.selectFileListLikeRightFilePath(userFile.getFilePath(), sessionUserBean.getUserId());
|
||||
for (UserFile userFile1 : userfileList) {
|
||||
ShareFile shareFile1 = new ShareFile();
|
||||
shareFile1.setUserFileId(userFile1.getUserFileId());
|
||||
shareFile1.setShareBatchNum(uuid);
|
||||
saveFileList.add(shareFile1);
|
||||
}
|
||||
} else {
|
||||
shareFile.setShareBatchNum(uuid);
|
||||
saveFileList.add(shareFile);
|
||||
}
|
||||
|
||||
}
|
||||
shareService.batchInsertShareFile(saveFileList);
|
||||
shareSecretVO.setShareBatchNum(uuid);
|
||||
|
||||
return RestResult.success().data(shareSecretVO);
|
||||
}
|
||||
|
||||
@Operation(summary = "保存分享文件", description = "用来将别人分享的文件保存到自己的网盘中", tags = {"share"})
|
||||
@PostMapping(value = "/sharefile")
|
||||
@MyLog(operation = "保存分享文件", module = CURRENT_MODULE)
|
||||
@ResponseBody
|
||||
public RestResult saveShareFile(@RequestBody SaveShareFileDTO saveShareFileDTO, @RequestHeader("token") String token) {
|
||||
UserBean sessionUserBean = userService.getUserBeanByToken(token);
|
||||
List<ShareFile> fileList = JSON.parseArray(saveShareFileDTO.getFiles(), ShareFile.class);
|
||||
|
||||
List<UserFile> saveUserFileList = new ArrayList<>();
|
||||
for (ShareFile shareFile : fileList) {
|
||||
UserFile userFile = userFileService.getById(shareFile.getUserFileId());
|
||||
if (userFile.getIsDir() == 1) {
|
||||
List<UserFile> userfileList = userFileService.selectFileListLikeRightFilePath(userFile.getFilePath(), sessionUserBean.getUserId());
|
||||
for (UserFile userFile1 : userfileList) {
|
||||
userFile1.setUserId(sessionUserBean.getUserId());
|
||||
userFile1.setFilePath(saveShareFileDTO.getFilePath());
|
||||
saveUserFileList.add(userFile1);
|
||||
fileService.increaseFilePointCount(userFile1.getFileId());
|
||||
}
|
||||
} else {
|
||||
userFile.setUserFileId(null);
|
||||
userFile.setUserId(sessionUserBean.getUserId());
|
||||
userFile.setFilePath(saveShareFileDTO.getFilePath());
|
||||
saveUserFileList.add(userFile);
|
||||
fileService.increaseFilePointCount(userFile.getFileId());
|
||||
}
|
||||
}
|
||||
userFileService.saveBatch(saveUserFileList);
|
||||
|
||||
return RestResult.success();
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
String sss = "[{\"fileId\":null,\"timeStampName\":null,\"fileUrl\":null,\"fileSize\":null,\"isOSS\":null,\"storageType\":null,\"pointCount\":null,\"identifier\":null,\"userFileId\":619,\"userId\":2,\"fileName\":\"2222\",\"filePath\":\"/\",\"extendName\":null,\"isDir\":1,\"uploadTime\":\"2021-03-15 22:16:26\",\"deleteFlag\":0,\"deleteTime\":null,\"deleteBatchNum\":null}]";
|
||||
List<ShareFile> fileList = JSON.parseArray(sss, ShareFile.class);
|
||||
@ -83,11 +136,7 @@ public class ShareController {
|
||||
@ResponseBody
|
||||
public RestResult<List<ShareFileListVO>> shareFileListBySecret(ShareFileListBySecretDTO shareFileListBySecretDTO) {
|
||||
log.info(JSON.toJSONString(shareFileListBySecretDTO));
|
||||
|
||||
Share share = new Share();
|
||||
share.setShareBatchNum(shareFileListBySecretDTO.getShareBatchNum());
|
||||
|
||||
List<ShareFileListVO> list = shareService.selectShareFileListByBatchNum(share);
|
||||
List<ShareFileListVO> list = shareService.selectShareFileList(shareFileListBySecretDTO.getShareBatchNum(), shareFileListBySecretDTO.getFilePath());
|
||||
return RestResult.success().data(list);
|
||||
}
|
||||
|
||||
@ -139,6 +188,5 @@ public class ShareController {
|
||||
} else {
|
||||
return RestResult.success();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,13 @@
|
||||
package com.qiwenshare.file.dto.sharefile;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@Schema(name = "保存分享文件DTO",required = true)
|
||||
public class SaveShareFileDTO {
|
||||
@Schema(description="文件集合")
|
||||
private String files;
|
||||
@Schema(description = "文件路径")
|
||||
private String filePath;
|
||||
}
|
@ -11,6 +11,8 @@ public class ShareFileListBySecretDTO {
|
||||
private String shareBatchNum;
|
||||
@Schema(description="提取码")
|
||||
private String extractionCode;
|
||||
@Schema(description="文件路径")
|
||||
private String filePath;
|
||||
|
||||
|
||||
|
||||
|
@ -5,10 +5,11 @@ import com.qiwenshare.file.domain.FileBean;
|
||||
import com.qiwenshare.file.domain.Share;
|
||||
import com.qiwenshare.file.domain.ShareFile;
|
||||
import com.qiwenshare.file.vo.share.ShareFileListVO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ShareMapper extends BaseMapper<Share> {
|
||||
void batchInsertShareFile(List<ShareFile> shareFiles);
|
||||
List<ShareFileListVO> selectShareFileListByBatchNum(Share share);
|
||||
List<ShareFileListVO> selectShareFileList(@Param("shareBatchNum") String shareBatchNum, @Param("filePath") String filePath);
|
||||
}
|
||||
|
@ -14,12 +14,12 @@ public interface UserFileMapper extends BaseMapper<UserFile> {
|
||||
void replaceFilePath(@Param("filePath") String filePath, @Param("oldFilePath") String oldFilePath, @Param("userId") Long userId);
|
||||
List<FileListVo> userFileList(UserFile userFile, Long beginCount, Long pageCount);
|
||||
|
||||
void updateFilepathByPathAndName(String oldfilePath, String newfilePath, String fileName, String extendName);
|
||||
void updateFilepathByFilepath(String oldfilePath, String newfilePath);
|
||||
void updateFilepathByPathAndName(String oldfilePath, String newfilePath, String fileName, String extendName, long userId);
|
||||
void updateFilepathByFilepath(String oldfilePath, String newfilePath, long userId);
|
||||
|
||||
List<FileListVo> selectFileByExtendName(List<String> fileNameList, Long beginCount, Long pageCount, long userId);
|
||||
Long selectCountByExtendName(List<String> fileNameList, Long beginCount, Long pageCount, long userId);
|
||||
List<FileListVo> selectFileNotInExtendNames(List<String> fileNameList, Long beginCount, Long pageCount, long userId);
|
||||
Long selectCountNotInExtendNames(List<String> fileNameList, Long beginCount, Long pageCount, long userId);
|
||||
Long selectStorageSizeByUserId(Long userId);
|
||||
Long selectStorageSizeByUserId(@Param("userId") Long userId);
|
||||
}
|
||||
|
@ -57,7 +57,8 @@ public class RecoveryFileService extends ServiceImpl<RecoveryFileMapper, Recove
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void restorefile(String deleteBatchNum, String filePath, Long sessionUserId) {
|
||||
LambdaUpdateWrapper<UserFile> userFileLambdaUpdateWrapper = new LambdaUpdateWrapper<>();
|
||||
userFileLambdaUpdateWrapper.set(UserFile::getDeleteFlag, 0)
|
||||
@ -71,6 +72,7 @@ public class RecoveryFileService extends ServiceImpl<RecoveryFileMapper, Recove
|
||||
parentFilePath = PathUtil.getParentPath(parentFilePath);
|
||||
LambdaQueryWrapper<UserFile> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(UserFile::getFilePath, parentFilePath + "/")
|
||||
.eq(UserFile::getFileName, fileName)
|
||||
.eq(UserFile::getDeleteFlag, 0)
|
||||
.eq(UserFile::getUserId, sessionUserId);
|
||||
List<UserFile> userFileList = userFileMapper.selectList(lambdaQueryWrapper);
|
||||
|
@ -25,7 +25,7 @@ public class ShareService extends ServiceImpl<ShareMapper, Share> implements ISh
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ShareFileListVO> selectShareFileListByBatchNum(Share share) {
|
||||
return shareMapper.selectShareFileListByBatchNum(share);
|
||||
public List<ShareFileListVO> selectShareFileList(String shareBatchNum, String filePath) {
|
||||
return shareMapper.selectShareFileList(shareBatchNum, filePath);
|
||||
}
|
||||
}
|
||||
|
@ -108,12 +108,12 @@ public class UserFileService extends ServiceImpl<UserFileMapper, UserFile> impl
|
||||
// }
|
||||
|
||||
@Override
|
||||
public void updateFilepathByFilepath(String oldfilePath, String newfilePath, String fileName, String extendName) {
|
||||
public void updateFilepathByFilepath(String oldfilePath, String newfilePath, String fileName, String extendName, long userId) {
|
||||
if ("null".equals(extendName)){
|
||||
extendName = null;
|
||||
}
|
||||
//移动根目录
|
||||
userFileMapper.updateFilepathByPathAndName(oldfilePath, newfilePath, fileName, extendName);
|
||||
userFileMapper.updateFilepathByPathAndName(oldfilePath, newfilePath, fileName, extendName, userId);
|
||||
|
||||
//移动子目录
|
||||
oldfilePath = oldfilePath + fileName + "/";
|
||||
@ -125,7 +125,7 @@ public class UserFileService extends ServiceImpl<UserFileMapper, UserFile> impl
|
||||
oldfilePath = oldfilePath.replace("_", "\\_");
|
||||
|
||||
if (extendName == null) { //为null说明是目录,则需要移动子目录
|
||||
userFileMapper.updateFilepathByFilepath(oldfilePath, newfilePath);
|
||||
userFileMapper.updateFilepathByFilepath(oldfilePath, newfilePath, userId);
|
||||
}
|
||||
|
||||
}
|
||||
@ -152,7 +152,7 @@ public class UserFileService extends ServiceImpl<UserFileMapper, UserFile> impl
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UserFile> selectFileTreeListLikeFilePath(String filePath, long userId) {
|
||||
public List<UserFile> selectFileListLikeRightFilePath(String filePath, long userId) {
|
||||
//UserFile userFile = new UserFile();
|
||||
filePath = filePath.replace("\\", "\\\\\\\\");
|
||||
filePath = filePath.replace("'", "\\'");
|
||||
@ -165,7 +165,9 @@ public class UserFileService extends ServiceImpl<UserFileMapper, UserFile> impl
|
||||
|
||||
log.info("查询文件路径:" + filePath);
|
||||
|
||||
lambdaQueryWrapper.eq(UserFile::getUserId, userId).likeRight(UserFile::getFilePath, filePath);
|
||||
lambdaQueryWrapper.eq(UserFile::getUserId, userId)
|
||||
.likeRight(UserFile::getFilePath, filePath)
|
||||
.eq(UserFile::getDeleteFlag, 0);
|
||||
return userFileMapper.selectList(lambdaQueryWrapper);
|
||||
}
|
||||
|
||||
@ -221,7 +223,7 @@ public class UserFileService extends ServiceImpl<UserFileMapper, UserFile> impl
|
||||
|
||||
private void updateFileDeleteStateByFilePath(String filePath, String deleteBatchNum, Long userId) {
|
||||
new Thread(()->{
|
||||
List<UserFile> fileList = selectFileTreeListLikeFilePath(filePath, userId);
|
||||
List<UserFile> fileList = selectFileListLikeRightFilePath(filePath, userId);
|
||||
for (int i = 0; i < fileList.size(); i++){
|
||||
UserFile userFileTemp = fileList.get(i);
|
||||
executor.execute(new Runnable() {
|
||||
|
@ -15,11 +15,12 @@
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<select id="selectShareFileListByBatchNum" parameterType="com.qiwenshare.file.domain.Share" resultType="com.qiwenshare.file.vo.share.ShareFileListVO">
|
||||
<select id="selectShareFileList" resultType="com.qiwenshare.file.vo.share.ShareFileListVO">
|
||||
select * from sharefile a
|
||||
left join userfile b on b.userFileId = a.userFileId
|
||||
left join file c on c.fileId = b.fileId
|
||||
where a.shareBatchNum = #{shareBatchNum}
|
||||
and b.filePath = #{filePath}
|
||||
</select>
|
||||
|
||||
|
||||
|
@ -73,7 +73,7 @@
|
||||
|
||||
<update id="updateFilepathByFilepath">
|
||||
UPDATE userfile SET filePath=REPLACE(filePath, #{param1}, #{param2})
|
||||
WHERE filePath like N'${param1}%'
|
||||
WHERE filePath like N'${param1}%' and userId = #{param3}
|
||||
</update>
|
||||
|
||||
<update id="updateFilepathByPathAndName">
|
||||
@ -85,12 +85,13 @@
|
||||
<if test="param4 == null">
|
||||
and extendName is null
|
||||
</if>
|
||||
and userId = #{param5}
|
||||
</update>
|
||||
|
||||
<select id="selectStorageSizeByUserId" resultType="java.lang.Long" parameterType="java.lang.Long">
|
||||
SELECT SUM(fileSize) FROM userfile
|
||||
LEFT JOIN file ON file.fileId = userfile.fileId
|
||||
WHERE userfile.userId = 2
|
||||
WHERE userfile.userId = #{userId}
|
||||
</select>
|
||||
|
||||
</mapper>
|
Loading…
Reference in New Issue
Block a user