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