From efab276536141c224e232cd046b08c9620f74d6e Mon Sep 17 00:00:00 2001
From: "rong.liu"
Date: Wed, 10 Jul 2024 14:35:09 +0800
Subject: [PATCH] =?UTF-8?q?SEO=E5=A2=9E=E5=8A=A0=E7=9B=B8=E5=BA=94?=
=?UTF-8?q?=E5=8F=82=E6=95=B0=20=E8=AF=BE=E7=A8=8B=E4=BA=A7=E5=93=81?=
=?UTF-8?q?=E6=96=87=E7=AB=A0=E5=85=B3=E8=81=94=E6=9F=A5=E8=AF=A2=E6=A0=8F?=
=?UTF-8?q?=E7=9B=AE=E4=B8=8B=E7=9A=84=E6=96=87=E7=AB=A0=EF=BC=88=E6=A0=B9?=
=?UTF-8?q?=E6=8D=AE=E9=80=89=E6=8B=A9=E6=A0=8F=E7=9B=AE=E8=8B=A5=E9=80=89?=
=?UTF-8?q?=E4=B8=AD=E6=A0=8F=E7=9B=AE=E4=B8=8E=E5=AD=90=E7=BA=A7=E5=85=A8?=
=?UTF-8?q?=E9=83=A8=E6=A0=8F=E7=9B=AE=E7=B1=BB=E5=9E=8B=E4=B8=80=E8=87=B4?=
=?UTF-8?q?=E8=BF=94=E5=9B=9E=E5=85=A8=E9=83=A8=E6=96=87=E7=AB=A0=EF=BC=8C?=
=?UTF-8?q?=E5=8F=8D=E4=B9=8B=E6=9F=A5=E8=AF=A2=E9=80=89=E4=B8=AD=E6=A0=8F?=
=?UTF-8?q?=E7=9B=AE=E4=B8=8B=E7=9A=84=E6=96=87=E7=AB=A0=EF=BC=89?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/main/java/com/huoran/iasf/entity/Seo.java | 11 +++
.../huoran/iasf/mapper/SysContentMapper.java | 3 +
.../iasf/mapper/xml/SysColumnMapper.xml | 4 +-
.../iasf/mapper/xml/SysContentMapper.xml | 32 ++++++
.../service/impl/SysColumnServiceImpl.java | 98 +++++++++++++++----
.../iasf/vo/resp/PageContentRespVO.java | 6 ++
6 files changed, 134 insertions(+), 20 deletions(-)
diff --git a/src/main/java/com/huoran/iasf/entity/Seo.java b/src/main/java/com/huoran/iasf/entity/Seo.java
index e8358bb..3692983 100644
--- a/src/main/java/com/huoran/iasf/entity/Seo.java
+++ b/src/main/java/com/huoran/iasf/entity/Seo.java
@@ -42,4 +42,15 @@ public class Seo implements Serializable {
@ApiModelProperty(value = "站点")
private Integer siteId;
+
+ @ApiModelProperty(value = "图标")
+ private String iconUrl;
+
+ @ApiModelProperty(value = "图标后缀")
+ private String iconSuffix;
+
+
+
+
+
}
diff --git a/src/main/java/com/huoran/iasf/mapper/SysContentMapper.java b/src/main/java/com/huoran/iasf/mapper/SysContentMapper.java
index 967f61d..c90a16b 100644
--- a/src/main/java/com/huoran/iasf/mapper/SysContentMapper.java
+++ b/src/main/java/com/huoran/iasf/mapper/SysContentMapper.java
@@ -33,6 +33,9 @@ public interface SysContentMapper extends BaseMapper {
List columnConditionsFilterArticles(@Param("columnId")String columnId);
+
+ List columnConditionsFilterProductCourse(@Param("columnId")String columnId);
+
/*Integer selectNextId(@Param("content")SysContent sysContent);
Integer updateSortById(@Param("content")SysContent sysContent);
diff --git a/src/main/java/com/huoran/iasf/mapper/xml/SysColumnMapper.xml b/src/main/java/com/huoran/iasf/mapper/xml/SysColumnMapper.xml
index bd24521..3cc47ff 100644
--- a/src/main/java/com/huoran/iasf/mapper/xml/SysColumnMapper.xml
+++ b/src/main/java/com/huoran/iasf/mapper/xml/SysColumnMapper.xml
@@ -187,9 +187,7 @@
T1.lvl DESC limit 0, 1
+
\ No newline at end of file
diff --git a/src/main/java/com/huoran/iasf/service/impl/SysColumnServiceImpl.java b/src/main/java/com/huoran/iasf/service/impl/SysColumnServiceImpl.java
index 1f4a61c..4531815 100644
--- a/src/main/java/com/huoran/iasf/service/impl/SysColumnServiceImpl.java
+++ b/src/main/java/com/huoran/iasf/service/impl/SysColumnServiceImpl.java
@@ -1,6 +1,7 @@
package com.huoran.iasf.service.impl;
import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -20,10 +21,7 @@ import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
+import java.util.*;
import java.util.stream.Collectors;
/**
@@ -155,7 +153,8 @@ public class SysColumnServiceImpl extends ServiceImpl {
if (pageContentRespVO.getLevel() > 1) {
//判断该栏目层级为第一级时候不返回上级栏目
- List upperLevel = baseMapper.getParentInformationBasedOnChild(pageContentRespVO.getId());
+ List upperLevel =
+ baseMapper.getParentInformationBasedOnChild(pageContentRespVO.getId());
pageContentRespVO.setSuperiorColumn(upperLevel);
}
@@ -192,26 +191,93 @@ public class SysColumnServiceImpl extends ServiceImpl
+ * 此方法用于根据提供的栏目类型ID字符串查询相关文章。如果ID字符串包含多个ID,则会考虑这些ID的数量来决定查询策略。
+ * 如果ID数量大于1,且查询到的栏目类型数量也为1,则会应用额外的文章过滤条件。
+ *
+ *
+ * @param ids 栏目类型ID字符串,多个ID以逗号分隔。
+ * @param id 单个栏目类型ID,用于当提供的ID字符串包含单个ID时的查询。
+ * @return 返回查询结果,封装在R对象中。
+ */
+ /*@Override
public R queryArticlesByColumnType(String ids, Integer id) {
-
+ // 计算提供的ID字符串中包含的栏目类型ID的数量。
Integer count = 0;
for (String columnId : ids.split(",")) {
++count;
}
+ SysColumn column = baseMapper.selectById(id);
+ if (!ObjectUtil.isEmpty(column) && (column.getTemplateId() == 12 || (column.getTemplateId() == 9 && column
+ .getListStyleId() == 73))) {
+ // 根据模板ID为12的特定情况调用相应方法
+ return null;
+ } else {
+ // 根据提供的栏目类型ID字符串查询栏目类型。
+ List queryByColumnType = baseMapper.queryByColumnType(ids);
+ // 如果提供的ID字符串中包含的栏目类型ID数量大于1,并且查询到的栏目类型数量为1,则应用额外的过滤条件。
+ //为1表示该层级下以及它本身列表样式模板一直则查询全部的
+ if (count > 1) {
+ if (queryByColumnType.size() == 1) {
+ // 使用过滤条件查询文章。
+ return R.success(contentMapper.columnConditionsFilterArticles(ids));
+ }
+ }
+ // 在其他情况下,直接根据单个栏目类型ID查询文章。
+ //表示该层级下的全部层级不一致只查本身
+ return R.success(contentMapper.columnConditionsFilterArticles(id + ""));
+ }
+
+
+ }*/
+
+ // 常量定义
+ private static final int TEMPLATE_ID_12 = 12;
+ private static final int TEMPLATE_ID_9 = 9;
+ private static final int LIST_STYLE_ID_73 = 73;
- List queryByColumnType = baseMapper.queryByColumnType(ids);
- //为1表示该层级下以及它本身列表样式模板一直则查询全部的
- if (count > 1) {
- if (queryByColumnType.size() == 1) {
- return R.success(contentMapper.columnConditionsFilterArticles(ids));
+ @Override
+ public R queryArticlesByColumnType(String ids, Integer id) {
+ // 检查输入参数是否有效
+ if (StrUtil.isBlank(ids)) {
+ return R.fail("栏目类型ID字符串不能为空");
+ }
+ ids = ids.trim();
+
+ // 初始化计数器
+ long count = Arrays.stream(ids.split(",")).filter(str -> !str.isEmpty()).count();
+
+ SysColumn column;
+ List queryByColumnType;
+ try {
+ column = baseMapper.selectById(id);
+ queryByColumnType = baseMapper.queryByColumnType(ids);
+ } catch (Exception e) {
+ return R.fail("查询栏目类型时发生异常");
+ }
+
+ if (column != null && (column.getTemplateId() == TEMPLATE_ID_12 || (column.getTemplateId() == TEMPLATE_ID_9 && column.getListStyleId() == LIST_STYLE_ID_73))) {
+ if (count > 1) {
+
+ List list = contentMapper.columnConditionsFilterProductCourse(ids);
+ return R.success(list);
+ } else {
+ List list = contentMapper.columnConditionsFilterProductCourse(String.valueOf(id));
+ return R.success(list);
}
}
- //表示该层级下的全部层级不一致只查本身
- return R.success(contentMapper.columnConditionsFilterArticles(id + ""));
+
+ if (count > 1 && queryByColumnType.size() == 1) {
+ return R.success(contentMapper.columnConditionsFilterArticles(ids));
+ }
+
+ return R.success(contentMapper.columnConditionsFilterArticles(id.toString()));
}
+
@Override
public List getColumnNamesByIds(Collection applicationScopeIds) {
if (CollectionUtils.isEmpty(applicationScopeIds)) {
@@ -226,13 +292,11 @@ public class SysColumnServiceImpl extends ServiceImpl fileList;
+
+ /*@ApiModelProperty(value = "分类/标签")
+ private String categoryName;
+
+ @ApiModelProperty(value = "类型")
+ private String classificationTagName;*/
}
\ No newline at end of file