package com.ozs.mdm.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Param;

import com.ozs.mdm.dto.MdmDimDatabaseType;
import com.ozs.mdm.dto.MdmDimResourceCharset;
import com.ozs.mdm.dto.MdmDimResourceType;
import com.ozs.mdm.dto.MdmInfoDatabase;

public interface DatabaseManageMapper {

	void saveDatabase(MdmInfoDatabase database);

	List<MdmDimDatabaseType> listDatabaseType();

	List<MdmDimResourceType> listResourceType();

	List<MdmDimResourceCharset> listCharsetType();

	List<MdmInfoDatabase> listDatabase(@Param("resourceName") String resourceName,
			@Param("resourceType") Integer resourceType);

	MdmDimResourceType getResorceTypeById(@Param("resourceType") Integer resourceType);

	MdmInfoDatabase getDatabaseById(@Param("id") String id);

	void updateDatabase(MdmInfoDatabase database);

	void removeDatabase(@Param("id") String id);

	Integer checkDatabaseName(@Param("resourceName") String resourceName, @Param("databaseId") String databaseId);

	List<String> listColumnIdByDatabaseId(@Param("databaseId") String databaseId);

	void removeTablesByDatabaseId(@Param("databaseId") String databaseId);

	void removeColumnsByDatabaseId(@Param("databaseId") String databaseId);

	/**
	 * 通过连接信息ip port 和databaseName 获取数据资源数量
	 * 
	 * @param ip
	 * @param resourcePort
	 * @param databaseName
	 * @return
	 */
	int countDatabase(@Param("ip") String ip, @Param("resourcePort") String resourcePort,
			@Param("databaseName") String databaseName);

}
