Forráskód Böngészése

公告列表排序

linhui.li 3 hete
szülő
commit
c636619c5b

+ 4 - 1
lot/src/main/java/cn/hobbystocks/auc/service/impl/LotNoticeServiceImpl.java

@@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.stereotype.Service;
 
+import java.util.Date;
 import java.util.List;
 
 @Service
@@ -20,7 +21,7 @@ public class LotNoticeServiceImpl extends ServiceImpl<LotNoticeMapper, LotNotice
         LambdaQueryWrapper<LotNotice> lotNoticeLambdaQueryWrapper = new LambdaQueryWrapper<>();
         if (StringUtils.isNotEmpty(lotNotice.getTitle()))
             lotNoticeLambdaQueryWrapper.eq(LotNotice::getTitle,lotNotice.getTitle());
-
+        lotNoticeLambdaQueryWrapper.orderByDesc(LotNotice::getId);
         return getBaseMapper().selectList(lotNoticePage, lotNoticeLambdaQueryWrapper);
     }
 
@@ -33,6 +34,8 @@ public class LotNoticeServiceImpl extends ServiceImpl<LotNoticeMapper, LotNotice
     public int pubLotNotice(LotNotice lotNotice) {
         LambdaUpdateWrapper<LotNotice> updateWrapper = new LambdaUpdateWrapper<>();
         updateWrapper.eq(LotNotice::getId,lotNotice.getId()).set(LotNotice::getStatus,lotNotice.getStatus());
+        if (lotNotice.getStatus()==1)
+            updateWrapper.set(LotNotice::getPubTime,new Date());
         return getBaseMapper().update(updateWrapper);
     }
 }