package com.yida.data.device.telephone.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.yida.data.common.core.entity.telephone.EduTelephoneFamily;
import com.yida.data.common.core.entity.telephone.EduTelephoneRecord;
import com.yida.data.device.dto.telephone.RecordPageDTO;
import com.yida.data.device.vo.telephone.FamilyRecordVO;
import com.yida.data.device.vo.telephone.RecordInfoVO;
import com.yida.data.device.vo.telephone.TelephoneCardVO;
import com.yida.data.device.vo.telephone.TelephoneSummaryVO;
import org.apache.ibatis.annotations.Param;

import java.time.LocalDateTime;
import java.util.List;


/**
 * 亲情电话-通话记录 Mapper
 *
 * @author zhanghaijun
 * @date 2021-08-10 17:01:40
 */
public interface EduTelephoneRecordMapper extends BaseMapper<EduTelephoneRecord> {


    EduTelephoneRecord selectMaxRecord();

    Long sumTelephone(@Param("telephoneId") Long telephoneId,
                      @Param("year") Integer year,
                      @Param("month") Integer month);


    /**
     * 查询本月通话时长
     *
     * @param now
     * @param start
     * @param id
     * @return
     */
    Integer selectMonthMaxLen(@Param("now") LocalDateTime now, @Param("start") String start, @Param("id") Long id);

    List<EduTelephoneFamily> selectRecord(@Param("id") Long id);

    TelephoneCardVO selectStartAndEnd(@Param("id") Long id);

    IPage<RecordInfoVO> listRecordPage(Page page, @Param("dto") RecordPageDTO dto);

    List<RecordInfoVO> listRecord(@Param("dto") RecordPageDTO dto);

    List<TelephoneSummaryVO> callSummary(@Param("type") Integer type, @Param("schoolId") Long schoolId);

    List<TelephoneSummaryVO> callYearSummary(@Param("schoolId") Long schoolId);

    List<TelephoneSummaryVO> callDaySummary(@Param("schoolId") Long schoolId);

    /**
     * 查询月数差，
     *
     * @return
     */
    Integer selectMonth(@Param("schoolId") Long schoolId);

    /**
     * 前台查询亲情电话
     *
     * @param cardId
     * @return
     */
    List<FamilyRecordVO> listFamilyRecord(@Param("cardId") Long cardId);
}
