瀏覽代碼

标签功能修改

zhangchen 6 天之前
父節點
當前提交
3cda1031c5

+ 1 - 1
alien-entity/src/main/java/shop/alien/entity/store/TagBusinessRelation.java

@@ -56,7 +56,7 @@ public class TagBusinessRelation extends Model<TagBusinessRelation> {
 
     @ApiModelProperty(value = "标签类型")
     @TableField("business_section_name")
-    private Integer businessSectionName;
+    private String businessSectionName;
 
     @ApiModelProperty(value = "标签名称")
     @TableField("tag_name")

+ 20 - 0
alien-entity/src/main/java/shop/alien/entity/store/TagStoreRelation.java

@@ -106,6 +106,26 @@ public class TagStoreRelation extends Model<TagStoreRelation> {
     @TableField("tag_column20")
     private String tagColumn20;
 
+    @ApiModelProperty(value = "标签信息21")
+    @TableField("tag_column21")
+    private String tagColumn21;
+
+    @ApiModelProperty(value = "标签信息22")
+    @TableField("tag_column22")
+    private String tagColumn22;
+
+    @ApiModelProperty(value = "标签信息23")
+    @TableField("tag_column23")
+    private String tagColumn23;
+
+    @ApiModelProperty(value = "标签信息24")
+    @TableField("tag_column24")
+    private String tagColumn24;
+
+    @ApiModelProperty(value = "标签信息25")
+    @TableField("tag_column25")
+    private String tagColumn25;
+
     @ApiModelProperty(value = "创建时间")
     @TableField(value = "created_time", fill = FieldFill.INSERT)
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")

+ 5 - 11
alien-entity/src/main/java/shop/alien/entity/store/vo/TagCategoryVo.java

@@ -1,6 +1,5 @@
 package shop.alien.entity.store.vo;
 
-
 import com.fasterxml.jackson.annotation.JsonInclude;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
@@ -8,22 +7,17 @@ import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.NoArgsConstructor;
 import shop.alien.entity.store.TagCategory;
-import java.util.List;
 
 @Data
 @EqualsAndHashCode(callSuper = false)
 @JsonInclude
 @NoArgsConstructor
 @ApiModel(value = "TagCategoryVo", description = "标签对象")
-public class TagCategoryVo {
-
-    @ApiModelProperty(value = "新增标签列表")
-    private List<TagCategory> addTagCategoryList;
-
-    @ApiModelProperty(value = "删除标签列表")
-    private List<TagCategory> deleteTagCategoryList;
+public class TagCategoryVo extends TagCategory {
 
-    @ApiModelProperty(value = "更新标签列表")
-    private List<TagCategory> updateTagCategoryList;
+    @ApiModelProperty(value = "标签类型")
+    private Integer businessSection;
 
+    @ApiModelProperty(value = "标签类型")
+    private String businessSectionName;
 }

+ 16 - 0
alien-entity/src/main/java/shop/alien/mapper/TagCategoryMapper.java

@@ -1,10 +1,26 @@
 package shop.alien.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
 import shop.alien.entity.store.TagCategory;
+import shop.alien.entity.store.vo.StoreMenuVo;
+import shop.alien.entity.store.vo.TagCategoryVo;
+
+import java.util.List;
 
 /**
  * 标签 Mapper 接口
  */
 public interface TagCategoryMapper extends BaseMapper<TagCategory> {
+
+    /**
+     * 获取菜单
+     *
+     * @param businessSection  门店id
+     * @return List<StoreMenuVo>
+     */
+    //"图片类型, 0:其他, 1:入口图, 2:相册, 3:菜品, 4:环境, 5:价目表, 6:推荐菜, 7:菜单, 8:用户评论, 9:商家申诉, 10:商家头像, 11:店铺轮播图"
+    @Select("select tc.*, tbr.business_section,tbr.business_section_name from tag_business_relation tbr left join tag_category tc on tc.id = tbr.tag_id and tc.delete_flag =0  where tbr.business_section  = #{businessSection} and tbr.delete_flag = 0")
+    List<TagCategoryVo> getBusinessRelationTagList(@Param("businessSection") Integer businessSection);
 }

+ 1 - 3
alien-entity/src/main/java/shop/alien/mapper/TagStoreRelationMapper.java

@@ -1,12 +1,10 @@
 package shop.alien.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import org.apache.ibatis.annotations.Mapper;
-import shop.alien.entity.store.TagBusinessRelation;
 import shop.alien.entity.store.TagStoreRelation;
 
 /**
- * 标签 Mapper 接口
+ * 门店标签信息表 Mapper 接口
  */
 public interface TagStoreRelationMapper extends BaseMapper<TagStoreRelation> {
 }

+ 12 - 0
alien-store/src/main/java/shop/alien/store/controller/TagCategoryController.java

@@ -7,10 +7,13 @@ import lombok.extern.slf4j.Slf4j;
 import org.springframework.web.bind.annotation.*;
 import shop.alien.entity.result.R;
 import shop.alien.entity.store.*;
+import shop.alien.entity.store.vo.TagCategoryVo;
 import shop.alien.store.service.StoreTagBusinessRelationService;
 import shop.alien.store.service.StoreTagService;
 import shop.alien.store.service.TagStoreRelationService;
 
+import java.util.List;
+
 /**
  * 标签前端控制器
  *
@@ -86,6 +89,15 @@ public class TagCategoryController {
         return R.data(tag);
     }
 
+    @ApiOperation("获取经营类型标签信息")
+    @ApiOperationSupport(order = 2)
+    @GetMapping("/getBusinessRelationTagList")
+    public R<List<TagCategoryVo>> getBusinessRelationTagList(@RequestParam(required = false) Integer businessSection) {
+        log.info("TagCategoryController.getBusinessRelationTagList");
+        List<TagCategoryVo> tagCategoryVoList = tagCategoryService.getBusinessRelationTagList(businessSection);
+        return R.data(tagCategoryVoList);
+    }
+
 
     @ApiOperation("获取标签经营类型关系")
     @ApiOperationSupport(order = 6)

+ 4 - 1
alien-store/src/main/java/shop/alien/store/service/StoreTagService.java

@@ -3,8 +3,10 @@ package shop.alien.store.service;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.IService;
-import shop.alien.entity.store.StoreGroupPackage;
 import shop.alien.entity.store.TagCategory;
+import shop.alien.entity.store.vo.TagCategoryVo;
+
+import java.util.List;
 
 /**
  * 标签服务
@@ -16,4 +18,5 @@ public interface StoreTagService extends IService<TagCategory> {
     IPage<TagCategory> getTagList(int page, int size,String label,String labelType, String labelButtonType);
     int deleteTag(TagCategory tagCategory);
     int updateTagCategory(TagCategory tagCategory);
+    List<TagCategoryVo> getBusinessRelationTagList(Integer businessSection);
 }

+ 9 - 0
alien-store/src/main/java/shop/alien/store/service/impl/StoreTagServiceImpl.java

@@ -19,6 +19,7 @@ import shop.alien.entity.store.StoreClockIn;
 import shop.alien.entity.store.TagCategory;
 import shop.alien.entity.store.vo.LifeDiscountCouponStoreFriendVo;
 import shop.alien.entity.store.vo.LifeDiscountCouponVo;
+import shop.alien.entity.store.vo.TagCategoryVo;
 import shop.alien.mapper.StoreClockInMapper;
 import shop.alien.mapper.TagCategoryMapper;
 import shop.alien.store.config.BaseRedisService;
@@ -137,6 +138,14 @@ public class StoreTagServiceImpl extends ServiceImpl<TagCategoryMapper, TagCateg
         return updateResult;
     }
 
+    @Override
+    public List<TagCategoryVo> getBusinessRelationTagList(Integer businessSection) {
+        if(businessSection!=null){
+            return tagCategoryMapper.getBusinessRelationTagList(businessSection);
+        }
+        return Collections.emptyList();
+    }
+
     /**
      * 构造树形结构方法
      *

+ 9 - 31
alien-store/src/main/java/shop/alien/store/service/impl/TagStoreRelationServiceImpl.java

@@ -1,7 +1,7 @@
 package shop.alien.store.service.impl;
+
 import com.alibaba.nacos.common.utils.CollectionUtils;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.fasterxml.jackson.core.JsonProcessingException;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
@@ -29,41 +29,19 @@ public class TagStoreRelationServiceImpl implements TagStoreRelationService {
             // 将数据存储到数据库中
             tagStoreRelationMapper.insert(tagStoreRelation);
         }
-        String cacheKey = buildTagStoreCacheKey(tagStoreRelation.getStoreId());
-//        try {
-//            baseRedisService.storeObject(cacheKey, tagStoreRelation);
-//        } catch (JsonProcessingException e) {
-//            throw new RuntimeException(e);
-//        }
         return tagStoreRelation;
     }
 
     @Override
     public TagStoreRelation getTagStoreRelationByStoreId(int storeId) {
-//        TagStoreRelation tagStoreRelation = null;
-//        String cacheKey = buildTagStoreCacheKey(storeId);
-//        try {
-//            tagStoreRelation = baseRedisService.getObject(cacheKey, TagStoreRelation.class);
-//        } catch (JsonProcessingException e) {
-//            log.error("Failed to deserialize TagStoreRelation from Redis", e);
-//            throw new RuntimeException(e);
-//        }
-//        if (tagStoreRelation != null) {
-//            return tagStoreRelation;
-//        }
-//        LambdaQueryWrapper<TagStoreRelation> wrapper = new LambdaQueryWrapper<>();
-//        wrapper.eq(TagStoreRelation::getStoreId, storeId);
-//        List<TagStoreRelation> tagStoreRelationList = tagStoreRelationMapper.selectList(wrapper);
-//        if (CollectionUtils.isNotEmpty(tagStoreRelationList)) {
-//            tagStoreRelation = tagStoreRelationList.get(0);
-//            try {
-//                baseRedisService.storeObject(cacheKey, tagStoreRelation);
-//            } catch (JsonProcessingException e) {
-//                log.error("Failed to serialize TagStoreRelation to Redis", e);
-//                throw new RuntimeException(e);
-//            }
-//        }
-        return null;
+        TagStoreRelation tagStoreRelation = new TagStoreRelation();
+        LambdaQueryWrapper<TagStoreRelation> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(TagStoreRelation::getStoreId, storeId);
+        List<TagStoreRelation> tagStoreRelationList = tagStoreRelationMapper.selectList(wrapper);
+        if (CollectionUtils.isNotEmpty(tagStoreRelationList)) {
+            tagStoreRelation = tagStoreRelationList.get(0);
+        }
+        return tagStoreRelation;
     }
 
     /**