From c5f7cdfaf69deb6fb3bb4a8379beb0e9bbe0f3c0 Mon Sep 17 00:00:00 2001
From: rentaiming <806181062@qq.com>
Date: 星期五, 31 五月 2024 16:28:12 +0800
Subject: [PATCH] 修改循环注入

---
 ruoyi-modules/ruoyi-auction/src/main/java/com/ruoyi/auction/service/impl/AuctionBidRecordServiceImpl.java |   30 +++++++++++++++++++-----------
 1 files changed, 19 insertions(+), 11 deletions(-)

diff --git a/ruoyi-modules/ruoyi-auction/src/main/java/com/ruoyi/auction/service/impl/AuctionBidRecordServiceImpl.java b/ruoyi-modules/ruoyi-auction/src/main/java/com/ruoyi/auction/service/impl/AuctionBidRecordServiceImpl.java
index 40de217..c802ba8 100644
--- a/ruoyi-modules/ruoyi-auction/src/main/java/com/ruoyi/auction/service/impl/AuctionBidRecordServiceImpl.java
+++ b/ruoyi-modules/ruoyi-auction/src/main/java/com/ruoyi/auction/service/impl/AuctionBidRecordServiceImpl.java
@@ -7,8 +7,9 @@
 import com.ruoyi.auction.domain.AuctionBidRecord;
 import com.ruoyi.auction.domain.AuctionSalesroomGoods;
 import com.ruoyi.auction.mapper.AuctionBidRecordMapper;
+import com.ruoyi.auction.mapper.AuctionSalesroomGoodsMapper;
 import com.ruoyi.auction.service.IAuctionBidRecordService;
-import com.ruoyi.auction.service.IAuctionSalesroomGoodsService;
+import com.ruoyi.common.core.enums.AuctionOrderTypeEnum;
 import com.ruoyi.common.core.enums.BidStatusEnum;
 import java.util.ArrayList;
 import java.util.List;
@@ -25,25 +26,24 @@
  */
 @Service
 public class AuctionBidRecordServiceImpl extends ServiceImpl<AuctionBidRecordMapper, AuctionBidRecord> implements IAuctionBidRecordService {
-    @Resource
-    private IAuctionBidRecordService iAuctionBidRecordService;
 
     @Resource
-    private IAuctionSalesroomGoodsService iAuctionSalesroomGoodsService;
+    private AuctionSalesroomGoodsMapper auctionSalesroomGoodsMapper;
 
     @Override
     public List<AuctionBidRecord> getAuctionBidRecordList(AuctionSalesroomGoodsDTO auctionSalesroomGoodsDTO) {
-            AuctionSalesroomGoods auctionSalesroomGoods=iAuctionSalesroomGoodsService.getById(auctionSalesroomGoodsDTO.getGoodsSkuId());
+        AuctionSalesroomGoods auctionSalesroomGoods = auctionSalesroomGoodsMapper.selectById(
+                auctionSalesroomGoodsDTO.getGoodsSkuId());
             List<AuctionBidRecord> auctionBidRecordList=new ArrayList<>();
             if (auctionSalesroomGoods.getStatus().getCode()==1){
                 LambdaQueryWrapper<AuctionBidRecord> wrapper=Wrappers.lambdaQuery();
-                wrapper.eq(AuctionBidRecord::getGoodsSkuId,auctionSalesroomGoodsDTO.getGoodsSkuId());
+                wrapper.eq(AuctionBidRecord::getTargetId,auctionSalesroomGoodsDTO.getGoodsSkuId());
                 wrapper.eq(AuctionBidRecord::getDelFlag,0);
                 wrapper.orderByDesc(AuctionBidRecord::getLastBidAmount);
-                auctionBidRecordList=iAuctionBidRecordService.list(wrapper);
+                auctionBidRecordList = this.list(wrapper);
                 //判断
-                if (auctionBidRecordList.size()>=auctionSalesroomGoods.getItemQuantity()){
-                    for (int i=0;i<=auctionSalesroomGoods.getItemQuantity();i++){
+                if (auctionBidRecordList.size()>=auctionSalesroomGoods.getSalesroomStock()){
+                    for (int i=0;i<=auctionSalesroomGoods.getSalesroomStock();i++){
                         AuctionBidRecord auctionBidRecord= auctionBidRecordList.get(i);
                         auctionBidRecord.setStatus(BidStatusEnum.LEAD);
                     }
@@ -55,14 +55,22 @@
                 }
             }if (auctionSalesroomGoods.getStatus().getCode()==2){
                 LambdaQueryWrapper<AuctionBidRecord> wrapper=Wrappers.lambdaQuery();
-                wrapper.eq(AuctionBidRecord::getGoodsSkuId,auctionSalesroomGoodsDTO.getGoodsSkuId());
+                wrapper.eq(AuctionBidRecord::getTargetId,auctionSalesroomGoodsDTO.getGoodsSkuId());
                 wrapper.eq(AuctionBidRecord::getStatus,2);
                 wrapper.eq(AuctionBidRecord::getDelFlag,0);
                 wrapper.orderByDesc(AuctionBidRecord::getLastBidAmount);
-                auctionBidRecordList=iAuctionBidRecordService.list(wrapper);
+            auctionBidRecordList = this.list(wrapper);
             }
             return auctionBidRecordList;
 
 
     }
+
+    @Override
+    public List<AuctionBidRecord> getBidRecordByGoodsId(Long id) {
+        return this.lambdaQuery().eq(AuctionBidRecord::getTargetId, id)
+                .eq(AuctionBidRecord::getAuctionType,
+                        AuctionOrderTypeEnum.REGULAR_ITEMS)
+                .orderByDesc(AuctionBidRecord::getLastBidAmount).list();
+    }
 }

--
Gitblit v1.7.1