zss
2025-01-13 8d85246f061e3da623c7b9eb4e323ee724b4de0b
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
package com.yuanchu.mom.controller;
 
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yuanchu.mom.dto.DeviceMaintenancePlanDto;
import com.yuanchu.mom.pojo.DeviceMaintenancePlan;
import com.yuanchu.mom.service.DeviceMaintenancePlanService;
import com.yuanchu.mom.utils.JackSonUtil;
import com.yuanchu.mom.vo.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.SneakyThrows;
import org.springframework.web.bind.annotation.*;
 
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;
 
/**
 * <p>
 * 设备保养计划表 前端控制器
 * </p>
 *
 * @author 江苏鵷雏网络科技有限公司
 * @since 2024-12-16 06:10:52
 */
@Api(tags = "设备保养计划")
@RestController
@RequestMapping("/deviceMaintenancePlan")
public class DeviceMaintenancePlanController {
    @Resource
    private DeviceMaintenancePlanService deviceMaintenancePlanService;
 
    /**
     * 分页查询设备保养计划
     * @param data 分页参数
     * @return
     */
    @ApiOperation("分页查询设备保养计划")
    @PostMapping("selectDeviceMaintenancePlanByPage")
    @SneakyThrows
    public Result<IPage<DeviceMaintenancePlan>> selectDeviceMaintenancePlanByPage(@RequestBody Map<String, Object> data){
        Page page = JackSonUtil.unmarshal(JackSonUtil.marshal(data.get("page")), Page.class);
        DeviceMaintenancePlanDto itemParameter = JackSonUtil.unmarshal(JackSonUtil.marshal(data.get("entity")), DeviceMaintenancePlanDto.class);
        return deviceMaintenancePlanService.selectDeviceMaintenancePlanByPage(page, itemParameter);
    }
 
    /**
     * 新增设备保养计划
     * @param deviceMaintenancePlanDto 设备保养计划
     */
    @ApiOperation("新增设备保养计划")
    @PostMapping("/addMaintenancePlan")
    public Result addMaintenancePlan(@RequestBody DeviceMaintenancePlanDto deviceMaintenancePlanDto) {
        return deviceMaintenancePlanService.addMaintenancePlan(deviceMaintenancePlanDto);
    }
 
    /**
     * 修改设备保养计划
     * @param deviceMaintenancePlanDto 设备保养计划
     */
    @ApiOperation("修改设备保养计划")
    @PostMapping("/updateMaintenancePlan")
    public Result updateMaintenancePlan(@RequestBody DeviceMaintenancePlanDto deviceMaintenancePlanDto) {
        return deviceMaintenancePlanService.updateMaintenancePlan(deviceMaintenancePlanDto);
    }
 
    /**
     * 删除设备保养计划
     * @param deviceMaintenancePlanDto 设备保养计划
     */
    @ApiOperation("删除设备保养计划")
    @GetMapping("/deleteMaintenancePlan")
    public Result deleteMaintenancePlan(DeviceMaintenancePlanDto deviceMaintenancePlanDto) {
        return deviceMaintenancePlanService.deleteMaintenancePlan(deviceMaintenancePlanDto);
    }
 
    /**
     * 查询设备保养计划详情
     */
    @ApiOperation("查询设备保养计划详情")
    @GetMapping("/getMaintenancePlanDetail")
    public Result<DeviceMaintenancePlanDto> getMaintenancePlanDetail(Integer maintenancePlanId) {
        return deviceMaintenancePlanService.getMaintenancePlanDetail(maintenancePlanId);
    }
 
    /**
     * 查询设备保养计划详情
     */
    @ApiOperation("保养计划审核状态修改")
    @PostMapping("/reviewMaintenancePlanStatus")
    public Result reviewMaintenancePlanStatus(@RequestBody DeviceMaintenancePlanDto deviceMaintenancePlanDto) {
        return deviceMaintenancePlanService.reviewMaintenancePlanStatus(deviceMaintenancePlanDto);
    }
 
    /**
     * 导出设备保养计划
     */
    @ApiOperation("导出设备保养计划")
    @GetMapping("/exportDeviceMaintenancePlan")
    public Result exportDeviceMaintenancePlan(@RequestParam("maintenancePlanId") Integer maintenancePlanId, HttpServletResponse response) {
        return deviceMaintenancePlanService.exportDeviceMaintenancePlanDto(maintenancePlanId, response);
    }
}