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