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

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.entry.RelationsEntryDO;
import cn.iocoder.yudao.module.relations.dal.dataobject.renew.RelationsRenewDO;
import cn.iocoder.yudao.module.system.enums.common.DeletedEnum;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.relations.controller.admin.renew.vo.*;

/**
 * 续签信息 Mapper
 *
 * @author zhaopq
 */
@Mapper
public interface RelationsRenewMapper extends BaseMapperX<RelationsRenewDO> {

    default PageResult<RelationsRenewDO> selectPage(RelationsRenewPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<RelationsRenewDO>()
                .eqIfPresent(RelationsRenewDO::getRenewId, reqVO.getRenewId())
                .eqIfPresent(RelationsRenewDO::getEmployeeId, reqVO.getEmployeeId())
                .eqIfPresent(RelationsRenewDO::getEmployeeUuid, reqVO.getEmployeeUuid())
                .likeIfPresent(RelationsRenewDO::getEmployeeName, reqVO.getEmployeeName())
                .eqIfPresent(RelationsRenewDO::getEmployeePhone, reqVO.getEmployeePhone())
                .eqIfPresent(RelationsRenewDO::getUserId, reqVO.getUserId())
                .eqIfPresent(RelationsRenewDO::getUserUuid, reqVO.getUserUuid())
                .eqIfPresent(RelationsRenewDO::getDeptId, reqVO.getDeptId())
                .eqIfPresent(RelationsRenewDO::getDeptUuid, reqVO.getDeptUuid())
                .eqIfPresent(RelationsRenewDO::getPostId, reqVO.getPostId())
                .eqIfPresent(RelationsRenewDO::getPosition, reqVO.getPosition())
                .betweenIfPresent(RelationsRenewDO::getOldContractStartDate, reqVO.getOldContractStartDate())
                .betweenIfPresent(RelationsRenewDO::getOldContractEndDate, reqVO.getOldContractEndDate())
                .eqIfPresent(RelationsRenewDO::getRenewPeriod, reqVO.getRenewPeriod())
                .betweenIfPresent(RelationsRenewDO::getRenewContractStartDate, reqVO.getRenewContractStartDate())
                .betweenIfPresent(RelationsRenewDO::getRenewContractEndDate, reqVO.getRenewContractEndDate())
                .eqIfPresent(RelationsRenewDO::getRenewReason, reqVO.getRenewReason())
                .eqIfPresent(RelationsRenewDO::getWorkPerformance, reqVO.getWorkPerformance())
                .eqIfPresent(RelationsRenewDO::getRemarks, reqVO.getRemarks())
                .eqIfPresent(RelationsRenewDO::getStatus, reqVO.getStatus())
                .eqIfPresent(RelationsRenewDO::getInfoSource, reqVO.getInfoSource())
                .eqIfPresent(RelationsRenewDO::getCreatorEmployeeId, reqVO.getCreatorEmployeeId())
                .likeIfPresent(RelationsRenewDO::getCreatorEmployeeName, reqVO.getCreatorEmployeeName())
                .betweenIfPresent(RelationsRenewDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(RelationsRenewDO::getTenantId, reqVO.getTenantId())
                .eq(RelationsRenewDO::getDeleted, DeletedEnum.FALSE)
                .orderByDesc(RelationsRenewDO::getId));
    }

}