From effb1eb1b45a6b70489cdcc5742656ff14bf2603 Mon Sep 17 00:00:00 2001 From: ZHD <123456> Date: Fri, 1 May 2020 19:24:22 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B8=96=E5=AD=90=E6=8E=A5=E5=8F=A3=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E5=B8=96=E5=AD=901=E6=A5=BC=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../community/pocket/entity/vo/android/ForumDto.java | 12 ++++++++++++ .../pocket/repository/android/ForumDao.java | 8 ++++++++ 2 files changed, 20 insertions(+) diff --git a/src/main/java/com/community/pocket/entity/vo/android/ForumDto.java b/src/main/java/com/community/pocket/entity/vo/android/ForumDto.java index a52fd82..07004ae 100644 --- a/src/main/java/com/community/pocket/entity/vo/android/ForumDto.java +++ b/src/main/java/com/community/pocket/entity/vo/android/ForumDto.java @@ -1,6 +1,7 @@ package com.community.pocket.entity.vo.android; import com.community.pocket.entity.po.Forum; +import com.community.pocket.entity.po.ForumContent; import com.community.pocket.entity.po.android.Active; import com.community.pocket.entity.po.android.Complain; import com.community.pocket.entity.po.android.MyInfo; @@ -35,6 +36,17 @@ public class ForumDto { //结算信息 private Score score; + //1楼数据 + private ForumContent detailContent; + + public ForumContent getDetailContent() { + return detailContent; + } + + public void setDetailContent(ForumContent detailContent) { + this.detailContent = detailContent; + } + public Active getActiveDto() { return activeDto; } diff --git a/src/main/java/com/community/pocket/repository/android/ForumDao.java b/src/main/java/com/community/pocket/repository/android/ForumDao.java index 7139a41..e9035c8 100644 --- a/src/main/java/com/community/pocket/repository/android/ForumDao.java +++ b/src/main/java/com/community/pocket/repository/android/ForumDao.java @@ -1,6 +1,7 @@ package com.community.pocket.repository.android; import com.community.pocket.entity.po.Forum; +import com.community.pocket.entity.po.ForumContent; import com.community.pocket.entity.po.android.Complain; import com.community.pocket.entity.po.android.MyInfo; import com.community.pocket.entity.vo.ForumQuery; @@ -17,6 +18,7 @@ import org.apache.commons.lang3.ObjectUtils; import org.bson.types.ObjectId; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.data.domain.Sort; import org.springframework.data.mongodb.core.aggregation.Aggregation; @@ -42,6 +44,7 @@ public class ForumDao extends BaseDao { @Value("${forum.content-length}") private int contentLength; + //添加回复数 public boolean update(ForumReplyForm forumReplyForm) { return mongoTemplate.updateFirst(new Query(Criteria.where("id").is(new ObjectId(forumReplyForm.getForumId()))), @@ -116,6 +119,7 @@ public class ForumDao extends BaseDao { if (forumDto.getComplainDto() != null) { loadComplain(forumDto); } + loadDetailContent(forumDto); } } page.setList(forumDtos); @@ -128,6 +132,10 @@ public class ForumDao extends BaseDao { return null; } + private void loadDetailContent(ForumDto forumDto) { + forumDto.setDetailContent(mongoTemplate.findOne(new Query(Criteria.where("forumId").is(forumDto.getId()).and("tower").is(1)), ForumContent.class)); + } + //保存动态 public Forum save(ForumVo forumVo) { try {