hsy
2026-08-28 a8e4132c3e2e9c3b3fcb0360901b35571b6464ea
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
package com.ruoyi.vehicle.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.vehicle.pojo.FuelRecord;
import com.ruoyi.vehicle.service.FuelRecordService;
import com.ruoyi.vehicle.mapper.FuelRecordMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
 
@RestController
@RequestMapping("/vehicle/fuelRecord")
public class FuelRecordController {
    @Autowired
    private FuelRecordService fuelRecordService;
    @Autowired
    private FuelRecordMapper fuelRecordMapper;
 
    @GetMapping("/listPage")
    public AjaxResult listPage(Page<FuelRecord> page, FuelRecord query, String beginDate, String endDate) {
        IPage<FuelRecord> pageInfo = fuelRecordMapper.selectFuelRecordPage(page, query, beginDate, endDate);
        return AjaxResult.success(pageInfo);
    }
 
    @PostMapping
    public AjaxResult add(@RequestBody FuelRecord entity) {
        return AjaxResult.success(fuelRecordService.saveRecord(entity));
    }
 
    @PutMapping
    public AjaxResult edit(@RequestBody FuelRecord entity) {
        return AjaxResult.success(fuelRecordService.updateRecord(entity));
    }
 
    @DeleteMapping("/{id}")
    public AjaxResult remove(@PathVariable Long id) {
        return AjaxResult.success(fuelRecordService.removeRecordById(id));
    }
    @PostMapping("/submit/{id}")
    public AjaxResult submit(@PathVariable Long id) {
        try {
            fuelRecordService.submitRecord(id);
            return AjaxResult.success();
        } catch (Exception e) {
            return AjaxResult.error(e.getMessage());
        }
    }
 
    @PostMapping("/revoke/{id}")
    public AjaxResult revoke(@PathVariable Long id) {
        try {
            fuelRecordService.revokeRecord(id);
            return AjaxResult.success();
        } catch (Exception e) {
            return AjaxResult.error(e.getMessage());
        }
    }
}