package cn.iocoder.yudao.module.bpm.dal.mysql.oa.universal;

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.bpm.controller.admin.oa.universal.vo.OaUniversalPageReqVO;
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.universal.OaUniversalDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 通用事项审批流程信息 Mapper
 *
 * @author dp
 */
@Mapper
public interface OaUniversalMapper extends BaseMapperX<OaUniversalDO> {

    default PageResult<OaUniversalDO> selectPage(OaUniversalPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<OaUniversalDO>()
                .likeIfPresent(OaUniversalDO::getEmployeeName, reqVO.getEmployeeName())
                .likeIfPresent(OaUniversalDO::getEmployeePhone, reqVO.getEmployeePhone())
                .eqIfPresent(OaUniversalDO::getDeptId, reqVO.getDeptId())
                .eqIfPresent(OaUniversalDO::getPostId, reqVO.getPostId())
                .likeIfPresent(OaUniversalDO::getTitle, reqVO.getTitle())
                .eqIfPresent(OaUniversalDO::getAuditStatus, reqVO.getAuditStatus())
                .betweenIfPresent(OaUniversalDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(OaUniversalDO::getId));
    }

}