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 {