| | |
| | | package com.ruoyi.chargingPile.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.chargingPile.api.model.Site; |
| | | import com.ruoyi.chargingPile.api.model.TParkingLot; |
| | | import com.ruoyi.chargingPile.api.model.TParkingRecord; |
| | | import com.ruoyi.chargingPile.api.query.ParkingRecordQuery; |
| | | import com.ruoyi.chargingPile.api.vo.TParkingLotVO; |
| | | import com.ruoyi.chargingPile.api.vo.TParkingRecordPageInfoVO; |
| | | import com.ruoyi.chargingPile.api.vo.TParkingRecordVO; |
| | | import com.ruoyi.chargingPile.domain.SiteMenu; |
| | | import com.ruoyi.chargingPile.mapper.SiteMapper; |
| | | import com.ruoyi.chargingPile.mapper.TParkingLotMapper; |
| | | import com.ruoyi.chargingPile.mapper.TParkingRecordMapper; |
| | | import com.ruoyi.chargingPile.service.TParkingRecordService; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @Service |
| | | public class TParkingRecordServiceImpl extends ServiceImpl<TParkingRecordMapper, TParkingRecord> implements TParkingRecordService { |
| | | |
| | | @Autowired |
| | | private SiteMapper siteMapper; |
| | | @Autowired |
| | | private TParkingLotMapper parkingLotMapper; |
| | | |
| | | @Override |
| | | public BigDecimal getSum(LocalDate sixBefore) { |
| | | return this.baseMapper.getSum(sixBefore); |
| | | } |
| | | |
| | | @Override |
| | | public TParkingRecordPageInfoVO pageList(ParkingRecordQuery query) { |
| | | // 查询站点的停车场id |
| | | if(Objects.nonNull(query.getSiteId())){ |
| | | Site site = siteMapper.selectById(query.getSiteId()); |
| | | List<TParkingLot> tParkingLots = parkingLotMapper.selectList(Wrappers.lambdaQuery(TParkingLot.class) |
| | | .eq(TParkingLot::getSiteId, site.getId())); |
| | | List<Integer> lotIds = tParkingLots.stream().map(TParkingLot::getId).collect(Collectors.toList()); |
| | | query.setLotIds(lotIds); |
| | | } |
| | | PageInfo<TParkingRecordVO> pageInfo = new PageInfo<>(query.getPageCurr(),query.getPageSize()); |
| | | List<TParkingRecordVO> list = this.baseMapper.pageList(query,pageInfo); |
| | | pageInfo.setRecords(list); |
| | | // 查询总数 |
| | | TParkingRecordPageInfoVO infoVO = this.baseMapper.getParkingRecordCount(query); |
| | | infoVO.setParkingRecordVOS(pageInfo); |
| | | return infoVO; |
| | | } |
| | | } |