Browse Source

fix:修改数据库字段

zhangwei 4 weeks ago
parent
commit
72dc79ec69
24 changed files with 212 additions and 24 deletions
  1. 0 8
      .idea/.gitignore
  2. 2 0
      edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/constant/RedisKey.java
  3. 9 0
      edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/dto/GetProductByTypeDto.java
  4. 9 0
      edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/dto/ProductSpecDto.java
  5. 2 8
      edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/entity/ShopCategory.java
  6. 5 0
      edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/entity/ShopProduct.java
  7. 2 0
      edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/service/ShopCategoryService.java
  8. 6 1
      edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/service/ShopProductService.java
  9. 6 0
      edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/service/ShopProductSpecService.java
  10. 23 1
      edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/service/impl/ShopCategoryServiceImpl.java
  11. 15 0
      edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/service/impl/ShopProductServiceImpl.java
  12. 19 0
      edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/service/impl/ShopProductSpecServiceImpl.java
  13. 7 0
      edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/vo/ProductSpecVo.java
  14. 47 0
      edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/vo/ShopProductVo.java
  15. 10 0
      edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/web/ShopCategoryController.java
  16. 16 0
      edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/web/ShopProductController.java
  17. 15 0
      edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/web/ShopProductSpecController.java
  18. 2 3
      edu-travel-service/edu-travel-service-commodity/src/main/resources/mapper/ShopCategoryMapper.xml
  19. 2 1
      edu-travel-service/edu-travel-service-commodity/src/main/resources/mapper/ShopProductMapper.xml
  20. 1 0
      edu-travel-service/edu-travel-service-order/src/main/java/edu/travel/order/controller/ShopOrderController.java
  21. 6 0
      edu-travel-service/edu-travel-service-tenement/src/main/java/edu/travel/tenant/entity/EduTenant.java
  22. 0 1
      edu-travel-service/edu-travel-service-upload/src/main/java/edu/travel/config/ResourceServerConfig.java
  23. 6 0
      edu-travel-service/edu-travel-service-warehouse/src/main/java/edu/travel/warehouse/entity/ShopWarehouse.java
  24. 2 1
      edu-travel-service/edu-travel-service-warehouse/src/main/resources/mapper/ShopWarehouseMapper.xml

+ 0 - 8
.idea/.gitignore

@@ -1,8 +0,0 @@
-# Default ignored files
-/shelf/
-/workspace.xml
-# Editor-based HTTP Client requests
-/httpRequests/
-# Datasource local storage ignored files
-/dataSources/
-/dataSources.local.xml

+ 2 - 0
edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/constant/RedisKey.java

@@ -7,4 +7,6 @@ public interface RedisKey {
    String PRODUCT_TYPE = BASH +"product:type";
    /**热门商品类型*/
    String PRODUCT_HOT_TYPE = BASH +"product:hot:type";
+    /**热门二级商品类型*/
+   String PRODUCT_TO_HOT_TYPE = BASH +"product:to:hot:type";
 }

+ 9 - 0
edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/dto/GetProductByTypeDto.java

@@ -0,0 +1,9 @@
+package edu.travel.commodity.dto;
+
+import lombok.Data;
+
+@Data
+public class GetProductByTypeDto extends BaseDto{
+    /**商品类型*/
+    private String type;
+}

+ 9 - 0
edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/dto/ProductSpecDto.java

@@ -0,0 +1,9 @@
+package edu.travel.commodity.dto;
+
+import lombok.Data;
+
+@Data
+public class ProductSpecDto extends BaseDto{
+    /**商品ID*/
+    private String productId;
+}

+ 2 - 8
edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/entity/ShopCategory.java

