Browse Source

fix getTagType by id

guozhaoshun 6 years ago
parent
commit
b19f89f623

+ 2 - 2
rankin-product-service/src/main/java/cn/rankin/productservice/controller/TagTypeController.java

@@ -92,14 +92,14 @@ public class TagTypeController {
     }
 
     @RequestMapping(value = "/{tagTypeId}", method = RequestMethod.GET)
-    public APIResult<TagType> getTagType(@PathVariable("tagTypeId") String tagTypeId, @RequestParam("merchantId") String merchantId) {
+    public APIResult<TagType> getTagType(@PathVariable("tagTypeId") String tagTypeId) {
         TagType tagType = tagTypeService.getTagType(tagTypeId);
 
         if (tagType == null) {
             return APIResult.error(ProductServiceAPICode.NOT_EXISTS);
         }else{
             //开始组装数据
-            List<Tag> tagList = tagService.findByTypeCode(tagType.getCode(),merchantId);
+            List<Tag> tagList = tagService.findByTypeCode(tagType.getCode());
             tagType.setTagList(tagList);
             return APIResult.ok(tagType);
         }

+ 3 - 0
rankin-product-service/src/main/java/cn/rankin/productservice/repository/TagRepository.java

@@ -21,6 +21,9 @@ public interface TagRepository extends BasicJpaRepository<Tag, String> {
     @Query(value = "select t from Tag t where t.typeCode = ?1 and t.merchantId = ?2 order by t.sort")
     List<Tag> findByTypeCode(String typeCode,String merchantId);
 
+    @Query(value = "select t from Tag t where t.typeCode = ?1 order by t.sort")
+    List<Tag> findByTypeCode(String typeCode);
+
     @Query(value = "select t from Tag t where t.id in (?1) and t.status = ?2")
     List<Tag> findByIds(List<String> tagIdList, BaseStatusEnum status);
 

+ 5 - 0
rankin-product-service/src/main/java/cn/rankin/productservice/service/TagService.java

@@ -57,6 +57,11 @@ public class TagService {
         return tagList;
     }
 
+    public List<Tag> findByTypeCode(String typeCode) {
+        List<Tag> tagList = tagRepository.findByTypeCode(typeCode);
+        return tagList;
+    }
+
 
     public void setGroupInfo(List<Tag> tagList) {
         if (CollectionUtils.isEmpty(tagList)) return;