1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<?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.ThemeMapper">
<!-- 通用查询映射结果 -->
<sql id="Base_Column_List">
id,
theme_id,
title,
theme_type,
content,
author_id,
former_theme_id,
topic_id,
review_status,
report_status,
is_top,
set_top_time,
create_time,
update_time,
delete_tag
</sql>
<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"/>
<result column="author_id" property="authorId"/>
<result column="former_theme_id" property="formerThemeId"/>
<result column="topic_id" property="topicId"/>
<result column="review_status" property="reviewStatus"/>
<result column="report_status" property="reportStatus"/>
<result column="is_top" property="isTop"/>
<result column="set_top_time" property="setTopTime"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
<result column="delete_tag" property="deleteTag"/>
</resultMap>
<!--auto generated by MybatisCodeHelper on 2022-02-17-->
<select id="queryOneByTopicIdOrderByUpdateTimeDesc" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from theme
where topic_id = #{topicId} and delete_tag = 0
order by update_time desc
limit 1
</select>
<!--auto generated by MybatisCodeHelper on 2022-02-17-->
<!--auto generated by MybatisCodeHelper on 2022-02-22-->
<select id="queryRecentdaysOrHasTopic" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from theme
where delete_tag=#{deleteTag}
and ( create_time <![CDATA[>]]> #{minCreateTime}
or topic_id <![CDATA[<>]]> #{notTopicId})
</select>
<!--auto generated by MybatisCodeHelper on 2022-02-23-->
<select id="queryFollowList" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from theme
where delete_tag=0 and (
<if test="authorIdCollection != null and authorIdCollection.size() > 0">
author_id in
<foreach item="item" index="index" collection="authorIdCollection"
open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="topicIdCollection != null and topicIdCollection.size() > 0">
or topic_id in
<foreach item="item" index="index" collection="topicIdCollection"
open="(" separator="," close=")">
#{item}
</foreach>
</if>
) 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>