@@ -32,16 +32,10 @@ public class ShopCategory extends BaseEntity {
     private Long parentId;
 
     /**
-     * 商品ID
-     */
-    @TableField(value = "product_id")
-    private Long productId;
-
-    /**
      * 国家ID
      */
-    @TableField(value = "country")
-    private String country;
+    @TableField(value = "country_id")
+    private String countryId;
 
     /**
      * 热度值

+ 5 - 0
edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/entity/ShopProduct.java

@@ -80,6 +80,11 @@ public class ShopProduct extends BaseEntity {
     @TableField(value = "default_price")
     private BigDecimal defaultPrice;
 
+    /**
+     * 库房id
+     */
+    @TableField(value = "`warehouse_id`")
+    private Long warehouseId;
 
     /**
      * 0 上架 1 下架

+ 2 - 0
edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/service/ShopCategoryService.java

@@ -1,5 +1,6 @@
 package edu.travel.commodity.service;
 
+import edu.travel.commodity.dto.BaseDto;
 import edu.travel.commodity.dto.ShopTypeDto;
 import edu.travel.commodity.entity.ShopCategory;
 import com.baomidou.mybatisplus.extension.service.IService;
@@ -11,4 +12,5 @@ public interface ShopCategoryService extends IService<ShopCategory>{
 
     List<ShopTypeVo> getShopType(ShopTypeDto param);
 
+    List<ShopTypeVo> getLevelToShopType(BaseDto param);
 }

+ 6 - 1
edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/service/ShopProductService.java

@@ -1,8 +1,13 @@
 package edu.travel.commodity.service;
 
+import edu.travel.commodity.dto.GetProductByTypeDto;
 import edu.travel.commodity.entity.ShopProduct;
 import com.baomidou.mybatisplus.extension.service.IService;
-public interface ShopProductService extends IService<ShopProduct>{
+import edu.travel.commodity.vo.ShopProductVo;
+
+import java.util.List;
 
+public interface ShopProductService extends IService<ShopProduct>{
 
+    List<ShopProductVo> getHotProduct(GetProductByTypeDto param);
 }

+ 6 - 0
edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/service/ShopProductSpecService.java

@@ -1,8 +1,14 @@
 package edu.travel.commodity.service;
 
+import edu.travel.commodity.dto.ProductSpecDto;
 import edu.travel.commodity.entity.ShopProductSpec;
 import com.baomidou.mybatisplus.extension.service.IService;
+import edu.travel.commodity.vo.ProductSpecVo;
+
+import java.util.List;
+
 public interface ShopProductSpecService extends IService<ShopProductSpec>{
 
 
+    List<ProductSpecVo> getShopSpec(ProductSpecDto param);
 }

+ 23 - 1
edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/service/impl/ShopCategoryServiceImpl.java

@@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import edu.travel.commodity.constant.BaseConstant;
 import edu.travel.commodity.constant.RedisKey;
+import edu.travel.commodity.dto.BaseDto;
 import edu.travel.commodity.dto.ShopTypeDto;
 import edu.travel.commodity.entity.ShopCategory;
 import edu.travel.commodity.mapper.ShopCategoryMapper;
@@ -44,7 +45,7 @@ public class ShopCategoryServiceImpl extends ServiceImpl<ShopCategoryMapper, Sho
         }
         LambdaQueryWrapper<ShopCategory> query = Wrappers.lambdaQuery();
         //条件构建
-        query.eq(ShopCategory::getCountry, shopTypeDto.getCountryId());
+        query.eq(ShopCategory::getCountryId, shopTypeDto.getCountryId());
 
         if(shopTypeDto.getIsHeat().equals(BaseConstant.BASIC_STATUS_NO_STR)){
             query.orderByDesc(ShopCategory::getHeatValue);
@@ -74,4 +75,25 @@ public class ShopCategoryServiceImpl extends ServiceImpl<ShopCategoryMapper, Sho
         }
         return parent;
     }
+
+    @Override
+    public List<ShopTypeVo> getLevelToShopType(BaseDto param) {
+        String string = redisUtil.getString(RedisKey.PRODUCT_TO_HOT_TYPE);
+        if(!ObjectUtil.isEmpty(string)){
+            JSONArray objects = JSONUtil.parseArray(string);
+            return JSONUtil.toList(objects, ShopTypeVo.class);
+        }
+        LambdaQueryWrapper<ShopCategory> query = Wrappers.lambdaQuery();
+        //条件构建
+        query.eq(ShopCategory::getCountryId, param.getCountryId())
+                .orderByDesc(ShopCategory::getHeatValue).ne(ShopCategory::getParentId,0);
+        List<ShopCategory> list = list(query);
+        if(list.isEmpty()){
+            return new ArrayList<>();
+        }
+        List<ShopTypeVo> parent = BeanUtil.copyToList(list, ShopTypeVo.class);
+        //24小时热门过期
+        redisUtil.setString(RedisKey.PRODUCT_TO_HOT_TYPE,JSONUtil.toJsonStr(parent),24*60*60*60, TimeUnit.SECONDS);
+        return parent;
+    }
 }

+ 15 - 0
edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/service/impl/ShopProductServiceImpl.java

@@ -1,12 +1,27 @@
 package edu.travel.commodity.service.impl;
 
+import cn.hutool.core.bean.BeanUtil;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import edu.travel.commodity.constant.BaseConstant;
+import edu.travel.commodity.dto.GetProductByTypeDto;
 import edu.travel.commodity.entity.ShopProduct;
 import edu.travel.commodity.mapper.ShopProductMapper;
 import edu.travel.commodity.service.ShopProductService;
+import edu.travel.commodity.vo.ShopProductVo;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
+
 @Service
 public class ShopProductServiceImpl extends ServiceImpl<ShopProductMapper, ShopProduct> implements ShopProductService {
 
+    @Override
+    public List<ShopProductVo> getHotProduct(GetProductByTypeDto type) {
+        List<ShopProduct> list = lambdaQuery().eq(ShopProduct::getCategoryId, type.getType())
+                .eq(ShopProduct::getStatus, BaseConstant.BASIC_STATUS_NO_NUM)
+                .eq(ShopProduct::getCountryId, type.getCountryId())
+                .orderByDesc(ShopProduct::getHeatValue).list();
+
+        return BeanUtil.copyToList(list, ShopProductVo.class);
+    }
 }

+ 19 - 0
edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/service/impl/ShopProductSpecServiceImpl.java

@@ -1,12 +1,31 @@
 package edu.travel.commodity.service.impl;
 
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import edu.travel.commodity.dto.ProductSpecDto;
+import edu.travel.commodity.entity.ShopProduct;
 import edu.travel.commodity.entity.ShopProductSpec;
 import edu.travel.commodity.mapper.ShopProductSpecMapper;
+import edu.travel.commodity.service.ShopProductService;
 import edu.travel.commodity.service.ShopProductSpecService;
+import edu.travel.commodity.vo.ProductSpecVo;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
+
 @Service
 public class ShopProductSpecServiceImpl extends ServiceImpl<ShopProductSpecMapper, ShopProductSpec> implements ShopProductSpecService {
+    @Autowired
+    private ShopProductService shopProductService;
+
+    @Override
+    public List<ProductSpecVo> getShopSpec(ProductSpecDto param) {
+
+        shopProductService.lambdaQuery().eq(ShopProduct::getId, param.getProductId())
+                .eq(ShopProduct::getCountryId, param.getCountryId());
+
+
 
+        return null;
+    }
 }

+ 7 - 0
edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/vo/ProductSpecVo.java

@@ -0,0 +1,7 @@
+package edu.travel.commodity.vo;
+
+import lombok.Data;
+
+@Data
+public class ProductSpecVo {
+}

+ 47 - 0
edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/vo/ShopProductVo.java

@@ -0,0 +1,47 @@
+package edu.travel.commodity.vo;
+
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+@Data
+public class ShopProductVo {
+    /**
+     * 商品ID
+     */
+    private String id;
+    /**
+     * 商品名称
+     */
+    private String productName;
+
+    /**
+     * 商品描述
+     */
+    private String description;
+
+    /**
+     * 列表展示图片
+     */
+    private String mainImageUrl;
+
+    /**
+     * 热度值
+     */
+    private Integer heatValue;
+
+    /**
+     * 销量
+     */
+    private Integer salesVolume;
+    /**
+     * 价格
+     */
+    private BigDecimal defaultPrice;
+
+    /**
+     * 评分满分五分
+     */
+    private Integer scoring;
+}

