Commit dd948a60 by 翁国栋

8小时后台--

应需求一定要展示前四张图片
parent ef0568de
package cn.timer.api.controller.qyxx; package cn.timer.api.controller.qyxx;
import java.util.ArrayList; import java.util.*;
import java.util.Date;
import java.util.List;
import java.util.Timer;
import java.util.TimerTask;
import cn.timer.api.utils.redis.RedisUtil; import cn.timer.api.utils.redis.RedisUtil;
import com.google.common.collect.Maps;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
...@@ -88,13 +85,22 @@ public class CmsController { ...@@ -88,13 +85,22 @@ public class CmsController {
*/ */
@GetMapping(value = "/zxqyxx") @GetMapping(value = "/zxqyxx")
@ApiOperation(value = "获取最新讯息的标题、发布时间", httpMethod = "GET", notes = "接口发布说明") @ApiOperation(value = "获取最新讯息的标题、发布时间", httpMethod = "GET", notes = "接口发布说明")
public Result<List<CmsContent>> groupbyTime(@CurrentUser UserBean userBean) { public Result<Object> groupbyTime(@CurrentUser UserBean userBean) {
Map map = Maps.newHashMap();
Integer orgCode = userBean.getOrgCode(); Integer orgCode = userBean.getOrgCode();
QueryWrapper<CmsContent> queryWrapper = new QueryWrapper<>(); QueryWrapper<CmsContent> queryWrapper = new QueryWrapper<>();
queryWrapper.select("id", "title", "author", "releasetime", "fmtpath").eq("releasestate", 0) queryWrapper.select("id", "title", "author", "releasetime", "fmtpath").eq("releasestate", 0)
.eq("organization_id", orgCode).orderByDesc("releasetime").last("limit 6"); .eq("organization_id", orgCode).orderByDesc("releasetime").last("limit 6");
List<CmsContent> qynr = CmsContent.builder().build().selectList(queryWrapper); List<CmsContent> qynr = CmsContent.builder().build().selectList(queryWrapper);
return ResultUtil.data(qynr, "查询分类成功!"); /*应需求一定要展示前四张图片*/
QueryWrapper<CmsContent> qw = new QueryWrapper<>();
qw.select("fmtpath").eq("releasestate", 0).isNotNull("fmtpath").ne("fmtpath","")
.eq("organization_id", orgCode).orderByDesc("releasetime").last("limit 4");
List<CmsContent> picList = CmsContent.builder().build().selectList(qw);
map.put("list",qynr);
map.put("picList",picList);
return ResultUtil.data(map, "查询分类成功!");
} }
/** /**
......
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