package com.keao.edu.user.dao;

import com.keao.edu.common.dal.BaseDAO;
import com.keao.edu.user.dto.ExamOrganRegistDto;
import com.keao.edu.user.entity.ExamOrganizationRelation;
import com.keao.edu.user.entity.Organization;
import com.keao.edu.user.enums.YesOrNoEnum;
import org.apache.ibatis.annotations.Param;

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

public interface ExamOrganizationRelationDao extends BaseDAO<Long, ExamOrganizationRelation> {

    /**
     * @param examOrganizationRelations:
     * @return int
     * @describe 批量插入考级项目与合作单位关联
     * @author Joburgess
     * @date 2020.06.18
     */
    int batchInsert(@Param("examOrganizationRelations") List<ExamOrganizationRelation> examOrganizationRelations);

    /**
     * @param examOrganizationRelations:
     * @return int
     * @describe 批量更新
     * @author Joburgess
     * @date 2020.06.29
     */
    int batchUpdate(@Param("examOrganizationRelations") List<ExamOrganizationRelation> examOrganizationRelations);

    /**
     * @param examId:      考级项目编号
     * @param organIds:    合作单位编号列表
     * @param sendUrlFlag: 链接发送状态
     * @return int
     * @describe 批量更新合作单位的链接发送状态
     * @author Joburgess
     * @date 2020.06.18
     */
    int batchUpdateSendUrlFlag(@Param("examId") Integer examId,
                               @Param("organIds") List<Integer> organIds,
                               @Param("sendUrlFlag") YesOrNoEnum sendUrlFlag);

    /**
     * @param examId:
     * @return com.keao.edu.user.entity.ExamOrganizationRelation
     * @describe 获取考级项目关联的合作单位
     * @author Joburgess
     * @date 2020.06.18
     */
    List<ExamOrganizationRelation> getWithExam(@Param("examId") Integer examId);

    List<ExamOrganizationRelation> getWithExams(@Param("examIds") List<Integer> examIds);

    /**
     * @param examId:
     * @return java.util.Set<java.lang.Integer>
     * @describe 获取考级项目关联的合作单位编号
     * @author Joburgess
     * @date 2020.06.18
     */
    Set<Integer> getOrganIdsWithExam(@Param("examId") Integer examId);

    /**
     * @param examId:
     * @param organIds:
     * @return java.util.List<com.keao.edu.user.entity.ExamOrganizationRelation>
     * @describe 统计指定考级项目与指定分布下的报名人数与累计收款
     * @author Joburgess
     * @date 2020.06.28
     */
    List<ExamOrganizationRelation> countExamOrganStudentAndPayment(@Param("examId") Integer examId,
                                                                   @Param("organIds") List<Integer> organIds);

    /**
     * 是否有考试项目
     *
     * @param organId
     * @return
     */
    Integer findByOrganId(@Param("organId") Integer organId);

    /**
     * @param params:
     * @return java.util.List<com.keao.edu.user.entity.Organization>
     * @describe 获取未关联到考级项目的合作单位
     * @author Joburgess
     * @date 2020.07.03
     */
    List<Organization> queryUnRelatedOrgans(Map<String, Object> params);

    int countUnRelatedOrgans(Map<String, Object> params);

    /**
     * 获取考级项目关联合作单位信息
     *
     * @param examId
     * @param OrganId
     * @return
     */
    ExamOrganizationRelation getExamOrganizationRelation(@Param("examId") Integer examId, @Param("OrganId") Integer OrganId);

}
