huminmin
2026-06-05 47d31d92a762cda66ff40de2f6cb111a408b146f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
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));
    }
}