郑永安
2023-09-19 69185134fcfaf913ea45f1255677225a2cc311a4
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
package com.gk.hotwork.doublePrevention.controller;
 
import com.gk.hotwork.Controller.Base.BaseController;
import com.gk.hotwork.Domain.co.ContextCacheUser;
import com.gk.hotwork.Domain.Vo.ResultVO;
import com.gk.hotwork.doublePrevention.entity.PreventProduceDevice;
import com.gk.hotwork.doublePrevention.entity.dto.req.*;
import com.gk.hotwork.doublePrevention.service.RiskService;
import com.gk.hotwork.doublePrevention.utils.CacheUserTransfer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.Authentication;
import org.springframework.web.bind.annotation.*;
 
 
/**
 * @author qihs
 * @since 2022-06-25 10:40:17
 */
@RestController
@RequestMapping("prevent/device")
public class PreventProduceDeviceController extends BaseController {
 
    @Autowired
    private RiskService riskService;
 
    /**
     * 生产装置-分页查询
     * @param deviceQueryReqDtoReqDto
     */
    @PostMapping("/select/getDevicePage")
    public ResultVO<PreventProduceDevice> getDevicePage(@RequestBody PreventProduceDeviceQueryReqDTO deviceQueryReqDtoReqDto) {
 
        return riskService.getDevicePage(deviceQueryReqDtoReqDto);
    }
 
    /**
     * 生产装置-新增
     * @param deviceSaveReqDto
     */
    @PostMapping("/insert/saveDevice")
    public ResultVO<PreventProduceDevice> saveDevice(Authentication authentication, @RequestBody PreventProduceDeviceSaveReqDTO deviceSaveReqDto) {
        //获取用户信息
        ContextCacheUser currentUser = CacheUserTransfer.transfer(getUser());
        return riskService.saveDevice(currentUser.getUid(), deviceSaveReqDto);
    }
 
    /**
     * 生产装置- 查询生产装置列表
     */
    @PostMapping("/select/listDevices")
    public ResultVO<PreventProduceDevice> getListDevices(Authentication authentication) {
        //获取用户信息
        ContextCacheUser currentUser = CacheUserTransfer.transfer(getUser());
        return riskService.getListDevices(currentUser.getUid());
    }
 
    /**
     * 生产装置-删除
     * @param deviceDeleteReqDTO
     */
    @PostMapping("/delete/deleteDevice")
    public ResultVO<PreventProduceDevice> deleteDevice(Authentication authentication, @RequestBody PreventProduceDeviceDeleteReqDTO deviceDeleteReqDTO) {
        //获取用户信息
        ContextCacheUser currentUser = CacheUserTransfer.transfer(getUser());
        return riskService.deleteOne(currentUser.getUid(), deviceDeleteReqDTO);
    }
    /**
     * 生产装置-批量删除
     */
    @PostMapping("/delete/deleteBatchDevice")
    public ResultVO<PreventProduceDevice> deleteBatchDevice(Authentication authentication, @RequestBody DeleteBatchReqDTO deleteBatchReqDTO) {
        //获取用户信息
        ContextCacheUser currentUser = CacheUserTransfer.transfer(getUser());
        return riskService.deleteBatchDevice(currentUser, deleteBatchReqDTO);
    }
 
    /**
     * 生产装置-修改
     * @param deviceUpdateReqDTO
     */
    @PostMapping("/update/updateDevice")
    public ResultVO<PreventProduceDevice> updateDevice(Authentication authentication, @RequestBody PreventProduceDeviceUpdateReqDTO deviceUpdateReqDTO) {
        //获取用户信息
        ContextCacheUser currentUser = CacheUserTransfer.transfer(getUser());
        return riskService.updateOneById(currentUser.getUid(), deviceUpdateReqDTO);
    }
 
 
 
 
 
 
    /**
     * 生产装置-按照等级查询
     * @param deviceQueryReqDTO
     */
    @GetMapping("/select/getListByLevel")
    public ResultVO<PreventProduceDevice> getByLevel(@RequestBody PreventProduceDeviceQueryReqDTO deviceQueryReqDTO) {
 
        return riskService.getByLevel(deviceQueryReqDTO);
    }
 
 
 
}