mirror of https://gitee.com/y_project/RuoYi.git
代码生成实体根据模板区分不同父字段
parent
9f5067fbad
commit
69cc7a4111
|
@ -44,6 +44,12 @@ public class GenConstants
|
|||
public static final String[] COLUMNNAME_NOT_QUERY = { "id", "create_by", "create_time", "del_flag", "update_by",
|
||||
"update_time", "remark" };
|
||||
|
||||
/** Entity基类字段 */
|
||||
public static final String[] BASE_ENTITY = { "createBy", "createTime", "updateBy", "updateTime", "remark" };
|
||||
|
||||
/** Tree基类字段 */
|
||||
public static final String[] TREE_ENTITY = { "parentName", "parentId", "orderNum", "ancestors" };
|
||||
|
||||
/** 文本框 */
|
||||
public static final String HTML_INPUT = "input";
|
||||
|
||||
|
|
|
@ -252,4 +252,18 @@ public class GenTable extends BaseEntity
|
|||
{
|
||||
return tplCategory != null && StringUtils.equals(GenConstants.TPL_CRUD, tplCategory);
|
||||
}
|
||||
|
||||
public boolean isSuperColumn(String javaField)
|
||||
{
|
||||
return isSuperColumn(this.tplCategory, javaField);
|
||||
}
|
||||
|
||||
public static boolean isSuperColumn(String tplCategory, String javaField)
|
||||
{
|
||||
if (isTree(tplCategory))
|
||||
{
|
||||
StringUtils.equalsAnyIgnoreCase(javaField, GenConstants.TREE_ENTITY);
|
||||
}
|
||||
return StringUtils.equalsAnyIgnoreCase(javaField, GenConstants.BASE_ENTITY);
|
||||
}
|
||||
}
|
|
@ -28,7 +28,7 @@ public class ${ClassName} extends ${Entity}
|
|||
private static final long serialVersionUID = 1L;
|
||||
|
||||
#foreach ($column in $columns)
|
||||
#if(!$column.superColumn)
|
||||
#if(!$table.isSuperColumn($column.javaField))
|
||||
/** $column.columnComment */
|
||||
#if($column.list)
|
||||
#set($parentheseIndex=$column.columnComment.indexOf("("))
|
||||
|
@ -50,7 +50,7 @@ public class ${ClassName} extends ${Entity}
|
|||
#end
|
||||
#end
|
||||
#foreach ($column in $columns)
|
||||
#if(!$column.superColumn)
|
||||
#if(!$table.isSuperColumn($column.javaField))
|
||||
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
|
||||
public void set${AttrName}($column.javaType $column.javaField)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue