|
|
|
@ -19,7 +19,9 @@ import org.springframework.validation.annotation.Validated; |
|
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
import java.util.HashSet; |
|
|
|
|
import java.util.List; |
|
|
|
|
import java.util.Set; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 产品与课程分类表控制类 |
|
|
|
@ -100,18 +102,20 @@ public class CategoryController { |
|
|
|
|
public R hasBeenCitedInTheArticle(@ApiParam(value = "类型标识") @RequestParam(required = false) Integer type, |
|
|
|
|
@ApiParam(value = "站点id") @RequestParam(required = false) Integer siteId) { |
|
|
|
|
|
|
|
|
|
List<Category> categories = new ArrayList<>(); |
|
|
|
|
if (type == 0) { |
|
|
|
|
//类型
|
|
|
|
|
Set<Category> categories = new HashSet<>(); |
|
|
|
|
|
|
|
|
|
categories = service.lookUpTheTypeOfReferenceBySite(siteId); |
|
|
|
|
if (type == 0) { |
|
|
|
|
// 类型
|
|
|
|
|
List<Category> categoriesList = service.lookUpTheTypeOfReferenceBySite(siteId); |
|
|
|
|
|
|
|
|
|
// 将List转换为Set
|
|
|
|
|
categories.addAll(categoriesList); |
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
//分类、标签
|
|
|
|
|
// 分类、标签
|
|
|
|
|
String tagIds = service.queryLabelsReferencedWithinSite(siteId); |
|
|
|
|
if (!StringUtils.isEmpty(tagIds)) { |
|
|
|
|
//逗号循环分隔设置到集合中
|
|
|
|
|
// 逗号循环分隔设置到集合中
|
|
|
|
|
String[] tagArray = tagIds.split(","); |
|
|
|
|
for (String tagId : tagArray) { |
|
|
|
|
Category category = service.getById(tagId); |
|
|
|
@ -119,14 +123,13 @@ public class CategoryController { |
|
|
|
|
categories.add(category); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return R.success(categories); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 查询分类详情 |
|
|
|
|
* |
|
|
|
|