| | |
| | | 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 { |
| | |
| | | @Autowired |
| | | private IDeviceMaintenanceService deviceMaintenanceService; |
| | | |
| | | @ApiModelProperty("设备报修列表") |
| | | @ApiModelProperty("设备保养列表") |
| | | @GetMapping("/page") |
| | | public AjaxResult page(Page page , DeviceMaintenanceDto deviceMaintenanceDto) { |
| | | return AjaxResult.success(deviceMaintenanceService.queryPage(page,deviceMaintenanceDto)); |
| | | } |
| | | |
| | | @PostMapping() |
| | | @ApiModelProperty("添加设备报修") |
| | | public AjaxResult add(@RequestBody DeviceMaintenance deviceRepair) { |
| | | return deviceMaintenanceService.saveDeviceRepair(deviceRepair); |
| | | @ApiModelProperty("添加设备保养") |
| | | public AjaxResult add(@RequestBody DeviceMaintenance deviceMaintenance) { |
| | | return deviceMaintenanceService.saveDeviceRepair(deviceMaintenance); |
| | | } |
| | | |
| | | @ApiModelProperty("根据id查询设备报修") |
| | | @ApiModelProperty("根据id查询设备保养") |
| | | @GetMapping("/{id}") |
| | | public AjaxResult detail(@PathVariable Long id) { |
| | | return AjaxResult.success(deviceMaintenanceService.getById(id)); |
| | | return AjaxResult.success(deviceMaintenanceService.detailById(id)); |
| | | } |
| | | |
| | | @PutMapping () |
| | | @ApiModelProperty("修改设备报修") |
| | | @ApiModelProperty("修改设备保养") |
| | | public AjaxResult update(@RequestBody DeviceMaintenance deviceMaintenance) { |
| | | return deviceMaintenanceService.updateDeviceRepair(deviceMaintenance); |
| | | return deviceMaintenanceService.updateDeviceDeviceMaintenance(deviceMaintenance); |
| | | } |
| | | |
| | | @DeleteMapping("/{id}") |
| | | @ApiModelProperty("删除设备报修") |
| | | public AjaxResult delete(@PathVariable ArrayList<Long> ids) { |
| | | boolean b = deviceMaintenanceService.removeBatchByIds(ids); |
| | | @PostMapping ("maintenance") |
| | | @ApiModelProperty("修改设备保养") |
| | | public AjaxResult maintenance(@RequestBody DeviceMaintenance deviceMaintenance) { |
| | | deviceMaintenance.setStatus(1); |
| | | return deviceMaintenanceService.updateDeviceDeviceMaintenance(deviceMaintenance); |
| | | } |
| | | |
| | | |
| | | @DeleteMapping("/{ida}") |
| | | @ApiModelProperty("删除设备保养") |
| | | public AjaxResult delete(@PathVariable("ids") Long[] ids) { |
| | | boolean b = deviceMaintenanceService.removeBatchByIds(Arrays.asList(ids)); |
| | | if (!b) { |
| | | return AjaxResult.error("删除失败"); |
| | | } |
| | |
| | | } |
| | | |
| | | @PostMapping("export") |
| | | @ApiModelProperty("导出设备报修") |
| | | @ApiModelProperty("导出设备保养") |
| | | public void export(HttpServletResponse response, Long[] ids) { |
| | | deviceMaintenanceService.export(response, ids); |
| | | } |