+ 10 - 0
edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/web/ShopCategoryController.java

@@ -1,6 +1,7 @@
 package edu.travel.commodity.web;
 
 import cn.hutool.core.bean.BeanUtil;
+import edu.travel.commodity.dto.BaseDto;
 import edu.travel.commodity.dto.ShopTypeDto;
 import edu.travel.commodity.entity.ShopCategory;
 import edu.travel.commodity.service.ShopCategoryService;
@@ -38,5 +39,14 @@ public class ShopCategoryController  extends BaseController<ShopCategory> {
         return new BaseResponse<>(200,"success",shopCategoryService.getShopType(param));
     }
 
+    /**
+     *  获取二级热门商品类型
+     * @return {@link BaseResponse }<{@link AddMenuVo }>
+     */
+    @GetMapping("getLevelToShopType")
+    public BaseResponse<List<ShopTypeVo>> getLevelToShopType(BaseDto param){
+
+        return new BaseResponse<>(200,"success",shopCategoryService.getLevelToShopType(param));
+    }
 
 }

+ 16 - 0
edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/web/ShopProductController.java

@@ -1,12 +1,17 @@
 package edu.travel.commodity.web;
 
+import edu.travel.commodity.dto.GetProductByTypeDto;
 import edu.travel.commodity.entity.ShopProduct;
 import edu.travel.commodity.service.ShopProductService;
