package cn.iocoder.lyzsys.module.tjt.dal.mysql.project;

import cn.iocoder.lyzsys.framework.common.pojo.PageResult;
import cn.iocoder.lyzsys.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.lyzsys.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.lyzsys.module.tjt.controller.admin.project.vo.ProjectPageReqVO;
import cn.iocoder.lyzsys.module.tjt.dal.dataobject.project.ProjectDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 项目 Mapper
 *
 * @author Codex
 */
@Mapper
public interface ProjectMapper extends BaseMapperX<ProjectDO> {

    default PageResult<ProjectDO> selectPage(ProjectPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ProjectDO>()
                .likeIfPresent(ProjectDO::getProjectName, reqVO.getProjectName())
                .eqIfPresent(ProjectDO::getContractSignedFlag, reqVO.getContractSignedFlag())
                .eqIfPresent(ProjectDO::getProjectStartYear, reqVO.getProjectStartYear())
                .eqIfPresent(ProjectDO::getProjectStatus, reqVO.getProjectStatus())
                .betweenIfPresent(ProjectDO::getCreateTime, reqVO.getCreateTime())
                .orderByAsc(ProjectDO::getSortNo)
                .orderByAsc(ProjectDO::getId));
    }

}
