mirror of
https://github.com/dromara/RuoYi-Vue-Plus.git
synced 2026-07-24 21:46:13 +00:00
update 优化 bo去掉BaseEntity之后 不生成基础字段问题
This commit is contained in:
@@ -135,14 +135,12 @@ public interface GenConstants {
|
||||
/**
|
||||
* BO对象 不需要添加字段
|
||||
*/
|
||||
String[] COLUMNNAME_NOT_ADD = {"create_dept", "create_by", "create_time", "del_flag", "update_by",
|
||||
"update_time", "version"};
|
||||
String[] COLUMNNAME_NOT_ADD = {"del_flag", "version"};
|
||||
|
||||
/**
|
||||
* BO对象 不需要编辑字段
|
||||
*/
|
||||
String[] COLUMNNAME_NOT_EDIT = {"create_dept", "create_by", "create_time", "del_flag", "update_by",
|
||||
"update_time", "version"};
|
||||
String[] COLUMNNAME_NOT_EDIT = {"del_flag", "version"};
|
||||
|
||||
/**
|
||||
* VO对象 不需要返回字段
|
||||
@@ -153,8 +151,7 @@ public interface GenConstants {
|
||||
/**
|
||||
* BO对象 不需要查询字段
|
||||
*/
|
||||
String[] COLUMNNAME_NOT_QUERY = {"id", "create_dept", "create_by", "create_time", "del_flag", "update_by",
|
||||
"update_time", "remark", "version"};
|
||||
String[] COLUMNNAME_NOT_QUERY = {"id", "del_flag", "remark", "version"};
|
||||
|
||||
/**
|
||||
* Entity基类字段
|
||||
|
||||
+12
-2
@@ -525,16 +525,26 @@ public class TemplateEngineUtils {
|
||||
List<GenTableColumn> columns = genTable.getColumns();
|
||||
HashSet<String> importList = new HashSet<>();
|
||||
for (GenTableColumn column : columns) {
|
||||
if (!column.isSuperColumn() && GenConstants.TYPE_DATE.equals(column.getJavaType())) {
|
||||
if (needImportColumn(column) && GenConstants.TYPE_DATE.equals(column.getJavaType())) {
|
||||
importList.add("java.time.LocalDateTime");
|
||||
importList.add("com.fasterxml.jackson.annotation.JsonFormat");
|
||||
} else if (!column.isSuperColumn() && GenConstants.TYPE_BIGDECIMAL.equals(column.getJavaType())) {
|
||||
} else if (needImportColumn(column) && GenConstants.TYPE_BIGDECIMAL.equals(column.getJavaType())) {
|
||||
importList.add("java.math.BigDecimal");
|
||||
}
|
||||
}
|
||||
return importList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断列是否需要生成类型导入。
|
||||
*
|
||||
* @param column 列对象
|
||||
* @return 需要生成类型导入返回 {@code true}
|
||||
*/
|
||||
private static boolean needImportColumn(GenTableColumn column) {
|
||||
return !column.isSuperColumn() || column.isQuery();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据列类型获取字典组
|
||||
*
|
||||
|
||||
@@ -30,7 +30,7 @@ public class ${ClassName}Bo implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
<#list columns as column>
|
||||
<#if !table.isSuperColumn(column.javaField) && (column.query || column.insert || column.edit)>
|
||||
<#if column.query || (!table.isSuperColumn(column.javaField) && (column.insert || column.edit))>
|
||||
/**
|
||||
* ${column.columnComment}
|
||||
*/
|
||||
@@ -41,7 +41,7 @@ public class ${ClassName}Bo implements Serializable {
|
||||
<#elseif column.edit>
|
||||
<#assign Group = "EditGroup.class">
|
||||
</#if>
|
||||
<#if column.required>
|
||||
<#if column.required && !table.isSuperColumn(column.javaField) && (column.insert || column.edit)>
|
||||
<#if column.javaType == 'String'>
|
||||
@NotBlank(message = "${column.columnComment}不能为空", groups = { ${Group} })
|
||||
<#else>
|
||||
@@ -60,4 +60,3 @@ public class ${ClassName}Bo implements Serializable {
|
||||
</#if>
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user