From aae48957ba971ed0a1bfbfa182701cd22bbe8694 Mon Sep 17 00:00:00 2001 From: inleft <inleft@qq.com> Date: Wed, 31 Aug 2022 18:12:16 +0800 Subject: [PATCH] 新增编辑页 查询接口 --- snowy-main/src/main/java/vip/xiaonuo/modular/blogarticle/mapper/mapping/BlogArticleMapper.xml | 103 ++++++++++++++++++++++++++++++++++++++++++++++----- 1 files changed, 92 insertions(+), 11 deletions(-) diff --git a/snowy-main/src/main/java/vip/xiaonuo/modular/blogarticle/mapper/mapping/BlogArticleMapper.xml b/snowy-main/src/main/java/vip/xiaonuo/modular/blogarticle/mapper/mapping/BlogArticleMapper.xml index bebddbc..ce497d4 100644 --- a/snowy-main/src/main/java/vip/xiaonuo/modular/blogarticle/mapper/mapping/BlogArticleMapper.xml +++ b/snowy-main/src/main/java/vip/xiaonuo/modular/blogarticle/mapper/mapping/BlogArticleMapper.xml @@ -23,50 +23,66 @@ a.publish_date, a.is_top, a.editor_status, - a.create_date + a.is_allowed_comment, + a.jump_url as jumpURL, + a.update_date, + a.create_date, + a.video_ids, + a.picture_ids </sql> + <!--首页通用的条件查询--> <sql id="queryListCondition"> <trim prefix="WHERE" prefixOverrides="AND | OR"> a.is_enable=1 and a.editor_status=1 - + and a.publish_date < now() <choose> <when test="param.typeId != null"> AND a.article_type_id = #{param.typeId} + order by a.is_top desc,a.top_value asc , a.publish_date desc </when> + <otherwise> - AND a.article_type_id != 4 + <!-- 首页不出现视频等文件类型--> + <if test="param.faceExcludeFile != null"> + and a.article_file_type not in + <foreach collection="param.faceExcludeFile" item="obj" separator="," open="(" close=")"> + #{obj} + </foreach> + </if> + order by a.is_top desc,a.top_value asc , a.update_date desc </otherwise> </choose> </trim> </sql> - <select id="searchList" resultType="vip.xiaonuo.modular.blogarticle.param.BlogArticleVo"> + <!-- 首页查询--> + <select id="searchList" resultType="vip.xiaonuo.modular.blogarticle.entity.BlogArticleVo"> select <include refid="Base_Column_List"/> - ,IFNULL("",CONCAT("/",f2.file_bucket,"/",f2.file_object_name)) as coverFileURL + ,IF(a.cover_file_id is not null,CONCAT("/",f2.file_bucket,"/",f2.file_object_name),"") as coverFileURL ,t.type_name as articleTypeName from blog_article a inner join blog_article_type t on t.id =a.article_type_id - left join sys_file_info f1 - on f1.id=a.article_file_id - + <!-- 排除首页不查询的分类--> + <if test="param.typeId == null"> + and t.is_show_face = 1 + </if> left join sys_file_info f2 on f2.id=a.cover_file_id <include refid="queryListCondition"/> - order by a.is_top desc,a.top_value asc , a.create_date desc - limit #{param.pageNo},#{param.pageSize} </select> + <!-- 首页查询个数统计--> <select id="searchListCount" resultType="java.lang.Long"> select count(0) @@ -76,10 +92,11 @@ </select> + <!-- 月份归档统计--> <select id="searchMonthCount" resultType="vip.xiaonuo.modular.blogStatistics.vo.BlogArchiveDetailVo"> SELECT separate_month AS `month`, - count(1) AS count + count(1) AS `count` FROM blog_article WHERE @@ -87,6 +104,7 @@ is_enable = 1 AND editor_status = 1 AND separate_year = #{separateYear} + AND publish_date < now() ) GROUP BY separate_month @@ -94,4 +112,67 @@ </select> + <!-- 上下篇查询--> + <select id="getAdjoiningRecord" resultType="vip.xiaonuo.modular.blogarticle.entity.BlogArticleVo"> + select + a.id, + a.title + from + blog_article a + <include refid="queryListCondition"/> + limit #{param.pageNo},#{param.pageSize} + </select> + + <sql id="queryPlatformCondition"> + <trim prefix="WHERE" prefixOverrides="AND | OR"> + a.is_enable=1 + and a.editor_status=1 + and a.publish_date < now() + + <if test="param.id != null"> + and a.id = #{param.id} + </if> + + <if test="param.fileType != null"> + and a.article_file_type = #{param.fileType} + </if> + + AND a.article_type_id in + <foreach collection="param.typeIds" item="obj" separator="," open="(" close=")"> + #{obj} + </foreach> + + order by a.is_top desc,a.top_value asc , a.publish_date desc + </trim> + + </sql> + + <!--月台列表查询--> + <select id="searchPlatformList" resultType="vip.xiaonuo.modular.blogarticle.entity.BlogArticleVo"> + select + <include refid="Base_Column_List"/> + ,IF(a.cover_file_id is not null,CONCAT("/",f2.file_bucket,"/",f2.file_object_name),"") as coverFileURL + ,t.type_name as articleTypeName + from + blog_article a + inner join blog_article_type t + on t.id =a.article_type_id + + left join sys_file_info f2 + on f2.id=a.cover_file_id + + <include refid="queryPlatformCondition"/> + + limit #{param.pageNo},#{param.pageSize} + </select> + + <select id="searchPlatformListCount" resultType="java.lang.Long"> + select + count(0) + from + blog_article a + <include refid="queryPlatformCondition"/> + </select> + + </mapper> -- Gitblit v1.9.1