inleft
2022-08-04 eaf26c265f8882b2e100428d942ac377330cc114
commit | author | age
9bcb19 1 <?xml version="1.0" encoding="UTF-8"?>
I 2 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3 <mapper namespace="vip.xiaonuo.modular.blogarticle.mapper.BlogArticleMapper">
4
0613f2 5
I 6     <!-- 通用查询结果列 -->
7     <sql id="Base_Column">
8         id,title,article_file_id,article_file_type,
9         article_type_id,introduce,cover_file_id,last_editor_date,publish_date,
10         is_top,top_value,auth_status,auth_password,editor_status,
11         separate_year,separate_month,separate_day,is_enable,update_date,create_date
12     </sql>
13
14     <sql id="Base_Column_List">
15        a.id,
16        a.title,
17        a.article_file_type,
18        a.article_type_id,
19        a.introduce,
20        a.cover_file_id,
21        a.auth_status,
22        a.last_editor_date,
23        a.publish_date,
24        a.is_top,
25        a.editor_status,
42b7d0 26        a.is_allowed_comment,
70097d 27        a.jump_url as jumpURL,
ba780f 28        a.update_date,
0613f2 29        a.create_date
I 30     </sql>
31
32     <sql id="queryListCondition">
33         <trim prefix="WHERE" prefixOverrides="AND | OR">
34             a.is_enable=1
35             and a.editor_status=1
cb2e50 36
I 37             <choose>
38                 <when test="param.typeId != null">
39                     AND a.article_type_id = #{param.typeId}
ba780f 40                     order by a.is_top desc,a.top_value asc , a.create_date desc
cb2e50 41                 </when>
I 42                 <otherwise>
43                     AND a.article_type_id != 4
ba780f 44                     order by a.is_top desc,a.top_value asc , a.update_date desc
cb2e50 45                 </otherwise>
I 46             </choose>
0613f2 47         </trim>
cb2e50 48
0613f2 49     </sql>
I 50
88f419 51     <select id="searchList" resultType="vip.xiaonuo.modular.blogarticle.entity.BlogArticleVo">
0613f2 52         select
I 53         <include refid="Base_Column_List"/>
70097d 54         ,IF(a.cover_file_id is not null,CONCAT("/",f2.file_bucket,"/",f2.file_object_name),"") as coverFileURL
0613f2 55         ,t.type_name as articleTypeName
I 56         from
57         blog_article a
a9c4c9 58         inner join blog_article_type t
0613f2 59         on t.id =a.article_type_id
I 60
61         left join sys_file_info f1
62         on f1.id=a.article_file_id
63
64
65         left join sys_file_info f2
66         on f2.id=a.cover_file_id
67
68         <include refid="queryListCondition"/>
69
70         limit #{param.pageNo},#{param.pageSize}
71     </select>
72
a9c4c9 73     <select id="searchListCount" resultType="java.lang.Long">
0613f2 74         select
I 75         count(0)
76         from
77         blog_article a
78         <include refid="queryListCondition"/>
79
80     </select>
81
a9c4c9 82     <select id="searchMonthCount" resultType="vip.xiaonuo.modular.blogStatistics.vo.BlogArchiveDetailVo">
I 83        SELECT
84         separate_month AS `month`,
85         count(1) AS count
86         FROM
87             blog_article
88         WHERE
89             (
90                 is_enable = 1
91                 AND editor_status = 1
92                 AND separate_year = #{separateYear}
93             )
94         GROUP BY
95             separate_month
96         ORDER BY  separate_month desc
97
98     </select>
99
9bcb19 100 </mapper>