mirror of
https://gitee.com/dromara/hutool.git
synced 2025-04-24 18:04:54 +08:00
!1235 hutool Column 暂未有 字段顺序,故新增列顺序字段 order
Merge pull request !1235 from 无极侠岚/v6-dev
This commit is contained in:
commit
6873b39095
@ -75,7 +75,19 @@ public class Column implements Serializable, Cloneable {
|
||||
* 是否为主键
|
||||
*/
|
||||
private boolean isPk;
|
||||
// ----------------------------------------------------- Fields end
|
||||
/**
|
||||
* 列字段顺序
|
||||
*/
|
||||
private int order;
|
||||
|
||||
public int getOrder() {
|
||||
return order;
|
||||
}
|
||||
|
||||
public void setOrder(int order) {
|
||||
this.order = order;
|
||||
}
|
||||
// ----------------------------------------------------- Fields end
|
||||
|
||||
/**
|
||||
* 创建列对象
|
||||
@ -137,7 +149,7 @@ public class Column implements Serializable, Cloneable {
|
||||
this.isNullable = columnMetaRs.getBoolean("NULLABLE");
|
||||
this.remarks = columnMetaRs.getString("REMARKS");
|
||||
this.columnDef = columnMetaRs.getString("COLUMN_DEF");
|
||||
|
||||
this.order = columnMetaRs.getRow();
|
||||
// 保留小数位数
|
||||
try {
|
||||
this.digit = columnMetaRs.getInt("DECIMAL_DIGITS");
|
||||
@ -395,7 +407,7 @@ public class Column implements Serializable, Cloneable {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Column [tableName=" + tableName + ", name=" + name + ", type=" + type + ", size=" + size + ", isNullable=" + isNullable + "]";
|
||||
return "Column [tableName=" + tableName + ", name=" + name + ", type=" + type + ", size=" + size + ", isNullable=" + isNullable + ", order=" + order + "]";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -54,4 +54,14 @@ public class MetaUtilTest {
|
||||
final Table table = MetaUtil.getTableMeta(ds, "user_1");
|
||||
Assertions.assertEquals(table.getIndexInfoList().size(), 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* 增加 列顺序字段
|
||||
*/
|
||||
@Test
|
||||
public void getTableColumnTest() {
|
||||
final Table table = MetaUtil.getTableMeta(ds, "user");
|
||||
System.out.println(table.getColumns());
|
||||
Assertions.assertEquals(SetUtil.of("id"), table.getPkNames());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user