Commit 666c52da authored by 刘基明's avatar 刘基明

置頂

parent 5d1635a6
...@@ -9,6 +9,7 @@ import lombok.Data; ...@@ -9,6 +9,7 @@ import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import java.io.Serializable; import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List; import java.util.List;
@Data @Data
...@@ -98,8 +99,16 @@ public class ThemeQo implements Serializable { ...@@ -98,8 +99,16 @@ public class ThemeQo implements Serializable {
@ApiModelProperty(value = "评论Id(我的评论列表使用)") @ApiModelProperty(value = "评论Id(我的评论列表使用)")
public String commentId; public String commentId;
@ApiModelProperty(value = "是否顶置 1是 0否")
private Integer isTop;
@ApiModelProperty(value = "置顶时间")
private LocalDateTime setTopTime;
@ApiModelProperty(value = "创建时间")
public Long createTime; public Long createTime;
@ApiModelProperty(value = "更新时间")
public Long updateTime; public Long updateTime;
//认证标签相关 //认证标签相关
......
...@@ -23,7 +23,7 @@ public class CodeAutoGenerator { ...@@ -23,7 +23,7 @@ public class CodeAutoGenerator {
String mysqlPassword = "@imeng123"; String mysqlPassword = "@imeng123";
String jdbcUrl = "jdbc:mysql://rm-uf6r22t3d798q4kmkao.mysql.rds.aliyuncs.com:3306/tamp_community"; String jdbcUrl = "jdbc:mysql://rm-uf6r22t3d798q4kmkao.mysql.rds.aliyuncs.com:3306/tamp_community";
// String[] tables = new String[]{"theme"}; // String[] tables = new String[]{"theme"};
String[] tables = new String[]{"comment"}; String[] tables = new String[]{"theme"};
String basePackage = "com.tanpu.community"; String basePackage = "com.tanpu.community";
String mapperPackage = "dao.mapper.community"; String mapperPackage = "dao.mapper.community";
String entityPackage = "dao.entity.community"; String entityPackage = "dao.entity.community";
......
...@@ -18,7 +18,7 @@ import java.time.LocalDateTime; ...@@ -18,7 +18,7 @@ import java.time.LocalDateTime;
* </p> * </p>
* *
* @author xudong * @author xudong
* @since 2021-07-28 * @since 2022-02-21
*/ */
@TableName("theme") @TableName("theme")
@Builder @Builder
...@@ -42,7 +42,7 @@ public class ThemeEntity implements Serializable { ...@@ -42,7 +42,7 @@ public class ThemeEntity implements Serializable {
@ApiModelProperty(value = "类型 1:讨论无标题 2:长文有标题 3:转发") @ApiModelProperty(value = "类型 1:讨论无标题 2:长文有标题 3:转发")
private Integer themeType; private Integer themeType;
@ApiModelProperty(value = "文本内容(json),type:附件类型(108:文本,88:产品 3:直播 6:短视频 303:新版课程-视频,304: 新版课程-音频,109:单图(长文) 110:多图(讨论)),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; private String content;
@ApiModelProperty(value = "作者id") @ApiModelProperty(value = "作者id")
...@@ -60,6 +60,12 @@ public class ThemeEntity implements Serializable { ...@@ -60,6 +60,12 @@ public class ThemeEntity implements Serializable {
@ApiModelProperty(value = "举报状态 0:未被举报 1:被举报 2:已处理") @ApiModelProperty(value = "举报状态 0:未被举报 1:被举报 2:已处理")
private Integer reportStatus; private Integer reportStatus;
@ApiModelProperty(value = "是否顶置 1是 0否")
private Integer isTop;
@ApiModelProperty(value = "置顶时间")
private LocalDateTime setTopTime;
private LocalDateTime createTime; private LocalDateTime createTime;
private LocalDateTime updateTime; private LocalDateTime updateTime;
...@@ -148,6 +154,22 @@ public class ThemeEntity implements Serializable { ...@@ -148,6 +154,22 @@ public class ThemeEntity implements Serializable {
this.reportStatus = reportStatus; this.reportStatus = reportStatus;
} }
public Integer getIsTop() {
return isTop;
}
public void setIsTop(Integer isTop) {
this.isTop = isTop;
}
public LocalDateTime getSetTopTime() {
return setTopTime;
}
public void setSetTopTime(LocalDateTime setTopTime) {
this.setTopTime = setTopTime;
}
public LocalDateTime getCreateTime() { public LocalDateTime getCreateTime() {
return createTime; return createTime;
} }
...@@ -185,6 +207,8 @@ public class ThemeEntity implements Serializable { ...@@ -185,6 +207,8 @@ public class ThemeEntity implements Serializable {
", topicId=" + topicId + ", topicId=" + topicId +
", reviewStatus=" + reviewStatus + ", reviewStatus=" + reviewStatus +
", reportStatus=" + reportStatus + ", reportStatus=" + reportStatus +
", isTop=" + isTop +
", setTopTime=" + setTopTime +
", createTime=" + createTime + ", createTime=" + createTime +
", updateTime=" + updateTime + ", updateTime=" + updateTime +
", deleteTag=" + deleteTag + ", deleteTag=" + deleteTag +
......
...@@ -16,7 +16,7 @@ import java.util.List; ...@@ -16,7 +16,7 @@ import java.util.List;
* </p> * </p>
* *
* @author xudong * @author xudong
* @since 2021-07-23 * @since 2022-02-21
*/ */
public interface ThemeMapper extends BaseMapper<ThemeEntity> { public interface ThemeMapper extends BaseMapper<ThemeEntity> {
......
...@@ -548,7 +548,7 @@ public class ThemeManager { ...@@ -548,7 +548,7 @@ public class ThemeManager {
// todo 测试性能 // todo 测试性能
commentService.queryRecentComments(resp.themes); commentService.queryRecentComments(resp.themes);
// 讨论区添加是否管理员 // 讨论区添加是否管理员,是否顶置
if (ThemeListTypeEnum.TOPIC_LATEST.getCode().equals(req.getType()) if (ThemeListTypeEnum.TOPIC_LATEST.getCode().equals(req.getType())
|| ThemeListTypeEnum.TOPIC_HOT.getCode().equals(req.getType())) { || ThemeListTypeEnum.TOPIC_HOT.getCode().equals(req.getType())) {
topicService.checkManager(req.getTopicId(),resp.themes); topicService.checkManager(req.getTopicId(),resp.themes);
......
...@@ -66,7 +66,7 @@ public class TopicManager { ...@@ -66,7 +66,7 @@ public class TopicManager {
List<TopicRankQo> topicList = rankService.getRankTopicList(keyword); List<TopicRankQo> topicList = rankService.getRankTopicList(keyword);
if (CollectionUtils.isEmpty(topicList)) return topicList; if (CollectionUtils.isEmpty(topicList)) return topicList;
// 只取前两条 // 只取前两条
if (topicList.size() > 2) topicList = topicList.subList(0, 1); if (topicList.size() > 2) topicList = topicList.subList(0, 2);
// 添加权限 // 添加权限
topicService.batchCheckPermission(topicList, userHolder.getUserId()); topicService.batchCheckPermission(topicList, userHolder.getUserId());
return topicList; return topicList;
......
...@@ -50,6 +50,7 @@ public class ConvertUtil { ...@@ -50,6 +50,7 @@ public class ConvertUtil {
themeQO.setUpToNowTime(TimeUtils.calUpToNowTime(themeEntity.getCreateTime())); themeQO.setUpToNowTime(TimeUtils.calUpToNowTime(themeEntity.getCreateTime()));
themeQO.setFormatTime(TimeUtils.format(themeEntity.getCreateTime())); themeQO.setFormatTime(TimeUtils.format(themeEntity.getCreateTime()));
List<ThemeContentQo> themeContentQos = JsonUtil.toBean(themeEntity.getContent(), new TypeReference<List<ThemeContentQo>>() { List<ThemeContentQo> themeContentQos = JsonUtil.toBean(themeEntity.getContent(), new TypeReference<List<ThemeContentQo>>() {
}); });
// 屏蔽手机号和邮箱 // 屏蔽手机号和邮箱
......
<?xml version="1.0" encoding="UTF-8"?> <?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"> <!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.ThemeMapper"> <mapper namespace="com.tanpu.community.dao.mapper.community.ThemeMapper">
<!-- 通用查询映射结果 --> <!-- 通用查询映射结果 -->
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, id,
...@@ -14,38 +13,45 @@ ...@@ -14,38 +13,45 @@
topic_id, topic_id,
review_status, review_status,
report_status, report_status,
is_top,
set_top_time,
create_time, create_time,
update_time, update_time,
delete_tag delete_tag
</sql> </sql>
<resultMap id="BaseResultMap" type="com.tanpu.community.dao.entity.community.ThemeEntity"> <resultMap id="BaseResultMap" type="com.tanpu.community.dao.entity.community.ThemeEntity">
<id column="id" property="id" /> <id column="id" property="id"/>
<result column="theme_id" property="themeId" /> <result column="theme_id" property="themeId"/>
<result column="title" property="title" /> <result column="title" property="title"/>
<result column="theme_type" property="themeType" /> <result column="theme_type" property="themeType"/>
<result column="content" property="content" /> <result column="content" property="content"/>
<result column="author_id" property="authorId" /> <result column="author_id" property="authorId"/>
<result column="former_theme_id" property="formerThemeId" /> <result column="former_theme_id" property="formerThemeId"/>
<result column="topic_id" property="topicId" /> <result column="topic_id" property="topicId"/>
<result column="review_status" property="reviewStatus" /> <result column="review_status" property="reviewStatus"/>
<result column="report_status" property="reportStatus" /> <result column="report_status" property="reportStatus"/>
<result column="create_time" property="createTime" /> <result column="is_top" property="isTop"/>
<result column="update_time" property="updateTime" /> <result column="set_top_time" property="setTopTime"/>
<result column="delete_tag" property="deleteTag" /> <result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
<result column="delete_tag" property="deleteTag"/>
</resultMap> </resultMap>
<!--auto generated by MybatisCodeHelper on 2022-02-17--> <!--auto generated by MybatisCodeHelper on 2022-02-17-->
<select id="queryOneByTopicIdOrderByUpdateTimeDesc" resultMap="BaseResultMap"> <select id="queryOneByTopicIdOrderByUpdateTimeDesc" resultMap="BaseResultMap">
select select
<include refid="Base_Column_List"/> <include refid="Base_Column_List"/>
from theme from theme
where topic_id=#{topicId} order by update_time desc limit 1 where topic_id = #{topicId}
order by update_time desc
limit 1
</select> </select>
<!--auto generated by MybatisCodeHelper on 2022-02-17--> <!--auto generated by MybatisCodeHelper on 2022-02-17-->
<select id="countByTopicIdAndCreateTimeAfter" resultType="java.lang.Integer"> <select id="countByTopicIdAndCreateTimeAfter" resultType="java.lang.Integer">
select count(1) select count(1)
from theme from theme
where topic_id=#{topicId} and create_time <![CDATA[>]]> #{minCreateTime} where topic_id = #{topicId}
and create_time <![CDATA[>]]> #{minCreateTime}
</select> </select>
</mapper> </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