From 5995481ac8c368c74178dcfca531994099b143f5 Mon Sep 17 00:00:00 2001 From: rentaiming <806181062@qq.com> Date: 星期四, 06 六月 2024 12:40:38 +0800 Subject: [PATCH] 用户端商品 --- ruoyi-modules/ruoyi-promotion/src/main/java/com/ruoyi/promotion/service/impl/PromotionWishListServiceImpl.java | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 57 insertions(+), 2 deletions(-) diff --git a/ruoyi-modules/ruoyi-promotion/src/main/java/com/ruoyi/promotion/service/impl/PromotionWishListServiceImpl.java b/ruoyi-modules/ruoyi-promotion/src/main/java/com/ruoyi/promotion/service/impl/PromotionWishListServiceImpl.java index 02ca19d..0f4db48 100644 --- a/ruoyi-modules/ruoyi-promotion/src/main/java/com/ruoyi/promotion/service/impl/PromotionWishListServiceImpl.java +++ b/ruoyi-modules/ruoyi-promotion/src/main/java/com/ruoyi/promotion/service/impl/PromotionWishListServiceImpl.java @@ -1,10 +1,20 @@ package com.ruoyi.promotion.service.impl; -import com.ruoyi.promotion.domain.pojo.PromotionWishList; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ruoyi.common.core.utils.page.PageDTO; +import com.ruoyi.system.api.domain.dto.PromotionWishListDTO; +import com.ruoyi.promotion.domain.PromotionWishList; import com.ruoyi.promotion.mapper.PromotionWishListMapper; import com.ruoyi.promotion.service.IPromotionWishListService; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ruoyi.system.api.util.HuaWeiOBSUtil; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; import org.springframework.stereotype.Service; +import org.springframework.web.multipart.MultipartFile; /** * <p> @@ -17,4 +27,49 @@ @Service public class PromotionWishListServiceImpl extends ServiceImpl<PromotionWishListMapper, PromotionWishList> implements IPromotionWishListService { + + @Override + public PageDTO<PromotionWishList> getPromotionWishList(PromotionWishListDTO promotionWishListDTO) { + + Page<PromotionWishList> page = new Page<>(promotionWishListDTO.getPageCurr(), promotionWishListDTO.getPageSize()); + LambdaQueryWrapper<PromotionWishList> wrapper= Wrappers.lambdaQuery(); + wrapper.eq(PromotionWishList::getMemberId,promotionWishListDTO.getMemberId()); + Page<PromotionWishList> page1 = this.page(page, wrapper); + return PageDTO.of(page1); + } + + @Override + public void savePromotionWishList(PromotionWishListDTO promotionWishListDTO) { + PromotionWishList promotionWishList=new PromotionWishList(); + promotionWishList.setExpectedPrice(promotionWishListDTO.getExpectedPrice()); + promotionWishList.setGoodsName(promotionWishListDTO.getGoodsName()); + promotionWishList.setRemark(promotionWishListDTO.getRemark()); + List<String> urlList=new ArrayList<>(); + if (promotionWishListDTO.getGoodsImageUrl().length>0){ + for (MultipartFile file:promotionWishListDTO.getGoodsImageUrl()){ + try { + String url= HuaWeiOBSUtil.obsUpload(file); + urlList.add(url); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + promotionWishList.setGoodsImageUrl(urlList.toString()); + } + this.save(promotionWishList); + } + + @Override + public void delPromotionWishOne(PromotionWishListDTO promotionWishListDTO) { + this.removeById(promotionWishListDTO.getRomotionWishId()); + } + + @Override + public PromotionWishList getPromotionWishOne(PromotionWishListDTO promotionWishListDTO) { + LambdaQueryWrapper<PromotionWishList> wrapper= Wrappers.lambdaQuery(); + wrapper.eq(PromotionWishList::getId,promotionWishListDTO.getRomotionWishId()); + wrapper.eq(PromotionWishList::getDelFlag,0); + return this.getOne(wrapper); + } + } -- Gitblit v1.7.1