From a1a806f266576cd4bf770c061da94fb0cc9409ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E9=B9=8F?= Date: Mon, 17 Aug 2026 15:50:17 +0800 Subject: [PATCH] feat: support article demo videos and category counts --- .../app/AppBlogArticleController.java | 19 ++++++++++++ .../com/ruoyi/app/domain/AppBlogArticle.java | 28 +++++++++++++++++ .../app/mapper/AppBlogArticleMapper.java | 6 ++++ .../ruoyi/app/mapper/AppResourceMapper.java | 5 +++ .../mapper/app/AppBlogArticleMapper.xml | 13 ++++++-- ruoyi-ui/src/views/app/article/index.vue | 31 +++++++++++++++---- sql/article_video_feed_id.sql | 4 +++ sql/article_video_feed_id_2.sql | 3 ++ 8 files changed, 101 insertions(+), 8 deletions(-) create mode 100644 sql/article_video_feed_id.sql create mode 100644 sql/article_video_feed_id_2.sql diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/app/AppBlogArticleController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/app/AppBlogArticleController.java index cf415ff..9ab8f34 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/app/AppBlogArticleController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/app/AppBlogArticleController.java @@ -2,6 +2,7 @@ package com.ruoyi.web.controller.app; import com.ruoyi.app.domain.AppBlogArticle; import com.ruoyi.app.mapper.AppBlogArticleMapper; +import com.ruoyi.app.mapper.AppResourceMapper; import com.ruoyi.app.service.ImageUrlService; import com.ruoyi.app.service.IAppBlogArticleService; import com.ruoyi.common.annotation.Log; @@ -19,7 +20,9 @@ import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; import java.util.ArrayList; +import java.util.LinkedHashMap; import java.util.List; +import java.util.Map; /** * 文章Controller @@ -39,6 +42,9 @@ public class AppBlogArticleController extends BaseController { @Resource private AppBlogArticleMapper appBlogArticleMapper; + @Resource + private AppResourceMapper appResourceMapper; + @Resource private ITtFileService fileService; @@ -87,6 +93,19 @@ public class AppBlogArticleController extends BaseController { return success(appBlogArticle); } + /** + * 获取首页四个分类的可见内容数量 + */ + @GetMapping(value = "/app/homeCategoryCounts") + public AjaxResult homeCategoryCounts() { + Map counts = new LinkedHashMap<>(); + counts.put("highQuality", appBlogArticleMapper.countByArticleType(7L, 1L)); + counts.put("resource", appResourceMapper.countByIsShow(1L)); + counts.put("integral", appBlogArticleMapper.countByArticleType(4L, 1L)); + counts.put("free", appBlogArticleMapper.countByArticleType(8L, 1L)); + return success(counts); + } + /** * 新增文章 */ diff --git a/ruoyi-system/src/main/java/com/ruoyi/app/domain/AppBlogArticle.java b/ruoyi-system/src/main/java/com/ruoyi/app/domain/AppBlogArticle.java index 4263437..fa62e13 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/app/domain/AppBlogArticle.java +++ b/ruoyi-system/src/main/java/com/ruoyi/app/domain/AppBlogArticle.java @@ -43,6 +43,14 @@ public class AppBlogArticle extends BaseEntity /** List-card thumbnail URL (not persisted). */ private String showImgThumb; + /** 视频号演示视频feedId */ + @Excel(name = "视频号演示视频ID") + private String videoFeedId; + + /** 第二个视频号演示视频feedId */ + @Excel(name = "视频号演示视频ID 2") + private String videoFeedId2; + /** 关联已有资源(关联app_resource id) */ @Excel(name = "关联已有资源", readConverterExp = "关=联app_resource,i=d") private Long appResourceId; @@ -171,6 +179,24 @@ public class AppBlogArticle extends BaseEntity { return showImgThumb; } + public void setVideoFeedId(String videoFeedId) + { + this.videoFeedId = videoFeedId; + } + + public String getVideoFeedId() + { + return videoFeedId; + } + public void setVideoFeedId2(String videoFeedId2) + { + this.videoFeedId2 = videoFeedId2; + } + + public String getVideoFeedId2() + { + return videoFeedId2; + } public void setAppResourceId(Long appResourceId) { this.appResourceId = appResourceId; @@ -260,6 +286,8 @@ public class AppBlogArticle extends BaseEntity .append("contentInfo", getContentInfo()) .append("articleType", getArticleType()) .append("showImg", getShowImg()) + .append("videoFeedId", getVideoFeedId()) + .append("videoFeedId2", getVideoFeedId2()) .append("appResourceId", getAppResourceId()) .append("lookNumber", getLookNumber()) .append("loveNumber", getLoveNumber()) diff --git a/ruoyi-system/src/main/java/com/ruoyi/app/mapper/AppBlogArticleMapper.java b/ruoyi-system/src/main/java/com/ruoyi/app/mapper/AppBlogArticleMapper.java index 140e9c8..e2a0702 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/app/mapper/AppBlogArticleMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/app/mapper/AppBlogArticleMapper.java @@ -3,6 +3,8 @@ package com.ruoyi.app.mapper; import java.util.List; import com.ruoyi.app.domain.AppBlogArticle; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Update; /** @@ -37,6 +39,10 @@ public interface AppBlogArticleMapper */ public List selectAppBlogArticleList(AppBlogArticle appBlogArticle); + /** 查询指定类型的可见文章数量 */ + @Select("select count(*) from app_blog_article where article_type = #{articleType} and is_show = #{isShow}") + public Long countByArticleType(@Param("articleType") Long articleType, @Param("isShow") Long isShow); + /** * 新增文章 * diff --git a/ruoyi-system/src/main/java/com/ruoyi/app/mapper/AppResourceMapper.java b/ruoyi-system/src/main/java/com/ruoyi/app/mapper/AppResourceMapper.java index 6aed331..088c154 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/app/mapper/AppResourceMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/app/mapper/AppResourceMapper.java @@ -4,6 +4,7 @@ import java.util.List; import com.ruoyi.app.domain.AppResource; import com.ruoyi.app.domain.AppResourceList; import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Update; /** @@ -44,6 +45,10 @@ public interface AppResourceMapper */ public List selectAppResourceList(AppResource appResource); + /** 查询可见资源数量 */ + @Select("select count(*) from app_resource where is_show = #{isShow}") + public Long countByIsShow(@Param("isShow") Long isShow); + /** * 新增资源 * diff --git a/ruoyi-system/src/main/resources/mapper/app/AppBlogArticleMapper.xml b/ruoyi-system/src/main/resources/mapper/app/AppBlogArticleMapper.xml index bba8528..de12e09 100644 --- a/ruoyi-system/src/main/resources/mapper/app/AppBlogArticleMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/app/AppBlogArticleMapper.xml @@ -11,6 +11,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + @@ -46,12 +48,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - select id, title, content_info, article_type, keyword, show_img, app_resource_id, look_number, weight, love_number, is_recommendation, is_show, is_ad, ad_number, del_flag, create_by, create_time, remark from app_blog_article + select id, title, content_info, article_type, keyword, show_img, video_feed_id, video_feed_id_2, app_resource_id, look_number, weight, love_number, is_recommendation, is_show, is_ad, ad_number, del_flag, create_by, create_time, remark from app_blog_article @@ -106,6 +109,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" article_type, keyword, show_img, + video_feed_id, + video_feed_id_2, app_resource_id, look_number, love_number, @@ -125,6 +130,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{articleType}, #{keyword}, #{showImg}, + #{videoFeedId}, + #{videoFeedId2}, #{appResourceId}, #{lookNumber}, #{loveNumber}, @@ -148,6 +155,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" article_type = #{articleType}, keyword = #{keyword}, show_img = #{showImg}, + video_feed_id = #{videoFeedId}, + video_feed_id_2 = #{videoFeedId2}, app_resource_id = #{appResourceId}, look_number = #{lookNumber}, love_number = #{loveNumber}, diff --git a/ruoyi-ui/src/views/app/article/index.vue b/ruoyi-ui/src/views/app/article/index.vue index cc50fee..b8a4389 100644 --- a/ruoyi-ui/src/views/app/article/index.vue +++ b/ruoyi-ui/src/views/app/article/index.vue @@ -9,9 +9,6 @@ - - - @@ -58,8 +55,6 @@ - - @@ -80,8 +75,16 @@ + + + -