增加子表生成模板的后端验证注解
This commit is contained in:
@@ -8,6 +8,9 @@
|
|||||||
<content><![CDATA[
|
<content><![CDATA[
|
||||||
package ${packageName}.${moduleName}.entity${isNotBlank(subModuleName)?'.'+subModuleName:''};
|
package ${packageName}.${moduleName}.entity${isNotBlank(subModuleName)?'.'+subModuleName:''};
|
||||||
|
|
||||||
|
<% if(table.childList.~size > 0){ %>
|
||||||
|
import javax.validation.Valid;
|
||||||
|
<% } %>
|
||||||
<% for(i in table.importList){ %>
|
<% for(i in table.importList){ %>
|
||||||
import ${i};
|
import ${i};
|
||||||
<% } %>
|
<% } %>
|
||||||
@@ -210,15 +213,16 @@ public class ${ClassName} extends ${toBoolean(table.optionMap['isBpmForm'])?(tab
|
|||||||
public ${ClassName}() {
|
public ${ClassName}() {
|
||||||
this(<% for(pk in table.pkList){ %>${pkLP.index!=1?', ':''}null<% } %>);
|
this(<% for(pk in table.pkList){ %>${pkLP.index!=1?', ':''}null<% } %>);
|
||||||
}
|
}
|
||||||
|
|
||||||
<%
|
<%
|
||||||
// 生成带主键参数的构造
|
// 生成带主键参数的构造
|
||||||
if (!table.parentExists){
|
if (!table.parentExists){
|
||||||
if (table.pkList.~size == 1){ %>
|
if (table.pkList.~size == 1){ %>
|
||||||
|
|
||||||
public ${ClassName}(String id){
|
public ${ClassName}(String id){
|
||||||
super(id);
|
super(id);
|
||||||
}
|
}
|
||||||
<% }else{ %>
|
<% }else{ %>
|
||||||
|
|
||||||
public ${ClassName}(<% for(pk in table.pkList){ %>${pkLP.index!=1?', ':''}${pk.simpleAttrType} ${pk.simpleAttrName}<% } %>){
|
public ${ClassName}(<% for(pk in table.pkList){ %>${pkLP.index!=1?', ':''}${pk.simpleAttrType} ${pk.simpleAttrName}<% } %>){
|
||||||
<% for(pk in table.pkList){ %>
|
<% for(pk in table.pkList){ %>
|
||||||
this.${pk.simpleAttrName} = ${pk.simpleAttrName};
|
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){
|
if(table.parentExists && table.parentTableFkName == c.columnName){
|
||||||
%>
|
%>
|
||||||
@@ -299,6 +298,11 @@ public class ${ClassName} extends ${toBoolean(table.optionMap['isBpmForm'])?(tab
|
|||||||
<%
|
<%
|
||||||
// 其它字段
|
// 其它字段
|
||||||
}else{
|
}else{
|
||||||
|
for(a in c.simpleAnnotationList){
|
||||||
|
%>
|
||||||
|
@${a}
|
||||||
|
<%
|
||||||
|
}
|
||||||
%>
|
%>
|
||||||
public ${c.simpleAttrType} get${@StringUtils.cap(c.simpleAttrName)}() {
|
public ${c.simpleAttrType} get${@StringUtils.cap(c.simpleAttrName)}() {
|
||||||
return ${c.simpleAttrName};
|
return ${c.simpleAttrName};
|
||||||
@@ -340,6 +344,7 @@ public class ${ClassName} extends ${toBoolean(table.optionMap['isBpmForm'])?(tab
|
|||||||
for(child in table.childList){
|
for(child in table.childList){
|
||||||
%>
|
%>
|
||||||
|
|
||||||
|
@Valid
|
||||||
public List<${@StringUtils.cap(child.className)}> get${@StringUtils.cap(child.className)}List() {
|
public List<${@StringUtils.cap(child.className)}> get${@StringUtils.cap(child.className)}List() {
|
||||||
return ${@StringUtils.uncap(child.className)}List;
|
return ${@StringUtils.uncap(child.className)}List;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -210,15 +210,16 @@ public class ${ClassName} extends ${toBoolean(table.optionMap['isBpmForm'])?(tab
|
|||||||
public ${ClassName}() {
|
public ${ClassName}() {
|
||||||
this(<% for(pk in table.pkList){ %>${pkLP.index!=1?', ':''}null<% } %>);
|
this(<% for(pk in table.pkList){ %>${pkLP.index!=1?', ':''}null<% } %>);
|
||||||
}
|
}
|
||||||
|
|
||||||
<%
|
<%
|
||||||
// 生成带主键参数的构造
|
// 生成带主键参数的构造
|
||||||
if (!table.parentExists){
|
if (!table.parentExists){
|
||||||
if (table.pkList.~size == 1){ %>
|
if (table.pkList.~size == 1){ %>
|
||||||
|
|
||||||
public ${ClassName}(String id){
|
public ${ClassName}(String id){
|
||||||
super(id);
|
super(id);
|
||||||
}
|
}
|
||||||
<% }else{ %>
|
<% }else{ %>
|
||||||
|
|
||||||
public ${ClassName}(<% for(pk in table.pkList){ %>${pkLP.index!=1?', ':''}${pk.simpleAttrType} ${pk.simpleAttrName}<% } %>){
|
public ${ClassName}(<% for(pk in table.pkList){ %>${pkLP.index!=1?', ':''}${pk.simpleAttrType} ${pk.simpleAttrName}<% } %>){
|
||||||
<% for(pk in table.pkList){ %>
|
<% for(pk in table.pkList){ %>
|
||||||
this.${pk.simpleAttrName} = ${pk.simpleAttrName};
|
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){
|
if(table.parentExists && table.parentTableFkName == c.columnName){
|
||||||
%>
|
%>
|
||||||
@@ -299,6 +295,11 @@ public class ${ClassName} extends ${toBoolean(table.optionMap['isBpmForm'])?(tab
|
|||||||
<%
|
<%
|
||||||
// 其它字段
|
// 其它字段
|
||||||
}else{
|
}else{
|
||||||
|
for(a in c.simpleAnnotationList){
|
||||||
|
%>
|
||||||
|
@${a}
|
||||||
|
<%
|
||||||
|
}
|
||||||
%>
|
%>
|
||||||
public ${c.simpleAttrType} get${@StringUtils.cap(c.simpleAttrName)}() {
|
public ${c.simpleAttrType} get${@StringUtils.cap(c.simpleAttrName)}() {
|
||||||
return ${c.simpleAttrName};
|
return ${c.simpleAttrName};
|
||||||
@@ -340,6 +341,7 @@ public class ${ClassName} extends ${toBoolean(table.optionMap['isBpmForm'])?(tab
|
|||||||
for(child in table.childList){
|
for(child in table.childList){
|
||||||
%>
|
%>
|
||||||
|
|
||||||
|
@Valid
|
||||||
public List<${@StringUtils.cap(child.className)}> get${@StringUtils.cap(child.className)}List() {
|
public List<${@StringUtils.cap(child.className)}> get${@StringUtils.cap(child.className)}List() {
|
||||||
return ${@StringUtils.uncap(child.className)}List;
|
return ${@StringUtils.uncap(child.className)}List;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -129,3 +129,4 @@ function treeselectCallback(id, act, index, layero){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
<% } %>
|
<% } %>
|
||||||
|
</script>
|
||||||
Reference in New Issue
Block a user