package com.engine.salary.mapper.siarchives;

import com.engine.salary.entity.siarchives.param.InsuranceArchivesListParam;
import com.engine.salary.entity.siarchives.po.InsuranceArchivesEmployeePO;
import com.engine.salary.entity.siarchives.po.InsuranceArchivesSocialSchemePO;
import org.apache.ibatis.annotations.Param;

import java.util.Collection;
import java.util.List;

/**
 * @Author weaver_cl
 * 
 * @Date 2022/3/15
 * @Version V1.0
 **/
public interface SocialSchemeMapper {

    /**
     * 根据员工id获取
     * @param employeeId
     * @return
     */
    List<InsuranceArchivesSocialSchemePO> getSocialByEmployeeId(@Param("employeeIds")List<Long> employeeId);

    /**
     * 根据人员id和个税扣缴人id获取记录
     * @param insuranceArchivesEmployeePO
     * @return
     */
    List<InsuranceArchivesSocialSchemePO> getSocialByEmployeeIdAndPayOrg(@Param("param")InsuranceArchivesEmployeePO insuranceArchivesEmployeePO);

    /**
     * 根据ids获取多条
     * @param ids
     * @return
     */
    List<InsuranceArchivesSocialSchemePO> getSocialById(@Param("ids")List<Long> ids);

    /**
     * 根据id获取单条
     * @param id
     * @return
     */
    InsuranceArchivesSocialSchemePO getOneById(@Param("id")Long id);

    /**
     * 批量删除
     * @param singletonList
     */
    void batchDeleteByEmployeeIds(@Param("employeeIds") Collection<Long> singletonList);

    /**
     * 根据人员id和个税扣缴义务人删除档案
     * @param insuranceArchivesSocialSchemePO
     */
    void deleteByEmployeeIdAndPayOrg(@Param("param") InsuranceArchivesSocialSchemePO insuranceArchivesSocialSchemePO);
    /**
     * 批量保存
     * @param singletonList
     */
    void batchSave(@Param("socialSchemePOS") List<InsuranceArchivesSocialSchemePO> singletonList);

    /**
     * 人员档案信息
     * @param param
     * @return
     */
    List<InsuranceArchivesEmployeePO> listPageEmployeePOS(@Param("param") InsuranceArchivesListParam param);

    /**
     * 信息提示
     * @return
     */
    List<Long> tips();


    List<InsuranceArchivesEmployeePO> queryEmployeeList(@Param("param") InsuranceArchivesListParam param);

    List<InsuranceArchivesEmployeePO> queryExtEmployeeList(@Param("param") InsuranceArchivesListParam param);

    /**
     * 根据社保缴纳组织id获取
     * @param paymentOrganization
     * @return
     */
    List<InsuranceArchivesSocialSchemePO> getSocialByPaymentOrganization(@Param("paymentOrganization")Long paymentOrganization);

    /**
     * 根据个税扣缴义务人id获取目标账单月可以进行缴纳的人员id
     * 筛选条件为账单月是否在起始缴纳月和最后缴纳月之间
     * @param paymentOrganization
     * @return
     */
    List<Long> listCanPayEmpIds(@Param("paymentOrganization")Long paymentOrganization, @Param("billMonth")String billMonth);

    List<InsuranceArchivesSocialSchemePO> listAll();

    int batchUpdate(@Param("collection") List<InsuranceArchivesSocialSchemePO> insuranceArchivesSocialSchemePos);

    /**
     * 批量更新最后缴纳月
     * @param ids
     * @param endTime
     */
    void batchUpdateEndTime(@Param("ids")List<Long> ids, @Param("endTime")String endTime);

    /**
     * 更新,更新全部字段
     * @param insuranceArchivesSocialSchemePO
     * @return
     */
    int updateById(InsuranceArchivesSocialSchemePO insuranceArchivesSocialSchemePO);

    /**
     * 批量更新最后缴纳月为null
     * @param ids
     */
    void batchUpdateEndTimeToNull(@Param("ids")List<Long> ids);

    /**
     * 根据id删除
     * @param socialArchiveDelIds
     */
    void deleteByIds(@Param("ids")List<Long> socialArchiveDelIds);

    /**
     * 新增
     * @param insuranceArchivesSocialSchemePO
     */
    void insert(InsuranceArchivesSocialSchemePO insuranceArchivesSocialSchemePO);

    /**
     * 更新最后缴纳月
     * @param id
     * @param endTime
     */
    void updateEndTime(@Param("id")Long id, @Param("endTime")String endTime);
}
