package com.yeejoin.amos.boot.module.tzs.api.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledQueryDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledRecordDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.WechatMyBusinessListDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.WechatMyBussinessDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.WechatMyTaskListDto;
import com.yeejoin.amos.boot.module.tzs.api.entity.AlertCalled;
import org.apache.ibatis.annotations.Param;
import org.typroject.tyboot.core.rdbms.annotation.Condition;
import org.typroject.tyboot.core.rdbms.annotation.Operator;

import java.util.List;
import java.util.Map;

/**
 * 警情接警填报记录 Mapper 接口
 *
 * @author litw
 * @date 2021-08-03
 */
public interface AlertCalledMapper extends BaseMapper<AlertCalled> {

    /**
     * 接警情况统计
     *
     * @param beginDate
     * @param endDate
     * @return
     */
   List<Map<String, Integer>> queryNearlyCount(@Param("beginDate") String beginDate,
                                               @Param("endDate") String endDate,
                                               @Param("orgCode") String orgCode,
                                               @Param("recUserId") String recUserId
    );
    /**
     * 接警情况统计
     *
     * @param beginDate
     * @param endDate
     * @return
     */
    Map<String, Integer> queryAlertStatusCount(@Param("beginDate") String beginDate,
                                               @Param("endDate") String endDate,
                                               @Param("orgCode") String orgCode,
                                               @Param("recUserId") String recUserId
    );

    /**
     * 根据查询条件返回警情记录
     * @param workOrderNumber
     * @return
     */
    Page<List<AlertCalledQueryDto>> queryAlertListByQueryDto(IPage<AlertCalledQueryDto> page,
                                                            String workOrderNumber,
                                                             String creator,
                                                             String emergency,
                                                             String emergencyTimeStart,
                                                             String emergencyTimeEnd,
                                                             String emergencyCall,
                                                             String deviceId,
                                                             String elevatorAddress,
                                                             String alertType,
                                                             String alertSource,
                                                             String alertStage,
                                                             String alertStatus,
                                                             String address);
    Map<String, Integer> getTodayEmergencyCount(String regionCode);
    
	Map<String, Integer> getImportantEventCount(String regionCode);


    List<Map<String, Object>> getImportantEventDetail(String type,String regionCode);

    List<Map<String, Object>> getTodayEmergencyDetail(String rescueTotal,String rescueComplete, String regionCode);

    WechatMyBussinessDto getBussinessInfoById(@Param("alertId")  Long alertId);

    List<WechatMyBusinessListDto> getBussinessListByPhonePager(@Param("phone") String phone, @Param("bussinessCode") String bussinessCode, @Param("current") Long current);

 /**
  * 根据条件返回接警记录信息
  * @param callTimeStart
  * @param callTimeEnd
  * @param type
  * @param alertSource
  * @param alarmType
  * @return
  */
 List<AlertCalledRecordDto> queryAlertRecordListByQueryDto(
                                                                  String callTimeStart,
                                                                  String callTimeEnd,
                                                                  String type,
                                                                  String alertSource,
                                                                  String alarmType);

}