+import edu.travel.commodity.vo.ShopProductVo;
+import edu.travel.resp.BaseResponse;
 import edu.travel.web.BaseController;
 import org.springframework.web.bind.annotation.*;
 
 import org.springframework.beans.factory.annotation.Autowired;
 
+import java.util.List;
+
 /**
 * 商品表(shop_product)表控制层
 *
@@ -21,4 +26,15 @@ public class ShopProductController extends BaseController<ShopProduct> {
     @Autowired
     private ShopProductService shopProductService;
 
+    /**
+     *  首页获取热门类别的热门商品
+     * @param param 类型
+     * @return {@link BaseResponse }<{@link List }<{@link ShopProductVo }>>
+     */
+    @GetMapping("/getHotProduct")
+    public BaseResponse<List<ShopProductVo>> getHotProduct(GetProductByTypeDto param){
+        return new BaseResponse<>(200,"success",shopProductService.getHotProduct(param));
+    }
+
+
 }

+ 15 - 0
edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/web/ShopProductSpecController.java

@@ -1,12 +1,19 @@
 package edu.travel.commodity.web;
 
+import edu.travel.commodity.dto.GetProductByTypeDto;
+import edu.travel.commodity.dto.ProductSpecDto;
 import edu.travel.commodity.entity.ShopProductSpec;
 import edu.travel.commodity.service.ShopProductSpecService;
+import edu.travel.commodity.vo.ProductSpecVo;
+import edu.travel.commodity.vo.ShopProductVo;
+import edu.travel.resp.BaseResponse;
 import edu.travel.web.BaseController;
 import org.springframework.web.bind.annotation.*;
 
 import org.springframework.beans.factory.annotation.Autowired;
 
+import java.util.List;
+
 /**
 * 商品规格表(shop_product_spec)表控制层
 *
@@ -21,4 +28,12 @@ public class ShopProductSpecController extends BaseController<ShopProductSpec> {
     @Autowired
     private ShopProductSpecService shopProductSpecService;
 
+    /**
+     * @param param 查询商品
+     * @return {@link BaseResponse }<{@link List }<{@link ShopProductVo }>>
+     */
+    @GetMapping("/getShopSpec")
+    public BaseResponse<List<ProductSpecVo>> getShopSpec(ProductSpecDto param){
+        return new BaseResponse<>(200,"success",shopProductSpecService.getShopSpec(param));
+    }
 }

+ 2 - 3
edu-travel-service/edu-travel-service-commodity/src/main/resources/mapper/ShopCategoryMapper.xml

@@ -6,8 +6,7 @@
     <!--@Table shop_category-->
     <id column="id" jdbcType="BIGINT" property="id" />
     <result column="parent_id" jdbcType="BIGINT" property="parentId" />
-    <result column="product_id" jdbcType="BIGINT" property="productId" />
-    <result column="country" jdbcType="VARCHAR" property="country" />
+    <result column="country_id" jdbcType="VARCHAR" property="countryId" />
     <result column="heat_value" jdbcType="INTEGER" property="heatValue" />
     <result column="warehouse_id" jdbcType="BIGINT" property="warehouseId" />
     <result column="type_name" jdbcType="VARCHAR" property="typeName" />
