diff --git a/images/apk.png b/images/apk.png index 2edc2b6..aef4287 100644 Binary files a/images/apk.png and b/images/apk.png differ diff --git a/src/main/java/io/linfeng/modules/admin/entity/PostEntity.java b/src/main/java/io/linfeng/modules/admin/entity/PostEntity.java index 6c9847c..7e5cf3a 100644 --- a/src/main/java/io/linfeng/modules/admin/entity/PostEntity.java +++ b/src/main/java/io/linfeng/modules/admin/entity/PostEntity.java @@ -94,4 +94,8 @@ public class PostEntity implements Serializable { */ private Date createTime; + /** + * 分类id + */ + private Integer cut; } diff --git a/src/main/java/io/linfeng/modules/admin/service/impl/PostServiceImpl.java b/src/main/java/io/linfeng/modules/admin/service/impl/PostServiceImpl.java index 4bee180..349a4f2 100644 --- a/src/main/java/io/linfeng/modules/admin/service/impl/PostServiceImpl.java +++ b/src/main/java/io/linfeng/modules/admin/service/impl/PostServiceImpl.java @@ -250,7 +250,16 @@ public class PostServiceImpl extends ServiceImpl implements AppPageUtils appPage; Page page = new Page<>(request.getPage(), 10); QueryWrapper queryWrapper = new QueryWrapper<>(); - + if(request.getClassId()!=null){ + if(request.getClassId()==0){ + queryWrapper.lambda().orderByDesc(PostEntity::getReadCount); + appPage = this.mapPostList(page, queryWrapper, 0); + }else{ + queryWrapper.lambda().eq(PostEntity::getCut,request.getClassId()); + queryWrapper.lambda().orderByDesc(PostEntity::getId); + appPage = this.mapPostList(page, queryWrapper, 0); + } + }else{ if (ObjectUtil.isNotNull(request.getTopicId())) { queryWrapper.lambda().eq(PostEntity::getTopicId, request.getTopicId()); } @@ -270,6 +279,9 @@ public class PostServiceImpl extends ServiceImpl implements } else { appPage = this.mapPostList(page, queryWrapper, user.getUid()); } + } + + return appPage; } diff --git a/src/main/java/io/linfeng/modules/app/controller/AppCategoryController.java b/src/main/java/io/linfeng/modules/app/controller/AppCategoryController.java new file mode 100644 index 0000000..d18fc08 --- /dev/null +++ b/src/main/java/io/linfeng/modules/app/controller/AppCategoryController.java @@ -0,0 +1,35 @@ +package io.linfeng.modules.app.controller; + +import io.linfeng.common.utils.R; +import io.linfeng.modules.admin.entity.CategoryEntity; +import io.linfeng.modules.admin.service.CategoryService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +/** + * @author linfeng + * @date 2022/9/4 10:06 + */ +@Api(tags = "用户端——分类") +@RestController +@RequestMapping("app/topic") +public class AppCategoryController { + + + @Autowired + private CategoryService categoryService; + + + @GetMapping("/classList") + @ApiOperation("分类列表") + public R classList(){ + List list = categoryService.list(); + return R.ok().put("result",list); + } +} diff --git a/src/main/java/io/linfeng/modules/app/controller/AppLinkController.java b/src/main/java/io/linfeng/modules/app/controller/AppLinkController.java new file mode 100644 index 0000000..f92d65b --- /dev/null +++ b/src/main/java/io/linfeng/modules/app/controller/AppLinkController.java @@ -0,0 +1,31 @@ +package io.linfeng.modules.app.controller; + +import io.linfeng.common.utils.R; +import io.linfeng.modules.admin.service.LinkService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * @author linfeng + * @date 2022/9/4 10:15 + */ +@Api(tags = "用户端——分类") +@RestController +@RequestMapping("app/link") +public class AppLinkController { + + @Autowired + private LinkService linkService; + + + @GetMapping("/list") + @ApiOperation("轮播图列表") + public R getList(){ + + return R.ok().put("result",linkService.list()); + } +} diff --git a/src/main/java/io/linfeng/modules/app/form/AddPostForm.java b/src/main/java/io/linfeng/modules/app/form/AddPostForm.java index 5d6b3d6..1c2a327 100644 --- a/src/main/java/io/linfeng/modules/app/form/AddPostForm.java +++ b/src/main/java/io/linfeng/modules/app/form/AddPostForm.java @@ -71,5 +71,10 @@ public class AddPostForm implements Serializable { */ private Double latitude; + /** + * 分类id + */ + private Integer cut; + } diff --git a/src/main/java/io/linfeng/modules/app/form/PostListForm.java b/src/main/java/io/linfeng/modules/app/form/PostListForm.java index 16c75a6..81d3325 100644 --- a/src/main/java/io/linfeng/modules/app/form/PostListForm.java +++ b/src/main/java/io/linfeng/modules/app/form/PostListForm.java @@ -34,4 +34,8 @@ public class PostListForm { @ApiModelProperty(value = "disId") private Integer disId; + @ApiModelProperty(value = "分类id") + private Integer classId; + + }