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