mirror of
https://gitee.com/mybatis-flex/mybatis-flex.git
synced 2025-12-07 00:58:24 +08:00
commit
a48d363815
@ -149,7 +149,11 @@ public class MybatisFlexProcessor extends AbstractProcessor {
|
||||
assert table != null;
|
||||
|
||||
// 类属性
|
||||
List<ColumnInfo> columnInfoList = new LinkedList<>();
|
||||
//修改bug https://gitee.com/mybatis-flex/mybatis-flex/issues/I7I08X
|
||||
//会执行 subClass subClass
|
||||
//再执行 superClass superClass
|
||||
//按照顺序使用,子类有的属性,父类放不进去,也就形成了子类覆盖父类
|
||||
Collection<ColumnInfo> columnInfoList = new HashSet<>();
|
||||
// 默认查询的属性,非 isLarge 字段
|
||||
List<String> defaultColumns = new ArrayList<>();
|
||||
|
||||
@ -220,7 +224,7 @@ public class MybatisFlexProcessor extends AbstractProcessor {
|
||||
return SourceVersion.latestSupported();
|
||||
}
|
||||
|
||||
private void fillColumnInfoList(List<ColumnInfo> columnInfoList, List<String> defaultColumns, TypeElement baseElement, TypeElement classElement, boolean camelToUnderline) {
|
||||
private void fillColumnInfoList(Collection<ColumnInfo> columnInfoList, List<String> defaultColumns, TypeElement baseElement, TypeElement classElement, boolean camelToUnderline) {
|
||||
for (Element fieldElement : classElement.getEnclosedElements()) {
|
||||
|
||||
// all fields
|
||||
@ -296,6 +300,7 @@ public class MybatisFlexProcessor extends AbstractProcessor {
|
||||
columnInfo.setProperty(property);
|
||||
columnInfo.setColumn(columnName);
|
||||
columnInfo.setAlias(alias);
|
||||
columnInfo.setFullClassName(baseElement.getQualifiedName().toString());
|
||||
|
||||
columnInfoList.add(columnInfo);
|
||||
|
||||
|
||||
@ -20,6 +20,7 @@ import com.mybatisflex.annotation.Table;
|
||||
import com.mybatisflex.processor.entity.ColumnInfo;
|
||||
import com.mybatisflex.processor.util.StrUtil;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.StringJoiner;
|
||||
|
||||
@ -56,7 +57,7 @@ public class ContentBuilder {
|
||||
public static String buildTableDef(Table table, String entityClass, String entityClassName, boolean allInTablesEnable,
|
||||
String tableDefPackage, String tableDefClassName,
|
||||
String tableDefPropertiesNameStyle, String tableDefInstanceSuffix,
|
||||
List<ColumnInfo> columnInfoList, List<String> defaultColumns) {
|
||||
Collection<ColumnInfo> columnInfoList, List<String> defaultColumns) {
|
||||
StringBuilder content = new StringBuilder("package ");
|
||||
content.append(tableDefPackage).append(";\n\n");
|
||||
content.append("import com.mybatisflex.core.query.QueryColumn;\n");
|
||||
|
||||
@ -16,6 +16,8 @@
|
||||
|
||||
package com.mybatisflex.processor.entity;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 列详细信息。
|
||||
*
|
||||
@ -39,6 +41,8 @@ public class ColumnInfo {
|
||||
*/
|
||||
private String[] alias;
|
||||
|
||||
private String fullClassName;
|
||||
|
||||
public String getProperty() {
|
||||
return property;
|
||||
}
|
||||
@ -63,4 +67,24 @@ public class ColumnInfo {
|
||||
this.alias = alias;
|
||||
}
|
||||
|
||||
public String getFullClassName() {
|
||||
return fullClassName;
|
||||
}
|
||||
|
||||
public void setFullClassName(String fullClassName) {
|
||||
this.fullClassName = fullClassName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
ColumnInfo that = (ColumnInfo) o;
|
||||
return Objects.equals(property, that.property) && Objects.equals(fullClassName, that.fullClassName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(property, fullClassName);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
package com.mybatisflex.test;
|
||||
|
||||
import com.mybatisflex.annotation.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Table(value = "tb_account_vv", dataSource = "ds2", onSet = AccountOnSetListener.class)
|
||||
public class AccountVV extends Account implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id(keyType = KeyType.Auto)
|
||||
private Long id;
|
||||
|
||||
private String userName;
|
||||
|
||||
private int age;
|
||||
private int ageVV;
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user