廖井涛
2024-04-07 63a1705be31f5f6a27774743a13740fa7b67b279
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
package com.example.erp.controller.pp;
 
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.util.Map;
 
@RestController
 
@Api(value="设备保养维修controller",tags={"设备保养维修操作接口"})
@RequestMapping("/maintenance")
public class DeviceMaintenanceController {
    @Autowired
    DeviceMaintenanceService deviceMaintenanceService;
 
    @ApiOperation("设备新增接口")
    @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("保养维修新增接口")
    @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")
    public Result selectMaintenance()  {
        return  Result.seccess(deviceMaintenanceService.selectMaintenanceSv());
    }
 
 
    @ApiOperation("删除维修保养记录接口")
    @PostMapping("/deleteMaintenance/{id}")
    public Result deleteMaintenance(@PathVariable String id){
        if(deviceMaintenanceService.deleteMaintenanceSv(id)){
            return Result.seccess();
        }else {
            throw new ServiceException(Constants.Code_500,"删除失败!");
 
        }
    }
 
}