package com.lz.modules.app.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lz.modules.app.dto.GraphicsStatisticalDto;
import com.lz.modules.app.dto.StaffBaseInfoDto;
import com.lz.modules.app.dto.StaffDto;
import com.lz.modules.app.dto.StaffStatisticalDto;
import com.lz.modules.app.entity.StaffEntity;
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);

}
