From cf5e5fa6739752fce84f219d2c227a458a4dc69b Mon Sep 17 00:00:00 2001 From: dzq <dzq@ys.com> Date: Tue, 10 Jun 2025 11:16:05 +0800 Subject: [PATCH] =?UTF-8?q?feat(shop):=20=E6=B7=BB=E5=8A=A0=E6=A0=B9?= =?UTF-8?q?=E6=8D=AE=E4=BC=81=E4=B8=9AID=E8=8E=B7=E5=8F=96=E5=BA=97?= =?UTF-8?q?=E9=93=BA=E5=88=97=E8=A1=A8=E5=8A=9F=E8=83=BD=E5=B9=B6=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3=E9=99=90=E8=B4=AD=E6=95=B0=E9=87=8F=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在ShopService接口和实现类中添加getShopListByCorpid方法 - 在ShopApplicationService中实现业务逻辑 - 在ShopController中新增/list接口 - 将monthlyPurchaseLimit字段类型从String改为Integer --- .../agileboot/api/controller/ShopController.java | 15 ++++++++++++++- .../asset/command/PostAssetGoodsCommand.java | 2 +- .../domain/shop/goods/db/ShopGoodsEntity.java | 2 +- .../domain/shop/goods/dto/ShopGoodsDTO.java | 2 +- .../domain/shop/shop/ShopApplicationService.java | 4 ++++ .../domain/shop/shop/db/ShopService.java | 2 ++ .../domain/shop/shop/db/ShopServiceImpl.java | 9 +++++++++ 7 files changed, 32 insertions(+), 4 deletions(-) diff --git a/agileboot-api/src/main/java/com/agileboot/api/controller/ShopController.java b/agileboot-api/src/main/java/com/agileboot/api/controller/ShopController.java index 17bde5c..77181da 100644 --- a/agileboot-api/src/main/java/com/agileboot/api/controller/ShopController.java +++ b/agileboot-api/src/main/java/com/agileboot/api/controller/ShopController.java @@ -20,6 +20,8 @@ import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; +import com.agileboot.domain.shop.shop.ShopApplicationService; +import com.agileboot.domain.shop.shop.db.ShopEntity; import lombok.RequiredArgsConstructor; import org.apache.commons.lang3.StringUtils; import org.springframework.web.bind.annotation.*; @@ -34,10 +36,21 @@ import org.springframework.web.util.UriComponentsBuilder; @Slf4j @RequiredArgsConstructor public class ShopController { - + private final ShopApplicationService shopApplicationService; private final GoodsApplicationService goodsApplicationService; private final CategoryApplicationService categoryApplicationService; + @GetMapping("/list") + public ResponseDTO<List<ShopEntity>> getShopList(@RequestParam(required = false) String corpid) { + List<ShopEntity> shopList; + if (StringUtils.isNotBlank(corpid)) { + shopList = shopApplicationService.getShopListByCorpid(corpid); + } else { + shopList = shopApplicationService.getShopListByCorpid(WeixinConstants.corpid); + } + return ResponseDTO.ok(shopList); + } + @GetMapping("/goods") public ResponseDTO<ShopGoodsResponse> getShopGoodsInfo(@RequestParam(required = false) Long shopId) { /*// 获取商品列表 diff --git a/agileboot-domain/src/main/java/com/agileboot/domain/asset/command/PostAssetGoodsCommand.java b/agileboot-domain/src/main/java/com/agileboot/domain/asset/command/PostAssetGoodsCommand.java index 3acda64..238f20f 100644 --- a/agileboot-domain/src/main/java/com/agileboot/domain/asset/command/PostAssetGoodsCommand.java +++ b/agileboot-domain/src/main/java/com/agileboot/domain/asset/command/PostAssetGoodsCommand.java @@ -51,6 +51,6 @@ public class PostAssetGoodsCommand { private Integer belongType; @ApiModelProperty("每人每月限购数量") - private String monthlyPurchaseLimit; + private Integer monthlyPurchaseLimit; } } diff --git a/agileboot-domain/src/main/java/com/agileboot/domain/shop/goods/db/ShopGoodsEntity.java b/agileboot-domain/src/main/java/com/agileboot/domain/shop/goods/db/ShopGoodsEntity.java index 2d47992..2df90cd 100644 --- a/agileboot-domain/src/main/java/com/agileboot/domain/shop/goods/db/ShopGoodsEntity.java +++ b/agileboot-domain/src/main/java/com/agileboot/domain/shop/goods/db/ShopGoodsEntity.java @@ -50,7 +50,7 @@ public class ShopGoodsEntity extends BaseEntity<ShopGoodsEntity> { @ApiModelProperty("每人每月限购数量") @TableField("monthly_purchase_limit") - private String monthlyPurchaseLimit; + private Integer monthlyPurchaseLimit; @ApiModelProperty("销售价格") @TableField("price") diff --git a/agileboot-domain/src/main/java/com/agileboot/domain/shop/goods/dto/ShopGoodsDTO.java b/agileboot-domain/src/main/java/com/agileboot/domain/shop/goods/dto/ShopGoodsDTO.java index 66af8f4..0ea1dc2 100644 --- a/agileboot-domain/src/main/java/com/agileboot/domain/shop/goods/dto/ShopGoodsDTO.java +++ b/agileboot-domain/src/main/java/com/agileboot/domain/shop/goods/dto/ShopGoodsDTO.java @@ -103,5 +103,5 @@ public class ShopGoodsDTO { private String usageInstruction; @ExcelColumn(name = "每人每月限购数量") - private String monthlyPurchaseLimit; + private Integer monthlyPurchaseLimit; } diff --git a/agileboot-domain/src/main/java/com/agileboot/domain/shop/shop/ShopApplicationService.java b/agileboot-domain/src/main/java/com/agileboot/domain/shop/shop/ShopApplicationService.java index 859a0e2..4e9ea9b 100644 --- a/agileboot-domain/src/main/java/com/agileboot/domain/shop/shop/ShopApplicationService.java +++ b/agileboot-domain/src/main/java/com/agileboot/domain/shop/shop/ShopApplicationService.java @@ -32,6 +32,10 @@ public class ShopApplicationService { return new PageDTO<>(dtoList, page.getTotal()); } + public List<ShopEntity> getShopListByCorpid(String corpid) { + return shopService.getShopListByCorpid(corpid); + } + public void addShop(AddShopCommand command) { ShopModel model = shopModelFactory.create(); model.loadAddCommand(command); diff --git a/agileboot-domain/src/main/java/com/agileboot/domain/shop/shop/db/ShopService.java b/agileboot-domain/src/main/java/com/agileboot/domain/shop/shop/db/ShopService.java index 8ea9073..665af47 100644 --- a/agileboot-domain/src/main/java/com/agileboot/domain/shop/shop/db/ShopService.java +++ b/agileboot-domain/src/main/java/com/agileboot/domain/shop/shop/db/ShopService.java @@ -27,4 +27,6 @@ public interface ShopService extends IService<ShopEntity> { ShopEntity selectByShopName(String shopName); Long countAllRecord(); + + List<ShopEntity> getShopListByCorpid(String corpid); } diff --git a/agileboot-domain/src/main/java/com/agileboot/domain/shop/shop/db/ShopServiceImpl.java b/agileboot-domain/src/main/java/com/agileboot/domain/shop/shop/db/ShopServiceImpl.java index 12c8a4c..3c1dddb 100644 --- a/agileboot-domain/src/main/java/com/agileboot/domain/shop/shop/db/ShopServiceImpl.java +++ b/agileboot-domain/src/main/java/com/agileboot/domain/shop/shop/db/ShopServiceImpl.java @@ -1,6 +1,7 @@ package com.agileboot.domain.shop.shop.db; import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springframework.stereotype.Service; @@ -47,4 +48,12 @@ public class ShopServiceImpl extends ServiceImpl<ShopMapper, ShopEntity> impleme public Long countAllRecord() { return baseMapper.countAllRecord(); } + + @Override + public List<ShopEntity> getShopListByCorpid(String corpid) { + QueryWrapper<ShopEntity> queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("corpid", corpid) + .eq("deleted", 0); + return this.list(queryWrapper); + } } \ No newline at end of file