郑永安
2023-06-19 7a6abd05683528032687c75e80e0bd2030a3e46c
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
package com.gkhy.safePlatform.doublePrevention.controller;
 
import com.gkhy.safePlatform.commons.co.ContextCacheUser;
import com.gkhy.safePlatform.commons.vo.ResultVO;
import com.gkhy.safePlatform.doublePrevention.entity.PreventProduceDevice;
import com.gkhy.safePlatform.doublePrevention.entity.dto.req.PreventProduceDeviceDeleteReqDTO;
import com.gkhy.safePlatform.doublePrevention.entity.dto.req.PreventProduceDeviceQueryReqDTO;
import com.gkhy.safePlatform.doublePrevention.entity.dto.req.PreventProduceDeviceSaveReqDTO;
import com.gkhy.safePlatform.doublePrevention.entity.dto.req.PreventProduceDeviceUpdateReqDTO;
import com.gkhy.safePlatform.doublePrevention.service.RiskService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.Authentication;
import org.springframework.web.bind.annotation.*;
 
 
/**
 * (PreventProduceDevice)表控制层
 *
 * @author qihs
 * @since 2022-06-25 10:40:17
 */
@RestController
@RequestMapping("prevent/device")
public class PreventProduceDeviceController {
 
    @Autowired
    private RiskService riskService;
//    @Autowired
//    private FileHandlerService handlerService;
 
    /**
     * 生产装置-分页查询
     * @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 = (ContextCacheUser)authentication.getPrincipal();
        return riskService.saveDevice(currentUser.getUid(), deviceSaveReqDto);
    }
 
    /**
     * 生产装置- 查询生产装置列表
     */
    @PostMapping("/select/listDevices")
    public ResultVO<PreventProduceDevice> getListDevices(Authentication authentication) {
        //获取用户信息
        ContextCacheUser currentUser = (ContextCacheUser)authentication.getPrincipal();
        return riskService.getListDevices(currentUser.getUid());
    }
 
    /**
     * 生产装置-删除
     * @param deviceDeleteReqDTO
     */
    @PostMapping("/delete/deleteDevice")
    public ResultVO<PreventProduceDevice> deleteDevice(Authentication authentication, @RequestBody PreventProduceDeviceDeleteReqDTO deviceDeleteReqDTO) {
        //获取用户信息
        ContextCacheUser currentUser = (ContextCacheUser)authentication.getPrincipal();
        return riskService.deleteOne(currentUser.getUid(), deviceDeleteReqDTO);
    }
 
    /**
     * 生产装置-修改
     * @param deviceUpdateReqDTO
     */
    @PostMapping("/update/updateDevice")
    public ResultVO<PreventProduceDevice> updateDevice(Authentication authentication, @RequestBody PreventProduceDeviceUpdateReqDTO deviceUpdateReqDTO) {
        //获取用户信息
        ContextCacheUser currentUser = (ContextCacheUser)authentication.getPrincipal();
        return riskService.updateOneById(currentUser.getUid(), deviceUpdateReqDTO);
    }
 
 
 
 
 
//    /**
//     * 生产装置-导入
//     */
//    @PostMapping("/insert/import")
//    public  ResultVO<PreventProduceDevice> deviceImport(Authentication authentication, @RequestParam MultipartFile file) throws Exception {
//
//        //获取用户信息
//        ContextCacheUser currentUser = (ContextCacheUser)authentication.getPrincipal();
//        return handlerService.deviceImport(currentUser, file );
//    }
 
    /**
     * 生产装置-按照等级查询
     * @param deviceQueryReqDTO
     */
    @GetMapping("/select/getListByLevel")
    public ResultVO<PreventProduceDevice> getByLevel(@RequestBody PreventProduceDeviceQueryReqDTO deviceQueryReqDTO) {
 
        return riskService.getByLevel(deviceQueryReqDTO);
    }
 
 
 
}