package com.yida.data.school.letter.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.letter.EduLetterBox;

import com.yida.data.school.vo.letterbox.StaLetterVO;
import java.time.LocalDate;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 信箱表（仅查看） Mapper
 *
 * @author zhanghaijun
 * @date 2021-07-20 10:55:41
 */
public interface EduLetterBoxMapper extends BaseMapper<EduLetterBox> {

    List<EduLetterBox> findListViewLetter(EduLetterBox letterBox);

    IPage<EduLetterBox> findListPage(Page page, @Param("title") String title, @Param("schoolId") Long schoolId,
        @Param("contentType") String contentType, @Param("appPhone") String appPhone, @Param("reply") Integer reply);

    Integer getTopNum(@Param("schoolId") Long schoolId);

    IPage<EduLetterBox> findViewList(Page page, @Param("title") String title, @Param("schoolId") Long schoolId,
        @Param("identityId") Long identityId, @Param("viewsNum") Integer viewsNum);

    void updateTop(@Param("id") Long id, @Param("top") Integer top);

    void updateByReply(@Param("id") Long id);

    /**
     * 查询信箱统计数据
     *
     * @param schoolIds
     * @return
     */
    StaLetterVO getStaData(@Param("schoolIds") List<Long> schoolIds, @Param("startDate") LocalDate startDate,
        @Param("endDate") LocalDate endDate);

    /**
     * 获取信件标题
     * @param schoolIds
     * @param startDate
     * @param endDate
     * @return
     */
    List<String> listTitle(@Param("schoolIds") List<Long> schoolIds, @Param("startDate") String startDate,
        @Param("endDate") String endDate);
}
