package com.reyun.saas.mob.user.dao;

import com.reyun.saas.common.core.Mapper;
import com.reyun.saas.mob.user.domain.WarningConfig;
import com.reyun.saas.mob.user.dto.WarningConfigDTO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

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

public interface WarningConfigMapper extends Mapper<WarningConfig> {

    List<WarningConfigDTO> selectTemplateByUserIds(@Param("userIds") String userIds, @Param("email") String email, @Param("searchText") String searchText,@Param("os") String os);

    List<WarningConfigDTO> selectConfigByUserIds(@Param("userIds") String userIds, @Param("appkeys") String appkeys, @Param("channelIds") String channelIds, @Param("isusing") Boolean isusing, @Param("appkey") String appkey, @Param("channelId") Long channelId,@Param("os") String os);

    @Select("select t0.id,t0.name from warning_config t0 left join app t1 where t0.template is true and t0.del_flag is false and t0.user_id in (${userIds}) and t0.appkey = #{appkey} and t0.cid = #{cid} and t1.os = #{os}")
    Map<String,String> selectConfigTemplateByUserIdsAandAppkeyAndCid(@Param("userIds") String userIds, @Param("appkey") String appkey, @Param("cid") String cid,@Param("os") String os);

    List<WarningConfigDTO> selectConfigAnalysisByUserIds(@Param("userIds") String userIds, @Param("appkeys") String appkeys, @Param("channelIds") String channelIds, @Param("startDate") String startDate, @Param("endDate") String endDate, @Param("appkey") String appkey, @Param("channelId") Long channelId,@Param("os") String os);

    List<WarningConfigDTO> checkWarningReportList();
}
