From 34ec63ac94b2b61bbdbc4b6a98a577efedbafda8 Mon Sep 17 00:00:00 2001 From: Pu Zhibing <393733352@qq.com> Date: 星期四, 28 十一月 2024 13:41:23 +0800 Subject: [PATCH] 开发购物车列表 --- ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsController.java | 16 +++++++++++++--- 1 files changed, 13 insertions(+), 3 deletions(-) diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsController.java index 6a4ad95..7a6c1b9 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsController.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsController.java @@ -1,6 +1,7 @@ package com.ruoyi.other.controller; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.web.controller.BaseController; import com.ruoyi.common.core.web.domain.AjaxResult; @@ -26,7 +27,7 @@ */ @RestController @RequestMapping("/goods") -@Api("商品") +@Api(tags = "商品") public class GoodsController extends BaseController { @Resource private GoodsService goodsService; @@ -62,10 +63,19 @@ public R<GoodsVO> goodsDetail(@PathVariable("goodsId") Long goodsId){ return R.ok(goodsService.goodsDetail(goodsId)); } - - + /** + * 根据类型(1=服务商品,2=单品商品)获取商品数据 + * @param type + * @return + */ + @ResponseBody + @PostMapping("/getGoodsByType") + public R<List<Goods>> getGoodsByType(@RequestParam("type") Integer type){ + List<Goods> list = goodsService.list(new LambdaQueryWrapper<Goods>().eq(Goods::getType, type).eq(Goods::getDelFlag, 0).eq(Goods::getStatus, 2)); + return R.ok(list); + } } -- Gitblit v1.7.1