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 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 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,"删除失败!"); } } }