| | |
| | | return ResultUtil.success("操作成功"); |
| | | } |
| | | |
| | | @RequestMapping(value = "/updateMileage", method = RequestMethod.POST) |
| | | @ApiOperation(value = "添加行车记录") |
| | | public Result<DrivingRecord> updateMileage(String carId,int mileage,String userId,String inDate) { |
| | | String format = DateUtil.format(new Date(), "yyyy-MM-dd"); |
| | | QueryWrapper<DrivingRecord> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("driving_date",format); |
| | | wrapper.eq("car_id",carId); |
| | | DrivingRecord drivingRecord = iDrivingRecordService.getOne(wrapper); |
| | | drivingRecord.setMileage(mileage); |
| | | drivingRecord.setInTime(DateUtil.parseDate(inDate)); |
| | | drivingRecord.setUserId(userId); |
| | | iDrivingRecordService.saveOrUpdate(drivingRecord); |
| | | return new ResultUtil<DrivingRecord>().setSuccessMsg("添加成功"); |
| | | } |
| | | |
| | | @RequestMapping(value = "/get/{id}", method = RequestMethod.GET) |
| | | @ApiOperation(value = "通过id获取") |
| | | public Result<DrivingRecord> get(@PathVariable String id) { |