diff --git a/modules/core/src/main/resources/templates/modules/gen/crud/entity.xml b/modules/core/src/main/resources/templates/modules/gen/crud/entity.xml index 60596c6d..4ae504b3 100644 --- a/modules/core/src/main/resources/templates/modules/gen/crud/entity.xml +++ b/modules/core/src/main/resources/templates/modules/gen/crud/entity.xml @@ -8,6 +8,9 @@ 0){ %> +import javax.validation.Valid; +<% } %> <% for(i in table.importList){ %> import ${i}; <% } %> @@ -210,15 +213,16 @@ public class ${ClassName} extends ${toBoolean(table.optionMap['isBpmForm'])?(tab public ${ClassName}() { this(<% for(pk in table.pkList){ %>${pkLP.index!=1?', ':''}null<% } %>); } - <% // 生成带主键参数的构造 if (!table.parentExists){ if (table.pkList.~size == 1){ %> + public ${ClassName}(String id){ super(id); } <% }else{ %> + public ${ClassName}(<% for(pk in table.pkList){ %>${pkLP.index!=1?', ':''}${pk.simpleAttrType} ${pk.simpleAttrName}<% } %>){ <% for(pk in table.pkList){ %> this.${pk.simpleAttrName} = ${pk.simpleAttrName}; @@ -281,11 +285,6 @@ public class ${ClassName} extends ${toBoolean(table.optionMap['isBpmForm'])?(tab %> <% - for(a in c.simpleAnnotationList){ - %> - @${a} - <% - } // 父类对象 if(table.parentExists && table.parentTableFkName == c.columnName){ %> @@ -299,6 +298,11 @@ public class ${ClassName} extends ${toBoolean(table.optionMap['isBpmForm'])?(tab <% // 其它字段 }else{ + for(a in c.simpleAnnotationList){ + %> + @${a} + <% + } %> public ${c.simpleAttrType} get${@StringUtils.cap(c.simpleAttrName)}() { return ${c.simpleAttrName}; @@ -340,6 +344,7 @@ public class ${ClassName} extends ${toBoolean(table.optionMap['isBpmForm'])?(tab for(child in table.childList){ %> + @Valid public List<${@StringUtils.cap(child.className)}> get${@StringUtils.cap(child.className)}List() { return ${@StringUtils.uncap(child.className)}List; } diff --git a/modules/core/src/main/resources/templates/modules/gen/crud_cloud/entity.xml b/modules/core/src/main/resources/templates/modules/gen/crud_cloud/entity.xml index a29a5f3a..d33e3668 100644 --- a/modules/core/src/main/resources/templates/modules/gen/crud_cloud/entity.xml +++ b/modules/core/src/main/resources/templates/modules/gen/crud_cloud/entity.xml @@ -210,15 +210,16 @@ public class ${ClassName} extends ${toBoolean(table.optionMap['isBpmForm'])?(tab public ${ClassName}() { this(<% for(pk in table.pkList){ %>${pkLP.index!=1?', ':''}null<% } %>); } - <% // 生成带主键参数的构造 if (!table.parentExists){ if (table.pkList.~size == 1){ %> + public ${ClassName}(String id){ super(id); } <% }else{ %> + public ${ClassName}(<% for(pk in table.pkList){ %>${pkLP.index!=1?', ':''}${pk.simpleAttrType} ${pk.simpleAttrName}<% } %>){ <% for(pk in table.pkList){ %> this.${pk.simpleAttrName} = ${pk.simpleAttrName}; @@ -281,11 +282,6 @@ public class ${ClassName} extends ${toBoolean(table.optionMap['isBpmForm'])?(tab %> <% - for(a in c.simpleAnnotationList){ - %> - @${a} - <% - } // 父类对象 if(table.parentExists && table.parentTableFkName == c.columnName){ %> @@ -299,6 +295,11 @@ public class ${ClassName} extends ${toBoolean(table.optionMap['isBpmForm'])?(tab <% // 其它字段 }else{ + for(a in c.simpleAnnotationList){ + %> + @${a} + <% + } %> public ${c.simpleAttrType} get${@StringUtils.cap(c.simpleAttrName)}() { return ${c.simpleAttrName}; @@ -340,6 +341,7 @@ public class ${ClassName} extends ${toBoolean(table.optionMap['isBpmForm'])?(tab for(child in table.childList){ %> + @Valid public List<${@StringUtils.cap(child.className)}> get${@StringUtils.cap(child.className)}List() { return ${@StringUtils.uncap(child.className)}List; } diff --git a/modules/core/src/main/resources/templates/modules/gen/include/viewForm.html b/modules/core/src/main/resources/templates/modules/gen/include/viewForm.html index 7b0e08bd..99ad3b8c 100644 --- a/modules/core/src/main/resources/templates/modules/gen/include/viewForm.html +++ b/modules/core/src/main/resources/templates/modules/gen/include/viewForm.html @@ -128,4 +128,5 @@ function treeselectCallback(id, act, index, layero){ }); } } -<% } %> \ No newline at end of file +<% } %> + \ No newline at end of file