| | |
| | | package com.ruoyi.other.service.impl; |
| | | |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.other.api.domain.TAdvertising; |
| | | import com.ruoyi.other.api.domain.TVip; |
| | | import com.ruoyi.other.api.dto.AdvertisingDTO; |
| | | import com.ruoyi.other.mapper.TAdvertisingMapper; |
| | | import com.ruoyi.other.service.TAdvertisingService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @Service |
| | | public class TAdvertisingServiceImpl extends ServiceImpl<TAdvertisingMapper, TAdvertising> implements TAdvertisingService { |
| | | |
| | | @Override |
| | | public PageInfo<TAdvertising> pageList(AdvertisingDTO dto) { |
| | | |
| | | PageInfo<TAdvertising> pageInfo = new PageInfo<>(dto.getPageCurr(),dto.getPageSize()); |
| | | List<TAdvertising> list = this.baseMapper.pageList(pageInfo,dto); |
| | | for (TAdvertising tAdvertising : list) { |
| | | // 如果开始时间大于当前时间 那么设置状态startState为1 未开始 |
| | | if (tAdvertising.getStartTime().isAfter(LocalDateTime.now())) { |
| | | tAdvertising.setStartState(1); |
| | | } else if (tAdvertising.getEndTime().isBefore(LocalDateTime.now())) { |
| | | tAdvertising.setStartState(3); |
| | | } else { |
| | | tAdvertising.setStartState(2); |
| | | } |
| | | if (tAdvertising.getStatus() == 0 ){ |
| | | // 未上架 |
| | | tAdvertising.setStartState(3); |
| | | |
| | | } |
| | | } |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | } |
| | | } |