package cn.iocoder.yudao.module.bpm.dal.mysql.processmapping;

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.bpm.controller.admin.processmapping.vo.BpmProcessMappingConfigPageReqVO;
import cn.iocoder.yudao.module.bpm.dal.dataobject.processmapping.BpmProcessMappingConfigDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 流程映射配置 Mapper
 *
 * @author 系统
 */
@Mapper
public interface BpmProcessMappingConfigMapper extends BaseMapperX<BpmProcessMappingConfigDO> {

    default PageResult<BpmProcessMappingConfigDO> selectPage(BpmProcessMappingConfigPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<BpmProcessMappingConfigDO>()
                .likeIfPresent(BpmProcessMappingConfigDO::getProcessCode, reqVO.getProcessCode())
                .likeIfPresent(BpmProcessMappingConfigDO::getProcessName, reqVO.getProcessName())
                .likeIfPresent(BpmProcessMappingConfigDO::getTableName, reqVO.getTableName())
                .likeIfPresent(BpmProcessMappingConfigDO::getEntityClass, reqVO.getEntityClass())
                .betweenIfPresent(BpmProcessMappingConfigDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(BpmProcessMappingConfigDO::getId));
    }

    default BpmProcessMappingConfigDO selectByProcessCode(String processCode) {
        return selectOne(BpmProcessMappingConfigDO::getProcessCode, processCode);
    }

}
