mybatis mysql获取当前数据库所有表与表字段信息
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import java.util.List;
import java.util.Map;
@Mapper
public interface TableDao {
@Select("select * from information_schema.TABLES where TABLE_SCHEMA=(select database())")
List<Map> listTable();
@Select("select * from information_schema.COLUMNS where TABLE_SCHEMA = (select database()) and TABLE_NAME=#{tableName}")
List<Map> listTableColumn(String tableName);
}
更多内容请访问:IT源点
注意:本文归作者所有,未经作者允许,不得转载