package com.lz.modules.app.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.lz.modules.app.dto.*;
import com.lz.modules.app.entity.DepartmentsEntity;
import com.lz.modules.app.entity.StaffEntity;
import com.lz.modules.app.entity.StaffSimpleInfo;
import com.lz.modules.app.req.ReportListReq;
import com.lz.modules.equipment.entity.model.FindByNameModel;
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-29 20:59:20
 */
@Mapper
public interface StaffDao extends BaseMapper<StaffEntity> {

    StaffEntity getStaffInfoByOpenId(@Param("openId") String openId);

    int updateStaff(StaffEntity staff);

    int addStaffBatch(@Param("staffs") List<StaffEntity> staffs);

    StaffEntity getByName(@Param("name") String name);

    List<StaffDto> getStaffInfos(@Param("departmentId") String departmentId, @Param("name") String name, @Param("staffStatus") Integer staffStatus, @Param("pageLimit") int pageLimit, @Param("startIndex") int startIndex);

    int getStaffInfoCount(@Param("departmentId") String departmentId, @Param("name") String name, @Param("staffStatus") Integer staffStatus);

    StaffBaseInfoDto getBaseInfo(@Param("staffId") Long staffId);

    StaffStatisticalDto getStatisticalData(@Param("departmentId") String departmentId, @Param("beginDate") String beginDate, @Param("endDate") String endDate);

    List<GraphicsStatisticalDto> getGenderData(@Param("departmentId") String departmentId, @Param("beginDate") String beginDate, @Param("endDate") String endDate);

    List<GraphicsStatisticalDto> getAgeData(@Param("departmentId") String departmentId, @Param("beginDate") String beginDate, @Param("endDate") String endDate);

    List<GraphicsStatisticalDto> getJobSeniorityData(@Param("departmentId") String departmentId, @Param("beginDate") String beginDate, @Param("endDate") String endDate);

    List<GraphicsStatisticalDto> getEducationData(@Param("departmentId") String departmentId, @Param("beginDate") String beginDate, @Param("endDate") String endDate);

    List<StaffEntity> selectByName(@Param("name") String name);

    List<StaffEntity> selectByIds(@Param("staffIds") List<Long> staffIds);



    StaffEntity selectStaffById(@Param("id") Long id);


    Long insertStaff(StaffEntity staff);


    int updateStaffById(StaffEntity staff);


    int updateCoverStaffById(StaffEntity staff);


    int deleteStaffById(@Param("id") Long id);


    int addStaff(StaffEntity staff);


    List<StaffEntity> selectByRang(@Param("id") String id);

    StaffEntity selectByPhone(@Param("phone") String phone);

    StaffEntity selectStaffByEmployeeId(@Param("employeeId") String employeeId);

    List<StaffEntity> selectBySearchName(@Param("page") IPage page, @Param("model") FindByNameModel nameModel);

    List<StaffEntity> selectAll();

    List<ReportProgressListDto> getPositionByStaffIds(@Param("req") ReportListReq req, @Param("staffIds") List<String> staffIds, @Param("page") IPage page);

    List<StaffSimpleDto> selectStaffSimpleInfoByIds(@Param("ids") List<Long> ids);

    List<StaffDto> getDepatAllStaffInfos(@Param("departmentId") String departmentId);

    List<StaffSimpleInfo> selectAllStaffSimpleInfos(@Param("depart") DepartmentsEntity depart);

    List<StaffSimpleInfo> selectStaffSimpleInfos(@Param("sIds") List<Long> sIds);

    List<StaffEntity> selectOnJobByIds(@Param("mIds") List<Long> mIds);

    StaffSimpleInfo selectStaffSimpleInfo(@Param("staffId") Long staffId);

    List<StaffEntity> selectNamesByIds(@Param("list") List<Long> sIds);

    List<StaffEntity> selectStaffsByGroupId(@Param("copyId") Long copyId);

    List<StaffEntity> findManger(@Param("recordId") Long recordId, @Param("flowProcess") int flowProcess);
}
