文件列表分页

This commit is contained in:
马超 2020-12-15 15:56:41 +08:00
parent 7978a8892d
commit be257c6ac0
6 changed files with 16 additions and 6 deletions

View File

@ -11,7 +11,7 @@ import java.util.Map;
public interface IUserFileService extends IService<UserFile> {
List<UserFile> selectUserFileByNameAndPath(String fileName, String filePath, Long userId);
void replaceUserFilePath(String filePath, String oldFilePath, Long userId);
List<Map<String, Object>> userFileList(UserFile userFile);
List<Map<String, Object>> userFileList(UserFile userFile, Long beginCount, Long pageCount);
void updateFilepathByFilepath(String oldfilePath, String newfilePath, String fileName, String extendName);
List<Map<String, Object>> selectFileByExtendName(List<String> fileNameList, long userId);

View File

@ -184,10 +184,16 @@ public class FileController {
userFile.setUserId(sessionUserBean.getUserId());
}
List<Map<String, Object>> fileList = null;
userFile.setFilePath(PathUtil.urlDecode(fileListDto.getFilePath()));
if (fileListDto.getCurrentPage() == null || fileListDto.getPageCount() == null) {
fileList = userFileService.userFileList(userFile, 0L, 10L);
} else {
Long beginCount = (fileListDto.getCurrentPage() - 1) * fileListDto.getPageCount();
List<Map<String, Object>> fileList = userFileService.userFileList(userFile); //fileService.selectFileListByPath(fileBean);
fileList = userFileService.userFileList(userFile, beginCount, fileListDto.getPageCount()); //fileService.selectFileListByPath(fileBean);
}
restResult.setData(fileList);
restResult.setSuccess(true);

View File

@ -5,4 +5,7 @@ import lombok.Data;
@Data
public class FileListDto {
private String filePath;
private Long currentPage;
private Long pageCount;
}

View File

@ -11,7 +11,7 @@ import java.util.Map;
public interface UserFileMapper extends BaseMapper<UserFile> {
void replaceFilePath(@Param("filePath") String filePath, @Param("oldFilePath") String oldFilePath, @Param("userId") Long userId);
List<Map<String, Object>> userFileList(UserFile userFile);
List<Map<String, Object>> userFileList(UserFile userFile, Long beginCount, Long pageCount);
void updateFilepathByPathAndName(String oldfilePath, String newfilePath, String fileName, String extendName);
void updateFilepathByFilepath(String oldfilePath, String newfilePath);

View File

@ -44,8 +44,8 @@ public class UserFileService extends ServiceImpl<UserFileMapper, UserFile> impl
}
@Override
public List<Map<String, Object>> userFileList(UserFile userFile) {
return userFileMapper.userFileList(userFile);
public List<Map<String, Object>> userFileList(UserFile userFile, Long beginCount, Long pageCount) {
return userFileMapper.userFileList(userFile, beginCount, pageCount);
}

View File

@ -26,6 +26,7 @@
</if>
and deleteFlag = 0
</where>
limit #{beginCount} #{pageCount}
</select>