Commit 57c3b245 authored by 刘基明's avatar 刘基明

表修改

parent a695f815
......@@ -19,11 +19,11 @@ public class CodeAutoGenerator {
String currentPath = System.getProperty("user.dir");
String codeBaseHome = "/community-service/src/main/java";
String author = "xudong";
String mysqlUserName = "dev";
String mysqlPassword = "qimeng123";
String jdbcUrl = "jdbc:mysql://47.101.189.151:31931/tamp_community";
String[] tables = new String[]{"comment"};
// String[] tables = new String[]{"follow_rel", "black_list","collection","comment","follow_rel","file_record","home_page","theme","topic","theme_attachment"};
String mysqlUserName = "tamp_admin";
String mysqlPassword = "@imeng123";
String jdbcUrl = "jdbc:mysql://rm-uf6r22t3d798q4kmkao.mysql.rds.aliyuncs.com:3306/tamp_community";
// String[] tables = new String[]{"theme"};
String[] tables = new String[]{"comment","follow_rel","theme","visit_log"};
String basePackage = "com.tanpu.community";
String mapperPackage = "dao.mapper.community";
String entityPackage = "dao.entity.community";
......
......@@ -3,7 +3,6 @@ package com.tanpu.community.dao.entity.community;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
......@@ -19,7 +18,7 @@ import java.time.LocalDateTime;
* </p>
*
* @author xudong
* @since 2021-07-22
* @since 2021-07-28
*/
@TableName("comment")
@ApiModel(value="CommentEntity对象", description="评论")
......@@ -55,16 +54,14 @@ public class CommentEntity implements Serializable {
@ApiModelProperty(value = "回复评论id")
private String replyId;
@ApiModelProperty(value = "是否通过 0:初始值 1:已通过(管理后台使用)")
private Integer isPass;
@ApiModelProperty(value = "审核状态 0:初始值 1:已通过(管理后台使用)")
private Integer reviewStatus;
@ApiModelProperty(value = "举报状态 0:未被举报 1:被举报 2:已处理")
private Integer reportStatus;
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private LocalDateTime createTime;
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private LocalDateTime updateTime;
private Integer deleteTag;
......@@ -134,12 +131,12 @@ public class CommentEntity implements Serializable {
this.replyId = replyId;
}
public Integer getIsPass() {
return isPass;
public Integer getReviewStatus() {
return reviewStatus;
}
public void setIsPass(Integer isPass) {
this.isPass = isPass;
public void setReviewStatus(Integer reviewStatus) {
this.reviewStatus = reviewStatus;
}
public Integer getReportStatus() {
......@@ -185,7 +182,7 @@ public class CommentEntity implements Serializable {
", themeId=" + themeId +
", parentId=" + parentId +
", replyId=" + replyId +
", isPass=" + isPass +
", reviewStatus=" + reviewStatus +
", reportStatus=" + reportStatus +
", createTime=" + createTime +
", updateTime=" + updateTime +
......
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-28
*/
@TableName("follow_rel")
@ApiModel(value="FollowRelEntity对象", description="粉丝关系")
......@@ -33,10 +34,10 @@ public class FollowRelEntity implements Serializable {
private Long id;
@ApiModelProperty(value = "被关注的人id")
private String followUserId;
private String idolId;
@ApiModelProperty(value = "粉丝id")
private String followerId;
private String fansId;
@ApiModelProperty(value = "关注时间")
private LocalDateTime followTime;
......@@ -59,20 +60,20 @@ public class FollowRelEntity implements Serializable {
this.id = id;
}
public String getFollowUserId() {
return followUserId;
public String getIdolId() {
return idolId;
}
public void setFollowUserId(String followUserId) {
this.followUserId = followUserId;
public void setIdolId(String idolId) {
this.idolId = idolId;
}
public String getFollowerId() {
return followerId;
public String getFansId() {
return fansId;
}
public void setFollowerId(String followerId) {
this.followerId = followerId;
public void setFansId(String fansId) {
this.fansId = fansId;
}
public LocalDateTime getFollowTime() {
......@@ -119,8 +120,8 @@ public class FollowRelEntity implements Serializable {
public String toString() {
return "FollowRelEntity{" +
"id=" + id +
", followUserId=" + followUserId +
", followerId=" + followerId +
", idolId=" + idolId +
", fansId=" + fansId +
", followTime=" + followTime +
", unfollowTime=" + unfollowTime +
", createTime=" + createTime +
......
......@@ -18,7 +18,7 @@ import java.time.LocalDateTime;
* </p>
*
* @author xudong
* @since 2021-07-23
* @since 2021-07-28
*/
@TableName("theme")
@Builder
......@@ -42,12 +42,9 @@ public class ThemeEntity implements Serializable {
@ApiModelProperty(value = "类型 1:讨论无标题 2:长文有标题 3:转发")
private Integer themeType;
@ApiModelProperty(value = "文本内容(json),type:附件类型(8:文本,88:产品 3:直播 6:短视频 300:课程,9:图片 10:多图),productType:基金类型(0 公募,1 私募,2 白名单,3 私有)")
@ApiModelProperty(value = "文本内容(json),type:附件类型(108:文本,88:产品 3:直播 6:短视频 303:新版课程-视频,304: 新版课程-音频,109:单图(长文) 110:多图(讨论)),productType:基金类型(0 公募,1 私募,2 白名单,3 私有)")
private String content;
@ApiModelProperty(value = "讨论中的文本")
private String discussContent;
@ApiModelProperty(value = "作者id")
private String authorId;
......@@ -57,8 +54,8 @@ public class ThemeEntity implements Serializable {
@ApiModelProperty(value = "所属的话题")
private String topicId;
@ApiModelProperty(value = "是否通过 0:初始值 1:已通过(管理后台使用)")
private Integer isPass;
@ApiModelProperty(value = "审核状态 0:未审核 1:审核通过(管理后台使用)")
private Integer reviewStatus;
@ApiModelProperty(value = "举报状态 0:未被举报 1:被举报 2:已处理")
private Integer reportStatus;
......@@ -111,14 +108,6 @@ 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;
}
......@@ -143,12 +132,12 @@ public class ThemeEntity implements Serializable {
this.topicId = topicId;
}
public Integer getIsPass() {
return isPass;
public Integer getReviewStatus() {
return reviewStatus;
}
public void setIsPass(Integer isPass) {
this.isPass = isPass;
public void setReviewStatus(Integer reviewStatus) {
this.reviewStatus = reviewStatus;
}
public Integer getReportStatus() {
......@@ -191,11 +180,10 @@ public class ThemeEntity implements Serializable {
", title=" + title +
", themeType=" + themeType +
", content=" + content +
", discussContent=" + discussContent +
", authorId=" + authorId +
", formerThemeId=" + formerThemeId +
", topicId=" + topicId +
", isPass=" + isPass +
", reviewStatus=" + reviewStatus +
", reportStatus=" + reportStatus +
", createTime=" + createTime +
", updateTime=" + updateTime +
......
package com.tanpu.community.dao.entity.community;
import com.baomidou.mybatisplus.annotation.TableName;
import java.time.LocalDateTime;
import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* <p>
* 浏览记录
* </p>
*
* @author xudong
* @since 2021-07-28
*/
@TableName("visit_log")
@ApiModel(value="VisitLogEntity对象", description="浏览记录")
public class VisitLogEntity implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "id")
private Long id;
@ApiModelProperty(value = "session_id")
private String ident;
@ApiModelProperty(value = "浏览者id")
private String visitorId;
@ApiModelProperty(value = "作者id")
private String authorId;
@ApiModelProperty(value = "关联目标ID")
private String refId;
@ApiModelProperty(value = "关联目标类型 1:进入话题页 2:进入主题正文 3、用户查看首页-关注")
private Integer refType;
@ApiModelProperty(value = "浏览时间 单位秒")
private Integer duration;
private LocalDateTime createTime;
private LocalDateTime updateTime;
private Integer deleteTag;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getIdent() {
return ident;
}
public void setIdent(String ident) {
this.ident = ident;
}
public String getVisitorId() {
return visitorId;
}
public void setVisitorId(String visitorId) {
this.visitorId = visitorId;
}
public String getAuthorId() {
return authorId;
}
public void setAuthorId(String authorId) {
this.authorId = authorId;
}
public String getRefId() {
return refId;
}
public void setRefId(String refId) {
this.refId = refId;
}
public Integer getRefType() {
return refType;
}
public void setRefType(Integer refType) {
this.refType = refType;
}
public Integer getDuration() {
return duration;
}
public void setDuration(Integer duration) {
this.duration = duration;
}
public LocalDateTime getCreateTime() {
return createTime;
}
public void setCreateTime(LocalDateTime createTime) {
this.createTime = createTime;
}
public LocalDateTime getUpdateTime() {
return updateTime;
}
public void setUpdateTime(LocalDateTime updateTime) {
this.updateTime = updateTime;
}
public Integer getDeleteTag() {
return deleteTag;
}
public void setDeleteTag(Integer deleteTag) {
this.deleteTag = deleteTag;
}
@Override
public String toString() {
return "VisitLogEntity{" +
"id=" + id +
", ident=" + ident +
", visitorId=" + visitorId +
", authorId=" + authorId +
", refId=" + refId +
", refType=" + refType +
", duration=" + duration +
", createTime=" + createTime +
", updateTime=" + updateTime +
", deleteTag=" + deleteTag +
"}";
}
}
package com.tanpu.community.dao.mapper.community;
import com.tanpu.community.dao.entity.community.VisitLogEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* 浏览记录 Mapper 接口
* </p>
*
* @author xudong
* @since 2021-07-28
*/
public interface VisitLogMapper extends BaseMapper<VisitLogEntity> {
}
......@@ -135,10 +135,10 @@ public class HomePageManager {
// 设置关注列表
List<String> collect = userInfoOrgs.stream().map(UserInfoOrg::getUserId).collect(Collectors.toList());
List<FollowRelEntity> followRelEntities = followRelMapper.selectList(new LambdaQueryWrapper<FollowRelEntity>()
.eq(FollowRelEntity::getFollowerId, userId)
.in(FollowRelEntity::getFollowUserId, collect)
.eq(FollowRelEntity::getIdolId, userId)
.in(FollowRelEntity::getFansId, collect)
.eq(FollowRelEntity::getDeleteTag, BizStatus.DeleteTag.tag_init));
Map<String, FollowRelEntity> collect1 = followRelEntities.stream().collect(Collectors.toMap(FollowRelEntity::getFollowUserId, Function.identity()));
Map<String, FollowRelEntity> collect1 = followRelEntities.stream().collect(Collectors.toMap(FollowRelEntity::getIdolId, Function.identity()));
userInfoOrgs.forEach(userInfoOrg -> {
if (collect1.containsKey(userInfoOrg.getUserId()))
userInfoOrg.setIsFollower(ShowFollowStatusEnum.FOLLOWED.getCode());//1已关注
......@@ -163,9 +163,9 @@ public class HomePageManager {
}
private void getFansNUmAndFollowNum(UserInfoNew userInfoNew) {
Integer fansNumber = followRelMapper.selectCount(new LambdaQueryWrapper<FollowRelEntity>().eq(FollowRelEntity::getFollowUserId, userInfoNew.getUserId())
Integer fansNumber = followRelMapper.selectCount(new LambdaQueryWrapper<FollowRelEntity>().eq(FollowRelEntity::getIdolId, userInfoNew.getUserId())
.eq(FollowRelEntity::getDeleteTag, BizStatus.DeleteTag.tag_init));
Integer followNumber = followRelMapper.selectCount(new LambdaQueryWrapper<FollowRelEntity>().eq(FollowRelEntity::getFollowerId, userInfoNew.getUserId())
Integer followNumber = followRelMapper.selectCount(new LambdaQueryWrapper<FollowRelEntity>().eq(FollowRelEntity::getFansId, userInfoNew.getUserId())
.eq(FollowRelEntity::getDeleteTag, BizStatus.DeleteTag.tag_init));
userInfoNew.setFollowNumber(followNumber);
userInfoNew.setFansNumber(fansNumber);
......
......@@ -132,15 +132,7 @@ public class ThemeManager {
BeanUtils.copyProperties(req, themeEntity);
themeEntity.setAuthorId(userId);
themeEntity.setContent(JsonUtil.toJson(req.getContent()));
// 讨论类型,将讨论中的文本放入到discussContent中
if (ThemeTypeEnum.DISCUSSION.getCode().equals(themeEntity.getThemeType())) {
String content = req.getContent().get(0).getValue();
// discuss_content字段上限为256个字符
if (content.length() > 256) {
content = content.substring(0, 255);
}
themeEntity.setDiscussContent(content);
}
// 腾讯云敏感词校验
checkContent(themeEntity.getContent());
......
......@@ -23,19 +23,19 @@ public class FollowRelService {
public List<String> queryFansByFollowerId(String followerId) {
return followRelMapper.selectList(new LambdaQueryWrapper<FollowRelEntity>()
.eq(FollowRelEntity::getFollowerId, followerId)
.eq(FollowRelEntity::getFansId, followerId)
.eq(FollowRelEntity::getDeleteTag, DeleteTagEnum.NOT_DELETED.getCode()))
.stream().map(FollowRelEntity::getFollowUserId)
.stream().map(FollowRelEntity::getIdolId)
.collect(Collectors.toList());
}
// @Cacheable(value = "tempCache", keyGenerator = "communityKeyGenerator")
public List<String> queryFansByIdolId(String idolId) {
LambdaQueryWrapper<FollowRelEntity> queryWrapper = new LambdaQueryWrapper<FollowRelEntity>()
.eq(FollowRelEntity::getFollowUserId, idolId)
.eq(FollowRelEntity::getIdolId, idolId)
.eq(FollowRelEntity::getDeleteTag, DeleteTagEnum.NOT_DELETED.getCode());
return followRelMapper.selectList(queryWrapper)
.stream().map(FollowRelEntity::getFollowerId).collect(Collectors.toList());
.stream().map(FollowRelEntity::getFansId).collect(Collectors.toList());
}
@Transactional
......@@ -43,8 +43,8 @@ public class FollowRelService {
FollowRelEntity searchResult = queryRecord(idolId, followerId);
if (searchResult==null){
FollowRelEntity entity = FollowRelEntity.builder()
.followUserId(idolId)
.followerId(followerId)
.idolId(idolId)
.fansId(followerId)
.followTime(LocalDateTime.now())
.build();
......@@ -75,14 +75,14 @@ public class FollowRelService {
public FollowRelEntity queryRecord(String idolId, String followerId){
return followRelMapper.selectOne(new LambdaQueryWrapper<FollowRelEntity>()
.eq(FollowRelEntity::getFollowUserId,idolId)
.eq(FollowRelEntity::getFollowerId,followerId));
.eq(FollowRelEntity::getIdolId,idolId)
.eq(FollowRelEntity::getFansId,followerId));
}
public boolean checkFollow(String idolId,String followerId){
return followRelMapper.selectCount(new LambdaQueryWrapper<FollowRelEntity>()
.eq(FollowRelEntity::getFollowUserId,idolId)
.eq(FollowRelEntity::getFollowerId,followerId)
.eq(FollowRelEntity::getIdolId,idolId)
.eq(FollowRelEntity::getFansId,followerId)
.eq(FollowRelEntity::getDeleteTag,DeleteTagEnum.NOT_DELETED.getCode()))
>0;
}
......
......@@ -12,7 +12,7 @@
<result column="theme_id" property="themeId" />
<result column="parent_id" property="parentId" />
<result column="reply_id" property="replyId" />
<result column="is_pass" property="isPass" />
<result column="review_status" property="reviewStatus" />
<result column="report_status" property="reportStatus" />
<result column="create_time" property="createTime" />
<result column="update_time" property="updateTime" />
......
......@@ -5,8 +5,8 @@
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.tanpu.community.dao.entity.community.FollowRelEntity">
<id column="id" property="id" />
<result column="follow_user_id" property="followUserId" />
<result column="follower_id" property="followerId" />
<result column="idol_id" property="idolId" />
<result column="fans_id" property="fansId" />
<result column="follow_time" property="followTime" />
<result column="unfollow_time" property="unfollowTime" />
<result column="create_time" property="createTime" />
......
......@@ -9,11 +9,10 @@
<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" />
<result column="is_pass" property="isPass" />
<result column="review_status" property="reviewStatus" />
<result column="report_status" property="reportStatus" />
<result column="create_time" property="createTime" />
<result column="update_time" property="updateTime" />
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.tanpu.community.dao.mapper.community.VisitLogMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.tanpu.community.dao.entity.community.VisitLogEntity">
<id column="id" property="id" />
<result column="ident" property="ident" />
<result column="visitor_id" property="visitorId" />
<result column="author_id" property="authorId" />
<result column="ref_id" property="refId" />
<result column="ref_type" property="refType" />
<result column="duration" property="duration" />
<result column="create_time" property="createTime" />
<result column="update_time" property="updateTime" />
<result column="delete_tag" property="deleteTag" />
</resultMap>
</mapper>
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