|
|
@@ -12,21 +12,47 @@
|
|
12
|
12
|
<result property="description" column="description" />
|
|
13
|
13
|
<result property="status" column="status" />
|
|
14
|
14
|
<result property="wordCount" column="word_count" />
|
|
15
|
|
- <result property="readCount" column="word_count" />
|
|
|
15
|
+ <result property="readCount" column="read_count" />
|
|
16
|
16
|
<result property="createTime" column="create_time" />
|
|
17
|
17
|
<result property="updateTime" column="update_time" />
|
|
|
18
|
+ <result property="authorId" column="author_id" />
|
|
|
19
|
+ <result property="cover" column="cover" />
|
|
18
|
20
|
</resultMap>
|
|
19
|
21
|
|
|
20
|
22
|
<!-- 基础字段列表 -->
|
|
21
|
23
|
<sql id="selectNovelVo">
|
|
22
|
24
|
select
|
|
23
|
25
|
id, title, author, category_id, cover_img, description,
|
|
24
|
|
- status, word_count, readCount,create_time, update_time
|
|
|
26
|
+ status, word_count, read_count,create_time, update_time,author_id,cover
|
|
25
|
27
|
from novel
|
|
26
|
28
|
</sql>
|
|
27
|
29
|
<select id="selectList" resultMap="NovelResult">
|
|
28
|
30
|
SELECT * FROM novel
|
|
29
|
31
|
</select>
|
|
|
32
|
+ <select id="selectNovelOneList" resultMap="NovelResult">
|
|
|
33
|
+ <include refid="selectNovelVo"/>
|
|
|
34
|
+ <where>
|
|
|
35
|
+ <if test="novel.title != null and novel.title != ''">
|
|
|
36
|
+ AND title LIKE CONCAT('%', #{novel.title}, '%')
|
|
|
37
|
+ </if>
|
|
|
38
|
+ <if test="novel.categoryId != null">
|
|
|
39
|
+ AND category_id = #{novel.categoryId}
|
|
|
40
|
+ </if>
|
|
|
41
|
+ <if test="novel.keyword != null and novel.keyword != ''">
|
|
|
42
|
+ AND MATCH(title, author, description) AGAINST (#{novel.keyword} IN BOOLEAN MODE)
|
|
|
43
|
+ </if>
|
|
|
44
|
+ <if test="novel.author != null and novel.author != ''">
|
|
|
45
|
+ AND author LIKE CONCAT('%', #{novel.author}, '%')
|
|
|
46
|
+ </if>
|
|
|
47
|
+ <if test="novel.description != null and novel.description != ''">
|
|
|
48
|
+ AND description LIKE CONCAT('%', #{novel.description}, '%')
|
|
|
49
|
+ </if>
|
|
|
50
|
+ <if test="novel.status != null">
|
|
|
51
|
+ AND status = #{novel.status}
|
|
|
52
|
+ </if>
|
|
|
53
|
+ </where>
|
|
|
54
|
+ ORDER BY update_time DESC
|
|
|
55
|
+ </select>
|
|
30
|
56
|
|
|
31
|
57
|
<select id="selectNovelList" parameterType="Novel" resultMap="NovelResult">
|
|
32
|
58
|
<include refid="selectNovelVo"/>
|
|
|
@@ -44,7 +70,9 @@
|
|
44
|
70
|
<!-- 全文索引模式 -->
|
|
45
|
71
|
AND MATCH(title, author, description) AGAINST (#{keyword} IN BOOLEAN MODE)
|
|
46
|
72
|
</if>
|
|
47
|
|
- <if test="authorName != null and authorName != ''"> AND author_name LIKE CONCAT('%', #{authorName}, '%')</if>
|
|
|
73
|
+ <if test="novel.author != null and novel.author != ''">
|
|
|
74
|
+ AND author LIKE CONCAT('%', #{novel.author}, '%')
|
|
|
75
|
+ </if>
|
|
48
|
76
|
<if test="description != null and description != ''"> AND description LIKE CONCAT('%', #{description}, '%')</if>
|
|
49
|
77
|
|
|
50
|
78
|
<if test="status != null and status != ''"> AND status = #{status}</if>
|