package com.engine.salary.mapper.sischeme;

import com.engine.salary.entity.sischeme.po.InsuranceSchemeDetailPO;
import org.apache.ibatis.annotations.Param;

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

/**
 * @Author weaver_cl
 * 
 * @Date 2022/3/8
 * @Version V1.0
 **/
public interface InsuranceSchemeDetailMapper {

    /**
     * 查询当前方案下面配置的福利类型明细
     *
     * @return list
     */
    List<InsuranceSchemeDetailPO> queryListBySchemeId(@Param("schemeId")Long schemeId);

    /**
     * 新增，插入所有字段
     *
     * @param insuranceSchemeDetailPO 新增的记录
     * @return 返回影响行数
     */
    int insert(InsuranceSchemeDetailPO insuranceSchemeDetailPO);


    /**
     * 批量删除
     * @param primaryIds
     */
    void batchDeleteByPrimaryIds(@Param("primaryIds") Collection<Long> primaryIds);

    /**
     * 根据险种id和是否缴费查询社保方案明细表
     *
     * @param insuranceId 险种id
     * @param isPayment   是否缴费
     * @return list
     */
    List<InsuranceSchemeDetailPO> queryListByInsuranceIdIsPayment(@Param("insuranceId") Long insuranceId, @Param("isPayment") Integer isPayment);


    /**
     *
     * @param primaryId
     * @param paymentScope
     * @param insuranceId
     * @return
     */
    InsuranceSchemeDetailPO getByPPI(@Param("primaryId") Long primaryId, @Param("paymentScope") Integer paymentScope,
                                     @Param("insuranceId") Long insuranceId);

    List<InsuranceSchemeDetailPO> getByPI(@Param("primaryId") Long primaryId, @Param("insuranceId") Long insuranceId);

    /**
     * 根据主键和是否缴费查询
     * @param primaryId
     * @param isPayment
     * @return
     */
    List<InsuranceSchemeDetailPO> queryListByPrimaryIdIsPayment(@Param("primaryId") Long primaryId, @Param("isPayment") Integer isPayment,
                                                                @Param("welfareType") Integer welfareType);


    List<InsuranceSchemeDetailPO> queryInsuranceSchemeDetailList(@Param("primaryId") Long primaryId, @Param("isPayment") Integer isPayment);

    void deleteByIds(@Param("ids")Collection<Long> ids);

    List<InsuranceSchemeDetailPO> listAll();

    List<InsuranceSchemeDetailPO> listBySchemeIds(@Param("schemeIds")Collection<Long> schemeIds);

    int batchUpdate(@Param("collection") List<InsuranceSchemeDetailPO> insuranceSchemeDetailPos);

    int updateAll(InsuranceSchemeDetailPO insuranceSchemeDetailPo);
}
