8.11 缓存优化,添加增删改时缓存失效逻辑
This commit is contained in:
parent
34909150be
commit
45fd2f6534
@ -212,47 +212,47 @@ public class PictureController {
|
|||||||
return ResultUtils.success(picturePage);
|
return ResultUtils.success(picturePage);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
* 分页获取图片列表(封装类,脱敏),普通用户使用,且不能看到未过审的图片
|
// * 分页获取图片列表(封装类,脱敏),普通用户使用,且不能看到未过审的图片
|
||||||
*/
|
// */
|
||||||
@PostMapping("/list/page/vo")
|
// @PostMapping("/list/page/vo")
|
||||||
public BaseResponse<Page<PictureVO>> listPictureVOByPage(@RequestBody PictureQueryRequest pictureQueryRequest,
|
// public BaseResponse<Page<PictureVO>> listPictureVOByPage(@RequestBody PictureQueryRequest pictureQueryRequest,
|
||||||
HttpServletRequest request) {
|
// HttpServletRequest request) {
|
||||||
long current = pictureQueryRequest.getCurrent();
|
// long current = pictureQueryRequest.getCurrent();
|
||||||
long size = pictureQueryRequest.getPageSize();
|
// long size = pictureQueryRequest.getPageSize();
|
||||||
// 限制爬虫,一次不能请求超过20页
|
// // 限制爬虫,一次不能请求超过20页
|
||||||
ThrowUtils.throwIf(size > 20, ErrorCode.PARAMS_ERROR);
|
// ThrowUtils.throwIf(size > 20, ErrorCode.PARAMS_ERROR);
|
||||||
// 空间权限校验
|
// // 空间权限校验
|
||||||
Long spaceId = pictureQueryRequest.getSpaceId();
|
// Long spaceId = pictureQueryRequest.getSpaceId();
|
||||||
if (spaceId == null) {
|
// if (spaceId == null) {
|
||||||
// 公开图库
|
// // 公开图库
|
||||||
// 普通用户默认只能看到审核通过的数据
|
// // 普通用户默认只能看到审核通过的数据
|
||||||
pictureQueryRequest.setReviewStatus(PictureReviewStatusEnum.PASS.getValue());
|
// pictureQueryRequest.setReviewStatus(PictureReviewStatusEnum.PASS.getValue());
|
||||||
pictureQueryRequest.setNullSpaceId(true);
|
// pictureQueryRequest.setNullSpaceId(true);
|
||||||
} else {
|
// } else {
|
||||||
// 私有空间、团队空间,无需过审
|
// // 私有空间、团队空间,无需过审
|
||||||
boolean hasPermission = StpKit.SPACE.hasPermission(SpaceUserPermissionConstant.PICTURE_VIEW);
|
// boolean hasPermission = StpKit.SPACE.hasPermission(SpaceUserPermissionConstant.PICTURE_VIEW);
|
||||||
ThrowUtils.throwIf(!hasPermission, ErrorCode.NO_AUTH_ERROR);
|
// ThrowUtils.throwIf(!hasPermission, ErrorCode.NO_AUTH_ERROR);
|
||||||
//已改为编程式鉴权
|
// //已改为编程式鉴权
|
||||||
// User loginUser = userService.getLoginUser(request);
|
//// User loginUser = userService.getLoginUser(request);
|
||||||
// Space space = spaceService.getById(spaceId);
|
//// Space space = spaceService.getById(spaceId);
|
||||||
// ThrowUtils.throwIf(space == null, ErrorCode.NOT_FOUND_ERROR, "空间不存在");
|
//// ThrowUtils.throwIf(space == null, ErrorCode.NOT_FOUND_ERROR, "空间不存在");
|
||||||
// if (!loginUser.getId().equals(space.getUserId())) {
|
//// if (!loginUser.getId().equals(space.getUserId())) {
|
||||||
// throw new BusinessException(ErrorCode.NO_AUTH_ERROR, "没有空间权限");
|
//// throw new BusinessException(ErrorCode.NO_AUTH_ERROR, "没有空间权限");
|
||||||
|
//// }
|
||||||
|
// }
|
||||||
|
// // 查询数据库
|
||||||
|
// Page<Picture> picturePage = pictureService.page(new Page<>(current, size),
|
||||||
|
// pictureService.getQueryWrapper(pictureQueryRequest));
|
||||||
|
// // 获取封装类
|
||||||
|
// return ResultUtils.success(pictureService.getPictureVOPage(picturePage, request));
|
||||||
// }
|
// }
|
||||||
}
|
|
||||||
// 查询数据库
|
|
||||||
Page<Picture> picturePage = pictureService.page(new Page<>(current, size),
|
|
||||||
pictureService.getQueryWrapper(pictureQueryRequest));
|
|
||||||
// 获取封装类
|
|
||||||
return ResultUtils.success(pictureService.getPictureVOPage(picturePage, request));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页获取图片列表(封装类,有缓存)
|
* 分页获取图片列表(封装类,有缓存)
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@PostMapping("/list/page/vo/cache")
|
@PostMapping("/list/page/vo")
|
||||||
public BaseResponse<Page<PictureVO>> listPictureVOByPageWithCache(
|
public BaseResponse<Page<PictureVO>> listPictureVOByPageWithCache(
|
||||||
@RequestBody PictureQueryRequest pictureQueryRequest,
|
@RequestBody PictureQueryRequest pictureQueryRequest,
|
||||||
HttpServletRequest request) {
|
HttpServletRequest request) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user