Browse Source

fix bug app/productCategory/list 接口的sql修改,同时加两个返回参数 count stockCount

dev
qiaohui 2 years ago
parent
commit
67f7d2f3b6
  1. 1
      hiver-admin/src/main/resources/application.yml
  2. 7
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/ProductCategoryController.java
  3. 3
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/ProductCategoryMapper.java
  4. 6
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/ProductCategory.java
  5. 27
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/ProductCategoryVo2.java
  6. 3
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/ProductCategoryService.java
  7. 7
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/ProductCategoryServiceImpl.java
  8. 2
      hiver-modules/hiver-mall/src/main/resources/mapper/ProductCategoryMapper.xml

1
hiver-admin/src/main/resources/application.yml

@ -347,6 +347,7 @@ ignored:
- /hiver/app/logisticsEntruckingLog/getDateLogisticsEntruckingLogPageList - /hiver/app/logisticsEntruckingLog/getDateLogisticsEntruckingLogPageList
- /hiver/app/logisticsEntruckingLog/batchAddLogisticsEntruckingLog - /hiver/app/logisticsEntruckingLog/batchAddLogisticsEntruckingLog
- /hiver/purchaseOcrPicture/getLogisticsOrderOfAi - /hiver/purchaseOcrPicture/getLogisticsOrderOfAi
- /hiver/app/productCategory/**
# 限流及黑名单不拦截的路径 # 限流及黑名单不拦截的路径
limitUrls: limitUrls:
- /**/*.js - /**/*.js

7
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.core.common.vo.Result;
import cc.hiver.mall.entity.ProductCategory; import cc.hiver.mall.entity.ProductCategory;
import cc.hiver.mall.pojo.vo.ProductCategoryVo; 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.ProductCategoryService;
import cc.hiver.mall.service.mybatis.ProductService; import cc.hiver.mall.service.mybatis.ProductService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@ -82,13 +83,13 @@ public class ProductCategoryController {
@RequestMapping(value = "/list", method = RequestMethod.GET) @RequestMapping(value = "/list", method = RequestMethod.GET)
@ApiOperation(value = "查询货品类别列表") @ApiOperation(value = "查询货品类别列表")
public Result list() { public Result list() {
QueryWrapper<ProductCategory> queryWrapper = new QueryWrapper<>(); // QueryWrapper<ProductCategory> queryWrapper = new QueryWrapper<>();
// shopId从缓存中设置 // shopId从缓存中设置
final String shopId = securityUtil.getShopId(); final String shopId = securityUtil.getShopId();
// final String shopId = "1759768115375378438"; // final String shopId = "1759768115375378438";
// queryWrapper.eq("shop_id", shopId); // queryWrapper.eq("shop_id", shopId);
List<ProductCategory> list = productCategoryService.getCategoryListByShopId(shopId); List<ProductCategoryVo2> list = productCategoryService.getCategoryListByShopId(shopId);
return new ResultUtil<List<ProductCategory>>().setData(list); return new ResultUtil<List<ProductCategoryVo2>>().setData(list);
} }
/** /**

3
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.ProductCategory;
import cc.hiver.mall.entity.ProductCategoryExample; import cc.hiver.mall.entity.ProductCategoryExample;
import cc.hiver.mall.pojo.vo.ProductCategoryVo; import cc.hiver.mall.pojo.vo.ProductCategoryVo;
import cc.hiver.mall.pojo.vo.ProductCategoryVo2;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
@ -41,5 +42,5 @@ public interface ProductCategoryMapper extends BaseMapper<ProductCategory> {
ProductCategoryVo getDefaultCategory(String shopId); ProductCategoryVo getDefaultCategory(String shopId);
List<ProductCategory> getCategoryListByShopId(@Param("shopId") String shopId); List<ProductCategoryVo2> getCategoryListByShopId(@Param("shopId") String shopId);
} }

6
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") @ApiModelProperty(value = "店铺id")
private String shopId; private String shopId;
@ApiModelProperty(value = "数量")
private int count;
@ApiModelProperty(value = "盘点数量")
private int stockCount;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
} }

27
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;
}

3
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.entity.ProductCategory;
import cc.hiver.mall.pojo.vo.ProductCategoryAiVo; import cc.hiver.mall.pojo.vo.ProductCategoryAiVo;
import cc.hiver.mall.pojo.vo.ProductCategoryVo; import cc.hiver.mall.pojo.vo.ProductCategoryVo;
import cc.hiver.mall.pojo.vo.ProductCategoryVo2;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List; import java.util.List;
@ -58,5 +59,5 @@ public interface ProductCategoryService extends IService<ProductCategory> {
ProductCategoryVo getCategoryOfshop(); ProductCategoryVo getCategoryOfshop();
List<ProductCategory> getCategoryListByShopId(String shopId); List<ProductCategoryVo2> getCategoryListByShopId(String shopId);
} }

7
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.ProductAttributeValue;
import cc.hiver.mall.entity.ProductCategory; import cc.hiver.mall.entity.ProductCategory;
import cc.hiver.mall.entity.Shop; import cc.hiver.mall.entity.Shop;
import cc.hiver.mall.pojo.vo.ProductAttributeOfAddVo; import cc.hiver.mall.pojo.vo.*;
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.service.ShopService; import cc.hiver.mall.service.ShopService;
import cc.hiver.mall.service.mybatis.ProductAttributeService; import cc.hiver.mall.service.mybatis.ProductAttributeService;
import cc.hiver.mall.service.mybatis.ProductAttributeValueService; import cc.hiver.mall.service.mybatis.ProductAttributeValueService;
@ -500,7 +497,7 @@ public class ProductCategoryServiceImpl extends ServiceImpl<ProductCategoryMappe
} }
@Override @Override
public List<ProductCategory> getCategoryListByShopId(String shopId){ public List<ProductCategoryVo2> getCategoryListByShopId(String shopId){
return productCategoryMapper.getCategoryListByShopId(shopId); return productCategoryMapper.getCategoryListByShopId(shopId);
} }
} }

2
hiver-modules/hiver-mall/src/main/resources/mapper/ProductCategoryMapper.xml

@ -282,7 +282,7 @@
</select> </select>
<select id="getCategoryListByShopId" parameterType="java.lang.String" resultType="cc.hiver.mall.entity.ProductCategory"> <select id="getCategoryListByShopId" parameterType="java.lang.String" resultType="cc.hiver.mall.pojo.vo.ProductCategoryVo2">
SELECT SELECT
sum( count ) AS count, sum( count ) AS count,
sum( stockCount ) AS stockCount, sum( stockCount ) AS stockCount,

Loading…
Cancel
Save