Bläddra i källkod

fix tag support update typeCode,merchant;

guozhaoshun 6 år sedan
förälder
incheckning
1a88c54723

+ 1 - 1
rankin-data-api/src/main/java/cn/rankin/data/api/product/entity/Tag.java

@@ -31,7 +31,7 @@ public class Tag implements Serializable {
     @Column(name = "group_id", updatable = false, nullable = false)
     private String groupId;
 
-    @Column(name = "type_code", updatable = false, nullable = false)
+    @Column(name = "type_code", nullable = false)
     private String typeCode;
 
     @Column

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

@@ -10,16 +10,16 @@ import java.util.List;
 
 public interface TagRepository extends BasicJpaRepository<Tag, String> {
 
-    @Query(value = "select t from Tag t where t.groupId = ?1 order by t.sort")
-    List<Tag> findByGroupId(String groupId);
+    @Query(value = "select t from Tag t where t.groupId = ?1 and t.status = ?2  order by t.sort")
+    List<Tag> findByGroupId(String groupId, BaseStatusEnum status);
 
     /*  add   */
     @Query(value = "select t from Tag t where t.groupId = ?1 order by t.sort")
     List<Tag> findByTagTypeId(String tagTypeId);
 
 
-    @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 and t.merchantId = ?2  and t.status = ?3 order by t.sort")
+    List<Tag> findByTypeCode(String typeCode,String merchantId, BaseStatusEnum status);
 
     @Query(value = "select t from Tag t where t.typeCode = ?1 order by t.sort")
     List<Tag> findByTypeCode(String typeCode);

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

@@ -46,14 +46,14 @@ public class TagService {
     private GoodsService goodsService;
 
     public List<Tag> findByGroupId(String groupId) {
-        List<Tag> tagList = tagRepository.findByGroupId(groupId);
+        List<Tag> tagList = tagRepository.findByGroupId(groupId, BaseStatusEnum.NORMAL);
         setGroupInfo(tagList);
         return tagList;
     }
 
     /*add    2018-05-17 */
     public List<Tag> findByTypeCode(String typeCode,String merchantId) {
-        List<Tag> tagList = tagRepository.findByTypeCode(typeCode,merchantId);
+        List<Tag> tagList = tagRepository.findByTypeCode(typeCode,merchantId, BaseStatusEnum.NORMAL);
         return tagList;
     }
 
@@ -192,7 +192,7 @@ public class TagService {
 
     @Transactional
     public void sortTag(String groupId, List<String> tagIdList) {
-        List<Tag> tagList = tagRepository.findByGroupId(groupId);
+        List<Tag> tagList = tagRepository.findByGroupId(groupId, BaseStatusEnum.NORMAL);
         sortTag(tagIdList, tagList);
         tagRepository.update(tagList);
     }