From 8f7fb44780b7a01b4b4a5dd48fde1e18a7cc6624 Mon Sep 17 00:00:00 2001 From: "rong.liu" Date: Tue, 30 Jul 2024 17:31:14 +0800 Subject: [PATCH] =?UTF-8?q?bug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/huoran/iasf/controller/CategoryController.java | 10 ++++++---- .../java/com/huoran/iasf/mapper/CategoryMapper.java | 2 +- .../java/com/huoran/iasf/mapper/xml/CategoryMapper.xml | 1 + .../com/huoran/iasf/service/SysCategoryService.java | 4 ++-- .../huoran/iasf/service/impl/CategoryServiceImpl.java | 6 +++--- 5 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/huoran/iasf/controller/CategoryController.java b/src/main/java/com/huoran/iasf/controller/CategoryController.java index 989188a..b858a89 100644 --- a/src/main/java/com/huoran/iasf/controller/CategoryController.java +++ b/src/main/java/com/huoran/iasf/controller/CategoryController.java @@ -106,27 +106,29 @@ public class CategoryController { if (type == 0) { // 类型 - List categoriesList = service.lookUpTheTypeOfReferenceBySite(siteId); + List categoriesList = service.lookUpTheTypeOfReferenceBySite(siteId, type); // 将List转换为Set categories.addAll(categoriesList); + return R.success(categories); } else { // 分类、标签 - String tagIds = service.queryLabelsReferencedWithinSite(siteId); + String tagIds = service.queryLabelsReferencedWithinSite(siteId, type); if (!StringUtils.isEmpty(tagIds)) { // 逗号循环分隔设置到集合中 String[] tagArray = tagIds.split(","); for (String tagId : tagArray) { Category category = service.getById(tagId); - if (!ObjectUtils.isEmpty(category)) { + if (!ObjectUtils.isEmpty(category) && category.getType() == 1) { categories.add(category); } } } + return R.success(categories); } - return R.success(categories); + } diff --git a/src/main/java/com/huoran/iasf/mapper/CategoryMapper.java b/src/main/java/com/huoran/iasf/mapper/CategoryMapper.java index 67b66b6..8ce0541 100644 --- a/src/main/java/com/huoran/iasf/mapper/CategoryMapper.java +++ b/src/main/java/com/huoran/iasf/mapper/CategoryMapper.java @@ -23,5 +23,5 @@ public interface CategoryMapper extends BaseMapper { String queryLabelsReferencedWithinSite(@Param("siteId") Integer siteId); - List lookUpTheTypeOfReferenceBySite(@Param("siteId")Integer siteId); + List lookUpTheTypeOfReferenceBySite(@Param("siteId")Integer siteId,@Param("type")Integer type); } diff --git a/src/main/java/com/huoran/iasf/mapper/xml/CategoryMapper.xml b/src/main/java/com/huoran/iasf/mapper/xml/CategoryMapper.xml index f97d401..dabafa2 100644 --- a/src/main/java/com/huoran/iasf/mapper/xml/CategoryMapper.xml +++ b/src/main/java/com/huoran/iasf/mapper/xml/CategoryMapper.xml @@ -42,6 +42,7 @@ d.site_id = #{siteId} AND ( d.classification_tag_id != NULL OR d.classification_tag_id != '' ) AND d.deleted = 1 + and c.type = #{type} GROUP BY d.classification_tag_id diff --git a/src/main/java/com/huoran/iasf/service/SysCategoryService.java b/src/main/java/com/huoran/iasf/service/SysCategoryService.java index d4214ea..03c7fc4 100644 --- a/src/main/java/com/huoran/iasf/service/SysCategoryService.java +++ b/src/main/java/com/huoran/iasf/service/SysCategoryService.java @@ -22,7 +22,7 @@ public interface SysCategoryService extends IService { boolean checkDelete(Integer siteId, Integer categoryId, Integer type); - String queryLabelsReferencedWithinSite(Integer siteId); + String queryLabelsReferencedWithinSite(Integer siteId,Integer type); - List lookUpTheTypeOfReferenceBySite(Integer siteId); + List lookUpTheTypeOfReferenceBySite(Integer siteId,Integer type); } diff --git a/src/main/java/com/huoran/iasf/service/impl/CategoryServiceImpl.java b/src/main/java/com/huoran/iasf/service/impl/CategoryServiceImpl.java index c7b3f35..c53fe1b 100644 --- a/src/main/java/com/huoran/iasf/service/impl/CategoryServiceImpl.java +++ b/src/main/java/com/huoran/iasf/service/impl/CategoryServiceImpl.java @@ -56,7 +56,7 @@ public class CategoryServiceImpl extends ServiceImpl i } @Override - public String queryLabelsReferencedWithinSite(Integer siteId) { + public String queryLabelsReferencedWithinSite(Integer siteId,Integer type) { if (!StringUtils.isEmpty(baseMapper.queryLabelsReferencedWithinSite(siteId))) { return baseMapper.queryLabelsReferencedWithinSite(siteId); } @@ -64,8 +64,8 @@ public class CategoryServiceImpl extends ServiceImpl i } @Override - public List lookUpTheTypeOfReferenceBySite(Integer siteId) { - return baseMapper.lookUpTheTypeOfReferenceBySite(siteId); + public List lookUpTheTypeOfReferenceBySite(Integer siteId,Integer type) { + return baseMapper.lookUpTheTypeOfReferenceBySite(siteId,type); }