package com.lz.modules.app.dao;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.lz.modules.app.dto.DepartmentInfos;
import com.lz.modules.app.dto.DepartmentsDto;
import com.lz.modules.app.dto.StaffDepartmentDto;
import com.lz.modules.app.entity.DepartmentsEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lz.modules.performance.dto.SimpleDepartmentDto;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 部门表
 *
 * @author fumeiai
 * @email fumeiai@linzikg.com
 * @date 2020-04-30 16:59:50
 */
@Mapper
public interface DepartmentsDao extends BaseMapper<DepartmentsEntity> {

    DepartmentsEntity getDepartmentByDepartmentId(@Param("departmentId") String departmentId);

    int updateDepartment(DepartmentsEntity departmentsEntity);

    int updateDepartmentStatus();

    int addDepartmentBatch(@Param("departments") List<DepartmentsEntity> departments);

    List<DepartmentsDto> getDepartmentsByparentId(@Param("parentId") String parentId);


    List<DepartmentsEntity> selectAll();

    List<DepartmentsEntity> selectEntityByParentDepartmentId(@Param("parentId") String parentId);

    DepartmentsEntity selectByDepartmentId(@Param("departmentId") String departmentId);

    StaffDepartmentDto selectStaffAllDepartments(@Param("departmentId") String departmentId);

    int addDepartment(@Param("departments") DepartmentsEntity departments);

    DepartmentInfos selectUserAllDepartmentIds(@Param("departmentId") String departmentId);

    List<DepartmentInfos> selectAllChildDepartmentIds(@Param("departmentId") String departmentId);

    List<String> selectDepartmentIdsByparentIds(@Param("parentIds") List parentIds);

    List<String> selectDepartmentIdsByparentIds(@Param("parentIds") List parentIds,  @Param("page") IPage page);

    List<DepartmentsEntity> selectDeparmentLevel1();

    List<DepartmentsEntity> selectEntityByDepartmentIds(@Param("dIds") List<String> dIds);

    List<DepartmentsEntity> selectEntityByParentDepartmentIds(@Param("dIds") List<DepartmentsEntity> dIds);

    DepartmentsEntity selectParentDepartmentByDepartmentId(String departmentId);

    int delDepartments(@Param("list") List<DepartmentsEntity> departmentsEntities);

    List<SimpleDepartmentDto> selectSimpleDepartmentByDepartmentIds(@Param("depIds") List<String> depIds);

    SimpleDepartmentDto selectSimpleDepartmentByDepartmentId(@Param("departmentId") String departmentId);

}
