|
@@ -5,10 +5,14 @@ import cn.rankin.common.utils.api.model.APIResult;
|
|
|
import cn.rankin.common.utils.api.page.Page;
|
|
|
import cn.rankin.common.utils.dto.search.TagTypeSearchDTO;
|
|
|
import cn.rankin.common.utils.enums.BaseOrderEnum;
|
|
|
+import cn.rankin.data.api.app.vo.ItemVo;
|
|
|
import cn.rankin.data.api.product.dto.TagTypeDTO;
|
|
|
+import cn.rankin.data.api.product.entity.Tag;
|
|
|
import cn.rankin.data.api.product.entity.TagType;
|
|
|
import cn.rankin.productservice.code.ProductServiceAPICode;
|
|
|
+import cn.rankin.productservice.service.TagService;
|
|
|
import cn.rankin.productservice.service.TagTypeService;
|
|
|
+import cn.rankin.productservice.service.app.ItemService;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
@@ -16,6 +20,7 @@ import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.validation.Valid;
|
|
|
import java.util.LinkedHashMap;
|
|
|
+import java.util.List;
|
|
|
|
|
|
@RestController
|
|
|
@RequestMapping(value = "tagType")
|
|
@@ -24,6 +29,9 @@ public class TagTypeController {
|
|
|
@Autowired
|
|
|
private TagTypeService tagTypeService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private TagService tagService;
|
|
|
+
|
|
|
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
|
|
public APIResult<Page<TagType>> search(TagTypeSearchDTO searchDTO) {
|
|
|
TagType tagType = new TagType();
|
|
@@ -84,26 +92,47 @@ public class TagTypeController {
|
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "/{tagTypeId}", method = RequestMethod.GET)
|
|
|
- public APIResult<TagType> getTagType(@PathVariable("tagTypeId") String tagTypeId) {
|
|
|
+ public APIResult<TagType> getTagType(@PathVariable("tagTypeId") String tagTypeId, @RequestParam("merchantId") String merchantId) {
|
|
|
TagType tagType = tagTypeService.getTagType(tagTypeId);
|
|
|
|
|
|
if (tagType == null) {
|
|
|
return APIResult.error(ProductServiceAPICode.NOT_EXISTS);
|
|
|
}else{
|
|
|
+
|
|
|
+ //开始组装数据
|
|
|
+ List<Tag> tagList = tagService.findByTypeCode(tagType.getCode(),merchantId);
|
|
|
+ tagType.setTagList(tagList);
|
|
|
+
|
|
|
+
|
|
|
return APIResult.ok(tagType);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
- @RequestMapping(value = "/code/{typeCode}", method = RequestMethod.GET)
|
|
|
- public APIResult<TagType> getTagTypeByCode(@PathVariable("typeCode") String typeCode) {
|
|
|
+/* @RequestMapping(value = "/code/{typeCode}", method = RequestMethod.GET)
|
|
|
+ public APIResult<TagType> getTagTypeByCode(@PathVariable("typeCode") String typeCode, @RequestParam("merchantId") String merchantId) {
|
|
|
TagType tagType = tagTypeService.getTagTypeByCode(typeCode);
|
|
|
|
|
|
if (tagType == null) {
|
|
|
return APIResult.error(ProductServiceAPICode.NOT_EXISTS);
|
|
|
}else{
|
|
|
+
|
|
|
+ //开始组装数据
|
|
|
+
|
|
|
+ //标签列表数据
|
|
|
+ List<Tag> tagList = tagService.findByTypeCode(typeCode,merchantId);
|
|
|
+
|
|
|
+ //标签下 课程数据
|
|
|
+ tagList.forEach(tag -> {
|
|
|
+ String tagId = tag.getId();
|
|
|
+ List<ItemVo> itemVoList = itemService.findPageByTagId(tagId, merchantId);
|
|
|
+ tag.setRecs(itemVoList);
|
|
|
+
|
|
|
+ });
|
|
|
+ tagType.setTagList(tagList);
|
|
|
+
|
|
|
return APIResult.ok(tagType);
|
|
|
}
|
|
|
|
|
|
- }
|
|
|
+ }*/
|
|
|
}
|