package com.cf.imes.module.system.dal.mysql.datasource;

import java.util.*;

import com.cf.imes.framework.common.pojo.PageResult;
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX;
import com.cf.imes.module.system.dal.dataobject.datasource.DataSourceDO;
import org.apache.ibatis.annotations.Mapper;
import com.cf.imes.module.system.controller.admin.datasource.vo.*;

/**
 * 系统数据源 Mapper
 *
 * @author 晨丰科技
 */
@Mapper
public interface DataSourceMapper extends BaseMapperX<DataSourceDO> {

    default PageResult<DataSourceDO> selectPage(DataSourcePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<DataSourceDO>()
                .likeIfPresent(DataSourceDO::getName, reqVO.getName())
                .eqIfPresent(DataSourceDO::getSqlStr, reqVO.getSqlStr())
                .eqIfPresent(DataSourceDO::getType, reqVO.getType())
                .betweenIfPresent(DataSourceDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(DataSourceDO::getId));
    }

    List<DataSourceRespVO> selectListVO();
}