From e25868f8b3f200d5ed239c0cc9a6837bcbf77413 Mon Sep 17 00:00:00 2001 From: wangfukang <15630117759@163.com> Date: Sat, 7 Sep 2024 12:25:13 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BF=9B=E9=94=80=E5=AD=98=E9=9C=80=E8=A6=81?= =?UTF-8?q?=E4=B8=80=E4=B8=AA=E5=BC=80=E6=94=BE=E6=8E=A5=E5=8F=A3=20=20?= =?UTF-8?q?=E6=A0=B9=E6=8D=AEshop=5Fid=E6=9F=A5=E5=88=86=E7=B1=BB=EF=BC=88?= =?UTF-8?q?=E7=94=A8=E7=8E=B0=E6=9C=89=E7=9A=84=E5=B0=B1=E8=A1=8C=EF=BC=8C?= =?UTF-8?q?=E5=8F=AA=E4=B8=8D=E8=BF=87shopid=E6=98=AF=E5=89=8D=E5=8F=B0?= =?UTF-8?q?=E4=BC=A0=E7=9A=84=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 后台 getShaerList接口去掉7天销量联查 --- .../src/main/resources/application.yml | 2 + hiver-admin/test-output/test-report.html | 16 +++---- .../controller/ProductCategoryController.java | 36 ++++++++++++++++ .../main/resources/mapper/ProductMapper.xml | 43 ++++++++++--------- 4 files changed, 69 insertions(+), 28 deletions(-) diff --git a/hiver-admin/src/main/resources/application.yml b/hiver-admin/src/main/resources/application.yml index 0b35670f..c3edbcd8 100644 --- a/hiver-admin/src/main/resources/application.yml +++ b/hiver-admin/src/main/resources/application.yml @@ -337,6 +337,8 @@ ignored: # 物流订单详情 - /hiver/app/logisticsOrder/getLogisticsOrderDetail - /hiver/app/customer/findByUserPhoneAndShopId + # 分享页获取店铺分类 + - app/productCategory/listByShopId # 临时增加 - /hiver/app/logisticsOrder/addLogisticsOrder diff --git a/hiver-admin/test-output/test-report.html b/hiver-admin/test-output/test-report.html index 15225554..a91d2b9b 100644 --- a/hiver-admin/test-output/test-report.html +++ b/hiver-admin/test-output/test-report.html @@ -35,7 +35,7 @@ Hiver
  • - 06, 2024 13:53:46 + 06, 2024 15:28:59
  • @@ -84,7 +84,7 @@

    passTest

    -

    13:53:47 / 0.017 secs

    +

    15:29:00 / 0.026 secs

    @@ -92,9 +92,9 @@
    #test-id=1
    passTest
    -09.06.2024 13:53:47 -09.06.2024 13:53:47 -0.017 secs +09.06.2024 15:29:00 +09.06.2024 15:29:00 +0.026 secs
    @@ -104,7 +104,7 @@ Pass - 13:53:47 + 15:29:00 Test passed @@ -128,13 +128,13 @@

    Started

    -

    06, 2024 13:53:46

    +

    06, 2024 15:28:59

    Ended

    -

    06, 2024 13:53:47

    +

    06, 2024 15:29:00

    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 72a09e59..62ebff20 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 @@ -90,6 +90,25 @@ public class ProductCategoryController { return new ResultUtil>().setData(list); } + /** + * 前台传参查询店铺类别列表 + * @author 王富康 + * @date 2024/9/7 + * @param shopId + * @return Result + */ + @RequestMapping(value = "/listByShopId", method = RequestMethod.GET) + @ApiOperation(value = "前台传参查询店铺类别列表") + public Result listByShopId(String shopId) { + if(StringUtils.isEmpty(shopId)){ + return ResultUtil.error("店铺信息不能为空"); + } + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("shop_id", shopId); + List list = productCategoryService.list(queryWrapper); + return new ResultUtil>().setData(list); + } + /** * 获取店铺下所有分类及分类的规格及规格的属性值 @@ -122,6 +141,23 @@ public class ProductCategoryController { return new ResultUtil().setData(defaultCategory); } + /** + * 根据前台传的shopId查询店铺默认分类 + * @author 王富康 + * @date 2024/9/7 + * @param shopId + * @return Result + */ + @RequestMapping(value = "/getDefaultCategoryByShopId", method = RequestMethod.POST) + @ApiOperation(value = "根据前台传的shopId查询店铺默认分类") + public Result getDefaultCategoryByShopId(String shopId){ + if(StringUtils.isEmpty(shopId)){ + return ResultUtil.error("店铺id不能为空"); + } + ProductCategoryVo defaultCategory = productCategoryService.getDefaultCategory(shopId); + return new ResultUtil().setData(defaultCategory); + } + @RequestMapping(value = "/getCategoryOfshop", method = RequestMethod.POST) @ApiOperation(value = "查询店铺规格") public Result getCategoryOfshop(){ diff --git a/hiver-modules/hiver-mall/src/main/resources/mapper/ProductMapper.xml b/hiver-modules/hiver-mall/src/main/resources/mapper/ProductMapper.xml index d8cbc886..339bd95a 100644 --- a/hiver-modules/hiver-mall/src/main/resources/mapper/ProductMapper.xml +++ b/hiver-modules/hiver-mall/src/main/resources/mapper/ProductMapper.xml @@ -574,25 +574,25 @@ ) ss ON ss.product_id = t.id and ss.shop_id = t.shop_id - LEFT JOIN ( - SELECT - sd.product_id, - SUM(sd.product_count) AS total_sold - FROM - t_sale_detail sd - INNER JOIN t_sale s ON sd.sale_id = s.id - WHERE - s.del_flag = '0' - AND s.status = '4' - + + LEFT JOIN ( + SELECT + sd.product_id, + SUM(sd.product_count) AS total_sold + FROM + t_sale_detail sd + INNER JOIN t_sale s ON sd.sale_id = s.id + WHERE + s.del_flag = '0' + AND s.status = '4' and s.create_time BETWEEN #{queryParams.startDate} AND #{queryParams.endDate} - - - and s.create_time >= DATE_SUB(CURDATE(), INTERVAL 7 DAY) - - GROUP BY - product_id - ) sd ON t.id = sd.product_id + + GROUP BY + product_id + ) sd ON t.id = sd.product_id + AND t.del_flag != '2' @@ -637,9 +637,12 @@ ORDER BY - - sd.total_sold desc, + + + sd.total_sold desc, + + t.in_storage_status asc, t.del_flag desc,t.create_time desc, id