@@ -23,7 +22,7 @@
   </resultMap>
   <sql id="Base_Column_List">
     <!--@mbg.generated-->
-    id, parent_id, product_id, country, heat_value, warehouse_id, type_name, image_url, 
+    id, parent_id, country_id, heat_value, warehouse_id, type_name, image_url,
     sort_order, `enable`, project, create_time, create_user_id, update_time, update_user_id, 
     delete_flag
   </sql>

+ 2 - 1
edu-travel-service/edu-travel-service-commodity/src/main/resources/mapper/ShopProductMapper.xml

@@ -11,6 +11,7 @@
     <result column="description" jdbcType="LONGVARCHAR" property="description" />
     <result column="main_image_url" jdbcType="VARCHAR" property="mainImageUrl" />
     <result column="heat_value" jdbcType="INTEGER" property="heatValue" />
+    <result column="warehouse_id" jdbcType="BIGINT" property="warehouseId" />
     <result column="sales_volume" jdbcType="INTEGER" property="salesVolume" />
     <result column="country_id" jdbcType="INTEGER" property="countryId" />
     <result column="scoring" jdbcType="INTEGER" property="scoring" />
@@ -26,7 +27,7 @@
   <sql id="Base_Column_List">
     <!--@mbg.generated-->
     id, category_id, category_name, product_name, description, main_image_url, heat_value, `scoring`,`country_id`
-    sales_volume, `status`, default_price, project, create_time, create_user_id, update_time, 
+    sales_volume, `status`, default_price, project, create_time, create_user_id, update_time, warehouse_id,
     update_user_id, delete_flag
   </sql>
 </mapper>

+ 1 - 0
edu-travel-service/edu-travel-service-order/src/main/java/edu/travel/order/controller/ShopOrderController.java

@@ -11,4 +11,5 @@ import org.springframework.web.bind.annotation.RestController;
 @RequestMapping("/shopOrder")
 public class ShopOrderController extends BaseController<ShopOrder> {
 
+
 }

+ 6 - 0
edu-travel-service/edu-travel-service-tenement/src/main/java/edu/travel/tenant/entity/EduTenant.java

@@ -99,6 +99,12 @@ public class EduTenant extends BaseEntity {
     private Integer userStatus;
 
     /**
+     * 默认语言
+     */
+    @TableField(value = "default_language_id")
+    private Integer defaultLanguageId;
+
+    /**
      * 性别字典
      */
     @TableField(exist = false)

+ 0 - 1
edu-travel-service/edu-travel-service-upload/src/main/java/edu/travel/config/ResourceServerConfig.java

@@ -1,6 +1,5 @@
 package edu.travel.config;
 
-import edu.travel.tenant.config.MyAuthenticationEntryPoint;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.security.config.annotation.web.builders.HttpSecurity;

+ 6 - 0
edu-travel-service/edu-travel-service-warehouse/src/main/java/edu/travel/warehouse/entity/ShopWarehouse.java

@@ -60,6 +60,12 @@ public class ShopWarehouse {
     private String detailedAddress;
 
     /**
+     * '启用禁用 0 启用 1禁用'
+     */
+    @TableField(value = "status")
+    private Integer status;
+
+    /**
      * 系统标识
      */
     @TableField(value = "project")

+ 2 - 1
edu-travel-service/edu-travel-service-warehouse/src/main/resources/mapper/ShopWarehouseMapper.xml

@@ -10,6 +10,7 @@
     <result column="longitude" jdbcType="VARCHAR" property="longitude" />
     <result column="latitude" jdbcType="VARCHAR" property="latitude" />
     <result column="country_id" jdbcType="VARCHAR" property="countryId" />
+    <result column="status" jdbcType="INTEGER" property="status" />
     <result column="detailed_address" jdbcType="VARCHAR" property="detailedAddress" />
     <result column="project" jdbcType="VARCHAR" property="project" />
     <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
@@ -20,7 +21,7 @@
   </resultMap>
   <sql id="Base_Column_List">
     <!--@mbg.generated-->
-    id, parent_id, warehouse_name, longitude, latitude, country_id, detailed_address, 
+    id, parent_id, warehouse_name, longitude, latitude, country_id, detailed_address, status,
     project, create_time, create_user_id, update_time, update_user_id, delete_flag
   </sql>
 </mapper>