From 5f9e42d921ba2b191199e61cf070da20de39758c Mon Sep 17 00:00:00 2001 From: puzhibing <393733352@qq.com> Date: 星期二, 10 十二月 2024 14:15:36 +0800 Subject: [PATCH] 合并代码 --- ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsCategoryController.java | 22 ++++++++++++++-------- 1 files changed, 14 insertions(+), 8 deletions(-) diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsCategoryController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsCategoryController.java index aa66681..7864100 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsCategoryController.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsCategoryController.java @@ -1,12 +1,16 @@ package com.ruoyi.other.controller; +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.ruoyi.common.core.domain.R; +import com.ruoyi.common.core.utils.StringUtils; +import com.ruoyi.common.core.web.controller.BaseController; +import com.ruoyi.common.core.web.page.TableDataInfo; import com.ruoyi.other.api.domain.GoodsCategory; import com.ruoyi.other.service.GoodsCategoryService; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.Api; +import io.swagger.annotations.*; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; @@ -22,8 +26,8 @@ */ @RestController @RequestMapping("/goods-category") -@Api(tags = "商品分类") -public class GoodsCategoryController { +@Api("商品分类") +public class GoodsCategoryController extends BaseController { @Resource private GoodsCategoryService goodsCategoryService; @@ -51,8 +55,11 @@ @GetMapping("/getList") @ApiOperation(value = "商品分类列表", tags = {"管理后台-商品分类"}) - public R<List<GoodsCategory>> list(IPage<GoodsCategory> page, GoodsCategory goodsCategory){ - return R.ok(goodsCategoryService.list()); + public R<Page<GoodsCategory>> list(@ApiParam("页码") @RequestParam Integer PageNum,@ApiParam("每一页数据大小") Integer pageSize, GoodsCategory goodsCategory){ + Page<GoodsCategory> page = goodsCategoryService.lambdaQuery() + .like(StringUtils.isNotEmpty(goodsCategory.getName()),GoodsCategory::getName, goodsCategory.getName()) + .page(Page.of(PageNum, pageSize)); + return R.ok(page); } @GetMapping("/index/list") @@ -61,8 +68,7 @@ List<GoodsCategory> indexlist = goodsCategoryService.lambdaQuery() .orderByDesc(GoodsCategory::getCreateTime) .last("limit 8") - .list() - ; + .list(); return R.ok(indexlist); } @GetMapping("/list") -- Gitblit v1.7.1