From 762a902950595232c8e7aa668558a1f440fee317 Mon Sep 17 00:00:00 2001 From: wangw <1594593906@qq.com> Date: Thu, 20 Jun 2024 11:57:02 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=8E=A5=E5=8F=A3=20?= =?UTF-8?q?=E5=88=86=E7=B1=BB=E5=88=97=E8=A1=A8(=E5=8C=85=E6=8B=AC?= =?UTF-8?q?=E5=AD=90=E5=88=86=E7=B1=BB)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/ProductController.java | 10 ++++++++ .../dao/TbShopCategoryMapper.java | 2 ++ .../entity/vo/ShopCategoryVo.java | 15 ++++++++++++ .../service/ProductService.java | 8 +++++++ .../resources/mapper/TbShopCategoryMapper.xml | 23 +++++++++++++++++++ 5 files changed, 58 insertions(+) create mode 100644 src/main/java/com/chaozhanggui/system/cashierservice/entity/vo/ShopCategoryVo.java diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/controller/ProductController.java b/src/main/java/com/chaozhanggui/system/cashierservice/controller/ProductController.java index 8942544..6a5d63b 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/controller/ProductController.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/controller/ProductController.java @@ -65,6 +65,16 @@ public class ProductController { return productService.queryCategory(shopId,page,pageSize); } + @GetMapping(value = "queryAllCategory") + public Result queryAllCategory( + @RequestParam("shopId") String shopId, + @RequestParam(value = "page", required = false, defaultValue = "1")int page, + @RequestParam(value = "pageSize", required = false, defaultValue = "10")int pageSize + ){ + + return productService.queryAllCategory(shopId,page,pageSize); + } + @GetMapping("queryProductSku") public Result queryProductSku(@RequestHeader("token") String token, diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/dao/TbShopCategoryMapper.java b/src/main/java/com/chaozhanggui/system/cashierservice/dao/TbShopCategoryMapper.java index 80ff571..dcf563e 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/dao/TbShopCategoryMapper.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/dao/TbShopCategoryMapper.java @@ -1,6 +1,7 @@ package com.chaozhanggui.system.cashierservice.dao; import com.chaozhanggui.system.cashierservice.entity.TbShopCategory; +import com.chaozhanggui.system.cashierservice.entity.vo.ShopCategoryVo; import org.apache.ibatis.annotations.Mapper; import org.springframework.stereotype.Component; @@ -22,4 +23,5 @@ public interface TbShopCategoryMapper { int updateByPrimaryKey(TbShopCategory record); List selectByAll(String shopId); + List queryAllCategory(String shopId); } \ No newline at end of file diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/entity/vo/ShopCategoryVo.java b/src/main/java/com/chaozhanggui/system/cashierservice/entity/vo/ShopCategoryVo.java new file mode 100644 index 0000000..2186e4f --- /dev/null +++ b/src/main/java/com/chaozhanggui/system/cashierservice/entity/vo/ShopCategoryVo.java @@ -0,0 +1,15 @@ +package com.chaozhanggui.system.cashierservice.entity.vo; + +import lombok.Data; + +import java.util.List; + +@Data +public class ShopCategoryVo { + + private Integer id; + + private String name; + + private List childs; +} diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/service/ProductService.java b/src/main/java/com/chaozhanggui/system/cashierservice/service/ProductService.java index 5b07369..21d9dfb 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/service/ProductService.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/service/ProductService.java @@ -3,6 +3,7 @@ package com.chaozhanggui.system.cashierservice.service; import cn.hutool.core.util.ObjectUtil; import com.chaozhanggui.system.cashierservice.dao.*; import com.chaozhanggui.system.cashierservice.entity.*; +import com.chaozhanggui.system.cashierservice.entity.vo.ShopCategoryVo; import com.chaozhanggui.system.cashierservice.sign.CodeEnum; import com.chaozhanggui.system.cashierservice.sign.Result; import com.chaozhanggui.system.cashierservice.util.DateUtils; @@ -44,6 +45,13 @@ public class ProductService { return Result.success(CodeEnum.SUCCESS,pageInfo); } + public Result queryAllCategory(String shopId,Integer page,Integer pageSize){ + PageHelper.startPage(page, pageSize); + List list=tbShopCategoryMapper.queryAllCategory(shopId); + PageInfo pageInfo=new PageInfo(list); + return Result.success(CodeEnum.SUCCESS,pageInfo); + } + public Result queryCommodityInfo(String shopId, String categoryId, String commdityName, Integer page, Integer pageSize, String masterId){ List tbProductWithBLOBs=null; diff --git a/src/main/resources/mapper/TbShopCategoryMapper.xml b/src/main/resources/mapper/TbShopCategoryMapper.xml index 5dc4db5..48b6a73 100644 --- a/src/main/resources/mapper/TbShopCategoryMapper.xml +++ b/src/main/resources/mapper/TbShopCategoryMapper.xml @@ -18,6 +18,18 @@ + + + + + + + + + + + + id, name, short_name, tree, pid, pic, merchant_id, shop_id, style, is_show, detail, sort, key_word, created_at, updated_at @@ -220,4 +232,15 @@ ORDER BY `sort` asc + + + \ No newline at end of file