package com.engine.organization.mapper.staff;


import com.engine.organization.entity.staff.po.StaffPO;
import org.apache.ibatis.annotations.Param;

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

/**
 * @Author dxfeng
 * @description:
 * @Date 2022/5/25
 * @Version V1.0
 **/
public interface StaffMapper {

    /**
     * 根据ID查询编制方案
     *
     * @param id
     * @return
     */
    StaffPO getStaffByID(@Param("id") long id);

    /**
     * 根据分部、部门、岗位查询编制
     *
     * @param companyId
     * @param departmentId
     * @param jobId
     * @return
     */
    List<StaffPO> getStaffByFilter(@Param("companyId") Long companyId, @Param("departmentId") Long departmentId, @Param("jobId") Long jobId);


    /**
     * @Description: 自定义查询
     * @Author: liang.cheng
     * @Date: 2023/9/4 11:26 AM
     * @param: [planId, companyId, departmentId, jobId]
     * @return: com.engine.organization.entity.staff.po.StaffPO
     */
    List<StaffPO> customSelect(@Param("planId") Integer planId,@Param("companyId") Integer companyId, @Param("departmentId") Integer departmentId, @Param("jobId") Integer jobId);

    /**
     * 插入编制方案
     *
     * @param staffPO
     * @return
     */
    int insertIgnoreNull(StaffPO staffPO);

    /**
     * 修改，修改所有字段
     *
     * @param staffPO
     * @return
     */
    int updateStaff(StaffPO staffPO);


    /**
     * 批量删除
     *
     * @param ids
     */
    int deleteByIds(@Param("ids") Collection<Long> ids);

    /**
     * 查询所有被引用的ID
     *
     * @return
     */
    List<String> listUsedId();

    List<StaffPO> getStaffsByIds(@Param("ids") Collection<Long> ids);

    /**
     * 查询同维度的所有编制方案
     * @return
     */
    StaffPO getStaffsByParamId(@Param("ftype") Integer ftype,@Param("compId") String compId,@Param("deptId") String deptId,@Param("jobId") String jobId);



    List<StaffPO> selectByEcCompany(@Param("companyIds") Collection<Integer> companyIds);

    List<StaffPO> selectByEcDepartment(@Param("departmentIds") Collection<Integer> departmentIds);
}
