mirror of
https://gitee.com/mybatis-flex/mybatis-flex.git
synced 2025-12-08 01:28:24 +08:00
ColumnConfig添加tenantId字段,用于代码生成时添加@Column(tenantId=true)注解
This commit is contained in:
parent
eda42f60d5
commit
0293bb4c09
@ -42,6 +42,8 @@ public class ColumnConfig implements Serializable {
|
||||
private String keyValue;
|
||||
private Boolean keyBefore;
|
||||
|
||||
private Boolean tenantId;
|
||||
|
||||
|
||||
public String getColumnName() {
|
||||
return columnName;
|
||||
@ -146,4 +148,12 @@ public class ColumnConfig implements Serializable {
|
||||
public void setKeyBefore(Boolean keyBefore) {
|
||||
this.keyBefore = keyBefore;
|
||||
}
|
||||
|
||||
public Boolean getTenantId() {
|
||||
return tenantId;
|
||||
}
|
||||
|
||||
public void setTenantId(Boolean tenantId) {
|
||||
this.tenantId = tenantId;
|
||||
}
|
||||
}
|
||||
|
||||
@ -150,6 +150,7 @@ public class Column {
|
||||
|| columnConfig.getVersion() != null
|
||||
|| columnConfig.getJdbcType() != null
|
||||
|| columnConfig.getTypeHandler() != null
|
||||
|| columnConfig.getTenantId() != null
|
||||
) {
|
||||
annotations.append("@Column(");
|
||||
boolean needComma = false;
|
||||
@ -185,6 +186,11 @@ public class Column {
|
||||
if (columnConfig.getTypeHandler() != null) {
|
||||
addComma(annotations, needComma);
|
||||
annotations.append("typeHandler=" + columnConfig.getTypeHandler().getSimpleName() + ".class");
|
||||
needComma = true;
|
||||
}
|
||||
if (Boolean.TRUE.equals(columnConfig.getTenantId())) {
|
||||
addComma(annotations, needComma);
|
||||
annotations.append("tenantId=true");
|
||||
}
|
||||
annotations.append(")");
|
||||
}
|
||||
@ -194,7 +200,11 @@ public class Column {
|
||||
annotations.append("@ColumnMask(\"" + columnConfig.getMask() + "\")");
|
||||
}
|
||||
|
||||
return annotations.toString();
|
||||
String result = annotations.toString();
|
||||
if (!result.isEmpty()) {
|
||||
result += "\n ";
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private void addComma(StringBuilder annotations, boolean needComma) {
|
||||
@ -242,6 +252,7 @@ public class Column {
|
||||
|| columnConfig.getVersion() != null
|
||||
|| columnConfig.getJdbcType() != null
|
||||
|| columnConfig.getTypeHandler() != null
|
||||
|| Boolean.TRUE.equals(columnConfig.getTenantId())
|
||||
) {
|
||||
importClasses.add(com.mybatisflex.annotation.Column.class.getName());
|
||||
}
|
||||
|
||||
@ -7,9 +7,9 @@ import #(importClass);
|
||||
|
||||
#(table.buildTableAnnotation())
|
||||
public class #(table.buildEntityClassName())#(table.buildExtends())#(table.buildImplements()) {
|
||||
#for(column: table.columns)
|
||||
|
||||
#for(column: table.columns) #(column.buildAnnotations())
|
||||
private #(column.propertySimpleType) #(column.property);
|
||||
#(column.buildAnnotations())private #(column.propertySimpleType) #(column.property);
|
||||
#end
|
||||
|
||||
#if(!globalConfig.isEntityWithLombok())
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user