From 1810d6efd7879e6d2c18aee6de731cd4cc5fb95e Mon Sep 17 00:00:00 2001 From: wangjinlei <751475802@qq.com> Date: Thu, 21 Sep 2023 14:04:39 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ShopProductLabelController.java | 41 ++++++++++++------- 1 file changed, 27 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/peanut/modules/book/controller/ShopProductLabelController.java b/src/main/java/com/peanut/modules/book/controller/ShopProductLabelController.java index 979f0076..0f5e6403 100644 --- a/src/main/java/com/peanut/modules/book/controller/ShopProductLabelController.java +++ b/src/main/java/com/peanut/modules/book/controller/ShopProductLabelController.java @@ -1,9 +1,14 @@ package com.peanut.modules.book.controller; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.github.yulichang.wrapper.MPJLambdaWrapper; import com.peanut.common.utils.PageUtils; import com.peanut.common.utils.R; import com.peanut.modules.book.dao.ShopProductLabelDao; +import com.peanut.modules.book.dao.ShopProductToLabelDao; +import com.peanut.modules.book.entity.ShopProductEntity; import com.peanut.modules.book.entity.ShopProductLabelEntity; import com.peanut.modules.book.entity.ShopProductToLabelEntity; import com.peanut.modules.book.service.ShopProductLabelService; @@ -29,6 +34,8 @@ public class ShopProductLabelController { private ShopProductToLabelService shopProductToLabelService; @Autowired private ShopProductLabelDao shopProductLabelDao; + @Autowired + private ShopProductToLabelDao shopProductToLabelDao; @RequestMapping("/addLabel") @@ -97,21 +104,27 @@ public class ShopProductLabelController { } + /** + * 获取商品列表通过标签 + * @return + */ + @RequestMapping("/getProductsByLabel") + public R getProductsByLabel(@RequestParam Integer splId,@RequestParam Integer limit,@RequestParam Integer page){ + MPJLambdaWrapper shopProductEntityMPJLambdaWrapper = new MPJLambdaWrapper(); + shopProductEntityMPJLambdaWrapper.selectAll(ShopProductEntity.class); + shopProductEntityMPJLambdaWrapper.leftJoin(ShopProductEntity.class,ShopProductEntity::getProductId,ShopProductToLabelEntity::getProductId); + shopProductEntityMPJLambdaWrapper.eq(ShopProductToLabelEntity::getDelFlag,0); + shopProductEntityMPJLambdaWrapper.eq(ShopProductEntity::getDelFlag,0); + Page shopProductEntityPage = shopProductToLabelDao.selectJoinPage(new Page(page, limit), ShopProductEntity.class, shopProductEntityMPJLambdaWrapper); - - - - - - - @RequestMapping("/mytest") - public R mytest(){ - - shopProductLabelService.getBaseMapper(); - - -// shopProductLabelDao.selectJoinList() - return R.ok(); + return R.ok().put("page",shopProductEntityPage); } + + + + + + + }