package com.elephant.framework.galaxy.aroad.module.emergencyevent.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.elephant.framework.galaxy.aroad.module.emergencyevent.entity.EmergencyEvent;
import com.elephant.framework.galaxy.aroad.module.emergencyevent.mapper.EmergencyEventMapper;
import com.elephant.framework.galaxy.aroad.module.emergencyevent.service.EmergencyEventService;
import com.elephant.framework.galaxy.aroad.module.system.service.DeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 应急事件表
 *
 * @author songwenjie
 * @date 2019-05-08 14:43:42
 */
@Service
public class EmergencyEventServiceImpl extends ServiceImpl<EmergencyEventMapper, EmergencyEvent> implements EmergencyEventService {

    @Autowired
    private DeptService deptService;

    /** 
    * @Description: 新增（上报）应急事件
    * @Param: [event] 
    * @return: boolean 
    * @Author: songwenjie 
    * @Date: 2019/5/8 
    */ 
    public boolean saveEvent(EmergencyEvent event){
        int reportingDeptId = event.getReportingDeptId();
        String deptName = deptService.getDeptName(reportingDeptId);
        event.setReportingDept(deptName);
        return save(event);
    }
}
