package cn.iocoder.yudao.module.portal.dal.mysql.jobpost;

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.portal.dal.dataobject.jobpost.JobPostDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.portal.controller.admin.jobpost.vo.*;

/**
 * 职位 Mapper
 *
 * @author 篮智科技
 */
@Mapper
public interface JobPostMapper extends BaseMapperX<JobPostDO> {

    default PageResult<JobPostDO> selectPage(JobPostPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<JobPostDO>()
                .eqIfPresent(JobPostDO::getTitle, reqVO.getTitle())
                .eqIfPresent(JobPostDO::getDescription, reqVO.getDescription())
                .eqIfPresent(JobPostDO::getRequirement, reqVO.getRequirement())
                .eqIfPresent(JobPostDO::getCityId, reqVO.getCityId())
                .eqIfPresent(JobPostDO::getJobCategoryId, reqVO.getJobCategoryId())
                .betweenIfPresent(JobPostDO::getPublishTime, reqVO.getPublishTime())
                .betweenIfPresent(JobPostDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(JobPostDO::getId));
    }

}