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