mirror of
https://gitee.com/mybatis-flex/mybatis-flex.git
synced 2025-12-07 00:58:24 +08:00
feat: apt 添加字段排序。
This commit is contained in:
parent
2e802f3bf5
commit
ab1da604d0
@ -149,7 +149,7 @@ public class MybatisFlexProcessor extends AbstractProcessor {
|
||||
assert table != null;
|
||||
|
||||
// 类属性 fix: https://gitee.com/mybatis-flex/mybatis-flex/issues/I7I08X
|
||||
Set<ColumnInfo> columnInfos = new HashSet<>();
|
||||
Set<ColumnInfo> columnInfos = new TreeSet<>();
|
||||
// 默认查询的属性,非 isLarge 字段
|
||||
List<String> defaultColumns = new ArrayList<>();
|
||||
|
||||
|
||||
@ -24,7 +24,7 @@ import java.util.Objects;
|
||||
* @author 王帅
|
||||
* @since 2023-07-01
|
||||
*/
|
||||
public class ColumnInfo {
|
||||
public class ColumnInfo implements Comparable<ColumnInfo> {
|
||||
|
||||
/**
|
||||
* 属性名。
|
||||
@ -82,4 +82,12 @@ public class ColumnInfo {
|
||||
return property != null ? property.hashCode() : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(ColumnInfo o) {
|
||||
// 先根据属性长度排序,属性名短的在上
|
||||
int compare = Integer.compare(property.length(), o.property.length());
|
||||
// 属性名长度一样,再按字母排序
|
||||
return compare == 0 ? property.compareTo(o.property) : compare;
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user