package com.gkhy.safePlatform.emergency.controller; import com.gkhy.safePlatform.commons.co.ContextCacheUser; import com.gkhy.safePlatform.commons.query.PageQuery; import com.gkhy.safePlatform.commons.utils.PageUtils; import com.gkhy.safePlatform.commons.vo.ResultVO; import com.gkhy.safePlatform.emergency.model.dto.req.EmergencyPlanLogReqDTO; import com.gkhy.safePlatform.emergency.model.dto.resp.EmergencyPlanLogRespDTO; import com.gkhy.safePlatform.emergency.query.EmergencyPlanLogQuery; import com.gkhy.safePlatform.emergency.service.EmergencyPlanLogService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.core.Authentication; import org.springframework.web.bind.annotation.*; import java.security.Principal; import java.util.List; @RestController @RequestMapping("/emergencyPlanLog") public class EmergencyPlanLogController { @Autowired private EmergencyPlanLogService emergencyPlanLogService; /** * 应急预案启动记录列表 */ @RequestMapping(value = "/page/list" ,method = RequestMethod.POST) private ResultVO> list (@RequestBody PageQuery pageQuery){ PageUtils.checkCheck(pageQuery); return emergencyPlanLogService.selectEmergencyPlanLogList(pageQuery); } /** * 应急预案启动记录新增 */ @RequestMapping(value = "/add",method = RequestMethod.POST) public ResultVO addEmergencyPlanLog(Authentication authentication, @RequestBody EmergencyPlanLogReqDTO emergencyPlanLogReqDTO) { ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal(); return emergencyPlanLogService.addEmergencyPlanLog(currentUser, emergencyPlanLogReqDTO); } /** * 应急预案启动记录详情 */ @RequestMapping(value = "/info/{id}",method = RequestMethod.GET) public ResultVO getEmergencyPlanLogById(@PathVariable("id")Long id){ return emergencyPlanLogService.getEmergencyPlanLogById(id); } /** * 应急预案启动记录修改 */ @RequestMapping(value = "/update",method = RequestMethod.POST) public ResultVO updateEmergencyPlanLog(Authentication authentication, @RequestBody EmergencyPlanLogReqDTO emergencyPlanLogReqDTO) { ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal(); return emergencyPlanLogService.updateEmergencyPlanLog(currentUser.getUid(), emergencyPlanLogReqDTO); } /** * 应急预案启动记录删除/批量删除 */ @RequestMapping(value = "/batchDelete",method = RequestMethod.POST) public ResultVO batchDeleteEmergencyPlanLog(@RequestBody Long[] ids){ return emergencyPlanLogService.batchDeleteEmergencyPlanLog(ids); } }