inleft
2022-03-02 42b7d05dfdf60ee67c876084a3240ff48a3bf3a5
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,
0613f2 27        a.create_date
I 28     </sql>
29
30     <sql id="queryListCondition">
31         <trim prefix="WHERE" prefixOverrides="AND | OR">
32             a.is_enable=1
33             and a.editor_status=1
cb2e50 34
I 35             <choose>
36                 <when test="param.typeId != null">
37                     AND a.article_type_id = #{param.typeId}
38                 </when>
39                 <otherwise>
40                     AND a.article_type_id != 4
41                 </otherwise>
42             </choose>
0613f2 43         </trim>
cb2e50 44
0613f2 45     </sql>
I 46
88f419 47     <select id="searchList" resultType="vip.xiaonuo.modular.blogarticle.entity.BlogArticleVo">
0613f2 48         select
I 49         <include refid="Base_Column_List"/>
50         ,IFNULL("",CONCAT("/",f2.file_bucket,"/",f2.file_object_name)) as coverFileURL
51         ,t.type_name as articleTypeName
52         from
53         blog_article a
a9c4c9 54         inner join blog_article_type t
0613f2 55         on t.id =a.article_type_id
I 56
57         left join sys_file_info f1
58         on f1.id=a.article_file_id
59
60
61         left join sys_file_info f2
62         on f2.id=a.cover_file_id
63
64         <include refid="queryListCondition"/>
65
cfde48 66         order by a.is_top desc,a.top_value asc , a.create_date desc
0613f2 67
I 68         limit #{param.pageNo},#{param.pageSize}
69     </select>
70
a9c4c9 71     <select id="searchListCount" resultType="java.lang.Long">
0613f2 72         select
I 73         count(0)
74         from
75         blog_article a
76         <include refid="queryListCondition"/>
77
78     </select>
79
a9c4c9 80     <select id="searchMonthCount" resultType="vip.xiaonuo.modular.blogStatistics.vo.BlogArchiveDetailVo">
I 81        SELECT
82         separate_month AS `month`,
83         count(1) AS count
84         FROM
85             blog_article
86         WHERE
87             (
88                 is_enable = 1
89                 AND editor_status = 1
90                 AND separate_year = #{separateYear}
91             )
92         GROUP BY
93             separate_month
94         ORDER BY  separate_month desc
95
96     </select>
97
9bcb19 98 </mapper>