Browse Source

兑换大厅按价格区间筛选

chunping 3 years ago
parent
commit
bdd470b864

+ 9 - 2
mp-admin/src/main/java/com/qs/mp/web/controller/api/user/UserExchangeController.java

@@ -1,5 +1,6 @@
 package com.qs.mp.web.controller.api.user;
 
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.qs.mp.admin.domain.Goods;
@@ -72,10 +73,16 @@ public class UserExchangeController extends BaseApiController {
    */
   @PostMapping("/goods/list")
   @ApiOperation(value = "商品列表" , notes = "获取所有可兑换商品")
-  public TableDataInfo list(@RequestBody Goods goods) {
+  public TableDataInfo list(@RequestBody JSONObject param) {
+    Long categoryId = param.getLong("categoryId");
+    Integer startPrice = param.getInteger("startPrice");
+    Integer endPrice = param.getInteger("endPrice");
+
     startPage();
     List<Goods> goodsList = goodsService.list(new LambdaQueryWrapper<Goods>()
-        .eq(null != goods.getCategoryId() && 0 != goods.getCategoryId(), Goods::getCategoryId, goods.getCategoryId())
+        .eq(null != categoryId && 0 != categoryId, Goods::getCategoryId, categoryId)
+        .ge(null != startPrice && 0 != startPrice, Goods::getExchangePrice, startPrice)
+        .le(null != endPrice && 0 != endPrice, Goods::getExchangePrice, endPrice)
         .eq(Goods::getStatus, GoodsStatusEnum.PUT_ON)
         .eq(Goods::getExchangeShow, 1));
     List<GoodsListVO> goodsListVOList = mapperFacade.mapAsList(goodsList, GoodsListVO.class);