| | |
| | | import com.ruoyi.device.service.IDeviceMaintenanceService; |
| | | import com.ruoyi.device.service.IDeviceRepairService; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import io.swagger.annotations.Api; |
| | | 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; |
| | | import java.util.Arrays; |
| | | |
| | | |
| | | @Api(tags = "设备保养") |
| | | @RestController |
| | | @RequestMapping("/device/maintenance") |
| | | public class DeviceMaintenanceController { |
| | |
| | | |
| | | @PostMapping() |
| | | @ApiModelProperty("添加设备保养") |
| | | public AjaxResult add(@RequestBody DeviceMaintenance deviceRepair) { |
| | | return deviceMaintenanceService.saveDeviceRepair(deviceRepair); |
| | | public AjaxResult add(@RequestBody DeviceMaintenance deviceMaintenance) { |
| | | return deviceMaintenanceService.saveDeviceRepair(deviceMaintenance); |
| | | } |
| | | |
| | | @ApiModelProperty("根据id查询设备保养") |
| | |
| | | @PutMapping () |
| | | @ApiModelProperty("修改设备保养") |
| | | public AjaxResult update(@RequestBody DeviceMaintenance deviceMaintenance) { |
| | | return deviceMaintenanceService.updateDeviceRepair(deviceMaintenance); |
| | | return deviceMaintenanceService.updateDeviceDeviceMaintenance(deviceMaintenance); |
| | | } |
| | | |
| | | @PostMapping ("maintenance") |
| | | @ApiModelProperty("修改设备保养") |
| | | public AjaxResult maintenance(@RequestBody DeviceMaintenance deviceMaintenance) { |
| | | return deviceMaintenanceService.updateDeviceRepair(deviceMaintenance); |
| | | deviceMaintenance.setStatus(1); |
| | | return deviceMaintenanceService.updateDeviceDeviceMaintenance(deviceMaintenance); |
| | | } |
| | | |
| | | |
| | | @DeleteMapping("/{id}") |
| | | @DeleteMapping("/{ida}") |
| | | @ApiModelProperty("删除设备保养") |
| | | public AjaxResult delete(@PathVariable ArrayList<Long> ids) { |
| | | boolean b = deviceMaintenanceService.removeBatchByIds(ids); |
| | | public AjaxResult delete(@PathVariable("ids") Long[] ids) { |
| | | boolean b = deviceMaintenanceService.removeBatchByIds(Arrays.asList(ids)); |
| | | if (!b) { |
| | | return AjaxResult.error("删除失败"); |
| | | } |