zhibing.pu
2024-08-31 f6125b320b78b36c439e85d926cb2b11cd71fc6c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
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();
 
    }
 
 
 
}