新增分类后端代码

This commit is contained in:
linfeng 2022-09-04 12:15:02 +08:00
parent f97f11dd06
commit 01ab666f62
7 changed files with 92 additions and 1 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

View File

@ -94,4 +94,8 @@ public class PostEntity implements Serializable {
*/
private Date createTime;
/**
* 分类id
*/
private Integer cut;
}

View File

@ -250,7 +250,16 @@ public class PostServiceImpl extends ServiceImpl<PostDao, PostEntity> implements
AppPageUtils appPage;
Page<PostEntity> page = new Page<>(request.getPage(), 10);
QueryWrapper<PostEntity> 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<PostDao, PostEntity> implements
} else {
appPage = this.mapPostList(page, queryWrapper, user.getUid());
}
}
return appPage;
}

View File

@ -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<CategoryEntity> list = categoryService.list();
return R.ok().put("result",list);
}
}

View File

@ -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());
}
}

View File

@ -71,5 +71,10 @@ public class AddPostForm implements Serializable {
*/
private Double latitude;
/**
* 分类id
*/
private Integer cut;
}

View File

@ -34,4 +34,8 @@ public class PostListForm {
@ApiModelProperty(value = "disId")
private Integer disId;
@ApiModelProperty(value = "分类id")
private Integer classId;
}