gongchunyi
5 天以前 e7a970151c40925eefa1fe837ac06e93594fcf82
src/main/java/com/ruoyi/device/controller/DeviceDefectRecordController.java
@@ -4,24 +4,26 @@
import com.ruoyi.device.dto.DeviceDefectRecordDto;
import com.ruoyi.device.pojo.DeviceDefectRecord;
import com.ruoyi.device.service.DeviceDefectRecordService;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.framework.web.domain.AjaxResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;
@Api(tags = "设备缺陷记录管理")
@Tag(name = "设备缺陷记录管理")
@RequestMapping("/defect")
@AllArgsConstructor
@RestController
public class DeviceDefectRecordController {
    @Autowired
    private DeviceDefectRecordService deviceDefectRecordService;
    @ApiOperation("设备缺陷记录列表")
    @Operation(summary = "设备缺陷记录列表")
    @GetMapping("/page")
    public AjaxResult page(Page page , DeviceDefectRecordDto deviceDefectRecordDto) {
        return AjaxResult.success(deviceDefectRecordService.listPage(page,deviceDefectRecordDto));
    }
    @ApiOperation("设备id查询设备缺陷记录列表")
    @Operation(summary = "设备id查询设备缺陷记录列表")
    @GetMapping("/find/{deviceLedgerId}")
    public AjaxResult find(@PathVariable Long deviceLedgerId) {
        DeviceDefectRecordDto deviceDefectRecordDto = new DeviceDefectRecordDto();
@@ -29,18 +31,21 @@
        return AjaxResult.success(deviceDefectRecordService.listPage(new Page<>(1,-1),deviceDefectRecordDto));
    }
    @Log(title = "新增设备缺陷记录", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @ApiOperation("添加设备缺陷记录")
    @Operation(summary = "添加设备缺陷记录")
    public AjaxResult add(@RequestBody DeviceDefectRecord deviceDefectRecord) {
        return AjaxResult.success(deviceDefectRecordService.add(deviceDefectRecord));
    }
    @Log(title = "修改设备缺陷记录", businessType = BusinessType.UPDATE)
    @PostMapping("/update")
    @ApiOperation("修改设备缺陷记录")
    @Operation(summary = "修改设备缺陷记录")
    public AjaxResult update(@RequestBody DeviceDefectRecord deviceDefectRecord) {
        return AjaxResult.success(deviceDefectRecordService.updateByDDR(deviceDefectRecord));
    }
    @Log(title = "删除设备缺陷记录", businessType = BusinessType.DELETE)
    @DeleteMapping("/delete")
    @ApiOperation("删除设备缺陷记录")
    @Operation(summary = "删除设备缺陷记录")
    public AjaxResult delete(@PathVariable Long id) {
        return AjaxResult.success(deviceDefectRecordService.removeById(id));
    }