wang-hao-jie
2021-12-08 1b4c59f5f3a0e332ad1cc27c836d98c6d2bdf22c
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/CarController.java
@@ -24,8 +24,11 @@
import org.springframework.web.bind.annotation.*;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
 * @author zhangzeli
@@ -101,6 +104,27 @@
        }
        return new ResultUtil<List<CarVo>>().setData(carVos);
    }
    @RequestMapping(value = "/getInfo", method = RequestMethod.GET)
    @ApiOperation(value = "通过车辆id获取")
    public Result<List<Car>> getInfo(String beginTime,String endTime) {
        QueryWrapper<Car> wrapper = new QueryWrapper<>();
        wrapper.ge(beginTime!=null && beginTime!="","a.add_date",beginTime);
        wrapper.le(endTime!=null && endTime!="","a.add_date",endTime);
        wrapper.groupBy("car_no");
        List<Car> list2 = iCarService.getCarInfo2(wrapper);
        List<Car> list = iCarService.getCarInfo();
        for (Car car:list2){
            for (Car car1:list){
                if (car.getId().equals(car1.getId())){
                    car1.setAmount(car.getAmount());
                    car1.setMileage(car.getMileage());
                    car1.setMoney(car.getMoney());
                    continue;
                }
            }
        }
        return new ResultUtil<List<Car>>().setData(list);
    }
    @RequestMapping(value = "/getByPage", method = RequestMethod.GET)
    @ApiOperation(value = "分页获取")