广丰卷烟厂数采质量分析系统
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
package org.dromara.qa.qm.controller;
 
import java.util.List;
import java.util.Map;
 
import lombok.RequiredArgsConstructor;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.constraints.*;
import cn.dev33.satoken.annotation.SaCheckPermission;
import org.springframework.web.bind.annotation.*;
import org.springframework.validation.annotation.Validated;
import org.dromara.common.idempotent.annotation.RepeatSubmit;
import org.dromara.common.log.annotation.Log;
import org.dromara.common.web.core.BaseController;
import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.common.core.domain.R;
import org.dromara.common.core.validate.AddGroup;
import org.dromara.common.core.validate.EditGroup;
import org.dromara.common.log.enums.BusinessType;
import org.dromara.common.excel.utils.ExcelUtil;
import org.dromara.qa.qm.domain.vo.QmCheckitemVo;
import org.dromara.qa.qm.domain.bo.QmCheckitemBo;
import org.dromara.qa.qm.service.IQmCheckitemService;
import org.dromara.common.mybatis.core.page.TableDataInfo;
 
/**
 * 规程检验项目
 *
 * @author zhuguifei
 * @date 2026-03-12
 */
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/qm/checkitem")
public class QmCheckitemController extends BaseController {
 
    private final IQmCheckitemService qmCheckitemService;
 
    /**
     * 查询规程检验项目列表
     */
    @SaCheckPermission("qm:checkitem:list")
    @GetMapping("/list")
    public TableDataInfo<QmCheckitemVo> list(QmCheckitemBo bo, PageQuery pageQuery) {
        return qmCheckitemService.queryPageList(bo, pageQuery);
    }
 
    @SaCheckPermission("qm:checkitem:list")
    @GetMapping("/tree")
    public TableDataInfo<QmCheckitemVo> tree(@RequestParam @NotBlank(message = "stdCode不能为空") String stdCode,
                                             @RequestParam(required = false) Integer page,
                                             @RequestParam(required = false) Integer rows) {
        List<QmCheckitemVo> list = qmCheckitemService.queryTreeListByStdCode(stdCode);
        return TableDataInfo.build(list);
    }
 
    /**
     * 根据 stdCode 查询规程检验项目的 id 和 itemName 列表
     * @param stdCode 规程代码
     * @return 包含 id 和 text 的列表
     */
    @SaCheckPermission("qm:checkitem:list") // 假设使用相同的权限
    @GetMapping("/getRid")
    public R<List<Map<String, String>>> getRid(@RequestParam @NotBlank(message = "stdCode不能为空") String stdCode) { // 修改返回类型
        List<Map<String, String>> list = qmCheckitemService.getRid(stdCode);
        return R.ok(list);
    }
 
 
    /**
     * 导出规程检验项目列表
     */
    @SaCheckPermission("qm:checkitem:export")
    @Log(title = "规程检验项目", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(QmCheckitemBo bo, HttpServletResponse response) {
        List<QmCheckitemVo> list = qmCheckitemService.queryList(bo);
        ExcelUtil.exportExcel(list, "规程检验项目", QmCheckitemVo.class, response);
    }
 
    /**
     * 获取规程检验项目详细信息
     *
     * @param id 主键
     */
    @SaCheckPermission("qm:checkitem:query")
    @GetMapping("/{id}")
    public R<QmCheckitemVo> getInfo(@NotNull(message = "主键不能为空")
                                     @PathVariable String id) {
        return R.ok(qmCheckitemService.queryById(id));
    }
 
    /**
     * 新增规程检验项目
     */
    @SaCheckPermission("qm:checkitem:add")
    @Log(title = "规程检验项目", businessType = BusinessType.INSERT)
    @RepeatSubmit()
    @PostMapping()
    public R<Void> add(@Validated(AddGroup.class) @RequestBody QmCheckitemBo bo) {
        return toAjax(qmCheckitemService.insertByBo(bo));
    }
 
    /**
     * 修改规程检验项目
     */
    @SaCheckPermission("qm:checkitem:edit")
    @Log(title = "规程检验项目", businessType = BusinessType.UPDATE)
    @RepeatSubmit()
    @PutMapping()
    public R<Void> edit(@Validated(EditGroup.class) @RequestBody QmCheckitemBo bo) {
        return toAjax(qmCheckitemService.updateByBo(bo));
    }
 
    /**
     * 删除规程检验项目
     *
     * @param ids 主键串
     */
    @SaCheckPermission("qm:checkitem:remove")
    @Log(title = "规程检验项目", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public R<Void> remove(@NotEmpty(message = "主键不能为空")
                          @PathVariable String[] ids) {
        return toAjax(qmCheckitemService.deleteWithValidByIds(List.of(ids), true));
    }
}