master 或然科技网站管理平台V1.0
rong.liu 4 months ago
parent 7ea5d11708
commit 8f7fb44780
  1. 10
      src/main/java/com/huoran/iasf/controller/CategoryController.java
  2. 2
      src/main/java/com/huoran/iasf/mapper/CategoryMapper.java
  3. 1
      src/main/java/com/huoran/iasf/mapper/xml/CategoryMapper.xml
  4. 4
      src/main/java/com/huoran/iasf/service/SysCategoryService.java
  5. 6
      src/main/java/com/huoran/iasf/service/impl/CategoryServiceImpl.java

@ -106,27 +106,29 @@ public class CategoryController {
if (type == 0) {
// 类型
List<Category> categoriesList = service.lookUpTheTypeOfReferenceBySite(siteId);
List<Category> 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);
}

@ -23,5 +23,5 @@ public interface CategoryMapper extends BaseMapper<Category> {
String queryLabelsReferencedWithinSite(@Param("siteId") Integer siteId);
List<Category> lookUpTheTypeOfReferenceBySite(@Param("siteId")Integer siteId);
List<Category> lookUpTheTypeOfReferenceBySite(@Param("siteId")Integer siteId,@Param("type")Integer type);
}

@ -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
</select>

@ -22,7 +22,7 @@ public interface SysCategoryService extends IService<Category> {
boolean checkDelete(Integer siteId, Integer categoryId, Integer type);
String queryLabelsReferencedWithinSite(Integer siteId);
String queryLabelsReferencedWithinSite(Integer siteId,Integer type);
List<Category> lookUpTheTypeOfReferenceBySite(Integer siteId);
List<Category> lookUpTheTypeOfReferenceBySite(Integer siteId,Integer type);
}

@ -56,7 +56,7 @@ public class CategoryServiceImpl extends ServiceImpl<CategoryMapper, Category> 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<CategoryMapper, Category> i
}
@Override
public List<Category> lookUpTheTypeOfReferenceBySite(Integer siteId) {
return baseMapper.lookUpTheTypeOfReferenceBySite(siteId);
public List<Category> lookUpTheTypeOfReferenceBySite(Integer siteId,Integer type) {
return baseMapper.lookUpTheTypeOfReferenceBySite(siteId,type);
}

Loading…
Cancel
Save