inleft
2022-08-22 1e152bbcfb357073d8bcf0b51fe701e3fb81540d
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
c49fa0 36             and a.publish_date &lt; now()
d80267 37             <choose>
1e152b 38                 <!-- 月台查询用 -->
d80267 39                 <when test="param.fileType != null">
I 40                     and a.article_file_type = #{param.fileType}
41                 </when>
1e152b 42                 <!-- 指定排除 视频类在首页显示,但需要在分类栏目列表显示 -->
d80267 43                 <when test="param.fileType == null and param.typeId == null">
I 44                     and a.article_file_type not in (3,4)
45                 </when>
46             </choose>
cb2e50 47             <choose>
I 48                 <when test="param.typeId != null">
49                     AND a.article_type_id = #{param.typeId}
20e5fc 50                     order by a.is_top desc,a.top_value asc , a.publish_date desc
cb2e50 51                 </when>
1e152b 52
I 53                 <!-- 指定排除 笔记类在首页显示 -->
cb2e50 54                 <otherwise>
I 55                     AND a.article_type_id != 4
ba780f 56                     order by a.is_top desc,a.top_value asc , a.update_date desc
cb2e50 57                 </otherwise>
I 58             </choose>
0613f2 59         </trim>
cb2e50 60
0613f2 61     </sql>
I 62
88f419 63     <select id="searchList" resultType="vip.xiaonuo.modular.blogarticle.entity.BlogArticleVo">
0613f2 64         select
I 65         <include refid="Base_Column_List"/>
70097d 66         ,IF(a.cover_file_id is not null,CONCAT("/",f2.file_bucket,"/",f2.file_object_name),"") as coverFileURL
0613f2 67         ,t.type_name as articleTypeName
I 68         from
69         blog_article a
a9c4c9 70         inner join blog_article_type t
0613f2 71         on t.id =a.article_type_id
I 72
73         left join sys_file_info f1
74         on f1.id=a.article_file_id
75
76
77         left join sys_file_info f2
78         on f2.id=a.cover_file_id
79
80         <include refid="queryListCondition"/>
81
82         limit #{param.pageNo},#{param.pageSize}
83     </select>
84
a9c4c9 85     <select id="searchListCount" resultType="java.lang.Long">
0613f2 86         select
I 87         count(0)
88         from
89         blog_article a
90         <include refid="queryListCondition"/>
91
92     </select>
93
a9c4c9 94     <select id="searchMonthCount" resultType="vip.xiaonuo.modular.blogStatistics.vo.BlogArchiveDetailVo">
I 95        SELECT
96         separate_month AS `month`,
d80267 97         count(1) AS `count`
a9c4c9 98         FROM
I 99             blog_article
100         WHERE
101             (
102                 is_enable = 1
103                 AND editor_status = 1
104                 AND separate_year = #{separateYear}
20e5fc 105                 AND publish_date &lt; now()
a9c4c9 106             )
I 107         GROUP BY
108             separate_month
109         ORDER BY  separate_month desc
110
111     </select>
112
1e152b 113     <select id="getAdjoiningRecord"  resultType="vip.xiaonuo.modular.blogarticle.entity.BlogArticleVo">
I 114         select
115         a.id,
116         a.title
117         from
118         blog_article a
119         <include refid="queryListCondition"/>
120         limit #{param.pageNo},#{param.pageSize}
121     </select>
9bcb19 122 </mapper>