liyong
昨天 beb0fc04f59f4f448e70d8de9ae39161632de2fb
src/main/java/com/ruoyi/device/controller/DeviceRepairController.java
@@ -15,14 +15,18 @@
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.Arrays;
@Api(tags = "设备报修管理")
@RequestMapping("/device/reppair")
@RequestMapping("/device/repair")
@RestController
public class DeviceRepairController {
    @Autowired
    private IDeviceRepairService deviceRepairService;
    @Autowired
    private IDeviceLedgerService deviceLedgerService;
    @ApiModelProperty("设备报修列表")
    @GetMapping("/page")
@@ -32,26 +36,37 @@
    @PostMapping()
    @ApiModelProperty("添加设备报修")
    public AjaxResult add(DeviceRepair deviceRepair) {
    public AjaxResult add( @RequestBody DeviceRepair deviceRepair) {
        DeviceLedger byId = deviceLedgerService.getById(deviceRepair.getDeviceLedgerId());
        deviceRepair.setDeviceName(byId.getDeviceName());
        deviceRepair.setDeviceModel(byId.getDeviceModel());
        return deviceRepairService.saveDeviceRepair(deviceRepair);
    }
    @ApiModelProperty("根据id查询设备报修")
    @GetMapping("/{id}")
    public AjaxResult detail(@PathVariable Long id) {
        return AjaxResult.success(deviceRepairService.getById(id));
        DeviceRepairDto byId = deviceRepairService.detailById(id);
        return AjaxResult.success(byId);
    }
    @PutMapping ()
    @ApiModelProperty("修改设备报修")
    public AjaxResult update(DeviceRepair deviceRepair) {
    public AjaxResult update( @RequestBody DeviceRepair deviceRepair) {
        return deviceRepairService.updateDeviceRepair(deviceRepair);
    }
    @DeleteMapping("/{id}")
    @PostMapping ("repair")
    @ApiModelProperty("设备维修")
    public AjaxResult repair( @RequestBody DeviceRepair deviceRepair) {
        deviceRepair.setStatus(1);
        return deviceRepairService.updateDeviceRepair(deviceRepair);
    }
    @DeleteMapping("/{ids}")
    @ApiModelProperty("删除设备报修")
    public AjaxResult delete(@PathVariable ArrayList<Long> ids) {
        boolean b = deviceRepairService.removeBatchByIds(ids);
    public AjaxResult delete(@PathVariable("ids") Long[] ids) {
        boolean b = deviceRepairService.removeBatchByIds(Arrays.asList(ids));
        if (!b) {
            return AjaxResult.error("删除失败");
        }