🔨 修改代码生成器模板.
This commit is contained in:
@@ -23,10 +23,12 @@
|
||||
package org.dromara.visor.framework.mybatis.core.generator.core;
|
||||
|
||||
import cn.orionsec.kit.lang.able.Executable;
|
||||
import cn.orionsec.kit.lang.constant.Const;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.generator.AutoGenerator;
|
||||
import com.baomidou.mybatisplus.generator.config.*;
|
||||
import com.baomidou.mybatisplus.generator.config.builder.CustomFile;
|
||||
import com.baomidou.mybatisplus.generator.config.builder.Entity;
|
||||
import com.baomidou.mybatisplus.generator.config.querys.MySqlQuery;
|
||||
import com.baomidou.mybatisplus.generator.config.rules.DateType;
|
||||
import com.baomidou.mybatisplus.generator.config.rules.DbColumnType;
|
||||
@@ -135,6 +137,10 @@ public class CodeGenerator implements Executable {
|
||||
// 整合注入配置
|
||||
.injection(injectionConfig);
|
||||
|
||||
// 提前解析父类 并且排除父类的 id 字段
|
||||
Entity entity = strategyConfig.entity();
|
||||
entity.getSuperEntityColumns().remove(Const.ID);
|
||||
|
||||
// 执行
|
||||
ag.execute(engine);
|
||||
}
|
||||
|
||||
@@ -60,6 +60,7 @@ public class ${entity} {
|
||||
#end
|
||||
## ---------- BEGIN 字段循环遍历 ----------
|
||||
#foreach($field in ${table.fields})
|
||||
#if("$!field.propertyName" != "id")
|
||||
|
||||
#if(${field.keyFlag})
|
||||
#set($keyPropertyName=${field.propertyName})
|
||||
@@ -88,5 +89,6 @@ public class ${entity} {
|
||||
#end
|
||||
private ${field.propertyType} ${field.propertyName};
|
||||
#end
|
||||
#end
|
||||
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
export const TABLE_NAME = '$table.name';
|
||||
export const TableName = '$table.name';
|
||||
|
||||
#if($dictMap.entrySet().size() > 0)
|
||||
#foreach($enumEntity in $dictMap.entrySet())
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import type { FieldRule } from '@arco-design/web-vue';
|
||||
|
||||
#foreach($field in ${table.fields})
|
||||
#if("$!field.propertyName" != "id")
|
||||
#if(${field.propertyType} == 'String' && "$field.metaInfo.jdbcType" != "LONGVARCHAR")
|
||||
|
||||
Reference in New Issue
Block a user