lyh
2025-06-25 e756af0f5bfd1addbd5d5c145441fb34aad91a28
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
package org.jeecg.modules.dnc.controller;
 
import cn.hutool.core.util.StrUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.modules.dnc.entity.ProcessInfo;
import org.jeecg.modules.dnc.response.CommonCode;
import org.jeecg.modules.dnc.response.QueryListResponseResult;
import org.jeecg.modules.dnc.response.ResponseResult;
import org.jeecg.modules.dnc.service.IProcessInfoService;
import org.jeecg.modules.dnc.utils.ValidateUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
 
import java.util.Collections;
import java.util.List;
 
@Slf4j
@Api(tags = "新建工序表")
@RestController
@RequestMapping("/nc/process")
public class ProcessController extends JeecgController<ProcessInfo, IProcessInfoService> {
    @Autowired
    private IProcessInfoService processInfoService;
 
    @AutoLog(value = "新建工序表-新增或编辑工序基本信息")
    @ApiOperation(value = "新建工序表-新增或编辑工序基本信息", notes = "新建工序表-新增或编辑工序基本信息")
    @PostMapping("/addOrEdit")
    public ResponseResult addOrEdit(@RequestBody ProcessInfo processInfo) {
        boolean b = processInfoService.addOrEdit(processInfo);
        if(b) {
            return new ResponseResult(CommonCode.SUCCESS);
        }
        return new ResponseResult(CommonCode.FAIL);
    }
 
    @AutoLog(value = "新建工序表-根据工序名称模糊查询")
    @ApiOperation(value = "新建工序表-根据工序名称模糊查询", notes = "新建工序表-根据工序名称模糊查询")
    @GetMapping("/find/list")
    public QueryListResponseResult<ProcessInfo> findByProcessName(@RequestParam(value = "processName", required = false) String processName) {
        if(!ValidateUtil.validateString(processName))
            return new QueryListResponseResult(CommonCode.SUCCESS, Collections.emptyList());
        List<ProcessInfo> list = processInfoService.findByProcessName(processName);
        if(list == null)
            list = Collections.emptyList();
        return new QueryListResponseResult(CommonCode.SUCCESS, list);
    }
 
 
    @AutoLog(value = "新建工序表-工序列表")
    @ApiOperation(value = "新建工序表-工序列表", notes = "新建工序表-工序列表")
    @GetMapping("/find/all")
    public QueryListResponseResult<ProcessInfo> findAll() {
        List<ProcessInfo> list = processInfoService.list();
        if(list == null)
            list = Collections.emptyList();
        return new QueryListResponseResult(CommonCode.SUCCESS, list);
    }
}