Commit dba5d746 authored by 刘基明's avatar 刘基明

更新数量

parent d131a09b
......@@ -25,10 +25,8 @@ public interface ThemeMapper extends BaseMapper<ThemeEntity> {
@Select("select former_theme_id as id, count(1) as times from theme ${ew.customSqlSegment}")
List<TimesCountEntity> selectCountByThemeIds(@Param(Constants.WRAPPER) LambdaQueryWrapper wrapper);
ThemeEntity queryOneByTopicIdOrderByUpdateTimeDesc(@Param("topicId") String topicId);
Integer countByTopicIdAndCreateTimeAfter(@Param("topicId") String topicId, @Param("minCreateTime") LocalDateTime minCreateTime);
List<ThemeEntity> queryRecentdaysOrHasTopic(@Param("deleteTag") Integer deleteTag, @Param("minCreateTime") LocalDateTime minCreateTime, @Param("notTopicId") String notTopicId);
......
......@@ -222,7 +222,7 @@ public class ThemeService {
return Collections.emptyList();
}
userPermitTopics.remove("");
return themeMapper.queryFollowList(userIds,userPermitTopics,pageStart,pageSize);
return themeMapper.queryFollowList(userIds, userPermitTopics, pageStart, pageSize);
}
......@@ -342,13 +342,13 @@ public class ThemeService {
// 查询更新条数
VisitLogEntity visitLogEntity = visitLogMapper.queryLastByVisitorIdAndRefId(userId, topicId);
Integer updates;
if (visitLogEntity != null) {
Integer updates = themeMapper.countByTopicIdAndCreateTimeAfter(topicId, visitLogEntity.getUpdateTime());
topic.setUpdateCount(updates);
updates = themeMapper.countByTopicIdAndCreateTimeAfter(topicId, visitLogEntity.getUpdateTime());
} else {
topic.setUpdateCount(0);
updates = themeMapper.countByTopicIdAndCreateTimeAfter(topicId, null);
}
topic.setUpdateCount(updates);
}
......@@ -366,7 +366,7 @@ public class ThemeService {
LambdaQueryWrapper<ThemeEntity> queryWrapper = new LambdaQueryWrapper<ThemeEntity>()
.eq(ThemeEntity::getTopicId, topicId)
.eq(ThemeEntity::getDeleteTag, StatusEnum.FALSE.getCode())
.eq(ThemeEntity::getIsTop,StatusEnum.TRUE.getCode())
.eq(ThemeEntity::getIsTop, StatusEnum.TRUE.getCode())
.orderByDesc(ThemeEntity::getSetTopTime);
return themeMapper.selectList(queryWrapper);
}
......
......@@ -48,14 +48,8 @@
</select>
<!--auto generated by MybatisCodeHelper on 2022-02-17-->
<select id="countByTopicIdAndCreateTimeAfter" resultType="java.lang.Integer">
select count(1)
from theme
where topic_id = #{topicId}
and create_time <![CDATA[>]]> #{minCreateTime}
</select>
<!--auto generated by MybatisCodeHelper on 2022-02-22-->
<!--auto generated by MybatisCodeHelper on 2022-02-22-->
<select id="queryRecentdaysOrHasTopic" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
......@@ -82,4 +76,16 @@
</foreach>
) order by create_time desc limit #{pageStart}, #{pageSize}
</select>
<!--auto generated by MybatisCodeHelper on 2022-02-23-->
<select id="countByTopicIdAndCreateTimeAfter" resultType="java.lang.Integer">
select count(1)
from theme
<where>
topic_id=#{topicId}
<if test="minCreateTime != null">
and create_time <![CDATA[>]]> #{minCreateTime}
</if>
</where>
</select>
</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