Commit 6d214c43 authored by 刘基明's avatar 刘基明

sql字段优化

parent f2b5a80c
......@@ -8,7 +8,7 @@ import com.tanpu.community.api.beans.qo.ThemeQo;
import com.tanpu.community.api.beans.req.CreateCommentReq;
import com.tanpu.community.api.beans.req.CreateThemeReq;
import com.tanpu.community.manager.ThemeManager;
import com.tanpu.community.service.FansRelService;
import com.tanpu.community.service.FollowRelService;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -26,7 +26,7 @@ public class ThemeController {
private ThemeManager themeManager;
@Autowired
private FansRelService fansRelService;
private FollowRelService followRelService;
@ApiOperation("发表主题")
@PostMapping(value = "/publish")
......
......@@ -19,15 +19,15 @@ public class CodeAutoGenerator {
String currentPath = System.getProperty("user.dir");
String codeBaseHome = "/community-service/src/main/java";
String author = "xudong";
String mysqlUserName = "tamp_admin";
String mysqlPassword = "@imeng123";
String jdbcUrl = "jdbc:mysql://rm-uf6r22t3d798q4kmkao.mysql.rds.aliyuncs.com:3306/tamp_community";
String[] tables = new String[]{"home_page"};
// String[] tables = new String[]{"visit_summary", "black_list","collection","comment","fans_rel","file_record","home_page","theme","topic"};
String mysqlUserName = "dev";
String mysqlPassword = "qimeng123";
String jdbcUrl = "jdbc:mysql://47.101.189.151:31931/tamp_community";
// String[] tables = new String[]{"follow_rel"};
String[] tables = new String[]{"visit_summary", "black_list","collection","comment","follow_rel","file_record","home_page","theme","topic","theme_attachment"};
String basePackage = "com.tanpu.community";
String mapperPackage = "dao.mapper.community";
String entityPackage = "dao.entity.community";
String xmlPath = "D:\\code\\backend\\tanpu-community\\community-service\\src\\main\\resources\\mapper\\user";
String xmlPath = "D:\\IdeaProjects\\tanpu-community\\community-service\\src\\main\\resources\\mapper\\community";
AutoGenerator autoGenerator = new AutoGenerator();
//全局配置
GlobalConfig gc = new GlobalConfig();
......
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
......@@ -16,24 +18,25 @@ import java.time.LocalDateTime;
* </p>
*
* @author xudong
* @since 2021-06-10
* @since 2021-07-07
*/
@TableName("black_list")
@Builder
@NoArgsConstructor
@AllArgsConstructor
@TableName("black_list")
@NoArgsConstructor
@ApiModel(value="BlackListEntity对象", description="黑名单")
public class BlackListEntity implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "id")
private String id;
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
@ApiModelProperty(value = "屏蔽发起人")
private String blocker;
@ApiModelProperty(value = "屏蔽类型")
@ApiModelProperty(value = "屏蔽类型,1:用户,2:内容")
private Integer blockedType;
@ApiModelProperty(value = "被屏蔽的")
......@@ -43,18 +46,16 @@ public class BlackListEntity implements Serializable {
private LocalDateTime createTime;
private String updateBy;
private LocalDateTime updateTime;
private Integer deleteTag;
public String getId() {
public Integer getId() {
return id;
}
public void setId(String id) {
public void setId(Integer id) {
this.id = id;
}
......@@ -98,14 +99,6 @@ public class BlackListEntity implements Serializable {
this.createTime = createTime;
}
public String getUpdateBy() {
return updateBy;
}
public void setUpdateBy(String updateBy) {
this.updateBy = updateBy;
}
public LocalDateTime getUpdateTime() {
return updateTime;
}
......@@ -131,7 +124,6 @@ public class BlackListEntity implements Serializable {
", blockedId=" + blockedId +
", createBy=" + createBy +
", createTime=" + createTime +
", updateBy=" + updateBy +
", updateTime=" + updateTime +
", deleteTag=" + deleteTag +
"}";
......
......@@ -16,12 +16,12 @@ import java.time.LocalDateTime;
* </p>
*
* @author xudong
* @since 2021-06-10
* @since 2021-07-07
*/
@TableName("collection")
@Builder
@NoArgsConstructor
@AllArgsConstructor
@TableName("collection")
@NoArgsConstructor
@ApiModel(value="CollectionEntity对象", description="收藏/点赞")
public class CollectionEntity implements Serializable {
......@@ -30,20 +30,22 @@ public class CollectionEntity implements Serializable {
@ApiModelProperty(value = "id")
private String id;
@ApiModelProperty(value = "类型")
@ApiModelProperty(value = "类型 1:点赞,2:收藏")
private Integer collectionType;
@ApiModelProperty(value = "作者id")
private String authorId;
@ApiModelProperty(value = "用户id")
private String userId;
@ApiModelProperty(value = "评论的目标id")
@ApiModelProperty(value = "目标id")
private String targetId;
private String createBy;
@ApiModelProperty(value = "收藏时间")
private LocalDateTime collectionTime;
private LocalDateTime createTime;
@ApiModelProperty(value = "取消收藏时间")
private LocalDateTime uncollectionTime;
private String updateBy;
private LocalDateTime createTime;
private LocalDateTime updateTime;
......@@ -66,12 +68,12 @@ public class CollectionEntity implements Serializable {
this.collectionType = collectionType;
}
public String getAuthorId() {
return authorId;
public String getUserId() {
return userId;
}
public void setAuthorId(String authorId) {
this.authorId = authorId;
public void setUserId(String userId) {
this.userId = userId;
}
public String getTargetId() {
......@@ -82,28 +84,28 @@ public class CollectionEntity implements Serializable {
this.targetId = targetId;
}
public String getCreateBy() {
return createBy;
public LocalDateTime getCollectionTime() {
return collectionTime;
}
public void setCreateBy(String createBy) {
this.createBy = createBy;
public void setCollectionTime(LocalDateTime collectionTime) {
this.collectionTime = collectionTime;
}
public LocalDateTime getCreateTime() {
return createTime;
public LocalDateTime getUncollectionTime() {
return uncollectionTime;
}
public void setCreateTime(LocalDateTime createTime) {
this.createTime = createTime;
public void setUncollectionTime(LocalDateTime uncollectionTime) {
this.uncollectionTime = uncollectionTime;
}
public String getUpdateBy() {
return updateBy;
public LocalDateTime getCreateTime() {
return createTime;
}
public void setUpdateBy(String updateBy) {
this.updateBy = updateBy;
public void setCreateTime(LocalDateTime createTime) {
this.createTime = createTime;
}
public LocalDateTime getUpdateTime() {
......@@ -127,11 +129,11 @@ public class CollectionEntity implements Serializable {
return "CollectionEntity{" +
"id=" + id +
", collectionType=" + collectionType +
", authorId=" + authorId +
", userId=" + userId +
", targetId=" + targetId +
", createBy=" + createBy +
", collectionTime=" + collectionTime +
", uncollectionTime=" + uncollectionTime +
", createTime=" + createTime +
", updateBy=" + updateBy +
", updateTime=" + updateTime +
", deleteTag=" + deleteTag +
"}";
......
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
......@@ -16,19 +18,23 @@ import java.time.LocalDateTime;
* </p>
*
* @author xudong
* @since 2021-06-10
* @since 2021-07-07
*/
@TableName("comment")
@Builder
@NoArgsConstructor
@AllArgsConstructor
@TableName("comment")
@NoArgsConstructor
@ApiModel(value="CommentEntity对象", description="评论")
public class CommentEntity implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "id")
private String id;
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
@ApiModelProperty(value = "uuid")
private String commentId;
@ApiModelProperty(value = "类型")
private Integer commentType;
......@@ -39,31 +45,41 @@ public class CommentEntity implements Serializable {
@ApiModelProperty(value = "作者id")
private String authorId;
@ApiModelProperty(value = "评论的目标id")
private String targetId;
@ApiModelProperty(value = "主题id")
private String themeId;
@ApiModelProperty(value = "一级评论id")
private String parentId;
@ApiModelProperty(value = "回复评论id")
private String replyId;
@ApiModelProperty(value = "是否屏蔽")
private Integer isBlock;
private String createBy;
private LocalDateTime createTime;
private String updateBy;
private LocalDateTime updateTime;
private Integer deleteTag;
public String getId() {
public Integer getId() {
return id;
}
public void setId(String id) {
public void setId(Integer id) {
this.id = id;
}
public String getCommentId() {
return commentId;
}
public void setCommentId(String commentId) {
this.commentId = commentId;
}
public Integer getCommentType() {
return commentType;
}
......@@ -88,44 +104,44 @@ public class CommentEntity implements Serializable {
this.authorId = authorId;
}
public String getTargetId() {
return targetId;
public String getThemeId() {
return themeId;
}
public void setTargetId(String targetId) {
this.targetId = targetId;
public void setThemeId(String themeId) {
this.themeId = themeId;
}
public Integer getIsBlock() {
return isBlock;
public String getParentId() {
return parentId;
}
public void setIsBlock(Integer isBlock) {
this.isBlock = isBlock;
public void setParentId(String parentId) {
this.parentId = parentId;
}
public String getCreateBy() {
return createBy;
public String getReplyId() {
return replyId;
}
public void setCreateBy(String createBy) {
this.createBy = createBy;
public void setReplyId(String replyId) {
this.replyId = replyId;
}
public LocalDateTime getCreateTime() {
return createTime;
public Integer getIsBlock() {
return isBlock;
}
public void setCreateTime(LocalDateTime createTime) {
this.createTime = createTime;
public void setIsBlock(Integer isBlock) {
this.isBlock = isBlock;
}
public String getUpdateBy() {
return updateBy;
public LocalDateTime getCreateTime() {
return createTime;
}
public void setUpdateBy(String updateBy) {
this.updateBy = updateBy;
public void setCreateTime(LocalDateTime createTime) {
this.createTime = createTime;
}
public LocalDateTime getUpdateTime() {
......@@ -148,14 +164,15 @@ public class CommentEntity implements Serializable {
public String toString() {
return "CommentEntity{" +
"id=" + id +
", commentId=" + commentId +
", commentType=" + commentType +
", content=" + content +
", authorId=" + authorId +
", targetId=" + targetId +
", themeId=" + themeId +
", parentId=" + parentId +
", replyId=" + replyId +
", isBlock=" + isBlock +
", createBy=" + createBy +
", createTime=" + createTime +
", updateBy=" + updateBy +
", updateTime=" + updateTime +
", deleteTag=" + deleteTag +
"}";
......
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 java.time.LocalDateTime;
import java.io.Serializable;
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-06-17
* @since 2021-07-07
*/
@TableName("file_record")
@ApiModel(value="FileRecordEntity对象", description="文件")
@Builder
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value="FileRecordEntity对象", description="上传文件")
public class FileRecordEntity implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "id")
private String id;
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
@ApiModelProperty(value = "UUID")
private String fileId;
@ApiModelProperty(value = "类型:1:图片")
private Integer fileType;
@ApiModelProperty(value = "文件名称")
private String originalName;
private String fileName;
@ApiModelProperty(value = "逻辑url")
private String logicKey;
@ApiModelProperty(value = "阿里云key")
private String fileOssKey;
@ApiModelProperty(value = "预览url")
private String previewUrl;
private String presignedUrl;
@ApiModelProperty(value = "关联的内容类型")
private Integer relType;
@ApiModelProperty(value = "关联的内容ID")
private String relId;
private String createBy;
private LocalDateTime createTime;
private String updateBy;
private LocalDateTime updateTime;
private Integer deleteTag;
public String getId() {
public Integer getId() {
return id;
}
public void setId(String id) {
public void setId(Integer id) {
this.id = id;
}
public String getOriginalName() {
return originalName;
}
public void setOriginalName(String originalName) {
this.originalName = originalName;
}
public String getLogicKey() {
return logicKey;
public String getFileId() {
return fileId;
}
public void setLogicKey(String logicKey) {
this.logicKey = logicKey;
public void setFileId(String fileId) {
this.fileId = fileId;
}
public String getPreviewUrl() {
return previewUrl;
}
public void setPreviewUrl(String previewUrl) {
this.previewUrl = previewUrl;
}
public String getPresignedUrl() {
return presignedUrl;
public Integer getFileType() {
return fileType;
}
public void setPresignedUrl(String presignedUrl) {
this.presignedUrl = presignedUrl;
public void setFileType(Integer fileType) {
this.fileType = fileType;
}
public Integer getRelType() {
return relType;
public String getFileName() {
return fileName;
}
public void setRelType(Integer relType) {
this.relType = relType;
public void setFileName(String fileName) {
this.fileName = fileName;
}
public String getRelId() {
return relId;
public String getFileOssKey() {
return fileOssKey;
}
public void setRelId(String relId) {
this.relId = relId;
public void setFileOssKey(String fileOssKey) {
this.fileOssKey = fileOssKey;
}
public String getCreateBy() {
return createBy;
public String getPreviewUrl() {
return previewUrl;
}
public void setCreateBy(String createBy) {
this.createBy = createBy;
public void setPreviewUrl(String previewUrl) {
this.previewUrl = previewUrl;
}
public LocalDateTime getCreateTime() {
......@@ -123,14 +111,6 @@ public class FileRecordEntity implements Serializable {
this.createTime = createTime;
}
public String getUpdateBy() {
return updateBy;
}
public void setUpdateBy(String updateBy) {
this.updateBy = updateBy;
}
public LocalDateTime getUpdateTime() {
return updateTime;
}
......@@ -151,15 +131,12 @@ public class FileRecordEntity implements Serializable {
public String toString() {
return "FileRecordEntity{" +
"id=" + id +
", originalName=" + originalName +
", logicKey=" + logicKey +
", fileId=" + fileId +
", fileType=" + fileType +
", fileName=" + fileName +
", fileOssKey=" + fileOssKey +
", previewUrl=" + previewUrl +
", presignedUrl=" + presignedUrl +
", relType=" + relType +
", relId=" + relId +
", createBy=" + createBy +
", createTime=" + createTime +
", updateBy=" + updateBy +
", updateTime=" + updateTime +
", deleteTag=" + deleteTag +
"}";
......
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 java.time.LocalDateTime;
import java.io.Serializable;
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>
......@@ -12,48 +18,54 @@ import io.swagger.annotations.ApiModelProperty;
* </p>
*
* @author xudong
* @since 2021-06-10
* @since 2021-07-07
*/
@TableName("fans_rel")
@ApiModel(value="FansRelEntity对象", description="粉丝关系")
public class FansRelEntity implements Serializable {
@TableName("follow_rel")
@Builder
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value="FollowRelEntity对象", description="粉丝关系")
public class FollowRelEntity implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "id")
private String id;
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
@ApiModelProperty(value = "被关注的人id")
private String idolId;
private String followId;
@ApiModelProperty(value = "粉丝id")
private String followerId;
private String createBy;
@ApiModelProperty(value = "关注时间")
private LocalDateTime followTime;
private LocalDateTime createTime;
@ApiModelProperty(value = "取消关注时间")
private LocalDateTime unfollowTime;
private String updateBy;
private LocalDateTime createTime;
private LocalDateTime updateTime;
private Integer deleteTag;
public String getId() {
public Integer getId() {
return id;
}
public void setId(String id) {
public void setId(Integer id) {
this.id = id;
}
public String getIdolId() {
return idolId;
public String getFollowId() {
return followId;
}
public void setIdolId(String idolId) {
this.idolId = idolId;
public void setFollowId(String followId) {
this.followId = followId;
}
public String getFollowerId() {
......@@ -64,28 +76,28 @@ public class FansRelEntity implements Serializable {
this.followerId = followerId;
}
public String getCreateBy() {
return createBy;
public LocalDateTime getFollowTime() {
return followTime;
}
public void setCreateBy(String createBy) {
this.createBy = createBy;
public void setFollowTime(LocalDateTime followTime) {
this.followTime = followTime;
}
public LocalDateTime getCreateTime() {
return createTime;
public LocalDateTime getUnfollowTime() {
return unfollowTime;
}
public void setCreateTime(LocalDateTime createTime) {
this.createTime = createTime;
public void setUnfollowTime(LocalDateTime unfollowTime) {
this.unfollowTime = unfollowTime;
}
public String getUpdateBy() {
return updateBy;
public LocalDateTime getCreateTime() {
return createTime;
}
public void setUpdateBy(String updateBy) {
this.updateBy = updateBy;
public void setCreateTime(LocalDateTime createTime) {
this.createTime = createTime;
}
public LocalDateTime getUpdateTime() {
......@@ -106,13 +118,13 @@ public class FansRelEntity implements Serializable {
@Override
public String toString() {
return "FansRelEntity{" +
return "FollowRelEntity{" +
"id=" + id +
", idolId=" + idolId +
", followId=" + followId +
", followerId=" + followerId +
", createBy=" + createBy +
", followTime=" + followTime +
", unfollowTime=" + unfollowTime +
", createTime=" + createTime +
", updateBy=" + updateBy +
", updateTime=" + updateTime +
", deleteTag=" + deleteTag +
"}";
......
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
......@@ -16,19 +18,20 @@ import java.time.LocalDateTime;
* </p>
*
* @author xudong
* @since 2021-06-29
* @since 2021-07-07
*/
@TableName("home_page")
@Builder
@AllArgsConstructor
@NoArgsConstructor
@TableName("home_page")
@ApiModel(value="HomePageEntity对象", description="个人主页")
public class HomePageEntity implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "id")
private String id;
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
@ApiModelProperty(value = "用户id")
private String userId;
......@@ -48,22 +51,18 @@ public class HomePageEntity implements Serializable {
@ApiModelProperty(value = "地址")
private String location;
private String createBy;
private LocalDateTime createTime;
private String updateBy;
private LocalDateTime updateTime;
private Integer deleteTag;
public String getId() {
public Integer getId() {
return id;
}
public void setId(String id) {
public void setId(Integer id) {
this.id = id;
}
......@@ -115,14 +114,6 @@ public class HomePageEntity implements Serializable {
this.location = location;
}
public String getCreateBy() {
return createBy;
}
public void setCreateBy(String createBy) {
this.createBy = createBy;
}
public LocalDateTime getCreateTime() {
return createTime;
}
......@@ -131,14 +122,6 @@ public class HomePageEntity implements Serializable {
this.createTime = createTime;
}
public String getUpdateBy() {
return updateBy;
}
public void setUpdateBy(String updateBy) {
this.updateBy = updateBy;
}
public LocalDateTime getUpdateTime() {
return updateTime;
}
......@@ -165,9 +148,7 @@ public class HomePageEntity implements Serializable {
", introduction=" + introduction +
", sex=" + sex +
", location=" + location +
", createBy=" + createBy +
", createTime=" + createTime +
", updateBy=" + updateBy +
", updateTime=" + updateTime +
", deleteTag=" + deleteTag +
"}";
......
......@@ -16,12 +16,12 @@ import java.time.LocalDateTime;
* </p>
*
* @author xudong
* @since 2021-06-28
* @since 2021-07-07
*/
@TableName("theme_attachment")
@Builder
@AllArgsConstructor
@NoArgsConstructor
@TableName("theme_attachment")
@ApiModel(value="ThemeAttachmentEntity对象", description="主题附件")
public class ThemeAttachmentEntity implements Serializable {
......@@ -33,11 +33,11 @@ public class ThemeAttachmentEntity implements Serializable {
@ApiModelProperty(value = "主题ID")
private String themeId;
@ApiModelProperty(value = "附件类型")
@ApiModelProperty(value = "附件类型:1:产品 2:直播 3:短视频 4:课程 5图片")
private Integer attachType;
@ApiModelProperty(value = "附件对应的ID")
private String attchId;
private String attachId;
private String createBy;
......@@ -74,12 +74,12 @@ public class ThemeAttachmentEntity implements Serializable {
this.attachType = attachType;
}
public String getAttchId() {
return attchId;
public String getAttachId() {
return attachId;
}
public void setAttchId(String attchId) {
this.attchId = attchId;
public void setAttachId(String attachId) {
this.attachId = attachId;
}
public String getCreateBy() {
......@@ -128,7 +128,7 @@ public class ThemeAttachmentEntity implements Serializable {
"id=" + id +
", themeId=" + themeId +
", attachType=" + attachType +
", attchId=" + attchId +
", attachId=" + attachId +
", createBy=" + createBy +
", createTime=" + createTime +
", updateBy=" + updateBy +
......
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
......@@ -16,19 +18,23 @@ import java.time.LocalDateTime;
* </p>
*
* @author xudong
* @since 2021-06-28
* @since 2021-07-07
*/
@TableName("theme")
@Builder
@AllArgsConstructor
@NoArgsConstructor
@TableName("theme")
@ApiModel(value="ThemeEntity对象", description="主题内容")
public class ThemeEntity implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "id")
private String id;
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
@ApiModelProperty(value = "UUID")
private String themeId;
@ApiModelProperty(value = "标题")
private String title;
......@@ -39,6 +45,12 @@ public class ThemeEntity implements Serializable {
@ApiModelProperty(value = "文本内容")
private String content;
@ApiModelProperty(value = "附件类型")
private Integer attachType;
@ApiModelProperty(value = "附件内容")
private String attachment;
@ApiModelProperty(value = "作者id")
private String authorId;
......@@ -48,25 +60,29 @@ public class ThemeEntity implements Serializable {
@ApiModelProperty(value = "所属的话题")
private String topicId;
private String createBy;
private LocalDateTime createTime;
private String updateBy;
private LocalDateTime updateTime;
private Integer deleteTag;
public String getId() {
public Integer getId() {
return id;
}
public void setId(String id) {
public void setId(Integer id) {
this.id = id;
}
public String getThemeId() {
return themeId;
}
public void setThemeId(String themeId) {
this.themeId = themeId;
}
public String getTitle() {
return title;
}
......@@ -91,6 +107,22 @@ public class ThemeEntity implements Serializable {
this.content = content;
}
public Integer getAttachType() {
return attachType;
}
public void setAttachType(Integer attachType) {
this.attachType = attachType;
}
public String getAttachment() {
return attachment;
}
public void setAttachment(String attachment) {
this.attachment = attachment;
}
public String getAuthorId() {
return authorId;
}
......@@ -115,14 +147,6 @@ public class ThemeEntity implements Serializable {
this.topicId = topicId;
}
public String getCreateBy() {
return createBy;
}
public void setCreateBy(String createBy) {
this.createBy = createBy;
}
public LocalDateTime getCreateTime() {
return createTime;
}
......@@ -131,14 +155,6 @@ public class ThemeEntity implements Serializable {
this.createTime = createTime;
}
public String getUpdateBy() {
return updateBy;
}
public void setUpdateBy(String updateBy) {
this.updateBy = updateBy;
}
public LocalDateTime getUpdateTime() {
return updateTime;
}
......@@ -159,15 +175,16 @@ public class ThemeEntity implements Serializable {
public String toString() {
return "ThemeEntity{" +
"id=" + id +
", themeId=" + themeId +
", title=" + title +
", themeType=" + themeType +
", content=" + content +
", attachType=" + attachType +
", attachment=" + attachment +
", authorId=" + authorId +
", formerThemeId=" + formerThemeId +
", topicId=" + topicId +
", createBy=" + createBy +
", createTime=" + createTime +
", updateBy=" + updateBy +
", updateTime=" + updateTime +
", deleteTag=" + deleteTag +
"}";
......
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
......@@ -16,19 +18,23 @@ import java.time.LocalDateTime;
* </p>
*
* @author xudong
* @since 2021-06-18
* @since 2021-07-07
*/
@TableName("topic")
@Builder
@NoArgsConstructor
@AllArgsConstructor
@TableName("topic")
@NoArgsConstructor
@ApiModel(value="TopicEntity对象", description="话题")
public class TopicEntity implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "id")
private String id;
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
@ApiModelProperty(value = "uuid")
private String topicId;
@ApiModelProperty(value = "话题名称")
private String topicTitle;
......@@ -42,25 +48,29 @@ public class TopicEntity implements Serializable {
@ApiModelProperty(value = "浏览量调整")
private Long viewAmountModify;
private String createBy;
private LocalDateTime createTime;
private String updateBy;
private LocalDateTime updateTime;
private Integer deleteTag;
public String getId() {
public Integer getId() {
return id;
}
public void setId(String id) {
public void setId(Integer id) {
this.id = id;
}
public String getTopicId() {
return topicId;
}
public void setTopicId(String topicId) {
this.topicId = topicId;
}
public String getTopicTitle() {
return topicTitle;
}
......@@ -93,14 +103,6 @@ public class TopicEntity implements Serializable {
this.viewAmountModify = viewAmountModify;
}
public String getCreateBy() {
return createBy;
}
public void setCreateBy(String createBy) {
this.createBy = createBy;
}
public LocalDateTime getCreateTime() {
return createTime;
}
......@@ -109,14 +111,6 @@ public class TopicEntity implements Serializable {
this.createTime = createTime;
}
public String getUpdateBy() {
return updateBy;
}
public void setUpdateBy(String updateBy) {
this.updateBy = updateBy;
}
public LocalDateTime getUpdateTime() {
return updateTime;
}
......@@ -137,13 +131,12 @@ public class TopicEntity implements Serializable {
public String toString() {
return "TopicEntity{" +
"id=" + id +
", topicId=" + topicId +
", topicTitle=" + topicTitle +
", isTop=" + isTop +
", isConceal=" + isConceal +
", viewAmountModify=" + viewAmountModify +
", createBy=" + createBy +
", createTime=" + createTime +
", updateBy=" + updateBy +
", updateTime=" + updateTime +
", deleteTag=" + deleteTag +
"}";
......
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;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* <p>
......@@ -12,9 +16,12 @@ import io.swagger.annotations.ApiModelProperty;
* </p>
*
* @author xudong
* @since 2021-06-15
* @since 2021-07-07
*/
@TableName("visit_summary")
@Builder
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value="VisitSummaryEntity对象", description="浏览记录")
public class VisitSummaryEntity implements Serializable {
......
......@@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
* </p>
*
* @author xudong
* @since 2021-06-16
* @since 2021-07-07
*/
public interface BlackListMapper extends BaseMapper<BlackListEntity> {
......
......@@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
* </p>
*
* @author xudong
* @since 2021-06-10
* @since 2021-07-07
*/
public interface CollectionMapper extends BaseMapper<CollectionEntity> {
......
......@@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
* </p>
*
* @author xudong
* @since 2021-06-10
* @since 2021-07-07
*/
public interface CommentMapper extends BaseMapper<CommentEntity> {
......
......@@ -5,11 +5,11 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* 文件 Mapper 接口
* 上传文件 Mapper 接口
* </p>
*
* @author xudong
* @since 2021-06-17
* @since 2021-07-07
*/
public interface FileRecordMapper extends BaseMapper<FileRecordEntity> {
......
package com.tanpu.community.dao.mapper.community;
import com.tanpu.community.dao.entity.community.FansRelEntity;
import com.tanpu.community.dao.entity.community.FollowRelEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
......@@ -9,8 +9,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
* </p>
*
* @author xudong
* @since 2021-06-10
* @since 2021-07-07
*/
public interface FansRelMapper extends BaseMapper<FansRelEntity> {
public interface FollowRelMapper extends BaseMapper<FollowRelEntity> {
}
......@@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
* </p>
*
* @author xudong
* @since 2021-06-10
* @since 2021-07-07
*/
public interface HomePageMapper extends BaseMapper<HomePageEntity> {
......
......@@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
* </p>
*
* @author xudong
* @since 2021-06-28
* @since 2021-07-07
*/
public interface ThemeAttachmentMapper extends BaseMapper<ThemeAttachmentEntity> {
......
......@@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
* </p>
*
* @author xudong
* @since 2021-06-10
* @since 2021-07-07
*/
public interface ThemeMapper extends BaseMapper<ThemeEntity> {
......
......@@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
* </p>
*
* @author xudong
* @since 2021-06-18
* @since 2021-07-07
*/
public interface TopicMapper extends BaseMapper<TopicEntity> {
......
......@@ -2,8 +2,6 @@ package com.tanpu.community.dao.mapper.community;
import com.tanpu.community.dao.entity.community.VisitSummaryEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
/**
* <p>
......@@ -11,10 +9,8 @@ import org.apache.ibatis.annotations.Update;
* </p>
*
* @author xudong
* @since 2021-06-15
* @since 2021-07-07
*/
public interface VisitSummaryMapper extends BaseMapper<VisitSummaryEntity> {
@Update("update visit_summary set duration=duration+#{dur} where ident=#{ident}")
void updateDurByIdent(@Param("ident") String ident, @Param("dur") Integer dur);
}
......@@ -3,7 +3,7 @@ package com.tanpu.community.manager;
import com.tanpu.community.api.beans.qo.FollowQo;
import com.tanpu.community.api.beans.req.HomePageReq;
import com.tanpu.community.dao.entity.community.HomePageEntity;
import com.tanpu.community.service.FansRelService;
import com.tanpu.community.service.FollowRelService;
import com.tanpu.community.service.HomePageService;
import com.tanpu.community.util.ConvertUtil;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -18,7 +18,7 @@ import java.util.stream.Collectors;
public class HomePageManager {
@Autowired
private FansRelService fansRelService;
private FollowRelService followRelService;
@Resource
private HomePageService homePageService;
......@@ -43,21 +43,21 @@ public class HomePageManager {
//获取用户的关注列表
public List<FollowQo> queryIdolsByFollowerId(String followerId) {
List<String> idolIds = fansRelService.queryFansByFollowerId(followerId);
List<String> idolIds = followRelService.queryFansByFollowerId(followerId);
List<HomePageEntity> list = homePageService.selectListByUserIds(idolIds);
return list.stream().map(ConvertUtil::homePageEntity2FollowQo).collect(Collectors.toList());
}
//获取用户的粉丝列表
public List<FollowQo> queryFansByIdolId(String idolId) {
List<String> fanIds = fansRelService.queryFansByIdolId(idolId);
List<String> fanIds = followRelService.queryFansByIdolId(idolId);
List<HomePageEntity> list = homePageService.selectListByUserIds(fanIds);
return list.stream().map(ConvertUtil::homePageEntity2FollowQo).collect(Collectors.toList());
}
//判断返回列表中的用户是否被当前用户关注
public List<FollowQo> judgeFollowed(List<FollowQo> followQos,String followerId){
Set<String> idolSet = fansRelService.queryFansByFollowerId(followerId).stream().collect(Collectors.toSet());
Set<String> idolSet = followRelService.queryFansByFollowerId(followerId).stream().collect(Collectors.toSet());
return followQos.stream().map(o->{
if (idolSet.contains(o.getUserId())){
o.setFollowed(true);
......@@ -68,6 +68,6 @@ public class HomePageManager {
}
public void addIdol(String idolId, String followerId) {
fansRelService.addFans(idolId, followerId);
followRelService.addFans(idolId, followerId);
}
}
......@@ -22,6 +22,7 @@ import com.tanpu.community.feign.vo.ShortVideoBaseInfoResp;
import com.tanpu.community.feign.zhibo.FeignClientForZhibo;
import com.tanpu.community.feign.zhibo.vo.ZhiboDetailVO;
import com.tanpu.community.service.*;
import com.tanpu.community.service.other.*;
import com.tanpu.community.util.ConvertUtil;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.BeanUtils;
......@@ -46,7 +47,7 @@ public class ThemeManager {
private CommentService commentService;
@Autowired
private FansRelService fansRelService;
private FollowRelService followRelService;
@Autowired
private BlackListService blackListService;
......@@ -84,13 +85,15 @@ public class ThemeManager {
@Autowired
private FeignClientForCourse feignClientForCourse;
public void publishTheme(CreateThemeReq req, String userId) {
ThemeEntity themeEntity = new ThemeEntity();
BeanUtils.copyProperties(req, themeEntity);
themeEntity.setAuthorId(userId);
themeService.insertTheme(themeEntity);
List<ThemeAttachmentEntity> themeAttachments = ConvertUtil.themeReqToAttachmentList(req, themeEntity.getId());
List<ThemeAttachmentEntity> themeAttachments = ConvertUtil.themeReqToAttachmentList(req, themeEntity.getThemeId());
//TODO 敏感词过滤
themeAttachmentService.insertList(themeAttachments);
......@@ -107,7 +110,7 @@ public class ThemeManager {
// 返回关注主题
public List<ThemeQo> selectInterestThemes(String userId) {
List<String> fansList = fansRelService.queryFansByFollowerId(userId);
List<String> fansList = followRelService.queryFansByFollowerId(userId);
List<ThemeEntity> themeEntities = themeService.selectByFans(fansList);
List<ThemeQo> themeQos = convertEntityToQo(themeEntities, userId);
return themeQos;
......@@ -137,9 +140,8 @@ public class ThemeManager {
// 评论(对主题)
public void comment(CreateCommentReq req, String userId) {
CommentEntity commentEntity = CommentEntity.builder()
.targetId(req.getThemeId())
.themeId(req.getThemeId())
.authorId(userId)
.createBy(userId)
.content(req.getComment())
.commentType(CommentTypeEnum.THEME.getCode())
.build();
......@@ -155,7 +157,6 @@ public class ThemeManager {
.topicId(req.getTopicId())
.formerThemeId(req.getFormerThemeId())
.authorId(userId)
.createBy(userId)
.themeType(ThemeTypeEnum.DISCUSSION.getCode())
.build();
......@@ -221,14 +222,14 @@ public class ThemeManager {
List<ThemeAttachmentEntity> attachments = themeAttachmentService.selectByThemeId(themeQO.getId());
if (!CollectionUtils.isEmpty(attachments)) {
HashMap<String, Object> attachmentQos = new HashMap<>();
attachments.forEach(o -> attachmentQos.put(o.getAttchId(), transferAttachment(o, userId)));
attachments.forEach(o -> attachmentQos.put(o.getAttachId(), transferAttachment(o, userId)));
themeQO.setAttachment(attachmentQos);
}
//迄今时间
themeQO.setUpToNowTime(calUpToNowTime(themeQO.getCreateTime()));
//是否关注作者
String authorId = themeQO.getAuthorId();
Set<String> fansSet = new HashSet<>(fansRelService.queryFansByFollowerId(userId));
Set<String> fansSet = new HashSet<>(followRelService.queryFansByFollowerId(userId));
themeQO.setFollow(fansSet.contains(authorId));
//用户信息:头像、昵称
HomePageEntity userEntity = homePageService.selectByUserId(userId);
......@@ -246,7 +247,7 @@ public class ThemeManager {
List<ThemeAttachmentEntity> attachments = themeAttachmentService.selectByThemeId(maintTextQo.getId());
if (!CollectionUtils.isEmpty(attachments)) {
HashMap<String, Object> attachmentQos = new HashMap<>();
attachments.forEach(o -> attachmentQos.put(o.getAttchId(), transferAttachment(o, userId)));
attachments.forEach(o -> attachmentQos.put(o.getAttachId(), transferAttachment(o, userId)));
maintTextQo.setAttachment(attachmentQos);
}
//迄今时间
......@@ -270,7 +271,7 @@ public class ThemeManager {
public Object transferAttachment(ThemeAttachmentEntity themeAttachment, String userId) {
String attachmentId = themeAttachment.getAttchId();
String attachmentId = themeAttachment.getAttachId();
switch (themeAttachment.getAttachType()) {
//附件类型 1:产品 2:直播 3:短视频 4:课程
//TODO ENTITY 转 DTO
......
......@@ -117,10 +117,10 @@ public class TopicManager {
public void refreshRedisCache() {
List<TopicEntity> topicEntities = topicService.queryAll();
for (TopicEntity topic : topicEntities) {
String topicId = topic.getId();
String topicId = topic.getTopicId();
Long viewAmountModify = topic.getViewAmountModify();
List<ThemeEntity> themeEntities = themeService.selectByTopic(topicId);
List<String> themeIds = themeEntities.stream().map(ThemeEntity::getId).collect(Collectors.toList());
List<String> themeIds = themeEntities.stream().map(ThemeEntity::getThemeId).collect(Collectors.toList());
Long likeAmountByThemeIds = collectionService.getLikeAmountByThemeIds(themeIds);
Long bookAmountByThemeIds = collectionService.getBookAmountByThemeIds(themeIds);
Long commentAmountByThemeIds = commentService.getCommentAmountByThemeIds(themeIds);
......
package com.tanpu.community.service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.tanpu.common.uuid.UuidGenHelper;
import com.tanpu.community.api.enums.CollectionTypeEnum;
import com.tanpu.community.api.enums.DeleteTagEnum;
import com.tanpu.community.dao.entity.community.CollectionEntity;
import com.tanpu.community.dao.mapper.community.CollectionMapper;
import com.tanpu.community.util.ConvertUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.List;
@Service
......@@ -16,20 +18,21 @@ public class CollectionService {
@Resource
private CollectionMapper collectionMapper;
// 若不存在则新增,若存在则修改deleteTag
public void addIfNotExist(String themeId, String userId, CollectionTypeEnum type) {
// 判断是否存在
CollectionEntity queryCollection = getTargetCollection(themeId, userId, type);
// 判断是否删除
CollectionEntity queryCollection = getDeletedTargetCollection(themeId, userId, type);
if (queryCollection != null) {
Integer oldDeleteTag = queryCollection.getDeleteTag();
queryCollection.setDeleteTag(ConvertUtil.deleteTagShift(oldDeleteTag));
queryCollection.setDeleteTag(DeleteTagEnum.NOT_DELETED.getCode());
queryCollection.setCollectionTime(LocalDateTime.now());
collectionMapper.updateById(queryCollection);
} else {
CollectionEntity entity = CollectionEntity.builder()
.collectionType(type.getCode())
.authorId(userId)
.userId(userId)
.targetId(themeId)
.createBy(userId)
.collectionTime(LocalDateTime.now())
.build();
collectionMapper.insert(entity);
......@@ -37,12 +40,22 @@ public class CollectionService {
}
//根据用户、主题、类型查询
//根据用户、主题、类型查询未删除对象
public CollectionEntity getTargetCollection(String themeId, String userId, CollectionTypeEnum type) {
return collectionMapper.selectOne(new LambdaQueryWrapper<CollectionEntity>()
.eq(CollectionEntity::getCollectionType, type.getCode())
.eq(CollectionEntity::getAuthorId, userId)
.eq(CollectionEntity::getTargetId, themeId));
.eq(CollectionEntity::getUserId, userId)
.eq(CollectionEntity::getTargetId, themeId)
.eq(CollectionEntity::getDeleteTag,DeleteTagEnum.NOT_DELETED.getCode()));
}
//根据用户、主题、类型查询已删除对象
public CollectionEntity getDeletedTargetCollection(String themeId, String userId, CollectionTypeEnum type) {
return collectionMapper.selectOne(new LambdaQueryWrapper<CollectionEntity>()
.eq(CollectionEntity::getCollectionType, type.getCode())
.eq(CollectionEntity::getUserId, userId)
.eq(CollectionEntity::getTargetId, themeId)
.eq(CollectionEntity::getDeleteTag,DeleteTagEnum.DELETED.getCode()));
}
// 根据用户id获取点赞列表
......@@ -96,7 +109,13 @@ public class CollectionService {
.size();
}
public void delete(String themeId, String userId, CollectionTypeEnum book) {
//TODO
//逻辑删除,修改delete_tag
public void delete(String themeId, String userId, CollectionTypeEnum type) {
CollectionEntity queryCollection = getTargetCollection(themeId, userId, type);
if (queryCollection != null) {
queryCollection.setDeleteTag(DeleteTagEnum.DELETED.getCode());
queryCollection.setUncollectionTime(LocalDateTime.now());
collectionMapper.updateById(queryCollection);
}
}
}
package com.tanpu.community.service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.tanpu.common.uuid.UuidGenHelper;
import com.tanpu.community.api.enums.DeleteTagEnum;
import com.tanpu.community.api.enums.TopicStatusEnum;
import com.tanpu.community.dao.entity.community.CommentEntity;
import com.tanpu.community.dao.mapper.community.CommentMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
......@@ -18,7 +20,11 @@ public class CommentService {
@Resource
private CommentMapper commentMapper;
@Autowired
private UuidGenHelper uuidGenHelper;
public void insertComment(CommentEntity commentEntity) {
commentEntity.setCommentId(uuidGenHelper.getUuidStr());
commentMapper.insert(commentEntity);
}
......@@ -30,13 +36,13 @@ public class CommentService {
//统计主题集合的评论量
public Long getCommentAmountByThemeIds(List<String> themeIds) {
return (long) commentMapper.selectList((new LambdaQueryWrapper<CommentEntity>()
.in(CommentEntity::getTargetId, themeIds)))
.in(CommentEntity::getThemeId, themeIds)))
.size();
}
public Set<String> getCommentUserAmount(List<String> themeIds) {
return commentMapper.selectList((new LambdaQueryWrapper<CommentEntity>()
.in(CommentEntity::getTargetId, themeIds)))
.in(CommentEntity::getThemeId, themeIds)))
.stream().map(CommentEntity::getAuthorId).collect(Collectors.toSet());
}
......
package com.tanpu.community.service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.tanpu.community.dao.entity.community.FansRelEntity;
import com.tanpu.community.dao.mapper.community.FansRelMapper;
import com.tanpu.community.dao.entity.community.FollowRelEntity;
import com.tanpu.community.dao.mapper.community.FollowRelMapper;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.stereotype.Service;
......@@ -12,29 +12,29 @@ import java.util.stream.Collectors;
@EnableCaching
@Service
public class FansRelService {
public class FollowRelService {
@Resource
private FansRelMapper fansRelMapper;
private FollowRelMapper followRelMapper;
public List<String> queryFansByFollowerId(String followerId) {
return fansRelMapper.selectList(new LambdaQueryWrapper<FansRelEntity>()
.eq(FansRelEntity::getFollowerId, followerId))
.stream().map(FansRelEntity::getIdolId).collect(Collectors.toList());
return followRelMapper.selectList(new LambdaQueryWrapper<FollowRelEntity>()
.eq(FollowRelEntity::getFollowerId, followerId))
.stream().map(FollowRelEntity::getFollowId).collect(Collectors.toList());
}
// @Cacheable(value = "tempCache", keyGenerator = "communityKeyGenerator")
public List<String> queryFansByIdolId(String idolId) {
return fansRelMapper.selectList(new LambdaQueryWrapper<FansRelEntity>()
.eq(FansRelEntity::getIdolId, idolId))
.stream().map(FansRelEntity::getFollowerId).collect(Collectors.toList());
return followRelMapper.selectList(new LambdaQueryWrapper<FollowRelEntity>()
.eq(FollowRelEntity::getFollowId, idolId))
.stream().map(FollowRelEntity::getFollowerId).collect(Collectors.toList());
}
public void addFans(String idolId, String followerId) {
FansRelEntity rel = new FansRelEntity();
rel.setIdolId(idolId);
FollowRelEntity rel = new FollowRelEntity();
rel.setFollowId(idolId);
rel.setFollowerId(followerId);
fansRelMapper.insert(rel);
followRelMapper.insert(rel);
}
}
package com.tanpu.community.service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.tanpu.common.uuid.UuidGenHelper;
import com.tanpu.community.dao.entity.community.HomePageEntity;
import com.tanpu.community.dao.mapper.community.HomePageMapper;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
......@@ -18,8 +20,6 @@ public class HomePageService {
private HomePageMapper homePageMapper;
public HomePageEntity selectByUserId(String userId){
return homePageMapper.selectOne(new LambdaQueryWrapper<HomePageEntity>()
.eq(HomePageEntity::getUserId,userId));
......
......@@ -2,6 +2,7 @@ package com.tanpu.community.service;
import com.tanpu.common.constant.BizStatus;
import com.tanpu.common.util.AliyunOSSHelper;
import com.tanpu.common.uuid.UuidGenHelper;
import com.tanpu.community.api.enums.OssRelType;
import com.tanpu.community.dao.entity.community.FileRecordEntity;
import com.tanpu.community.dao.mapper.community.FileRecordMapper;
......@@ -35,6 +36,10 @@ public class OSSFileService {
@Resource
private FileRecordMapper fileRecordMapper;
@Autowired
private UuidGenHelper uuidGenHelper;
@PostConstruct
public void init() {
ossHelper = AliyunOSSHelper.build(endpoint, accessId, accessSK);
......@@ -62,13 +67,12 @@ public class OSSFileService {
ossHelper.writeFile(bucketName, key, data, fileSuffix);
FileRecordEntity record = new FileRecordEntity();
record.setId(id);
record.setFileId(uuidGenHelper.getUuidStr());
record.setDeleteTag(BizStatus.DeleteTag.tag_init);
record.setLogicKey(key);
record.setOriginalName(fileName);
record.setPresignedUrl(ossHelper.getPreSignedUrl(bucketName, key));
record.setRelType(relType.type);
record.setRelId(relId);
record.setFileOssKey(key);
record.setFileId(fileName);
record.setPreviewUrl(ossHelper.getPreSignedUrl(bucketName, key));
record.setFileType(relType.type);
fileRecordMapper.insert(record);
......
package com.tanpu.community.service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.tanpu.common.uuid.UuidGenHelper;
import com.tanpu.community.dao.entity.community.ThemeEntity;
import com.tanpu.community.dao.mapper.community.ThemeMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
......@@ -16,7 +18,11 @@ public class ThemeService {
@Resource
private ThemeMapper themeMapper;
@Autowired
private UuidGenHelper uuidGenHelper;
public void insertTheme(ThemeEntity themeEntity){
themeEntity.setThemeId(uuidGenHelper.getUuidStr());
themeMapper.insert(themeEntity);
}
......
......@@ -2,10 +2,12 @@ package com.tanpu.community.service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.tanpu.common.uuid.UuidGenHelper;
import com.tanpu.community.api.enums.DeleteTagEnum;
import com.tanpu.community.api.enums.TopicStatusEnum;
import com.tanpu.community.dao.entity.community.TopicEntity;
import com.tanpu.community.dao.mapper.community.TopicMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.stereotype.Service;
......@@ -20,6 +22,8 @@ public class TopicService {
@Resource
private TopicMapper topicMapper;
@Autowired
private UuidGenHelper uuidGenHelper;
public List<TopicEntity> queryAll() {
return topicMapper.selectList(new LambdaQueryWrapper<TopicEntity>()
......@@ -29,9 +33,8 @@ public class TopicService {
public void addTopic(String topicTitle, String userId) {
TopicEntity entity = TopicEntity.builder()
.topicId(uuidGenHelper.getUuidStr())
.topicTitle(topicTitle)
.createBy(userId)
.updateBy(userId)
.isTop(TopicStatusEnum.FALSE.getCode())
.isConceal(TopicStatusEnum.FALSE.getCode())
.build();
......
......@@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.tanpu.community.dao.entity.community.VisitSummaryEntity;
import com.tanpu.community.dao.mapper.community.VisitSummaryMapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
......@@ -25,6 +24,6 @@ public class VisitSummaryService {
// 更新访问时长
public void updateDurByIdent(String ident, Integer dur) {
visitSummaryMapper.updateDurByIdent(ident, dur);
// visitSummaryMapper.updateDurByIdent(ident, dur);
}
}
package com.tanpu.community.service;
package com.tanpu.community.service.other;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.tanpu.common.exception.BizException;
......
package com.tanpu.community.service;
package com.tanpu.community.service.other;
import com.tanpu.community.dao.entity.user.CurriculumPriceEntity;
import com.tanpu.community.dao.mapper.user.CurriculumPriceMapper;
......
package com.tanpu.community.service;
package com.tanpu.community.service.other;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.tanpu.community.api.enums.CurriculumEnum;
......
package com.tanpu.community.service;
package com.tanpu.community.service.other;
import com.tanpu.community.dao.entity.user.FinProResEntity;
import com.tanpu.community.dao.mapper.user.FinProResMapper;
......
package com.tanpu.community.service;
package com.tanpu.community.service.other;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.tanpu.community.api.enums.DeleteTagEnum;
......
package com.tanpu.community.service;
package com.tanpu.community.service.other;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.tanpu.community.dao.entity.user.UserRistRzEntity;
......
package com.tanpu.community.service;
package com.tanpu.community.service.other;
import com.tanpu.community.dao.entity.zhibo.ZhiboThemeEntity;
import com.tanpu.community.dao.mapper.zhibo.ZhiboThemeMapper;
......
......@@ -95,7 +95,7 @@ public class ConvertUtil {
req.getAttachment().forEach((k, v) -> {
list.add(ThemeAttachmentEntity.builder()
.attachType(Integer.valueOf(k))
.attchId(v)
.attachId(v)
.themeId(themeId)
.build());
});
......
......@@ -10,7 +10,6 @@
<result column="blocked_id" property="blockedId" />
<result column="create_by" property="createBy" />
<result column="create_time" property="createTime" />
<result column="update_by" property="updateBy" />
<result column="update_time" property="updateTime" />
<result column="delete_tag" property="deleteTag" />
</resultMap>
......
......@@ -6,11 +6,11 @@
<resultMap id="BaseResultMap" type="com.tanpu.community.dao.entity.community.CollectionEntity">
<id column="id" property="id" />
<result column="collection_type" property="collectionType" />
<result column="author_id" property="authorId" />
<result column="user_id" property="userId" />
<result column="target_id" property="targetId" />
<result column="create_by" property="createBy" />
<result column="collection_time" property="collectionTime" />
<result column="uncollection_time" property="uncollectionTime" />
<result column="create_time" property="createTime" />
<result column="update_by" property="updateBy" />
<result column="update_time" property="updateTime" />
<result column="delete_tag" property="deleteTag" />
</resultMap>
......
......@@ -5,14 +5,15 @@
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.tanpu.community.dao.entity.community.CommentEntity">
<id column="id" property="id" />
<result column="comment_id" property="commentId" />
<result column="comment_type" property="commentType" />
<result column="content" property="content" />
<result column="author_id" property="authorId" />
<result column="target_id" property="targetId" />
<result column="theme_id" property="themeId" />
<result column="parent_id" property="parentId" />
<result column="reply_id" property="replyId" />
<result column="is_block" property="isBlock" />
<result column="create_by" property="createBy" />
<result column="create_time" property="createTime" />
<result column="update_by" property="updateBy" />
<result column="update_time" property="updateTime" />
<result column="delete_tag" property="deleteTag" />
</resultMap>
......
......@@ -5,15 +5,12 @@
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.tanpu.community.dao.entity.community.FileRecordEntity">
<id column="id" property="id" />
<result column="original_name" property="originalName" />
<result column="logic_key" property="logicKey" />
<result column="file_id" property="fileId" />
<result column="file_type" property="fileType" />
<result column="file_name" property="fileName" />
<result column="file_oss_key" property="fileOssKey" />
<result column="preview_url" property="previewUrl" />
<result column="presigned_url" property="presignedUrl" />
<result column="rel_type" property="relType" />
<result column="rel_id" property="relId" />
<result column="create_by" property="createBy" />
<result column="create_time" property="createTime" />
<result column="update_by" property="updateBy" />
<result column="update_time" property="updateTime" />
<result column="delete_tag" property="deleteTag" />
</resultMap>
......
<?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.FollowRelMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.tanpu.community.dao.entity.community.FollowRelEntity">
<id column="id" property="id" />
<result column="follow_id" property="followId" />
<result column="follower_id" property="followerId" />
<result column="follow_time" property="followTime" />
<result column="unfollow_time" property="unfollowTime" />
<result column="create_time" property="createTime" />
<result column="update_time" property="updateTime" />
<result column="delete_tag" property="deleteTag" />
</resultMap>
</mapper>
......@@ -9,9 +9,9 @@
<result column="head_img" property="headImg" />
<result column="nick_name" property="nickName" />
<result column="introduction" property="introduction" />
<result column="create_by" property="createBy" />
<result column="sex" property="sex" />
<result column="location" property="location" />
<result column="create_time" property="createTime" />
<result column="update_by" property="updateBy" />
<result column="update_time" property="updateTime" />
<result column="delete_tag" property="deleteTag" />
</resultMap>
......
<?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.FansRelMapper">
<mapper namespace="com.tanpu.community.dao.mapper.community.ThemeAttachmentMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.tanpu.community.dao.entity.community.FansRelEntity">
<resultMap id="BaseResultMap" type="com.tanpu.community.dao.entity.community.ThemeAttachmentEntity">
<id column="id" property="id" />
<result column="idol_id" property="idolId" />
<result column="follower_id" property="followerId" />
<result column="theme_id" property="themeId" />
<result column="attach_type" property="attachType" />
<result column="attach_id" property="attachId" />
<result column="create_by" property="createBy" />
<result column="create_time" property="createTime" />
<result column="update_by" property="updateBy" />
......
......@@ -5,6 +5,7 @@
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.tanpu.community.dao.entity.community.ThemeEntity">
<id column="id" property="id" />
<result column="theme_id" property="themeId" />
<result column="title" property="title" />
<result column="theme_type" property="themeType" />
<result column="content" property="content" />
......@@ -13,9 +14,7 @@
<result column="author_id" property="authorId" />
<result column="former_theme_id" property="formerThemeId" />
<result column="topic_id" property="topicId" />
<result column="create_by" property="createBy" />
<result column="create_time" property="createTime" />
<result column="update_by" property="updateBy" />
<result column="update_time" property="updateTime" />
<result column="delete_tag" property="deleteTag" />
</resultMap>
......
......@@ -5,12 +5,12 @@
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.tanpu.community.dao.entity.community.TopicEntity">
<id column="id" property="id" />
<result column="topic_id" property="topicId" />
<result column="topic_title" property="topicTitle" />
<result column="is_top" property="isTop" />
<result column="is_conceal" property="isConceal" />
<result column="create_by" property="createBy" />
<result column="view_amount_modify" property="viewAmountModify" />
<result column="create_time" property="createTime" />
<result column="update_by" property="updateBy" />
<result column="update_time" property="updateTime" />
<result column="delete_tag" property="deleteTag" />
</resultMap>
......
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