service 新增 getAndValid(entity) 替换 get(pkClass, pkValue, isNewRecord)
方法,为了更好支持复合主键和服务接口
This commit is contained in:
@@ -73,7 +73,10 @@ public class EmpUserController extends BaseController {
|
|||||||
|
|
||||||
@ModelAttribute
|
@ModelAttribute
|
||||||
public EmpUser get(String userCode, boolean isNewRecord) {
|
public EmpUser get(String userCode, boolean isNewRecord) {
|
||||||
return empUserService.get(userCode, isNewRecord);
|
EmpUser empUser = new EmpUser();
|
||||||
|
empUser.setUserCode(userCode);
|
||||||
|
empUser.setIsNewRecord(isNewRecord);
|
||||||
|
return empUserService.getAndValid(empUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequiresPermissions("sys:empUser:view")
|
@RequiresPermissions("sys:empUser:view")
|
||||||
|
|||||||
@@ -63,8 +63,12 @@ public class ${ClassName}Controller extends BaseController {
|
|||||||
<% if (table.pkList.~size == 1){ %>
|
<% if (table.pkList.~size == 1){ %>
|
||||||
return ${className}Service.get(<% for(pk in table.pkList){ %>${pkLP.index!=1?', ':''}${pk.simpleAttrName}<% } %>, isNewRecord);
|
return ${className}Service.get(<% for(pk in table.pkList){ %>${pkLP.index!=1?', ':''}${pk.simpleAttrName}<% } %>, isNewRecord);
|
||||||
<% }else{ %>
|
<% }else{ %>
|
||||||
return ${className}Service.get(new Class<?>[]{<% for(pk in table.pkList){ %>${pkLP.index!=1?', ':''}${pk.simpleAttrType}.class<% } %>},
|
${ClassName} ${className} = new ${ClassName}();
|
||||||
new Object[]{<% for(pk in table.pkList){ %>${pkLP.index!=1?', ':''}${pk.simpleAttrName}<% } %>}, isNewRecord);
|
<% for(pk in table.pkList){ %>
|
||||||
|
${className}.set${@StringUtils.cap(pk.simpleAttrName)}(${pk.simpleAttrName});
|
||||||
|
<% } %>
|
||||||
|
${className}.setIsNewRecord(isNewRecord);
|
||||||
|
return ${className}Service.getAndValid(${className});
|
||||||
<% } %>
|
<% } %>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -199,7 +199,7 @@ public class ${ClassName} extends ${table.isTreeEntity?'Tree':'Data'}Entity<${Cl
|
|||||||
%>
|
%>
|
||||||
|
|
||||||
public ${ClassName}() {
|
public ${ClassName}() {
|
||||||
this(null);
|
this(<% for(pk in table.pkList){ %>${pkLP.index!=1?', ':''}null<% } %>);
|
||||||
}
|
}
|
||||||
|
|
||||||
<%
|
<%
|
||||||
|
|||||||
@@ -61,8 +61,12 @@ public class ${ClassName}Controller extends BaseController {
|
|||||||
<% if (table.pkList.~size == 1){ %>
|
<% if (table.pkList.~size == 1){ %>
|
||||||
return ${className}Service.get(<% for(pk in table.pkList){ %>${pkLP.index!=1?', ':''}${pk.simpleAttrName}<% } %>, isNewRecord);
|
return ${className}Service.get(<% for(pk in table.pkList){ %>${pkLP.index!=1?', ':''}${pk.simpleAttrName}<% } %>, isNewRecord);
|
||||||
<% }else{ %>
|
<% }else{ %>
|
||||||
return ${className}Service.get(new Class<?>[]{<% for(pk in table.pkList){ %>${pkLP.index!=1?', ':''}${pk.simpleAttrType}.class<% } %>},
|
${ClassName} ${className} = new ${ClassName}();
|
||||||
new Object[]{<% for(pk in table.pkList){ %>${pkLP.index!=1?', ':''}${pk.simpleAttrName}<% } %>}, isNewRecord);
|
<% for(pk in table.pkList){ %>
|
||||||
|
${className}.set${@StringUtils.cap(pk.simpleAttrName)}(${pk.simpleAttrName});
|
||||||
|
<% } %>
|
||||||
|
${className}.setIsNewRecord(isNewRecord);
|
||||||
|
return ${className}Service.getAndValid(${className});
|
||||||
<% } %>
|
<% } %>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user