package com.ruoyi.oa.mapper;

import com.ruoyi.oa.domain.SysOaAttendance;
import com.ruoyi.oa.domain.vo.AttendanceMonthlyCount;
import com.ruoyi.oa.domain.vo.SysOaAttendanceVo;
import com.ruoyi.common.core.mapper.BaseMapperPlus;
import com.ruoyi.oa.domain.vo.SysUserVo;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;

/**
 * 人员考勤Mapper接口
 *
 * @author hdka
 * @date 2024-11-05
 */
public interface SysOaAttendanceMapper extends BaseMapperPlus<SysOaAttendanceMapper, SysOaAttendance, SysOaAttendanceVo> {

    List<SysOaAttendanceVo> selectVoListAndTime(@Param("userId") Long userId, @Param("firstDay") Date firstDay, @Param("lastDay") Date lastDay);

    int delOaAttendanceAll(@Param("firstDay") Date firstDay, @Param("lastDay")Date lastDay,@Param("day")Long day);

    List<SysUserVo> selectUserListAndAttendanceListAndProjectListByUserIds(@Param("userIds") List<Long> userIds, @Param("firstDay")  Date firstDay,@Param("lastDay")  Date lastDay);

    int updateDelAttendance(SysOaAttendance attendance);

    List<SysOaAttendanceVo> queryListByTime(@Param("userId") Long userId,
                                            @Param("attendanceDay") Long attendanceDay,
                                            @Param("startTime") Date startTime,
                                            @Param("endTime") Date endTime);

    /**
     * 计算人天数
     */
    Double getAttendanceDay(@Param("userId") Long userId,
                            @Param("projectId") Long projectId );

    List<Long> selectNowMonthUserId(Date firstDay);

    List<AttendanceMonthlyCount> selectLastSixMonthsByMonth(String refDate);

    AttendanceMonthlyCount selectAttendanceMonthlyCountByMonth(String refDate);

    List<AttendanceMonthlyCount> selectMonthlyCounts(String refDate);

    Long getWorkDaysByUserIdAndProjectId(@Param("userId") Long userId, @Param("projectId") Long projectId, @Param("calcTime") String calcTime, @Param("relationMonth") String relationMonth);
}
