package com.ruoyi.basic.controller;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.ruoyi.common.core.domain.Result;
|
import com.ruoyi.basic.dto.DefectiveProductAuditDto;
|
import com.ruoyi.basic.dto.DefectiveProductDto;
|
import com.ruoyi.basic.pojo.QualityDefectiveProduct;
|
import com.ruoyi.basic.service.QualityDefectiveProductService;
|
import io.swagger.annotations.Api;
|
import io.swagger.annotations.ApiOperation;
|
import org.springframework.web.bind.annotation.*;
|
|
import javax.annotation.Resource;
|
|
/**
|
* 不良品登记控制器
|
*/
|
@Api(tags = "不良品登记")
|
@RestController
|
@RequestMapping("/quality/defectiveProduct")
|
public class QualityDefectiveProductController {
|
|
@Resource
|
private QualityDefectiveProductService defectiveProductService;
|
|
/**
|
* 查询不良品登记列表
|
*/
|
@ApiOperation(value = "查询不良品登记列表")
|
@GetMapping("/list")
|
public Result<IPage<QualityDefectiveProduct>> pageDefectiveProduct(Page<QualityDefectiveProduct> page, QualityDefectiveProduct query) {
|
return Result.success(defectiveProductService.selectPage(page, query));
|
}
|
|
/**
|
* 获取不良品详情
|
*/
|
@ApiOperation(value = "获取不良品详情")
|
@GetMapping("/get")
|
public Result<QualityDefectiveProduct> getDefectiveProduct(Long id) {
|
return Result.success(defectiveProductService.selectById(id));
|
}
|
|
/**
|
* 新增不良品登记
|
*/
|
@ApiOperation(value = "新增不良品登记")
|
@PostMapping
|
public Result<Integer> addDefectiveProduct(@RequestBody DefectiveProductDto data) {
|
return Result.success(defectiveProductService.insert(data));
|
}
|
|
/**
|
* 修改不良品登记
|
*/
|
@ApiOperation(value = "修改不良品登记")
|
@PostMapping("/update")
|
public Result<Integer> updateDefectiveProduct(@RequestBody QualityDefectiveProduct data) {
|
return Result.success(defectiveProductService.update(data));
|
}
|
|
/**
|
* 删除不良品登记(支持批量删除)
|
*/
|
@ApiOperation(value = "删除不良品登记")
|
@DeleteMapping("/delete")
|
public Result<Integer> deleteDefectiveProduct(Long[] ids) {
|
if (ids == null || ids.length == 0) {
|
return Result.fail("请选择要删除的记录");
|
}
|
if (ids.length == 1) {
|
return Result.success(defectiveProductService.deleteById(ids[0]));
|
}
|
return Result.success(defectiveProductService.deleteBatchIds(ids));
|
}
|
|
/**
|
* 查询不良品审核列表
|
*/
|
@ApiOperation(value = "查询不良品审核列表")
|
@GetMapping("/audit/page")
|
public Result<IPage<QualityDefectiveProduct>> pageDefectiveProductAudit(Page<QualityDefectiveProduct> page, QualityDefectiveProduct query) {
|
// 审核列表支持按审核状态筛选,不传则查询所有状态
|
return Result.success(defectiveProductService.selectPage(page, query));
|
}
|
|
/**
|
* 不良品审核
|
*/
|
@ApiOperation(value = "不良品审核")
|
@PostMapping("/audit")
|
public Result<Integer> auditDefectiveProduct(@RequestBody DefectiveProductAuditDto data) {
|
return Result.success(defectiveProductService.audit(data));
|
}
|
}
|