package com.zcxk.charge.core.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zcxk.charge.core.entity.SceneEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.io.Serializable;
import java.util.List;
import java.util.Map;

/**
 *
 * sms_sceneDAO接口
 * @author: WYY
 * @date 2020-11-17 21:15
 */
@Mapper
public interface SceneMapper extends BaseMapper<SceneEntity> {

    /**
    * 自定义分页查询
    * @author Andy
    * @date 9:21 2021/8/18
    * @param page:
    * @param sceneEntity:
    * @return com.baomidou.mybatisplus.extension.plugins.pagination.Page<com.zcxk.charge.core.entity.SceneEntity>
    **/
    Page<SceneEntity> findPage(IPage<SceneEntity> page, @Param(value = "scene") SceneEntity sceneEntity);

    /**
    * 根据id查找
    * @author Andy
    * @date 9:21 2021/8/18
    * @param id:
    * @return com.zcxk.charge.core.entity.SceneEntity
    **/
    SceneEntity findSceneById(Serializable id);

    /**
    * 查找集合
    * @author Andy
    * @date 9:21 2021/8/18
    * @param sceneEntity:
    * @return java.util.List<com.zcxk.charge.core.entity.SceneEntity>
    **/
    List<SceneEntity> findList(@Param(value = "scene") SceneEntity sceneEntity);

    /**
    * 根据id集合查找
    * @author Andy
    * @date 9:21 2021/8/18
    * @param ids:
    * @return java.util.List<com.zcxk.charge.core.entity.SceneEntity>
    **/
    List<SceneEntity> findBySceneTypeIds(@Param(value = "Ids") Long[] ids);

    /**
    * 根据id集合查找对应的
    * @author Andy
    * @date 9:21 2021/8/18
    * @param ids:
    * @return java.util.List<com.zcxk.charge.core.entity.SceneEntity>
    **/
    List<SceneEntity> findByParentSceneIds(@Param(value = "Ids") Long[] ids);

    /**
    * 查找集合
    * @author Andy
    * @date 9:22 2021/8/18
    * @param sceneEntity:
    * @return java.util.List<com.zcxk.charge.core.entity.SceneEntity>
    **/
    List<SceneEntity> findByParentIdsLike(@Param(value = "scene") SceneEntity sceneEntity);

    /**
    * 根据类型名字查找
    * @author Andy
    * @date 9:22 2021/8/18
    * @param sceneEntity:
    * @return java.util.List<com.zcxk.charge.core.entity.SceneEntity>
    **/
    List<SceneEntity> selectByTypeName(@Param(value = "scene") SceneEntity sceneEntity);

    /**
    * findByParentId
    * @author Andy
    * @date 9:22 2021/8/18
    * @param sceneEntity:
    * @return java.util.List<com.zcxk.charge.core.entity.SceneEntity>
    **/
    List<SceneEntity> findByParentId(@Param(value = "scene") SceneEntity sceneEntity);

    /**
    * 根据ID查找
    * @author Andy
    * @date 9:22 2021/8/18
    * @param id:
    * @return com.zcxk.charge.core.entity.SceneEntity
    **/
    SceneEntity findParentSceneById(@Param(value = "id") Long id);

    /***
    * findSceneAmount
    * @author Andy
    * @date 9:22 2021/8/18
    * @param sceneEntity:
    * @param months:
    * @return java.util.List<java.util.Map<java.lang.String,java.lang.Object>>
    **/
    List<Map<String,Object>> findSceneAmount(@Param("scene") SceneEntity sceneEntity, @Param("months") Integer months);

    /**
    * selectAlarmSceneAndDevice
    * @author Andy
    * @date 9:22 2021/8/18
    * @param sceneEntity:
    * @param startDate:
    * @param endDate:
    * @return java.util.List<java.util.Map<java.lang.String,java.lang.Object>>
    **/
    List<Map<String,Object>> selectAlarmSceneAndDevice(@Param("scene") SceneEntity sceneEntity, @Param("startDate") String startDate, @Param("endDate") String endDate);

    /**
    * selectMonthAlarmTimes
    * @author Andy
    * @date 9:22 2021/8/18
    * @param sceneEntity:
    * @param startDate:
    * @param endDate:
    * @param sort:
    * @return java.util.List<java.util.Map<java.lang.String,java.lang.Object>>
    **/
    List<Map<String,Object>> selectMonthAlarmTimes(@Param("scene") SceneEntity sceneEntity, @Param("startDate") String startDate, @Param("endDate") String endDate, @Param("sort") int sort);

    /**
    * selectYearAlarmTimes
    * @author Andy
    * @date 9:23 2021/8/18
    * @param sceneEntity:
    * @param startDate:
    * @param endDate:
    * @param sort:
    * @return java.util.List<java.util.Map<java.lang.String,java.lang.Object>>
    **/
    List<Map<String,Object>> selectYearAlarmTimes(@Param("scene") SceneEntity sceneEntity, @Param("startDate") String startDate, @Param("endDate") String endDate, @Param("sort") int sort);

    /**
    * selectAlarmDeviceIdBySenceId
    * @author Andy
    * @date 9:23 2021/8/18
    * @param id:
    * @return java.util.List<java.util.Map<java.lang.String,java.lang.Object>>
    **/
    List<Map<String,Object>> selectAlarmDeviceIdBySenceId(@Param("id") int id);

    /**
    * selectAlarmLable
    * @author Andy
    * @date 9:23 2021/8/18
    * @param sceneEntity:
    * @param startDate:
    * @param endDate:
    * @param sort:
    * @return java.util.List<java.util.Map<java.lang.String,java.lang.Object>>
    **/
    List<Map<String,Object>> selectAlarmLable(@Param("scene") SceneEntity sceneEntity, @Param("startDate") String startDate, @Param("endDate") String endDate, @Param("sort") int sort);
}
