|
@@ -1,7 +1,5 @@
|
|
|
package com.chelvc.framework.database.support;
|
|
|
|
|
|
-import java.util.List;
|
|
|
-
|
|
|
import com.baomidou.mybatisplus.annotation.IdType;
|
|
|
import com.baomidou.mybatisplus.core.enums.SqlMethod;
|
|
|
import com.baomidou.mybatisplus.core.injector.AbstractMethod;
|
|
@@ -33,40 +31,37 @@ public abstract class AbstractCreateMethod extends AbstractMethod {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 将字段转换成列
|
|
|
+ * 获取表新增字段信息
|
|
|
*
|
|
|
- * @param table 表信息
|
|
|
- * @param fields 字段列表
|
|
|
- * @return 列信息
|
|
|
+ * @param table 表信息
|
|
|
+ * @return 字段信息
|
|
|
*/
|
|
|
- protected String field2column(TableInfo table, List<TableFieldInfo> fields) {
|
|
|
+ protected String getColumns(TableInfo table) {
|
|
|
String columns = table.getKeyInsertSqlColumn(false) +
|
|
|
- this.filterTableFieldInfo(fields, null, TableFieldInfo::getInsertSqlColumn, EMPTY);
|
|
|
+ this.filterTableFieldInfo(table.getFieldList(), null, TableFieldInfo::getInsertSqlColumn, EMPTY);
|
|
|
return columns.substring(0, columns.length() - 1);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 将字段转换成属性
|
|
|
+ * 获取表新增属性
|
|
|
*
|
|
|
- * @param table 表信息
|
|
|
- * @param fields 字段列表
|
|
|
+ * @param table 表信息
|
|
|
* @return 属性信息
|
|
|
*/
|
|
|
- protected String field2property(TableInfo table, List<TableFieldInfo> fields) {
|
|
|
- return this.field2property(table, null, fields);
|
|
|
+ protected String getProperties(TableInfo table) {
|
|
|
+ return this.getProperties(table, null);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 将字段转换成属性
|
|
|
+ * 获取表新增属性
|
|
|
*
|
|
|
* @param table 表信息
|
|
|
* @param prefix 属性前缀
|
|
|
- * @param fields 字段列表
|
|
|
* @return 属性信息
|
|
|
*/
|
|
|
- protected String field2property(TableInfo table, String prefix, List<TableFieldInfo> fields) {
|
|
|
+ protected String getProperties(TableInfo table, String prefix) {
|
|
|
String properties = table.getKeyInsertSqlProperty(prefix, false) +
|
|
|
- this.filterTableFieldInfo(fields, null, i -> i.getInsertSqlProperty(prefix), EMPTY);
|
|
|
+ this.filterTableFieldInfo(table.getFieldList(), null, i -> i.getInsertSqlProperty(prefix), EMPTY);
|
|
|
return properties.substring(0, properties.length() - 1);
|
|
|
}
|
|
|
|