package com.skr.mdm.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.skr.mdm.bean.qo.user.UserQO;
import com.skr.mdm.bean.vo.alarm.AlarmConfigUserVO;
import com.skr.mdm.bean.vo.department.DepartmentUserVO;
import com.skr.mdm.bean.vo.user.UserDeptVO;
import com.skr.mdm.bean.vo.user.UserVO;
import com.skr.mdm.entity.AuUserDO;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface AuUserDao extends BaseMapper<AuUserDO> {

	/**
	 * 根据公司ID删除
	 * @param companyId 公司ID
	 */
	void deleteByCompanyId(@Param("companyId") Integer companyId);

	List<String> selectNameByUserIdList(@Param("list") List<Integer> userIdList, @Param("companyId") Integer companyId);

	List<Integer> listUserIdByCompanyId(Integer companyId);

	/**
	 * 报警接收人
	 *
	 * @param userIdList
	 * @param searchType
	 * @param searchValue
	 * @return
	 */
	List<AlarmConfigUserVO> listAlarmReceiver(@Param("list") List<Integer> userIdList, @Param("searchType") Integer searchType, @Param("searchValue") String searchValue);

	/**
	 * 用户列表
	 *
	 * @param userQO
	 * @return
	 */
	List<UserVO> listUser(UserQO userQO);

	/**
	 * 获取用户名
	 * @param id
	 * @return
	 */
	String getUserNameById(Integer id);

	/**
	 * 获取部门id
	 * @param userIdList
	 * @return
	 */
	List<Integer> listDepartmentIdByUserIdList(@Param("list") List<Integer> userIdList);

	/**
	 * 获取没有被删除的用户
	 * @param userIdList
	 * @return
	 */
	List<Integer> listUserIdNotDel(@Param("list") List<Integer> userIdList);

	/**
	 * 获取用户名集合
	 * @param userIdList
	 * @return
	 */
	List<String> listUserNameByIdList(@Param("list") List<Integer> userIdList);

	List<Integer> selectUserIdListByDeptIdList(@Param("deptIdList") List<Integer> deptIdList);

	List<DepartmentUserVO> selectDepartmentUserVOList(Integer departmentId);

	List<UserDeptVO> listUserDeptVO(@Param("companyId") Integer companyId,
									@Param("adminId") Integer adminId,
									@Param("departmentIdList") List<Integer> departmentIdList,
									@Param("searchType") Integer searchType,
									@Param("searchValue") String searchValue);

	/**
	 * 批量插入
	 *
	 * @param userDOList
	 */
	void insertBatch(@Param("list") List<AuUserDO> userDOList);
}