package com.ym.mec.biz.dal.dao;

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

import org.apache.ibatis.annotations.Param;

import com.ym.mec.biz.dal.dto.SimpleUserDto;
import com.ym.mec.biz.dal.dto.SysEmployeePositionDto;
import com.ym.mec.biz.dal.entity.SysEmployeePosition;
import com.ym.mec.biz.dal.enums.SysUserRoleEnum;
import com.ym.mec.common.dal.BaseDAO;

public interface SysEmployeePositionDao extends BaseDAO<Integer, SysEmployeePosition> {


    void batchAddPosition(@Param("userId") Integer userId,
                          @Param("positionIds") List<Integer> positionIds,
                          @Param("tenantId") Integer tenantId);

    void delPosition(@Param("userId") Integer userId, @Param("tenantId") Integer tenantId);

    List<Map<Integer, String>> queryPositionMap(@Param("userIds") List<Integer> userIds, @Param("tenantId") Integer tenantId);

    List<Map<Integer, String>> queryPositionNameMap(@Param("userIds") List<Integer> userIds, @Param("tenantId") Integer tenantId);

    List<SimpleUserDto> findOrganPosition(@Param("organIds") String organIds, @Param("tenantId") Integer tenantId);

    /**
    * @description: 查询用户拥有的角色
     * @param userId
     * @param tenantId
    * @return java.util.List<com.ym.mec.biz.dal.enums.SysUserRoleEnum>
    * @author zx
    * @date 2022/1/8 14:25
    */
    List<SysUserRoleEnum> queryPositionList(@Param("userId") Integer userId, @Param("tenantId") Integer tenantId);

    /**
    * @description: 获取指定分部包含指定职位的员工列表
     * @param roleArr
     * @param organId
    * @return java.util.Set<java.lang.Integer>
    * @author zx
    * @date 2022/1/8 16:28
    */
    Set<Integer> queryUserIdByRoleId(@Param("roleArr") SysUserRoleEnum[] roleArr, @Param("organId") Integer organId, @Param("tenantId") Integer tenantId);
    
    List<SysEmployeePositionDto> queryByUserId(Integer userId);
}