guoyuji
2024-05-29 a85adf40d5e30d3b9e2a848cf8fd073998ff5c8b
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
package com.example.erp.controller.pp;
 
import cn.dev33.satoken.annotation.SaCheckPermission;
import com.example.erp.common.Constants;
import com.example.erp.common.Result;
import com.example.erp.exception.ServiceException;
import com.example.erp.service.pp.DeviceMaintenanceService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
 
import java.sql.Date;
import java.util.Map;
 
@RestController
 
@Api(value="设备保养维修controller",tags={"设备保养维修操作接口"})
@RequestMapping("/maintenance")
public class DeviceMaintenanceController {
    @Autowired
    DeviceMaintenanceService deviceMaintenanceService;
 
    @ApiOperation("设备新增接口")
    @SaCheckPermission("AddMachine.add")
    @PostMapping("/saveMachine")
    public Result saveTeamGroup( @RequestBody Map<String,Object> object){
        if(deviceMaintenanceService.saveMachineSv(object)){
            return Result.seccess();
        }else {
            throw new ServiceException(Constants.Code_500,"保存失败");
 
        }
    }
    @ApiOperation("查询下拉框数据接口")
    @PostMapping  ("/selectData")
    public Result selectData()  {
        return  Result.seccess(deviceMaintenanceService.selectDataSv());
    }
 
    @ApiOperation("保养维修新增接口")
    @SaCheckPermission("AddMaintenanceAndRepair.add")
    @PostMapping("/saveMaintenanceAndRepair")
    public Result saveMaintenanceAndRepair( @RequestBody Map<String,Object> object){
        if(deviceMaintenanceService.saveMaintenanceAndRepairSv(object)){
            return Result.seccess();
        }else {
            throw new ServiceException(Constants.Code_500,"保存失败");
 
        }
    }
 
    @ApiOperation("查询维修保养数据接口")
    @PostMapping  ("/selectMaintenance/{selectTime1}/{selectTime2}")
    public Result selectMaintenance(
            @PathVariable Date selectTime1,
            @PathVariable Date selectTime2
    )  {
        return  Result.seccess(deviceMaintenanceService.selectMaintenanceSv(selectTime1,selectTime2));
    }
 
 
    @ApiOperation("删除维修保养记录接口")
    @SaCheckPermission("MaintenanceAndRepair.delete")
    @PostMapping("/deleteMaintenance/{id}")
    public Result deleteMaintenance(@PathVariable String id){
        if(deviceMaintenanceService.deleteMaintenanceSv(id)){
            return Result.seccess();
        }else {
            throw new ServiceException(Constants.Code_500,"删除失败!");
 
        }
    }
 
    @ApiOperation("查询设备管理接口")
    @SaCheckPermission("SelectMachine.search")
    @PostMapping  ("/selectMachine")
    public Result selectMachine()  {
        return  Result.seccess(deviceMaintenanceService.selectMachineSv());
    }
 
    @ApiOperation("根据Id查询对应数据接口")
    @PostMapping  ("/openSelectId/{id}")
    public Result openSelectId(
            @PathVariable String id){
        return Result.seccess(deviceMaintenanceService.openSelectIdSv(id));
 
    }
 
    @ApiOperation("设备保养维修修改接口")
    @PostMapping("/updateMaintenance")
    public Result deleteOrderWork(
            @RequestBody Map<String,Object> object
    ){
        return  Result.seccess(deviceMaintenanceService.updateMaintenance(object));
    }
}