diff --git a/peanut_book.iml b/peanut_book.iml index bd75c926..e73e4b81 100644 --- a/peanut_book.iml +++ b/peanut_book.iml @@ -1,8 +1,275 @@ - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file 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 4157365b..979f0076 100644 --- a/src/main/java/com/peanut/modules/book/controller/ShopProductLabelController.java +++ b/src/main/java/com/peanut/modules/book/controller/ShopProductLabelController.java @@ -1,6 +1,7 @@ package com.peanut.modules.book.controller; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.peanut.common.utils.PageUtils; import com.peanut.common.utils.R; import com.peanut.modules.book.dao.ShopProductLabelDao; import com.peanut.modules.book.entity.ShopProductLabelEntity; @@ -82,6 +83,27 @@ public class ShopProductLabelController { } + + /** + * + * @param params + * @return + */ + @RequestMapping("/list") + public R list(@RequestParam Map params){ + PageUtils page = shopProductToLabelService.queryPageproductSales(params); + return R.ok().put("page", page); + + } + + + + + + + + + @RequestMapping("/mytest") public R mytest(){ diff --git a/src/main/java/com/peanut/modules/book/controller/ShopProudictBookController.java b/src/main/java/com/peanut/modules/book/controller/ShopProudictBookController.java index 1eb2e5d3..964d0c3d 100644 --- a/src/main/java/com/peanut/modules/book/controller/ShopProudictBookController.java +++ b/src/main/java/com/peanut/modules/book/controller/ShopProudictBookController.java @@ -85,6 +85,10 @@ public class ShopProudictBookController { + + + + diff --git a/src/main/java/com/peanut/modules/book/controller/UserEbookBuyController.java b/src/main/java/com/peanut/modules/book/controller/UserEbookBuyController.java index 0c07f901..cd8d5d4e 100644 --- a/src/main/java/com/peanut/modules/book/controller/UserEbookBuyController.java +++ b/src/main/java/com/peanut/modules/book/controller/UserEbookBuyController.java @@ -69,7 +69,7 @@ public class UserEbookBuyController { @RequestMapping("/appbooklist") public R appbooklist(@RequestParam("userId") Integer userId) { - String user = String.valueOf(userId); + String user = String.valueOf(userId); ArrayList maplist = new ArrayList<>(); ArrayList list = new ArrayList<>(); @@ -109,8 +109,6 @@ public class UserEbookBuyController { - - return R.ok().put("resultlist",maplist).put("total",index); } diff --git a/src/main/java/com/peanut/modules/book/entity/ShopProductToLabelEntity.java b/src/main/java/com/peanut/modules/book/entity/ShopProductToLabelEntity.java index bcee7bbd..b3f42276 100644 --- a/src/main/java/com/peanut/modules/book/entity/ShopProductToLabelEntity.java +++ b/src/main/java/com/peanut/modules/book/entity/ShopProductToLabelEntity.java @@ -6,7 +6,9 @@ import com.baomidou.mybatisplus.annotation.TableLogic; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; +import java.util.ArrayList; import java.util.Date; +import java.util.List; @Data @TableName("shop_product_to_label") @@ -23,4 +25,15 @@ public class ShopProductToLabelEntity { @TableField("del_flag") @TableLogic private Integer delFlag; + + /** + * 不存入数据库,返回商品详情 + */ + @TableField(exist = false) + private List shopproudicts; + + @TableField(exist = false) + private List shopp; + + } diff --git a/src/main/java/com/peanut/modules/book/service/ShopProductToLabelService.java b/src/main/java/com/peanut/modules/book/service/ShopProductToLabelService.java index 7ecb09ed..8ed2f893 100644 --- a/src/main/java/com/peanut/modules/book/service/ShopProductToLabelService.java +++ b/src/main/java/com/peanut/modules/book/service/ShopProductToLabelService.java @@ -2,7 +2,11 @@ package com.peanut.modules.book.service; import com.baomidou.mybatisplus.extension.service.IService; import com.github.yulichang.base.MPJBaseService; +import com.peanut.common.utils.PageUtils; import com.peanut.modules.book.entity.ShopProductToLabelEntity; +import java.util.Map; + public interface ShopProductToLabelService extends IService { + PageUtils queryPageproductSales(Map params); } diff --git a/src/main/java/com/peanut/modules/book/service/impl/OrderCartServiceImpl.java b/src/main/java/com/peanut/modules/book/service/impl/OrderCartServiceImpl.java index 53224ee5..976d7bd3 100644 --- a/src/main/java/com/peanut/modules/book/service/impl/OrderCartServiceImpl.java +++ b/src/main/java/com/peanut/modules/book/service/impl/OrderCartServiceImpl.java @@ -1,5 +1,6 @@ package com.peanut.modules.book.service.impl; +import com.peanut.common.utils.R; import com.peanut.modules.book.entity.ShopProductEntity; import com.peanut.modules.book.service.ShopProductService; import com.peanut.modules.book.vo.ShopCartVo; @@ -51,35 +52,41 @@ public class OrderCartServiceImpl extends ServiceImpl implements ShopProductToLabelService { + @Autowired + private ShopProductService shopProductService; + + + + + @Override + public PageUtils queryPageproductSales(Map params) { + String splId = (String) params.get("splId"); + IPage page = this.page( + new Query().getPage(params), + new ExcludeEmptyQueryWrapper() + .orderByDesc("ptl_id").eq("spl_id",splId) + + ); + //从分页查询结果中取出每条数据 + List records = page.getRecords(); + + + List objects = new ArrayList<>(); + //循环遍历ToLable 表数据取出 + for (ShopProductToLabelEntity shopProductToLabelEntity :records) { + + Integer ptlId = shopProductToLabelEntity.getProductId(); + //找到对应的商品信息,放在Tolable空字段中进行返回 + List ShopProduct = shopProductService.getBaseMapper().selectList(new QueryWrapper() + .eq("del_flag", 0) + .eq("product_id",ptlId) + ); + + shopProductToLabelEntity.setShopproudicts(ShopProduct); + } + return new PageUtils(page); + } }