yaowanxin
18 小时以前 e2aa651db9f17d58819329de571037edc0f9eba2
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
63
64
65
66
67
68
69
package com.ruoyi.device.controller;
 
 
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.device.dto.DeviceMaintenanceDto;
import com.ruoyi.device.dto.DeviceRepairDto;
import com.ruoyi.device.pojo.DeviceMaintenance;
import com.ruoyi.device.pojo.DeviceRepair;
import com.ruoyi.device.service.IDeviceMaintenanceService;
import com.ruoyi.device.service.IDeviceRepairService;
import com.ruoyi.framework.web.domain.AjaxResult;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
 
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
 
 
@RestController
@RequestMapping("/device/maintenance")
public class DeviceMaintenanceController {
 
 
    @Autowired
    private IDeviceMaintenanceService deviceMaintenanceService;
 
    @ApiModelProperty("设备报修列表")
    @GetMapping("/page")
    public AjaxResult page(Page page , DeviceMaintenanceDto deviceMaintenanceDto) {
        return AjaxResult.success(deviceMaintenanceService.queryPage(page,deviceMaintenanceDto));
    }
 
    @PostMapping()
    @ApiModelProperty("添加设备报修")
    public AjaxResult add(@RequestBody DeviceMaintenance deviceRepair) {
        return deviceMaintenanceService.saveDeviceRepair(deviceRepair);
    }
 
    @ApiModelProperty("根据id查询设备报修")
    @GetMapping("/{id}")
    public AjaxResult detail(@PathVariable Long id) {
        return AjaxResult.success(deviceMaintenanceService.getById(id));
    }
 
    @PutMapping ()
    @ApiModelProperty("修改设备报修")
    public AjaxResult update(@RequestBody DeviceMaintenance deviceMaintenance) {
        return deviceMaintenanceService.updateDeviceRepair(deviceMaintenance);
    }
 
    @DeleteMapping("/{id}")
    @ApiModelProperty("删除设备报修")
    public AjaxResult delete(@PathVariable ArrayList<Long> ids) {
        boolean b = deviceMaintenanceService.removeBatchByIds(ids);
        if (!b) {
            return AjaxResult.error("删除失败");
        }
        return AjaxResult.success();
    }
 
    @PostMapping("export")
    @ApiModelProperty("导出设备报修")
    public void export(HttpServletResponse response, Long[] ids) {
        deviceMaintenanceService.export(response, ids);
    }
 
 
}