From 31e915fdf6dc9dbed805be69d8e1859c44d314da Mon Sep 17 00:00:00 2001 From: phpcjl <phpcjl@gmail.com> Date: 星期三, 11 十二月 2024 09:33:46 +0800 Subject: [PATCH] 1. --- ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java | 7 ++++--- ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/ShopService.java | 7 +++++-- ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopServiceImpl.java | 10 +++++++--- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java index 36196c8..28337a9 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java @@ -2,6 +2,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; import com.ruoyi.account.api.feignClient.AppUserClient; import com.ruoyi.account.api.model.AppUser; import com.ruoyi.account.api.model.AppUserShop; @@ -106,9 +107,9 @@ @GetMapping("/list") @ApiOperation(value = "门店列表", tags = {"后台管理-门店管理-门店列表"}) - public R<List<Shop>> list(@ApiParam("页码") @RequestParam Integer PageNum,@ApiParam("每一页数据大小") Integer pageSize,Shop shop){ - List<Shop> list = shopService.list(); - return null; + public R<IPage<Shop>> list(@ApiParam("页码") @RequestParam Integer PageNum,@ApiParam("每一页数据大小") Integer pageSize,Shop shop){ + IPage<Shop> shopIPage = shopService.getShopList(PageNum, pageSize, shop); + return R.ok(shopIPage); } diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/ShopService.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/ShopService.java index 75337b8..0f1e3ff 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/ShopService.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/ShopService.java @@ -1,16 +1,19 @@ package com.ruoyi.other.service; +import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.IService; import com.ruoyi.other.api.domain.Shop; import com.ruoyi.other.vo.NearbyShopVO; import com.ruoyi.other.vo.ShopDetailVO; +import io.swagger.annotations.ApiParam; +import org.springframework.web.bind.annotation.RequestParam; import java.math.BigDecimal; import java.util.List; /** * <p> - * 服务类 + * 服务类 * </p> * * @author luodangjia @@ -18,7 +21,7 @@ */ public interface ShopService extends IService<Shop> { - List<Shop> getShopList(Shop shop); + IPage<Shop> getShopList(Integer PageNum, Integer pageSize, Shop shop); List<NearbyShopVO> nearbyShopList(BigDecimal longitude, BigDecimal latitude); diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopServiceImpl.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopServiceImpl.java index d40808b..98486ea 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopServiceImpl.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopServiceImpl.java @@ -2,6 +2,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ruoyi.account.api.feignClient.AppUserClient; import com.ruoyi.common.core.exception.ServiceException; @@ -43,9 +44,12 @@ @Override - public List<Shop> getShopList(Shop shop) { - IPage<Shop> shopIPage = shopMapper.selectShopList(null, null); - return shopIPage.getRecords(); + public IPage<Shop> getShopList(Integer PageNum, Integer pageSize, Shop shop) { + Page<Shop> page = new Page<>(); + page.setCurrent(PageNum); + page.setSize(pageSize); + IPage<Shop> shopIPage = shopMapper.selectShopList(page, shop); + return shopIPage; } @Override -- Gitblit v1.7.1