mirror of
https://gitee.com/mybatis-flex/mybatis-flex.git
synced 2025-12-07 00:58:24 +08:00
optimize codegen module
This commit is contained in:
parent
e7b6792342
commit
4a35667cb2
@ -16,6 +16,7 @@
|
|||||||
package com.mybatisflex.codegen.config;
|
package com.mybatisflex.codegen.config;
|
||||||
|
|
||||||
import com.mybatisflex.annotation.InsertListener;
|
import com.mybatisflex.annotation.InsertListener;
|
||||||
|
import com.mybatisflex.annotation.SetListener;
|
||||||
import com.mybatisflex.annotation.UpdateListener;
|
import com.mybatisflex.annotation.UpdateListener;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -42,6 +43,9 @@ public class TableConfig {
|
|||||||
private Class<? extends UpdateListener> updateListenerClass;
|
private Class<? extends UpdateListener> updateListenerClass;
|
||||||
|
|
||||||
|
|
||||||
|
private Class<? extends SetListener> setListenerClass;
|
||||||
|
|
||||||
|
|
||||||
private Map<String, ColumnConfig> columnConfigMap;
|
private Map<String, ColumnConfig> columnConfigMap;
|
||||||
|
|
||||||
|
|
||||||
@ -85,6 +89,14 @@ public class TableConfig {
|
|||||||
this.updateListenerClass = updateListenerClass;
|
this.updateListenerClass = updateListenerClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Class<? extends SetListener> getSetListenerClass() {
|
||||||
|
return setListenerClass;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSetListenerClass(Class<? extends SetListener> setListenerClass) {
|
||||||
|
this.setListenerClass = setListenerClass;
|
||||||
|
}
|
||||||
|
|
||||||
public Map<String, ColumnConfig> getColumnConfigMap() {
|
public Map<String, ColumnConfig> getColumnConfigMap() {
|
||||||
return columnConfigMap;
|
return columnConfigMap;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -135,8 +135,12 @@ public class Column {
|
|||||||
annotations.append("before=" + columnConfig.getKeyBefore());
|
annotations.append("before=" + columnConfig.getKeyBefore());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (annotations.length() == 4) {
|
||||||
|
annotations.deleteCharAt(annotations.length() - 1);
|
||||||
|
} else {
|
||||||
annotations.append(")");
|
annotations.append(")");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//@Column 注解
|
//@Column 注解
|
||||||
if (columnConfig.getOnInsertValue() != null
|
if (columnConfig.getOnInsertValue() != null
|
||||||
|
|||||||
@ -136,6 +136,9 @@ public class Table {
|
|||||||
if (tableConfig.getUpdateListenerClass() != null) {
|
if (tableConfig.getUpdateListenerClass() != null) {
|
||||||
imports.add(tableConfig.getUpdateListenerClass().getName());
|
imports.add(tableConfig.getUpdateListenerClass().getName());
|
||||||
}
|
}
|
||||||
|
if (tableConfig.getSetListenerClass() != null) {
|
||||||
|
imports.add(tableConfig.getSetListenerClass().getName());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return imports.stream().sorted(Comparator.naturalOrder()).collect(Collectors.toList());
|
return imports.stream().sorted(Comparator.naturalOrder()).collect(Collectors.toList());
|
||||||
@ -194,6 +197,9 @@ public class Table {
|
|||||||
if (tableConfig.getUpdateListenerClass() != null) {
|
if (tableConfig.getUpdateListenerClass() != null) {
|
||||||
tableAnnotation.append(", onUpdate = " + tableConfig.getUpdateListenerClass().getSimpleName() + ".class");
|
tableAnnotation.append(", onUpdate = " + tableConfig.getUpdateListenerClass().getSimpleName() + ".class");
|
||||||
}
|
}
|
||||||
|
if (tableConfig.getSetListenerClass() != null) {
|
||||||
|
tableAnnotation.append(", onSet = " + tableConfig.getUpdateListenerClass().getSimpleName() + ".class");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return tableAnnotation.append(")").toString();
|
return tableAnnotation.append(")").toString();
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user