zss
2023-08-18 1db3bc9e405c959566dd19b549aff743793362bd
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
package com.yuanchu.mom.controller;
 
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yuanchu.mom.pojo.Device;
import com.yuanchu.mom.service.DeviceService;
import com.yuanchu.mom.service.RawInsProductService;
import com.yuanchu.mom.service.UserService;
import com.yuanchu.mom.utils.MyUtil;
import com.yuanchu.mom.vo.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
 
import java.util.List;
import java.util.Map;
 
/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 江苏鵷雏网络科技有限公司
 * @since 2023-07-31
 */
@Api(tags = "技术管理-->标准MOM-->工艺路线")
@RestController
@RequestMapping("/device")
public class DeviceController {
 
    @Autowired
    private DeviceService deviceService;
 
    @Autowired
    private UserService userService;
 
    @Autowired
    private RawInsProductService rawInsProductService;
 
    @ApiOperation(value = "点击表格中的选择")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "deviceGroup", value = "设备组", dataTypeClass = String.class, required = true)
    })
    @GetMapping("/select")
    public Result<?> selectTreeDevice(String deviceGroup){
        Map<String, Object> map = deviceService.selectTechnology(deviceGroup);
        return Result.success(map);
    }
 
    @ApiOperation(value = "新增仪器设备", tags = "QMS管理-->实验室管理")
    @PostMapping("/add")
    public Result<?> addDevice(@RequestBody Device device){
        Boolean isUpdateSuccess = deviceService.addDevice(device);
        if (isUpdateSuccess){
            return Result.success("添加成功!");
        }
        return Result.fail("添加失败!");
    }
 
    @ApiOperation(value = "新增仪器设备:保管人下拉框", tags = "QMS管理-->实验室管理")
    @GetMapping("/list_user")
    public Result<?> selectUserIdAndName(){
        List<Map<String, Object>> maps = userService.listUserIdAndName();
        return Result.success(maps);
    }
 
    @ApiOperation(value = "二级树:默认生产设备", tags = "QMS管理-->实验室管理")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "type", value = "类型", dataTypeClass = String.class),
            @ApiImplicitParam(name = "search_class", value = "搜索框内容", dataTypeClass = String.class)
    })
    @GetMapping("/two_tree")
    public Result<?> deviceTwoTree(@RequestParam(defaultValue = "1") Integer type, String search_class){
        List<Map<String, Object>> mapList= deviceService.deviceTwoTree(type, search_class);
        return Result.success(mapList);
    }
 
    @ApiOperation(value = "新增仪器设备:检验项目下拉框", tags = "QMS管理-->实验室管理")
    @GetMapping("/listInspect")
    public Result<?> selectInspectIdAndName(){
        List<Map<String, Object>> mapList = rawInsProductService.selectInspectIdAndName();
        return Result.success(mapList);
    }
 
    @ApiOperation(value = "新增仪器设备:检验项目下拉框", tags = "QMS管理-->实验室管理")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "pageNo", value = "条数/页", dataTypeClass = Integer.class, required = true),
            @ApiImplicitParam(name = "pageSize", value = "页数", dataTypeClass = Integer.class, required = true),
            @ApiImplicitParam(name = "codeOrNameOrModel", value = "编号名称规格型号", dataTypeClass = String.class)
    })
    @GetMapping("/page")
    public Result<?> selectPageDevice(Integer pageNo, Integer pageSize, String codeOrNameOrModel){
        IPage<Map<String, Object>> mapList = rawInsProductService.selectPageDevice(pageNo, pageSize, codeOrNameOrModel);
        return Result.success(mapList);
    }
 
    @ApiOperation(value = "新增仪器设备:根据检验项目ID查询数据", tags = "QMS管理-->实验室管理")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "inspectId", value = "检验项目Id", dataTypeClass = Integer.class, required = true)
    })
    @GetMapping("/inspectId")
    public Result<?> inspectIdSelect(Integer inspectId){
        Map<String, Object> map = rawInsProductService.inspectIdSelect(inspectId);
        return Result.success(map);
    }
 
    @ApiOperation(value = "新增仪器设备:查询父级分类", tags = "QMS管理-->实验室管理")
    @GetMapping("/parent_classification")
    public Result<?> parentClassification(){
        List<Map<String, Object>> map = rawInsProductService.parentClassification();
        return Result.success(map);
    }
 
    @ApiOperation(value = "实验室模块表格数据", tags = "QMS管理-->实验室管理")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "type", value = "类型:默认生产设备", dataTypeClass = Integer.class),
            @ApiImplicitParam(name = "codeNameModel", value = "编号名称规格型号", dataTypeClass = String.class),
            @ApiImplicitParam(name = "deviceStatue", value = "设备状态", dataTypeClass = Integer.class),
            @ApiImplicitParam(name = "deviceId", value = "设备Id", dataTypeClass = Integer.class),
            @ApiImplicitParam(name = "fatherName", value = "父级分类", dataTypeClass = String.class)
    })
    @GetMapping("/table_list")
    public Result<?> tableData(String codeNameModel, @RequestParam(defaultValue = "1") Integer type, Integer deviceStatue, Integer deviceId, String fatherName){
        List<Map<String, Object>> map = deviceService.DevicePageList(codeNameModel, type, deviceStatue, deviceId, fatherName);
        return Result.success(map);
    }
 
    @ApiOperation(value = "删除实验室模块数据", tags = "QMS管理-->实验室管理")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "deviceId", value = "根据设备Id删除", dataTypeClass = Integer.class)
    })
    @DeleteMapping("/delete")
    public Result<?> deviceDelete(Integer deviceId){
        Integer map = deviceService.deviceDelete(deviceId);
        if (map == 1){
            return Result.success("删除成功!");
        }
        return Result.fail("删除失败!");
    }
 
    @ApiOperation(value = "删除树模块数据", tags = "QMS管理-->实验室管理")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "id", value = "根据设备Id删除", dataTypeClass = Integer.class),
            @ApiImplicitParam(name = "type", value = "设备类型", dataTypeClass = Integer.class),
            @ApiImplicitParam(name = "deviceFather", value = "根据设备分类删除", dataTypeClass = String.class)
    })
    @DeleteMapping("/deleteIdorFather")
    public Result<?> deviceDeleteIdOrFather(Integer id, Integer type, String deviceFather){
        Integer map = deviceService.deviceDeleteIdOrFather(id, type, deviceFather);
        if (map >= 1){
            return Result.success("删除成功!");
        }
        return Result.fail("删除失败!");
    }
}