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 getDevicePage(@RequestBody PreventProduceDeviceQueryReqDTO deviceQueryReqDtoReqDto) { return riskService.getDevicePage(deviceQueryReqDtoReqDto); } /** * 生产装置-新增 * @param deviceSaveReqDto */ @PostMapping("/insert/saveDevice") public ResultVO saveDevice(Authentication authentication, @RequestBody PreventProduceDeviceSaveReqDTO deviceSaveReqDto) { //获取用户信息 ContextCacheUser currentUser = (ContextCacheUser)authentication.getPrincipal(); return riskService.saveDevice(currentUser.getUid(), deviceSaveReqDto); } /** * 生产装置- 查询生产装置列表 */ @PostMapping("/select/listDevices") public ResultVO getListDevices(Authentication authentication) { //获取用户信息 ContextCacheUser currentUser = (ContextCacheUser)authentication.getPrincipal(); return riskService.getListDevices(currentUser.getUid()); } /** * 生产装置-删除 * @param deviceDeleteReqDTO */ @PostMapping("/delete/deleteDevice") public ResultVO deleteDevice(Authentication authentication, @RequestBody PreventProduceDeviceDeleteReqDTO deviceDeleteReqDTO) { //获取用户信息 ContextCacheUser currentUser = (ContextCacheUser)authentication.getPrincipal(); return riskService.deleteOne(currentUser.getUid(), deviceDeleteReqDTO); } /** * 生产装置-修改 * @param deviceUpdateReqDTO */ @PostMapping("/update/updateDevice") public ResultVO updateDevice(Authentication authentication, @RequestBody PreventProduceDeviceUpdateReqDTO deviceUpdateReqDTO) { //获取用户信息 ContextCacheUser currentUser = (ContextCacheUser)authentication.getPrincipal(); return riskService.updateOneById(currentUser.getUid(), deviceUpdateReqDTO); } // /** // * 生产装置-导入 // */ // @PostMapping("/insert/import") // public ResultVO 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 getByLevel(@RequestBody PreventProduceDeviceQueryReqDTO deviceQueryReqDTO) { return riskService.getByLevel(deviceQueryReqDTO); } }