package cn.iocoder.yudao.module.crm.dal.mysql.crmflow;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.crm.controller.admin.crmflow.vo.CrmFlowPageReqVO;
import cn.iocoder.yudao.module.crm.dal.dataobject.crmflow.CrmFlowDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 审批流程 Mapper
 *
 * @author yshop
 */
@Mapper
public interface CrmFlowMapper extends BaseMapperX<CrmFlowDO> {

    default PageResult<CrmFlowDO> selectPage(CrmFlowPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<CrmFlowDO>()
                .likeIfPresent(CrmFlowDO::getName, reqVO.getName())
                .eqIfPresent(CrmFlowDO::getTypes, reqVO.getTypes())
                .eqIfPresent(CrmFlowDO::getRemark, reqVO.getRemark())
                .eqIfPresent(CrmFlowDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(CrmFlowDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(CrmFlowDO::getId));
    }

}
