| | |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import java.util.List; |
| | | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| | | |
| | | @RestController @RequestMapping("/safety/risk-source") @Validated |
| | |
| | | public CommonResult<Boolean> update(@Valid @RequestBody SafetyRiskSourceSaveReqVO req){if(req.getId()==null)throw cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.invalidParamException("危险源编号不能为空");service.save(req);return success(true);} |
| | | @DeleteMapping("/delete") @PreAuthorize("@ss.hasPermission('safety:risk:delete')") |
| | | public CommonResult<Boolean> delete(@RequestParam("id") Long id){service.delete(id);return success(true);} |
| | | |
| | | /** 用设备采集数据刷新已绑定设备的危险源,返回本次报警清单。 */ |
| | | @PostMapping("/refresh") @PreAuthorize("@ss.hasPermission('safety:risk:update')") |
| | | public CommonResult<List<SafetyRiskSourceDO>> refreshFromCollect(){return success(service.refreshFromCollect());} |
| | | } |