package com.engine.salary.mapper.salarybill;

import com.engine.salary.entity.salaryBill.dto.SalaryMySalaryBillListDTO;
import com.engine.salary.entity.salaryBill.dto.SalarySendDetailListDTO;
import com.engine.salary.entity.salaryBill.dto.SalarySendInfoListDTO;
import com.engine.salary.entity.salaryBill.param.SalaryBillQueryParam;
import com.engine.salary.entity.salaryBill.param.SalarySendDetailQueryParam;
import com.engine.salary.entity.salaryBill.param.SalarySendInfoQueryParam;
import com.engine.salary.entity.salaryBill.po.SalarySendInfoPO;
import org.apache.ibatis.annotations.Param;

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

/**
 * 工资单发放信息
 * <p>Copyright: Copyright (c) 2022</p>
 * <p>Company: 泛微软件</p>
 *
 * @author qiantao
 * @version 1.0
 **/
public interface SalarySendInfoMapper  {

    SalarySendInfoPO getById(@Param("id") Long id);

    List<Long> listSalaryAccRecordIds(@Param("param") SalarySendDetailQueryParam param);

    /**
     * 查询工资单发放信息列表
     * @param param
     * @return
     */
    List<SalarySendInfoListDTO> list(@Param("param") SalarySendInfoQueryParam param);

    /**
     * 分页查询工资单发放信息列表
     * @param page
     * @param param
     * @param tenantKey
     * @return
     */
//    IPage<SalarySendInfoListDTO> list(Page<SalarySendInfoListDTO> page, @Param("param") SalarySendInfoQueryParam param, @Param("tenantKey") String tenantKey);

    /**
     * 查询工资单发放详情列表
     *
     * @param param
     * @param otherSalaryAccRecordIds
     * @return
     */
    List<SalarySendDetailListDTO> detailList(@Param("param") SalarySendDetailQueryParam param,
                                             @Param("otherSalaryAccRecordIds") Set<Long> otherSalaryAccRecordIds);

    /**
     * 分页查询工资单发放详情列表
     * @param page
     * @param param
     * @param tenantKey
     * @return
     */
//    IPage<SalarySendDetailListDTO> detailList(Page<SalarySendDetailListDTO> page, @Param("param") SalarySendDetailQueryParam param, @Param("tenantKey") String tenantKey);

    /**
     * 分页查询我的工资单列表
     * @param queryParam
     * @return
     */
    List<SalaryMySalaryBillListDTO>  mySalaryBillList(@Param("param") SalaryBillQueryParam queryParam);


    /**
     * 批量插入工资单信息记录
     * @param pos
     */
    void batchInsert(@Param("collection") List<SalarySendInfoPO> pos);

    /**
     * 发放、撤回工资单
     * @param po
     * @param salarySendId
     * @param statusList
     * @param ids
     */
    void updateGrantWithdraw(@Param("po") SalarySendInfoPO po, @Param("salarySendId")Long salarySendId, @Param("statusList")List<Integer> statusList, @Param("ids")Collection<Long> ids);

    /**
     * 根据现有字段查询
     * @param params
     * @return
     */
    List<SalarySendInfoPO> listSome(SalarySendInfoPO params);

    /**
     * 根据id更新
     * @param po
     */
    void updateIgnoreNull(SalarySendInfoPO po);

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

    List<SalarySendInfoPO> getNeedSendInfoList(@Param("salarySendIds") List<Long> salarySendIds);

    /**
     * 自动确认工资单
     * @param needAutoIds
     */
    void autoConfirmSalaryBill(@Param("ids") List<Long> needAutoIds);

    /**
     * 根据薪资账套id获取已发送，确认状态为未确认的工资单
     * @param salarySobIds
     * @return
     */
    List<SalarySendInfoPO> listUnConfirmedSendInfo(@Param("salarySobIds") List<Long> salarySobIds);
}