帖子接口增加帖子1楼信息

master
ZHD 5 years ago
parent 35b93aad46
commit effb1eb1b4
  1. 12
      src/main/java/com/community/pocket/entity/vo/android/ForumDto.java
  2. 8
      src/main/java/com/community/pocket/repository/android/ForumDao.java

@ -1,6 +1,7 @@
package com.community.pocket.entity.vo.android; package com.community.pocket.entity.vo.android;
import com.community.pocket.entity.po.Forum; 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.Active;
import com.community.pocket.entity.po.android.Complain; import com.community.pocket.entity.po.android.Complain;
import com.community.pocket.entity.po.android.MyInfo; import com.community.pocket.entity.po.android.MyInfo;
@ -35,6 +36,17 @@ public class ForumDto {
//结算信息 //结算信息
private Score score; private Score score;
//1楼数据
private ForumContent detailContent;
public ForumContent getDetailContent() {
return detailContent;
}
public void setDetailContent(ForumContent detailContent) {
this.detailContent = detailContent;
}
public Active getActiveDto() { public Active getActiveDto() {
return activeDto; return activeDto;
} }

@ -1,6 +1,7 @@
package com.community.pocket.repository.android; package com.community.pocket.repository.android;
import com.community.pocket.entity.po.Forum; 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.Complain;
import com.community.pocket.entity.po.android.MyInfo; import com.community.pocket.entity.po.android.MyInfo;
import com.community.pocket.entity.vo.ForumQuery; import com.community.pocket.entity.vo.ForumQuery;
@ -17,6 +18,7 @@ import org.apache.commons.lang3.ObjectUtils;
import org.bson.types.ObjectId; import org.bson.types.ObjectId;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Sort; import org.springframework.data.domain.Sort;
import org.springframework.data.mongodb.core.aggregation.Aggregation; import org.springframework.data.mongodb.core.aggregation.Aggregation;
@ -42,6 +44,7 @@ public class ForumDao extends BaseDao<Forum> {
@Value("${forum.content-length}") @Value("${forum.content-length}")
private int contentLength; private int contentLength;
//添加回复数 //添加回复数
public boolean update(ForumReplyForm forumReplyForm) { public boolean update(ForumReplyForm forumReplyForm) {
return mongoTemplate.updateFirst(new Query(Criteria.where("id").is(new ObjectId(forumReplyForm.getForumId()))), return mongoTemplate.updateFirst(new Query(Criteria.where("id").is(new ObjectId(forumReplyForm.getForumId()))),
@ -116,6 +119,7 @@ public class ForumDao extends BaseDao<Forum> {
if (forumDto.getComplainDto() != null) { if (forumDto.getComplainDto() != null) {
loadComplain(forumDto); loadComplain(forumDto);
} }
loadDetailContent(forumDto);
} }
} }
page.setList(forumDtos); page.setList(forumDtos);
@ -128,6 +132,10 @@ public class ForumDao extends BaseDao<Forum> {
return null; 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) { public Forum save(ForumVo forumVo) {
try { try {

Loading…
Cancel
Save