mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-05-09 23:51:34 +08:00
新增获取表是否存在于数据库状态标识
This commit is contained in:
parent
2881062f33
commit
68c9153eeb
@ -229,6 +229,7 @@ public class MetaUtil {
|
|||||||
if (null != rs) {
|
if (null != rs) {
|
||||||
if (rs.next()) {
|
if (rs.next()) {
|
||||||
table.setComment(rs.getString("REMARKS"));
|
table.setComment(rs.getString("REMARKS"));
|
||||||
|
table.setExists(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -45,6 +45,11 @@ public class Table implements Serializable, Cloneable {
|
|||||||
*/
|
*/
|
||||||
private final Map<String, Column> columns = new LinkedHashMap<>();
|
private final Map<String, Column> columns = new LinkedHashMap<>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表是否存在
|
||||||
|
*/
|
||||||
|
private Boolean exists;
|
||||||
|
|
||||||
public static Table create(String tableName) {
|
public static Table create(String tableName) {
|
||||||
return new Table(tableName);
|
return new Table(tableName);
|
||||||
}
|
}
|
||||||
@ -58,6 +63,7 @@ public class Table implements Serializable, Cloneable {
|
|||||||
*/
|
*/
|
||||||
public Table(String tableName) {
|
public Table(String tableName) {
|
||||||
this.setTableName(tableName);
|
this.setTableName(tableName);
|
||||||
|
this.setExists(false);
|
||||||
}
|
}
|
||||||
// ----------------------------------------------------- Constructor end
|
// ----------------------------------------------------- Constructor end
|
||||||
|
|
||||||
@ -173,6 +179,27 @@ public class Table implements Serializable, Cloneable {
|
|||||||
public void setPkNames(Set<String> pkNames) {
|
public void setPkNames(Set<String> pkNames) {
|
||||||
this.pkNames = pkNames;
|
this.pkNames = pkNames;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取表是否存在
|
||||||
|
*
|
||||||
|
* @return 表是否存在
|
||||||
|
*/
|
||||||
|
public Boolean isExists() {
|
||||||
|
return exists;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置表是否存在
|
||||||
|
*
|
||||||
|
* @param exists 表是否存在
|
||||||
|
* @return this
|
||||||
|
*/
|
||||||
|
public Table setExists(Boolean exists) {
|
||||||
|
this.exists = exists;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------- Getters and Setters end
|
// ----------------------------------------------------- Getters and Setters end
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user