From 6901d54eeb093a4b94f0630ae88bda7936f16919 Mon Sep 17 00:00:00 2001 From: wang-hao-jie <1550036656@qq.com> Date: 星期三, 05 一月 2022 09:30:09 +0800 Subject: [PATCH] 违章记录 --- xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/CarController.java | 28 +++++++++++++++++++++------- 1 files changed, 21 insertions(+), 7 deletions(-) diff --git a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/CarController.java b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/CarController.java index 7fd6d1d..2d5156f 100644 --- a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/CarController.java +++ b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/CarController.java @@ -4,13 +4,11 @@ import cn.exrick.xboot.core.common.utils.ResultUtil; import cn.exrick.xboot.core.common.vo.PageVo; import cn.exrick.xboot.core.common.vo.Result; -import cn.exrick.xboot.your.entity.AddOil; -import cn.exrick.xboot.your.entity.Car; -import cn.exrick.xboot.your.entity.DrivingRecord; -import cn.exrick.xboot.your.entity.Suggest; +import cn.exrick.xboot.your.entity.*; import cn.exrick.xboot.your.service.IAddOilService; import cn.exrick.xboot.your.service.ICarService; import cn.exrick.xboot.your.service.IDrivingRecordService; +import cn.exrick.xboot.your.service.IOrderTaskService; import cn.exrick.xboot.your.vo.CarVo; import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.conditions.Wrapper; @@ -46,6 +44,9 @@ private IAddOilService iAddOilService; @Autowired private IDrivingRecordService iDrivingRecordService; + @Autowired + private IOrderTaskService iOrderTaskService; + @RequestMapping(value = "/get/{id}", method = RequestMethod.GET) @ApiOperation(value = "閫氳繃id鑾峰彇") @@ -65,10 +66,11 @@ @RequestMapping(value = "/getAll", method = RequestMethod.GET) @ApiOperation(value = "鑾峰彇鍏ㄩ儴鏁版嵁") - public Result<List<CarVo>> getAll(String beginTime,String endTime) { + public Result<List<CarVo>> getAll(String beginTime,String endTime,PageVo page) { List<CarVo> carVos = new ArrayList<>(); - List<Car> list = iCarService.getAll2(); - for (Car car:list){ + + IPage<Car> list = iCarService.getAll2(PageUtil.initMpPage(page)); + for (Car car:list.getRecords()){ CarVo carVo = new CarVo(); //鍔犳补淇℃伅 QueryWrapper<AddOil> queryWrapper = new QueryWrapper<>(); @@ -85,9 +87,20 @@ wrapper.le(endTime!=null && endTime!="","in_time",endTime); queryWrapper.le(endTime!=null && endTime!="","add_date",beginTime); + QueryWrapper<OrderTask> wrapper1 = new QueryWrapper<>(); + + + wrapper1.eq("car_id",car.getId()); + wrapper1.ge(beginTime!=null && beginTime!="","send_date",beginTime); + wrapper1.le(endTime!=null && endTime!="","send_date",endTime); + + OrderTask orderTask = iOrderTaskService.getOne(wrapper1); + DrivingRecord drivingRecord = iDrivingRecordService.getOne(wrapper); AddOil addOil = iAddOilService.getOne(queryWrapper); + + if (addOil!=null){ carVo.setMoney(addOil.getMoney()); @@ -101,6 +114,7 @@ carVo.setCar(car); carVos.add(carVo); + carVo.setTotal(list.getTotal()); } return new ResultUtil<List<CarVo>>().setData(carVos); } -- Gitblit v1.9.1