songhuangfeng123
2022-07-04 ebf072008e6d544a940f70e65b7c59be8211f8cf
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
package com.gkhy.safePlatform.emergency.controller;
 
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.EmergencyPlanReqDTO;
import com.gkhy.safePlatform.emergency.model.dto.resp.EmergencyPlanPageRespDTO;
import com.gkhy.safePlatform.emergency.query.EmergencyPlanQuery;
import com.gkhy.safePlatform.emergency.service.EmergencyPlanService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
 
import java.security.Principal;
import java.util.List;
 
@RestController
@RequestMapping("/emergencyPlan")
public class EmergencyPlanController {
 
    @Autowired
    private EmergencyPlanService emergencyPlanService;
 
    /**
     * 应急预案列表
     */
    @RequestMapping(value = "/page/list" ,method = RequestMethod.POST)
    private ResultVO<List<EmergencyPlanPageRespDTO>> list (@RequestBody PageQuery<EmergencyPlanQuery> pageQuery){
        PageUtils.checkCheck(pageQuery.getPageIndex(), pageQuery.getPageSize());
        return  emergencyPlanService.selectEmergencyPlanList(pageQuery);
    }
 
    /**
     * 新增应急预案
     */
    @RequestMapping(value = "/add",method = RequestMethod.POST)
    public ResultVO<String> add(Principal principal, @RequestBody EmergencyPlanReqDTO emergencyPlanReqDTO) {
        String uid = principal.getName();
        return emergencyPlanService.add(Long.valueOf(uid), emergencyPlanReqDTO);
    }
 
}