package jnpf.personnels.mapper;

import cn.hutool.core.date.DateTime;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fantaibao.permission.annotation.DataScope;
import jnpf.model.attendance.vo.DailyApprovalVo;
import jnpf.model.personnels.dto.base.PersonnelsQueryDTO;
import jnpf.model.personnels.dto.secondment.FtbSecondMentQueryDTO;
import jnpf.model.personnels.po.FtbPersonnelsSecondmentManagement;
import jnpf.model.personnels.vo.secondment.FtbPersonnelsSecondmentVO;
import org.apache.ibatis.annotations.Param;

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

/**
*
*
*@Author: peng.hao
*@create: 2025/9/11
*
*/
public interface FtbPersonnelsSecondmentManagementMapper extends BaseMapper<FtbPersonnelsSecondmentManagement> {
    /**
     * 获取列表
     *
     * @param page
     * @param dto
     * @return
     */
    @DataScope(tableAlias = "se")
    Page<FtbPersonnelsSecondmentVO> pageList(@Param("page") Page<FtbPersonnelsSecondmentVO> page,
                                                   @Param("dto") PersonnelsQueryDTO dto);

    int checkIsInTheProcess(@Param("userId") String userId);

    int checkTheSecondmentTime(@Param("userId")String userId,
                               @Param("secondedStartTime") Date secondedStartTime,
                               @Param("secondedEndTime") Date secondedEndTime);

    Integer getUserGoOut(@Param("userId") String userId,
                            @Param("startTime")  Date secondedStartTime,
                         @Param("endTime")   Date secondedEndTime);

    Integer getUserGoOutForDay(@Param("userId") String userId,
                               @Param("startTime")  Date secondedStartTime,
                               @Param("endTime")   Date secondedEndTime);

    Integer getBusinessTrip(@Param("userId") String userId,
                            @Param("startTime")  Date secondedStartTime,
                            @Param("endTime")   Date secondedEndTime);

    List<FtbPersonnelsSecondmentManagement> getIdList(@Param("userId")String userId,@Param("leaveTime") Date leaveTime);

    List<FtbPersonnelsSecondmentVO> getSecondmentRecord(@Param("userId")String userId,
                                                        @Param("startLeaveTime")String startLeaveTime,
                                                        @Param("endLeaveTime") String endLeaveTime);

    List<FtbPersonnelsSecondmentVO> getSecondmentRecordBath(@Param("dto") FtbSecondMentQueryDTO dto);

    List<FtbPersonnelsSecondmentManagement> checkSecondmentEnd(@Param("date") DateTime date);


    List<DailyApprovalVo> queryListApproval(@Param("dto") FtbSecondMentQueryDTO dto);
}