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