package cn.iocoder.yudao.module.relations.dal.mysql.turnover;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.relations.dal.dataobject.turnover.RelationsTurnoverDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.relations.controller.admin.turnover.vo.*;

/**
 * 离职信息 Mapper
 *
 * @author zhaopq
 */
@Mapper
public interface RelationsTurnoverMapper extends BaseMapperX<RelationsTurnoverDO> {

    default PageResult<RelationsTurnoverDO> selectPage(RelationsTurnoverPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<RelationsTurnoverDO>()
                .eqIfPresent(RelationsTurnoverDO::getTurnoverId, reqVO.getTurnoverId())
                .eqIfPresent(RelationsTurnoverDO::getEmployeeId, reqVO.getEmployeeId())
                .eqIfPresent(RelationsTurnoverDO::getEmployeeUuid, reqVO.getEmployeeUuid())
                .likeIfPresent(RelationsTurnoverDO::getEmployeeName, reqVO.getEmployeeName())
                .eqIfPresent(RelationsTurnoverDO::getEmployeePhone, reqVO.getEmployeePhone())
                .eqIfPresent(RelationsTurnoverDO::getUserId, reqVO.getUserId())
                .eqIfPresent(RelationsTurnoverDO::getUserUuid, reqVO.getUserUuid())
                .eqIfPresent(RelationsTurnoverDO::getDeptId, reqVO.getDeptId())
                .eqIfPresent(RelationsTurnoverDO::getDeptUuid, reqVO.getDeptUuid())
                .eqIfPresent(RelationsTurnoverDO::getPosition, reqVO.getPosition())
                .betweenIfPresent(RelationsTurnoverDO::getEntryDate, reqVO.getEntryDate())
                .betweenIfPresent(RelationsTurnoverDO::getTurnoverDate, reqVO.getTurnoverDate())
                .eqIfPresent(RelationsTurnoverDO::getTurnoverReason, reqVO.getTurnoverReason())
                .eqIfPresent(RelationsTurnoverDO::getRemarks, reqVO.getRemarks())
                .eqIfPresent(RelationsTurnoverDO::getStatus, reqVO.getStatus())
                .eqIfPresent(RelationsTurnoverDO::getInfoSource, reqVO.getInfoSource())
                .eqIfPresent(RelationsTurnoverDO::getCreatorEmployeeId, reqVO.getCreatorEmployeeId())
                .likeIfPresent(RelationsTurnoverDO::getCreatorEmployeeName, reqVO.getCreatorEmployeeName())
                .betweenIfPresent(RelationsTurnoverDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(RelationsTurnoverDO::getTenantId, reqVO.getTenantId())
                .orderByDesc(RelationsTurnoverDO::getId));
    }

}