1111
作者:互联网
@Service public class VehicleServiceImpl extends ServiceImpl<VehicleMapper, Vehicle> implements IVehicleService { @Autowired private VehicleMapper vehicleMapper; @Override public PageData<VehicleVo> getCaroutDetail(Integer pageNo, Integer pageSize) { PageData<VehicleVo> result = new PageData<>(); Page<Vehicle> pageinfo=new Page<>(pageNo,pageSize); IPage<Vehicle> recordDoIpage =vehicleMapper.selectPage(pageinfo,new QueryWrapper<Vehicle>().eq("status",1)); result.setPageNo((long)pageNo); result.setTotal(recordDoIpage.getTotal()); result.setPageSize(recordDoIpage.getSize()); result.setTotalPage(recordDoIpage.getTotal().); result.setList(recordDoIpage.getRecords().stream().map(obj ->beanProcess(obj)).collect(Collectors.toList())); return result; } @Override public PageData<VehicleVo> getCarinDetail(Integer pageNo, Integer pageSize) { PageData<VehicleVo> result = new PageData<>(); Page<Vehicle> pageinfo=new Page<>(pageNo,pageSize); IPage<Vehicle> recordDoIpage =vehicleMapper.selectPage(pageinfo,new QueryWrapper<Vehicle>().eq("status",0)); result.setPageNo((long)pageNo); result.setTotal(recordDoIpage.getTotal()); result.setPageSize(recordDoIpage.getSize()); result.setTotalPage(recordDoIpage.getTotal().); result.setList(recordDoIpage.getRecords().stream().map(obj ->beanProcess(obj)).collect(Collectors.toList())); return result; } private VehicleVo beanProcess(Vehicle vehicle) { VehicleVo vehicleVo = new VehicleVo(); BeanUtils.copyProperties(vehicle,vehicleVo); return vehicleVo; } }
public interface IVehicleService extends IService<Vehicle> {
/**
* 查询出园车辆的数据
* @param pageNo
* @param pageSize
* @return
*/
PageData<VehicleVo> getCaroutDetail (Integer pageNo, Integer pageSize);
/**
* 查询预约入园车辆的数据
* @param pageNo
* @param pageSize
* @return
*/
PageData<VehicleVo> getCarinDetail(Integer pageNo, Integer pageSize);
}
/** * 预约车辆进厂数据 * @return */ @GetMapping("") public BaseResponse<PageData<VehicleVo>> getVisitorCarList(Integer pageSize,Integer pageNo) { return new BaseResponse<>(iVehicleService.getCarinDetail(pageNo, pageSize)); } /** * 当天车流量时段统计 * @return */ @GetMapping("") public BaseResponse<EchartsDto> getCarStatistic() { return super.success(); } /** * 出园车辆数据 * @return */ @GetMapping("") public BaseResponse<PageData<VehicleVo>> getCarOutList(Integer pageSize,Integer pageNo) { return new BaseResponse<>(iVehicleService.getCaroutDetail(pageNo, pageSize)); }
标签:return,pageNo,pageSize,recordDoIpage,1111,result,Integer 来源: https://www.cnblogs.com/ttxxdd/p/16455912.html