Commit aa6f6fb5 authored by 赵啸非's avatar 赵啸非

添加新闻列表与详细小程序接口

parent cf76c708
......@@ -15,4 +15,9 @@ public class NewsReq extends BaseReq {
private Long id;
/**
* 分类id
*/
private Long categoryId;
}
package com.mortals.xhx.busiz.applets.web;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.common.Rest;
import com.mortals.framework.exception.AppException;
......@@ -13,7 +12,6 @@ import com.mortals.xhx.base.system.user.model.UserQuery;
import com.mortals.xhx.base.system.user.service.UserService;
import com.mortals.xhx.busiz.applets.req.NewsReq;
import com.mortals.xhx.busiz.applets.rsp.NewsListInfo;
import com.mortals.xhx.common.code.ProcessStatusEnum;
import com.mortals.xhx.common.utils.BeanUtil;
import com.mortals.xhx.module.dept.model.DeptQuery;
import com.mortals.xhx.module.dept.service.DeptService;
......@@ -31,11 +29,13 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.math.BigDecimal;
import java.util.*;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import static com.mortals.framework.ap.SysConstains.*;
import static com.mortals.framework.ap.SysConstains.PAGEINFO_KEY;
import static com.mortals.xhx.common.key.ErrorCode.ERROR_TOKEN_EXPIRED;
import static com.mortals.xhx.common.key.ErrorCode.ERROR_TOKEN_EXPIRED_CONTENT;
......@@ -70,7 +70,7 @@ public class NewsApiController extends AbstractBaseController<NewsReq> {
}
/**
* 申诉列表
* 新闻列表
*/
@PostMapping(value = "list")
public Rest<Object> newsList(@RequestBody NewsReq newsReq) {
......@@ -85,6 +85,11 @@ public class NewsApiController extends AbstractBaseController<NewsReq> {
try {
PageInfo pageInfo = buildPageInfo(newsReq);
NewsQuery query = new NewsQuery();
if(!ObjectUtils.isEmpty(newsReq.getCategoryId())){
query.setCategoryId(newsReq.getCategoryId());
}
query.setOrderColList(Arrays.asList(new OrderCol("createTime", OrderCol.DESCENDING)));
Result<NewsEntity> result = newsService.find(query, pageInfo, context);
List<NewsListInfo> collect = result.getList().stream().map(item -> {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment