forked from iVMiku/guidance-backend
mybatis-plus依赖移到子模块
This commit is contained in:
@@ -0,0 +1,15 @@
|
|||||||
|
package com.ivmiku.tutorial.config;
|
||||||
|
import com.baomidou.mybatisplus.annotation.DbType;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
@Configuration
|
||||||
|
public class MpConfig {
|
||||||
|
@Bean
|
||||||
|
public MybatisPlusInterceptor mybatisPlusInterceptor() {
|
||||||
|
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
|
||||||
|
interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
|
||||||
|
return interceptor;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,6 +2,7 @@ package com.ivmiku.tutorial.controller;
|
|||||||
|
|
||||||
import cn.dev33.satoken.annotation.SaCheckLogin;
|
import cn.dev33.satoken.annotation.SaCheckLogin;
|
||||||
import cn.dev33.satoken.stp.StpUtil;
|
import cn.dev33.satoken.stp.StpUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
import com.ivmiku.tutorial.entity.Comment;
|
import com.ivmiku.tutorial.entity.Comment;
|
||||||
import com.ivmiku.tutorial.entity.Pages;
|
import com.ivmiku.tutorial.entity.Pages;
|
||||||
@@ -210,7 +211,7 @@ public class CommentController {
|
|||||||
logger.info("获取帖子ID:{}的评论列表", postId);
|
logger.info("获取帖子ID:{}的评论列表", postId);
|
||||||
logger.info("获取pageSize:{}", pages.getPageSize());
|
logger.info("获取pageSize:{}", pages.getPageSize());
|
||||||
System.out.println("aaaaaa" + pages.getPageSize());
|
System.out.println("aaaaaa" + pages.getPageSize());
|
||||||
PageInfo<Comment> comments = commentService.getPostComments(postId, pages.getPageNum(), pages.getPageSize());
|
IPage<Comment> comments = commentService.getPostComments(postId, pages.getPageNum(), pages.getPageSize());
|
||||||
return Result.ok(comments);
|
return Result.ok(comments);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -224,7 +225,7 @@ public class CommentController {
|
|||||||
@Operation(summary = "获取评论下的所有回复")
|
@Operation(summary = "获取评论下的所有回复")
|
||||||
public Result getCommentReplies(@PathVariable Long commentId, @RequestBody Pages pages) {
|
public Result getCommentReplies(@PathVariable Long commentId, @RequestBody Pages pages) {
|
||||||
logger.info("获取评论ID:{}的回复列表", commentId);
|
logger.info("获取评论ID:{}的回复列表", commentId);
|
||||||
PageInfo<Comment> replies = commentService.getCommentReplies(commentId, pages.getPageNum(), pages.getPageSize());
|
IPage<Comment> replies = commentService.getCommentReplies(commentId, pages.getPageNum(), pages.getPageSize());
|
||||||
return Result.ok(replies);
|
return Result.ok(replies);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.ivmiku.tutorial.controller;
|
|||||||
|
|
||||||
import cn.dev33.satoken.annotation.SaCheckLogin;
|
import cn.dev33.satoken.annotation.SaCheckLogin;
|
||||||
import cn.dev33.satoken.stp.StpUtil;
|
import cn.dev33.satoken.stp.StpUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
import com.ivmiku.tutorial.entity.Pages;
|
import com.ivmiku.tutorial.entity.Pages;
|
||||||
import com.ivmiku.tutorial.entity.Post;
|
import com.ivmiku.tutorial.entity.Post;
|
||||||
@@ -116,7 +117,7 @@ public class PostController {
|
|||||||
public Result getPostList(@RequestBody Pages pages) {
|
public Result getPostList(@RequestBody Pages pages) {
|
||||||
logger.info("开始获取帖子列表");
|
logger.info("开始获取帖子列表");
|
||||||
String userId = StpUtil.getLoginIdAsString(); // 获取当前登录用户的ID
|
String userId = StpUtil.getLoginIdAsString(); // 获取当前登录用户的ID
|
||||||
PageInfo<Post> posts = postService.getPostList(userId, pages.getPageNum(), pages.getPageSize());
|
IPage<Post> posts = postService.getPostList(userId, pages.getPageNum(), pages.getPageSize());
|
||||||
return Result.ok(posts); // 调用服务层获取帖子列表
|
return Result.ok(posts); // 调用服务层获取帖子列表
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -127,7 +128,7 @@ public class PostController {
|
|||||||
@GetMapping("/getCommunityPostList{communityId}")
|
@GetMapping("/getCommunityPostList{communityId}")
|
||||||
public Result getCommunityPostList(@PathVariable("communityId") Long communityId, @RequestBody Pages pages) {
|
public Result getCommunityPostList(@PathVariable("communityId") Long communityId, @RequestBody Pages pages) {
|
||||||
logger.info("开始获取帖子列表");
|
logger.info("开始获取帖子列表");
|
||||||
PageInfo<Post> posts = postService.getCommunityPostList(communityId, pages.getPageNum(), pages.getPageSize());
|
IPage<Post> posts = postService.getCommunityPostList(communityId, pages.getPageNum(), pages.getPageSize());
|
||||||
return Result.ok(posts); // 调用服务层获取帖子列表
|
return Result.ok(posts); // 调用服务层获取帖子列表
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -136,7 +137,7 @@ public class PostController {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping("/official")
|
@GetMapping("/official")
|
||||||
public PageInfo<Post> getOfficialPosts(@RequestBody Pages pages) {
|
public IPage<Post> getOfficialPosts(@RequestBody Pages pages) {
|
||||||
return postService.getOfficialPosts(pages.getPageNum(), pages.getPageSize());
|
return postService.getOfficialPosts(pages.getPageNum(), pages.getPageSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -145,7 +146,7 @@ public class PostController {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping("/nonOfficial")
|
@GetMapping("/nonOfficial")
|
||||||
public PageInfo<Post> getNonOfficialPosts(@RequestBody Pages pages) {
|
public IPage<Post> getNonOfficialPosts(@RequestBody Pages pages) {
|
||||||
return postService.getNonOfficialPosts(pages.getPageNum(), pages.getPageSize());
|
return postService.getNonOfficialPosts(pages.getPageNum(), pages.getPageSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.ivmiku.tutorial.service;
|
package com.ivmiku.tutorial.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
import com.ivmiku.tutorial.entity.Comment;
|
import com.ivmiku.tutorial.entity.Comment;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
@@ -50,9 +51,9 @@ public interface CommentService extends IService<Comment> {
|
|||||||
|
|
||||||
void deleteComment(Long commentId, String userId);
|
void deleteComment(Long commentId, String userId);
|
||||||
|
|
||||||
PageInfo<Comment> getPostComments(Long postId, int pageNum, int pageSize);
|
IPage<Comment> getPostComments(Long postId, int pageNum, int pageSize);
|
||||||
|
|
||||||
PageInfo<Comment> getCommentReplies(Long commentId, int pageNum, int pageSize);
|
IPage<Comment> getCommentReplies(Long commentId, int pageNum, int pageSize);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 回复评论。
|
* 回复评论。
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.ivmiku.tutorial.service;
|
package com.ivmiku.tutorial.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
import com.ivmiku.tutorial.entity.Post;
|
import com.ivmiku.tutorial.entity.Post;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
@@ -12,13 +13,13 @@ public interface PostService extends IService<Post> {
|
|||||||
void updatePost(Long postId, String userId, Post post);
|
void updatePost(Long postId, String userId, Post post);
|
||||||
void deletePost(Long postId, String userId);
|
void deletePost(Long postId, String userId);
|
||||||
|
|
||||||
PageInfo<Post> getPostList(String userId, int pageNum, int pageSize);
|
IPage<Post> getPostList(String userId, int pageNum, int pageSize);
|
||||||
|
|
||||||
PageInfo<Post> getCommunityPostList(Long communityId, int pageNum, int pageSize);
|
IPage<Post> getCommunityPostList(Long communityId, int pageNum, int pageSize);
|
||||||
|
|
||||||
PageInfo<Post> getOfficialPosts(int pageNum, int pageSize);
|
IPage<Post> getOfficialPosts(int pageNum, int pageSize);
|
||||||
|
|
||||||
PageInfo<Post> getNonOfficialPosts(int pageNum, int pageSize);
|
IPage<Post> getNonOfficialPosts(int pageNum, int pageSize);
|
||||||
|
|
||||||
void changePublic(Long postId, Integer isPublic);
|
void changePublic(Long postId, Integer isPublic);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ package com.ivmiku.tutorial.service.impl;
|
|||||||
|
|
||||||
import cn.dev33.satoken.stp.StpUtil;
|
import cn.dev33.satoken.stp.StpUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
import com.ivmiku.tutorial.entity.Comment;
|
import com.ivmiku.tutorial.entity.Comment;
|
||||||
@@ -103,16 +105,17 @@ public class CommentServiceImpl extends ServiceImpl<CommentMapper, Comment> impl
|
|||||||
* @return List<Comment> 返回评论列表
|
* @return List<Comment> 返回评论列表
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public PageInfo<Comment> getPostComments(Long postId, int pageNum, int pageSize) {
|
public IPage<Comment> getPostComments(Long postId, int pageNum, int pageSize) {
|
||||||
logger.info("开始获取帖子ID:{}的评论列表,第{}页,每页{}条", postId, pageNum, pageSize);
|
logger.info("开始获取帖子ID:{}的评论列表,第{}页,每页{}条", postId, pageNum, pageSize);
|
||||||
|
|
||||||
// 设置分页参数
|
// 设置分页参数
|
||||||
PageHelper.startPage(pageNum, pageSize);
|
// PageHelper.startPage(pageNum, pageSize);
|
||||||
|
IPage<Comment> page = new Page<>(pageNum, pageSize);
|
||||||
|
|
||||||
// 查询评论
|
// 查询评论
|
||||||
LambdaQueryWrapper<Comment> wrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<Comment> wrapper = new LambdaQueryWrapper<>();
|
||||||
wrapper.eq(Comment::getPostId, postId).eq(Comment::getIsDeleted, 0);
|
wrapper.eq(Comment::getPostId, postId).eq(Comment::getIsDeleted, 0);
|
||||||
List<Comment> comments = commentMapper.selectList(wrapper);
|
IPage<Comment> comments = commentMapper.selectPage(page, wrapper);
|
||||||
|
|
||||||
if (comments != null) {
|
if (comments != null) {
|
||||||
logger.info("获取帖子ID:{}的评论列表成功", postId);
|
logger.info("获取帖子ID:{}的评论列表成功", postId);
|
||||||
@@ -121,7 +124,7 @@ public class CommentServiceImpl extends ServiceImpl<CommentMapper, Comment> impl
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 使用 PageInfo 包装结果
|
// 使用 PageInfo 包装结果
|
||||||
return new PageInfo<>(comments);
|
return comments;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -132,16 +135,16 @@ public class CommentServiceImpl extends ServiceImpl<CommentMapper, Comment> impl
|
|||||||
* @return List<Comment> 返回回复列表
|
* @return List<Comment> 返回回复列表
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public PageInfo<Comment> getCommentReplies(Long commentId, int pageNum, int pageSize) {
|
public IPage<Comment> getCommentReplies(Long commentId, int pageNum, int pageSize) {
|
||||||
logger.info("开始获取评论ID:{}的回复列表,第{}页,每页{}条", commentId, pageNum, pageSize);
|
logger.info("开始获取评论ID:{}的回复列表,第{}页,每页{}条", commentId, pageNum, pageSize);
|
||||||
|
|
||||||
// 设置分页参数
|
// 设置分页参数
|
||||||
PageHelper.startPage(pageNum, pageSize);
|
// PageHelper.startPage(pageNum, pageSize);
|
||||||
|
IPage<Comment> page = new Page<>(pageNum, pageSize);
|
||||||
// 查询回复
|
// 查询回复
|
||||||
LambdaQueryWrapper<Comment> wrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<Comment> wrapper = new LambdaQueryWrapper<>();
|
||||||
wrapper.eq(Comment::getParentCommentId, commentId).eq(Comment::getIsDeleted, 0);
|
wrapper.eq(Comment::getParentCommentId, commentId).eq(Comment::getIsDeleted, 0);
|
||||||
List<Comment> replies = commentMapper.selectList(wrapper);
|
IPage<Comment> replies = commentMapper.selectPage(page, wrapper);
|
||||||
|
|
||||||
if (replies != null) {
|
if (replies != null) {
|
||||||
logger.info("获取评论ID:{}的回复列表成功", commentId);
|
logger.info("获取评论ID:{}的回复列表成功", commentId);
|
||||||
@@ -150,7 +153,7 @@ public class CommentServiceImpl extends ServiceImpl<CommentMapper, Comment> impl
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 使用 PageInfo 包装结果
|
// 使用 PageInfo 包装结果
|
||||||
return new PageInfo<>(replies);
|
return replies;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 回复评论。
|
* 回复评论。
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
package com.ivmiku.tutorial.service.impl;
|
package com.ivmiku.tutorial.service.impl;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
|
import com.ivmiku.tutorial.entity.Comment;
|
||||||
import com.ivmiku.tutorial.entity.Post;
|
import com.ivmiku.tutorial.entity.Post;
|
||||||
import com.ivmiku.tutorial.mapper.PostMapper;
|
import com.ivmiku.tutorial.mapper.PostMapper;
|
||||||
import com.ivmiku.tutorial.service.PostService;
|
import com.ivmiku.tutorial.service.PostService;
|
||||||
@@ -70,83 +73,83 @@ public class PostServiceImpl extends ServiceImpl<PostMapper, Post> implements Po
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageInfo<Post> getPostList(String userId, int pageNum, int pageSize) {
|
public IPage<Post> getPostList(String userId, int pageNum, int pageSize) {
|
||||||
logger.info("用户ID:{}开始获取帖子列表,第{}页,每页{}条", userId, pageNum, pageSize);
|
logger.info("用户ID:{}开始获取帖子列表,第{}页,每页{}条", userId, pageNum, pageSize);
|
||||||
|
|
||||||
// 设置分页参数
|
// 设置分页参数
|
||||||
PageHelper.startPage(pageNum, pageSize);
|
// PageHelper.startPage(pageNum, pageSize);
|
||||||
|
IPage<Post> page = new Page<>(pageNum, pageSize);
|
||||||
LambdaQueryWrapper<Post> wrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<Post> wrapper = new LambdaQueryWrapper<>();
|
||||||
wrapper.eq(Post::getUserOpenid, userId);
|
wrapper.eq(Post::getUserOpenid, userId);
|
||||||
wrapper.eq(Post::getIsDeleted, 0);
|
wrapper.eq(Post::getIsDeleted, 0);
|
||||||
wrapper.eq(Post::getIsPublic, 1);
|
wrapper.eq(Post::getIsPublic, 1);
|
||||||
|
|
||||||
List<Post> posts = postMapper.selectList(wrapper);
|
IPage<Post> posts = postMapper.selectPage(page, wrapper);
|
||||||
|
|
||||||
// 使用PageInfo封装分页结果
|
// 使用PageInfo封装分页结果
|
||||||
PageInfo<Post> pageInfo = new PageInfo<>(posts);
|
// PageInfo<Post> pageInfo = new PageInfo<>(posts);
|
||||||
|
|
||||||
return pageInfo;
|
return posts;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageInfo<Post> getCommunityPostList(Long communityId, int pageNum, int pageSize) {
|
public IPage<Post> getCommunityPostList(Long communityId, int pageNum, int pageSize) {
|
||||||
logger.info("开始获取社区ID:{}的帖子列表,第{}页,每页{}条", communityId, pageNum, pageSize);
|
logger.info("开始获取社区ID:{}的帖子列表,第{}页,每页{}条", communityId, pageNum, pageSize);
|
||||||
|
|
||||||
// 设置分页参数
|
// 设置分页参数
|
||||||
PageHelper.startPage(pageNum, pageSize);
|
// PageHelper.startPage(pageNum, pageSize);
|
||||||
|
IPage<Post> page = new Page<>(pageNum, pageSize);
|
||||||
LambdaQueryWrapper<Post> wrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<Post> wrapper = new LambdaQueryWrapper<>();
|
||||||
wrapper.eq(Post::getCommunityId, communityId);
|
wrapper.eq(Post::getCommunityId, communityId);
|
||||||
wrapper.eq(Post::getIsDeleted, 0);
|
wrapper.eq(Post::getIsDeleted, 0);
|
||||||
wrapper.eq(Post::getIsPublic, 1);
|
wrapper.eq(Post::getIsPublic, 1);
|
||||||
|
|
||||||
List<Post> posts = postMapper.selectList(wrapper);
|
IPage<Post> posts = postMapper.selectPage(page, wrapper);
|
||||||
|
|
||||||
// 使用PageInfo封装分页结果
|
// 使用PageInfo封装分页结果
|
||||||
PageInfo<Post> pageInfo = new PageInfo<>(posts);
|
// PageInfo<Post> pageInfo = new PageInfo<>(posts);
|
||||||
|
|
||||||
return pageInfo;
|
return posts;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageInfo<Post> getOfficialPosts(int pageNum, int pageSize) {
|
public IPage<Post> getOfficialPosts(int pageNum, int pageSize) {
|
||||||
logger.info("开始获取所有官方创建的帖子,第{}页,每页{}条", pageNum, pageSize);
|
logger.info("开始获取所有官方创建的帖子,第{}页,每页{}条", pageNum, pageSize);
|
||||||
|
|
||||||
// 设置分页参数
|
// 设置分页参数
|
||||||
PageHelper.startPage(pageNum, pageSize);
|
// PageHelper.startPage(pageNum, pageSize);
|
||||||
|
IPage<Post> page = new Page<>(pageNum, pageSize);
|
||||||
LambdaQueryWrapper<Post> wrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<Post> wrapper = new LambdaQueryWrapper<>();
|
||||||
wrapper.eq(Post::getIsOfficial, 1);
|
wrapper.eq(Post::getIsOfficial, 1);
|
||||||
wrapper.eq(Post::getIsDeleted, 0);
|
wrapper.eq(Post::getIsDeleted, 0);
|
||||||
wrapper.eq(Post::getIsPublic, 1);
|
wrapper.eq(Post::getIsPublic, 1);
|
||||||
|
|
||||||
List<Post> posts = postMapper.selectList(wrapper);
|
IPage<Post> posts = postMapper.selectPage(page, wrapper);
|
||||||
|
|
||||||
// 使用PageInfo封装分页结果
|
// 使用PageInfo封装分页结果
|
||||||
PageInfo<Post> pageInfo = new PageInfo<>(posts);
|
// PageInfo<Post> pageInfo = new PageInfo<>(posts);
|
||||||
|
|
||||||
return pageInfo;
|
return posts;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageInfo<Post> getNonOfficialPosts(int pageNum, int pageSize) {
|
public IPage<Post> getNonOfficialPosts(int pageNum, int pageSize) {
|
||||||
logger.info("开始获取所有非官方创建的帖子,第{}页,每页{}条", pageNum, pageSize);
|
logger.info("开始获取所有非官方创建的帖子,第{}页,每页{}条", pageNum, pageSize);
|
||||||
|
|
||||||
// 设置分页参数
|
// 设置分页参数
|
||||||
PageHelper.startPage(pageNum, pageSize);
|
// PageHelper.startPage(pageNum, pageSize);
|
||||||
|
IPage<Post> page = new Page<>(pageNum, pageSize);
|
||||||
LambdaQueryWrapper<Post> wrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<Post> wrapper = new LambdaQueryWrapper<>();
|
||||||
wrapper.eq(Post::getIsOfficial, 0);
|
wrapper.eq(Post::getIsOfficial, 0);
|
||||||
wrapper.eq(Post::getIsDeleted, 0);
|
wrapper.eq(Post::getIsDeleted, 0);
|
||||||
wrapper.eq(Post::getIsPublic, 1);
|
wrapper.eq(Post::getIsPublic, 1);
|
||||||
|
|
||||||
List<Post> posts = postMapper.selectList(wrapper);
|
IPage<Post> posts = postMapper.selectPage(page, wrapper);
|
||||||
|
|
||||||
// 使用PageInfo封装分页结果
|
// 使用PageInfo封装分页结果
|
||||||
PageInfo<Post> pageInfo = new PageInfo<>(posts);
|
// PageInfo<Post> pageInfo = new PageInfo<>(posts);
|
||||||
|
|
||||||
return pageInfo;
|
return posts;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user