package com.yida.data.device.telephone.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yida.data.common.core.entity.CurrentUser;
import com.yida.data.common.core.entity.telephone.EduTelephone;
import com.yida.data.common.core.entity.telephone.EduTelephoneCard;
import com.yida.data.device.dto.telephone.DevicePage;
import com.yida.data.device.vo.telephone.TelephoneVO;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Set;
import org.apache.ibatis.annotations.Param;


/**
 * 亲情电话-话机管理 Mapper
 *
 * @author zhanghaijun
 * @date 2021-08-10 16:27:43
 */
public interface EduTelephoneMapper extends BaseMapper<EduTelephone> {


    /**
     * 查询话机列表
     *
     * @param page
     * @param onlineStatus
     * @param runStatus
     * @param iccIdAndiMei
     * @return 话机列表vo
     */
    DevicePage<TelephoneVO> telephoneList(@Param("page") Page<TelephoneVO> page, @Param("onlineStatus") String onlineStatus,
        @Param("runStatus") String runStatus, @Param("iccIdAndiMei") String iccIdAndiMei,
        @Param("now") LocalDateTime now, @Param("start") String start,
        @Param("name") String name, @Param("schoolIds") List<Long> schoolIds,
        @Param("user") CurrentUser currentUser, @Param("schoolName") String schoolName);

    void updatePhoneOnline(@Param("online") Integer online,
        @Param("imeis") Set<String> imeis);


    /**
     * 查询话机详情
     *
     * @param id
     * @return
     */
    TelephoneVO getByTelephoneId(@Param("id") Long id);

    /**
     * 查询学生列表
     *
     * @param ids
     * @return
     */
    List<EduTelephoneCard> listStudent(@Param("now") LocalDateTime now,
        @Param("studentIds") List<Long> studentIds);

    /**
     * 根据学校id和状态查询话机设备数量统计
     *
     * @param schoolIds 学校id集合
     * @param status    话机设备状态
     * @return java.lang.Long
     * @author ZYJ
     * @date 2021/10/9 15:20
     */
    Long findDeviceNumber(@Param("schoolIds") List<Long> schoolIds, @Param("status") Integer status);
}
