package com.ruoyi.web.primary.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ruoyi.web.primary.entity.DatabaseMetadata;
import com.ruoyi.web.v2.v1.mapper.DatabaseMetadataMapper;
import com.ruoyi.web.primary.service.IDatabaseMetadataService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author author
 * @since 2025-11-25
 */
@Service
public class DatabaseMetadataServiceImpl extends ServiceImpl<DatabaseMetadataMapper, DatabaseMetadata> implements IDatabaseMetadataService {

    @Override
    public List<DatabaseMetadata> getAllConfigs() {
        return this.list();
    }

    @Override
    public DatabaseMetadata selectByName(String dbName) {
        return this.getOne(new QueryWrapper<DatabaseMetadata>().eq("db_name",dbName));
    }
    @Override
    public DatabaseMetadata selectByAccountId(String userId) {
        return this.getOne(new QueryWrapper<DatabaseMetadata>().eq("user_id",userId));
    }
}
