From 446c4e920cd9add753d9543a49f919e028d93c7d Mon Sep 17 00:00:00 2001 From: zhangli <123879394@qq.com> Date: Thu, 31 Jul 2025 23:43:10 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=BB=9F=E8=AE=A1=E9=97=A8?= =?UTF-8?q?=E5=BA=97=E8=BD=A6=E8=BE=86=E6=95=B0=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/sczx/car/controller/CarController.java | 7 +++++++ src/main/java/com/sczx/car/service/CarService.java | 7 +++++++ .../java/com/sczx/car/service/impl/CarServiceImpl.java | 5 +++++ 3 files changed, 19 insertions(+) diff --git a/src/main/java/com/sczx/car/controller/CarController.java b/src/main/java/com/sczx/car/controller/CarController.java index 770c7f7..44eec0f 100644 --- a/src/main/java/com/sczx/car/controller/CarController.java +++ b/src/main/java/com/sczx/car/controller/CarController.java @@ -35,4 +35,11 @@ public class CarController { public Result getCarByCarCondition(@RequestBody CarQueryConditionReq req){ return Result.ok(carService.getCarByCondition(req)); } + + + @ApiOperation(value = "统计门店车辆数量") + @GetMapping("/countCarByStoreId") + public Result countCarByStoreId(@RequestParam(name = "storeId") Long storeId){ + return Result.ok(carService.countCarByStoreId(storeId)); + } } diff --git a/src/main/java/com/sczx/car/service/CarService.java b/src/main/java/com/sczx/car/service/CarService.java index 918f9fb..2ca3f06 100644 --- a/src/main/java/com/sczx/car/service/CarService.java +++ b/src/main/java/com/sczx/car/service/CarService.java @@ -16,4 +16,11 @@ public interface CarService { * @return */ CarDTO getCarByCondition(CarQueryConditionReq req); + + /** + * 根据门店查车辆数量 + * @param storeId + * @return + */ + Long countCarByStoreId(Long storeId); } diff --git a/src/main/java/com/sczx/car/service/impl/CarServiceImpl.java b/src/main/java/com/sczx/car/service/impl/CarServiceImpl.java index 25c9e60..9c40d7b 100644 --- a/src/main/java/com/sczx/car/service/impl/CarServiceImpl.java +++ b/src/main/java/com/sczx/car/service/impl/CarServiceImpl.java @@ -35,4 +35,9 @@ public class CarServiceImpl implements CarService { CarPO carPO = carRepo.getOne(queryWrapper); return CarConvert.INSTANCE.poToDto(carPO); } + + @Override + public Long countCarByStoreId(Long storeId) { + return carRepo.count(new LambdaQueryWrapper().eq(CarPO::getStoreId, storeId)); + } }