From 67f7d2f3b6b8d242e3793826437d31d5b92b2c46 Mon Sep 17 00:00:00 2001 From: qiaohui <924337501@qq.com> Date: Fri, 20 Sep 2024 22:15:30 +0800 Subject: [PATCH] =?UTF-8?q?fix=20bug=20=20app/productCategory/list=20=20?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E7=9A=84sql=E4=BF=AE=E6=94=B9=EF=BC=8C?= =?UTF-8?q?=E5=90=8C=E6=97=B6=E5=8A=A0=E4=B8=A4=E4=B8=AA=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E5=8F=82=E6=95=B0=20count=20=20stockCount?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/application.yml | 1 + .../controller/ProductCategoryController.java | 7 ++--- .../dao/mapper/ProductCategoryMapper.java | 3 ++- .../cc/hiver/mall/entity/ProductCategory.java | 6 ----- .../mall/pojo/vo/ProductCategoryVo2.java | 27 +++++++++++++++++++ .../mybatis/ProductCategoryService.java | 3 ++- .../mybatis/ProductCategoryServiceImpl.java | 7 ++--- .../mapper/ProductCategoryMapper.xml | 2 +- 8 files changed, 39 insertions(+), 17 deletions(-) create mode 100644 hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/ProductCategoryVo2.java diff --git a/hiver-admin/src/main/resources/application.yml b/hiver-admin/src/main/resources/application.yml index ef3e36d2..49c93ed7 100644 --- a/hiver-admin/src/main/resources/application.yml +++ b/hiver-admin/src/main/resources/application.yml @@ -347,6 +347,7 @@ ignored: - /hiver/app/logisticsEntruckingLog/getDateLogisticsEntruckingLogPageList - /hiver/app/logisticsEntruckingLog/batchAddLogisticsEntruckingLog - /hiver/purchaseOcrPicture/getLogisticsOrderOfAi + - /hiver/app/productCategory/** # 限流及黑名单不拦截的路径 limitUrls: - /**/*.js diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/ProductCategoryController.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/ProductCategoryController.java index 6d290842..56daf7b6 100644 --- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/ProductCategoryController.java +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/ProductCategoryController.java @@ -5,6 +5,7 @@ import cc.hiver.core.common.utils.SecurityUtil; import cc.hiver.core.common.vo.Result; import cc.hiver.mall.entity.ProductCategory; import cc.hiver.mall.pojo.vo.ProductCategoryVo; +import cc.hiver.mall.pojo.vo.ProductCategoryVo2; import cc.hiver.mall.service.mybatis.ProductCategoryService; import cc.hiver.mall.service.mybatis.ProductService; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; @@ -82,13 +83,13 @@ public class ProductCategoryController { @RequestMapping(value = "/list", method = RequestMethod.GET) @ApiOperation(value = "查询货品类别列表") public Result list() { - QueryWrapper queryWrapper = new QueryWrapper<>(); +// QueryWrapper queryWrapper = new QueryWrapper<>(); // shopId从缓存中设置 final String shopId = securityUtil.getShopId(); // final String shopId = "1759768115375378438"; // queryWrapper.eq("shop_id", shopId); - List list = productCategoryService.getCategoryListByShopId(shopId); - return new ResultUtil>().setData(list); + List list = productCategoryService.getCategoryListByShopId(shopId); + return new ResultUtil>().setData(list); } /** diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/ProductCategoryMapper.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/ProductCategoryMapper.java index f8af8eed..13be647c 100644 --- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/ProductCategoryMapper.java +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/ProductCategoryMapper.java @@ -3,6 +3,7 @@ package cc.hiver.mall.dao.mapper; import cc.hiver.mall.entity.ProductCategory; import cc.hiver.mall.entity.ProductCategoryExample; import cc.hiver.mall.pojo.vo.ProductCategoryVo; +import cc.hiver.mall.pojo.vo.ProductCategoryVo2; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.apache.ibatis.annotations.Param; import org.springframework.stereotype.Repository; @@ -41,5 +42,5 @@ public interface ProductCategoryMapper extends BaseMapper { ProductCategoryVo getDefaultCategory(String shopId); - List getCategoryListByShopId(@Param("shopId") String shopId); + List getCategoryListByShopId(@Param("shopId") String shopId); } \ No newline at end of file diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/ProductCategory.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/ProductCategory.java index 13b842a6..e629cde7 100644 --- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/ProductCategory.java +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/ProductCategory.java @@ -17,11 +17,5 @@ public class ProductCategory extends HiverBaseEntity { @ApiModelProperty(value = "店铺id") private String shopId; - @ApiModelProperty(value = "数量") - private int count; - - @ApiModelProperty(value = "盘点数量") - private int stockCount; - private static final long serialVersionUID = 1L; } \ No newline at end of file diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/ProductCategoryVo2.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/ProductCategoryVo2.java new file mode 100644 index 00000000..6d26354b --- /dev/null +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/ProductCategoryVo2.java @@ -0,0 +1,27 @@ +package cc.hiver.mall.pojo.vo; + +import cc.hiver.core.base.HiverBaseEntity; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +@ApiModel(value = "商品类别表") +@TableName(value = "t_product_category", autoResultMap = true) +public class ProductCategoryVo2 extends HiverBaseEntity { + + @ApiModelProperty(value = "商品类别名称") + private String categoryName; + + @ApiModelProperty(value = "店铺id") + private String shopId; + + @ApiModelProperty(value = "数量") + private int count; + + @ApiModelProperty(value = "盘点数量") + private int stockCount; + + private static final long serialVersionUID = 1L; +} \ No newline at end of file diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/ProductCategoryService.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/ProductCategoryService.java index 11a7fd70..66a8c82d 100644 --- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/ProductCategoryService.java +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/ProductCategoryService.java @@ -3,6 +3,7 @@ package cc.hiver.mall.service.mybatis; import cc.hiver.mall.entity.ProductCategory; import cc.hiver.mall.pojo.vo.ProductCategoryAiVo; import cc.hiver.mall.pojo.vo.ProductCategoryVo; +import cc.hiver.mall.pojo.vo.ProductCategoryVo2; import com.baomidou.mybatisplus.extension.service.IService; import java.util.List; @@ -58,5 +59,5 @@ public interface ProductCategoryService extends IService { ProductCategoryVo getCategoryOfshop(); - List getCategoryListByShopId(String shopId); + List getCategoryListByShopId(String shopId); } diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/ProductCategoryServiceImpl.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/ProductCategoryServiceImpl.java index 8cf3e1c3..0d4783e5 100644 --- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/ProductCategoryServiceImpl.java +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/ProductCategoryServiceImpl.java @@ -7,10 +7,7 @@ import cc.hiver.mall.entity.ProductAttribute; import cc.hiver.mall.entity.ProductAttributeValue; import cc.hiver.mall.entity.ProductCategory; import cc.hiver.mall.entity.Shop; -import cc.hiver.mall.pojo.vo.ProductAttributeOfAddVo; -import cc.hiver.mall.pojo.vo.ProductAttributeValueVo; -import cc.hiver.mall.pojo.vo.ProductCategoryAiVo; -import cc.hiver.mall.pojo.vo.ProductCategoryVo; +import cc.hiver.mall.pojo.vo.*; import cc.hiver.mall.service.ShopService; import cc.hiver.mall.service.mybatis.ProductAttributeService; import cc.hiver.mall.service.mybatis.ProductAttributeValueService; @@ -500,7 +497,7 @@ public class ProductCategoryServiceImpl extends ServiceImpl getCategoryListByShopId(String shopId){ + public List getCategoryListByShopId(String shopId){ return productCategoryMapper.getCategoryListByShopId(shopId); } } diff --git a/hiver-modules/hiver-mall/src/main/resources/mapper/ProductCategoryMapper.xml b/hiver-modules/hiver-mall/src/main/resources/mapper/ProductCategoryMapper.xml index 09fddd33..cd1f20cc 100644 --- a/hiver-modules/hiver-mall/src/main/resources/mapper/ProductCategoryMapper.xml +++ b/hiver-modules/hiver-mall/src/main/resources/mapper/ProductCategoryMapper.xml @@ -282,7 +282,7 @@ - SELECT sum( count ) AS count, sum( stockCount ) AS stockCount,