|
@@ -3,12 +3,16 @@ package cn.rankin.productservice.controller.app;
|
|
import cn.rankin.common.utils.api.model.APIResult;
|
|
import cn.rankin.common.utils.api.model.APIResult;
|
|
import cn.rankin.common.utils.api.page.Page;
|
|
import cn.rankin.common.utils.api.page.Page;
|
|
import cn.rankin.data.api.app.vo.ItemVo;
|
|
import cn.rankin.data.api.app.vo.ItemVo;
|
|
|
|
+import cn.rankin.data.api.product.entity.Tag;
|
|
import cn.rankin.data.api.product.entity.TagGroup;
|
|
import cn.rankin.data.api.product.entity.TagGroup;
|
|
|
|
+import cn.rankin.productservice.service.TagService;
|
|
import cn.rankin.productservice.service.app.ItemService;
|
|
import cn.rankin.productservice.service.app.ItemService;
|
|
import cn.rankin.productservice.service.TagGroupService;
|
|
import cn.rankin.productservice.service.TagGroupService;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
+import java.util.List;
|
|
|
|
+
|
|
@RestController
|
|
@RestController
|
|
@RequestMapping(value = "/app")
|
|
@RequestMapping(value = "/app")
|
|
public class AppTagController {
|
|
public class AppTagController {
|
|
@@ -19,6 +23,9 @@ public class AppTagController {
|
|
@Autowired
|
|
@Autowired
|
|
private ItemService itemService;
|
|
private ItemService itemService;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private TagService tagService;
|
|
|
|
+
|
|
@RequestMapping(value = "/tagGroup/code/{code}", method = RequestMethod.GET)
|
|
@RequestMapping(value = "/tagGroup/code/{code}", method = RequestMethod.GET)
|
|
public APIResult<TagGroup> findTagGroupByCode(@PathVariable("code") String code, @RequestParam("merchantId") String merchantId) {
|
|
public APIResult<TagGroup> findTagGroupByCode(@PathVariable("code") String code, @RequestParam("merchantId") String merchantId) {
|
|
return tagGroupService.findTagGroupByCode(code, merchantId);
|
|
return tagGroupService.findTagGroupByCode(code, merchantId);
|
|
@@ -30,4 +37,18 @@ public class AppTagController {
|
|
return itemService.findPageByTagId(tagId, merchantId, pageNo, pageSize);
|
|
return itemService.findPageByTagId(tagId, merchantId, pageNo, pageSize);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @RequestMapping(value = "/tagType/code/{typeCode}", method = RequestMethod.GET)
|
|
|
|
+ public APIResult<List<Tag>> getTagsByTypeCode(@PathVariable("typeCode") String typeCode, @RequestParam("merchantId") String merchantId) {
|
|
|
|
+ //开始组装数据
|
|
|
|
+ //标签列表数据
|
|
|
|
+ List<Tag> tagList = tagService.findByTypeCode(typeCode,merchantId);
|
|
|
|
+
|
|
|
|
+ //标签下 课程数据
|
|
|
|
+ tagList.forEach(tag -> {
|
|
|
|
+ String tagId = tag.getId();
|
|
|
|
+ List<ItemVo> itemVoList = itemService.findPageByTagId(tagId, merchantId);
|
|
|
|
+ tag.setRecs(itemVoList);
|
|
|
|
+ });
|
|
|
|
+ return APIResult.ok(tagList);
|
|
|
|
+ }
|
|
}
|
|
}
|