package com.yhy.module.core.dal.mysql.workbench;

import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.yhy.module.core.dal.dataobject.workbench.SyncLibraryDO;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;

/**
 * 同步库主表 Mapper
 *
 * @author yhy
 */
@Mapper
public interface SyncLibraryMapper extends BaseMapperX<SyncLibraryDO> {

    /**
     * 根据项目ID查询同步库列表
     */
    default List<SyncLibraryDO> selectListByProjectId(Long projectId) {
        return selectList(new LambdaQueryWrapperX<SyncLibraryDO>()
                .eq(SyncLibraryDO::getProjectId, projectId)
                .orderByDesc(SyncLibraryDO::getCreateTime));
    }

    /**
     * 根据来源分部分项ID查询
     */
    default SyncLibraryDO selectBySourceDivisionId(Long sourceDivisionId) {
        return selectOne(new LambdaQueryWrapperX<SyncLibraryDO>()
                .eq(SyncLibraryDO::getSourceDivisionId, sourceDivisionId));
    }
}
