From c26092c422c4b72fa5d51a38f6de1b48ab1ccd87 Mon Sep 17 00:00:00 2001 From: mitao <2763622819@qq.com> Date: 星期一, 27 五月 2024 15:53:36 +0800 Subject: [PATCH] 提交普通拍品、资讯文章、商城商品收藏基础代码 --- ruoyi-modules/ruoyi-auction/src/main/java/com/ruoyi/auction/service/impl/AuctionGoodsServiceImpl.java | 38 +++++++++++++++++++++++++++++++++++--- 1 files changed, 35 insertions(+), 3 deletions(-) diff --git a/ruoyi-modules/ruoyi-auction/src/main/java/com/ruoyi/auction/service/impl/AuctionGoodsServiceImpl.java b/ruoyi-modules/ruoyi-auction/src/main/java/com/ruoyi/auction/service/impl/AuctionGoodsServiceImpl.java index 3b27cf9..d6b7aef 100644 --- a/ruoyi-modules/ruoyi-auction/src/main/java/com/ruoyi/auction/service/impl/AuctionGoodsServiceImpl.java +++ b/ruoyi-modules/ruoyi-auction/src/main/java/com/ruoyi/auction/service/impl/AuctionGoodsServiceImpl.java @@ -2,12 +2,15 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ruoyi.auction.controller.management.dto.AuctionGoodsDTO; import com.ruoyi.auction.controller.management.dto.AuctionGoodsQuery; import com.ruoyi.auction.controller.management.vo.AuctionGoodsVO; -import com.ruoyi.auction.domain.pojo.AuctionGoods; +import com.ruoyi.auction.domain.AuctionGoods; import com.ruoyi.auction.mapper.AuctionGoodsMapper; import com.ruoyi.auction.service.IAuctionGoodsService; +import com.ruoyi.common.core.exception.ServiceException; import com.ruoyi.common.core.utils.StringUtils; +import com.ruoyi.common.core.utils.page.BeanUtils; import com.ruoyi.common.core.utils.page.PageDTO; import com.ruoyi.system.api.domain.GoodsSku; import com.ruoyi.system.api.feignClient.GoodsSkuClient; @@ -33,6 +36,12 @@ private final GoodsSkuClient goodsSkuClient; + /** + * 获取拍卖商品列表的分页数据 + * + * @param query 拍卖商品查询对象 + * @return PageDTO<AuctionGoodsVO> + */ @Override public PageDTO<AuctionGoodsVO> getAuctionGoodsPage(AuctionGoodsQuery query) { Set<Long> goodsSkuIdList = null; @@ -42,7 +51,8 @@ goodsSkuIdList = goodsSku.stream().map(GoodsSku::getId) .collect(Collectors.toSet()); } - this.lambdaQuery().select(AuctionGoods::getId, AuctionGoods::getGoodsSkuId, + Page<AuctionGoods> page = this.lambdaQuery() + .select(AuctionGoods::getId, AuctionGoods::getGoodsSkuId, AuctionGoods::getListingStatus, AuctionGoods::getStartStatus, AuctionGoods::getStartTime, AuctionGoods::getEndTime, AuctionGoods::getAuctionStock, AuctionGoods::getMinimumMarkupAmount).in( @@ -54,6 +64,28 @@ .eq(StringUtils.isNotNull(query.getStartStatus()), AuctionGoods::getStartStatus, query.getStartStatus()) .page(new Page<>(query.getPageCurr(), query.getPageSize())); - return null; + return PageDTO.of(page, AuctionGoodsVO.class); + } + + @Override + public void saveAuctionGoods(AuctionGoodsDTO dto) { + Long id = dto.getId(); + Long goodsSkuId = dto.getGoodsSkuId(); + // 添加 + if (StringUtils.isNull(id)) { + if (StringUtils.isNull(goodsSkuId)) { + throw new ServiceException("商品id不能为空"); + } + GoodsSku goodsSku = goodsSkuClient.getGoodsSkuOne(goodsSkuId).getData(); + if (StringUtils.isNull(goodsSku)) { + throw new ServiceException("商品不存在"); + } + AuctionGoods auctionGoods = BeanUtils.copyBean(dto, AuctionGoods.class); + this.save(auctionGoods); + + } else { + // 编辑 + + } } } -- Gitblit v1.7.1