package com.ruoyi.chargingPile.controller;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.ruoyi.chargingPile.api.model.TParkingLot;
|
import com.ruoyi.chargingPile.api.model.TParkingRecord;
|
import com.ruoyi.chargingPile.dto.ParkingRecordPageQuery;
|
import com.ruoyi.chargingPile.service.TParkingLotService;
|
import com.ruoyi.chargingPile.service.TParkingRecordService;
|
import com.ruoyi.common.core.domain.R;
|
import com.ruoyi.common.core.web.domain.AjaxResult;
|
import io.swagger.annotations.ApiOperation;
|
import org.springframework.web.bind.annotation.*;
|
|
import javax.annotation.Resource;
|
|
/**
|
* <p>
|
* 前端控制器
|
* </p>
|
*
|
* @author xiaochen
|
* @since 2024-08-08
|
*/
|
@RestController
|
@RequestMapping("/t-parking-record")
|
public class TParkingRecordController {
|
@Resource
|
private TParkingRecordService parkingRecordService;
|
@Resource
|
private TParkingLotService parkingLotService;
|
|
@ApiOperation(tags = {"后台-订单管理-停车记录"},value = "列表")
|
@PostMapping(value = "/page")
|
public R<Page<TParkingRecord>> page(@RequestBody ParkingRecordPageQuery query) {
|
Page<TParkingRecord> page = parkingRecordService.lambdaQuery().ge(query.getStart() != null, TParkingRecord::getCreateTime, query.getStart())
|
.le(query.getEnd() != null, TParkingRecord::getCreateTime, query.getEnd())
|
.like(query.getLicensePlate() != null, TParkingRecord::getLicensePlate, query.getLicensePlate())
|
.eq(query.getStatus() != null, TParkingRecord::getStatus, query.getStatus())
|
.eq(query.getOutParkingType() != null, TParkingRecord::getOutParkingType, query.getOutParkingType())
|
.page(Page.of(query.getPageCurr(), query.getPageSize()));
|
|
for (TParkingRecord record : page.getRecords()) {
|
record.setName(parkingLotService.getById(record.getParkingLotId()).getName());
|
record.setUid(record.getId().toString());
|
}
|
return R.ok(page);
|
}
|
|
@ApiOperation(tags = {"后台-订单管理-停车记录"},value = "出场")
|
@GetMapping(value = "/out")
|
public R out(Long id) {
|
TParkingRecord byId = parkingRecordService.getById(id);
|
byId.setStatus(2);
|
parkingRecordService.updateById(byId);
|
return R.ok();
|
|
}
|
|
|
|
}
|