diff --git a/community-service/src/main/java/com/tanpu/community/dao/entity/community/ThemeEntity.java b/community-service/src/main/java/com/tanpu/community/dao/entity/community/ThemeEntity.java index c4567fe37f6c0c16df230c5d7b6e66789d724402..ef630c0345acd717ff0efc0821d756d403c03ea7 100644 --- a/community-service/src/main/java/com/tanpu/community/dao/entity/community/ThemeEntity.java +++ b/community-service/src/main/java/com/tanpu/community/dao/entity/community/ThemeEntity.java @@ -1,29 +1,30 @@ package com.tanpu.community.dao.entity.community; -import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; -import java.time.LocalDateTime; -import java.io.Serializable; +import com.baomidou.mybatisplus.annotation.TableName; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.NoArgsConstructor; +import java.io.Serializable; +import java.time.LocalDateTime; + /** * <p> * 主题内容 * </p> * * @author xudong - * @since 2021-07-22 + * @since 2021-07-23 */ @TableName("theme") -@ApiModel(value="ThemeEntity对象", description="主题内容") @Builder @AllArgsConstructor @NoArgsConstructor +@ApiModel(value="ThemeEntity对象", description="主题内容") public class ThemeEntity implements Serializable { private static final long serialVersionUID = 1L; @@ -44,6 +45,9 @@ public class ThemeEntity implements Serializable { @ApiModelProperty(value = "文本内容(json),type:附件类型(8:文本,88:äº§å“ 3ï¼šç›´æ’ 6:çŸè§†é¢‘ 300:课程,9:图片 10:多图),productType:基金类型(0 公募,1 ç§å‹Ÿï¼Œ2 白åå•,3 ç§æœ‰ï¼‰") private String content; + @ApiModelProperty(value = "讨论ä¸çš„æ–‡æœ¬") + private String discussContent; + @ApiModelProperty(value = "作者id") private String authorId; @@ -107,6 +111,14 @@ public class ThemeEntity implements Serializable { this.content = content; } + public String getDiscussContent() { + return discussContent; + } + + public void setDiscussContent(String discussContent) { + this.discussContent = discussContent; + } + public String getAuthorId() { return authorId; } @@ -179,6 +191,7 @@ public class ThemeEntity implements Serializable { ", title=" + title + ", themeType=" + themeType + ", content=" + content + + ", discussContent=" + discussContent + ", authorId=" + authorId + ", formerThemeId=" + formerThemeId + ", topicId=" + topicId + diff --git a/community-service/src/main/java/com/tanpu/community/dao/mapper/community/ThemeMapper.java b/community-service/src/main/java/com/tanpu/community/dao/mapper/community/ThemeMapper.java index 601b3a5fddb26faa75b8419fa047bf9c1c3a5c22..f822c16088b80519758688a8c7bb9cf3623fc5b8 100644 --- a/community-service/src/main/java/com/tanpu/community/dao/mapper/community/ThemeMapper.java +++ b/community-service/src/main/java/com/tanpu/community/dao/mapper/community/ThemeMapper.java @@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; * </p> * * @author xudong - * @since 2021-07-22 + * @since 2021-07-23 */ public interface ThemeMapper extends BaseMapper<ThemeEntity> { diff --git a/community-service/src/main/java/com/tanpu/community/manager/ThemeManager.java b/community-service/src/main/java/com/tanpu/community/manager/ThemeManager.java index 8f2e3c4309d20559d7340d140eecefa8f5920b2e..8c4ad36060ad85fe8682b77aacb3f752580284e7 100644 --- a/community-service/src/main/java/com/tanpu/community/manager/ThemeManager.java +++ b/community-service/src/main/java/com/tanpu/community/manager/ThemeManager.java @@ -118,6 +118,9 @@ public class ThemeManager { BeanUtils.copyProperties(req, themeEntity); themeEntity.setAuthorId(userId); themeEntity.setContent(JsonUtil.toJson(req.getContent())); + //讨论类型,将讨论ä¸çš„æ–‡æœ¬æ”¾å…¥åˆ°discussContentä¸ + if (ThemeTypeEnum.DISCUSSION.getCode().equals(themeEntity.getThemeType())) + themeEntity.setDiscussContent(req.getContent().get(0).getValue()); //è…¾è®¯äº‘æ•æ„Ÿè¯æ ¡éªŒ checkContent(themeEntity.getContent()); @@ -249,7 +252,7 @@ public class ThemeManager { ThemeQo themeQo = redisCache.getObject(StringUtils.joinWith("_", CACHE_THEME_ID, themeId), 60, () -> this.getDetailForCommon(themeId), ThemeQo.class); - buildThemeExtraInfoByUser(userId,themeQo); + buildThemeExtraInfoByUser(userId, themeQo); return themeQo; } @@ -264,13 +267,12 @@ public class ThemeManager { batchFeignCallService.getAttachDetail(themeQo); //转å‘ã€æ”¶è—ã€ç‚¹èµž - buildThemeQoExtraInfo( themeQo); + buildThemeQoExtraInfo(themeQo); return themeQo; } - // 点赞/å–æ¶ˆç‚¹èµž public void like(LikeThemeReq req, String userId) { if (OperationTypeEnum.CONFIRM.getCode().equals(req.getType())) { @@ -338,8 +340,8 @@ public class ThemeManager { batchFeignCallService.getAttachDetailByBatch(themeQos); //å…¶ä»–ä¿¡æ¯ for (ThemeQo themeQO : themeQos) { - buildThemeQoExtraInfo( themeQO); - buildThemeExtraInfoByUser(userId,themeQO); + buildThemeQoExtraInfo(themeQO); + buildThemeExtraInfoByUser(userId, themeQO); } return themeQos; @@ -347,7 +349,7 @@ public class ThemeManager { //转å‘对象ã€ç‚¹èµžã€æ”¶è—ã€è½¬å‘æ•° - private void buildThemeQoExtraInfo( ThemeQo themeQo) { + private void buildThemeQoExtraInfo(ThemeQo themeQo) { String themeId = themeQo.getThemeId(); //å°è£…转å‘对象 FormerThemeQo former = redisCache.getObject(StringUtils.joinWith("_", CACHE_FORMER_THEME_ID, themeId), 60, @@ -363,7 +365,7 @@ public class ThemeManager { } //组装和当å‰ç”¨æˆ·ç›¸å…³ä¿¡æ¯ - private void buildThemeExtraInfoByUser(String userId, ThemeQo themeQo){ + private void buildThemeExtraInfoByUser(String userId, ThemeQo themeQo) { String themeId = themeQo.getThemeId(); //是å¦å…³æ³¨ä½œè€… String authorId = themeQo.getAuthorId(); diff --git a/community-service/src/main/resources/mapper/community/ThemeEntityMapper.xml b/community-service/src/main/resources/mapper/community/ThemeEntityMapper.xml index dc7f367c6e2029504d94d62bdf22bb019f0a77cf..fc0fd9e26cb6bcb1275d4a2d7a45ff0281ba3d7c 100644 --- a/community-service/src/main/resources/mapper/community/ThemeEntityMapper.xml +++ b/community-service/src/main/resources/mapper/community/ThemeEntityMapper.xml @@ -9,6 +9,7 @@ <result column="title" property="title" /> <result column="theme_type" property="themeType" /> <result column="content" property="content" /> + <result column="discuss_content" property="discussContent" /> <result column="author_id" property="authorId" /> <result column="former_theme_id" property="formerThemeId" /> <result column="topic_id" property="topicId" />