代码生成模板新增classNameSimple参数,不带模块名的类名。子表List字段名不带模块名。
This commit is contained in:
@@ -146,7 +146,7 @@ public class ${ClassName}Controller extends BaseController {
|
|||||||
* 查询子表数据
|
* 查询子表数据
|
||||||
*/
|
*/
|
||||||
@RequiresPermissions("${permissionPrefix}:view")
|
@RequiresPermissions("${permissionPrefix}:view")
|
||||||
@RequestMapping(value = "${@StringUtils.uncap(child.className)}ListData")
|
@RequestMapping(value = "${@StringUtils.uncap(child.classNameSimple)}ListData")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public Page<${@StringUtils.cap(child.className)}> subListData(${@StringUtils.cap(child.className)} ${@StringUtils.uncap(child.className)}, HttpServletRequest request, HttpServletResponse response) {
|
public Page<${@StringUtils.cap(child.className)}> subListData(${@StringUtils.cap(child.className)} ${@StringUtils.uncap(child.className)}, HttpServletRequest request, HttpServletResponse response) {
|
||||||
${@StringUtils.uncap(child.className)}.setPage(new Page<>(request, response));
|
${@StringUtils.uncap(child.className)}.setPage(new Page<>(request, response));
|
||||||
|
|||||||
@@ -213,7 +213,7 @@ public class ${ClassName} extends ${toBoolean(table.optionMap['isBpmForm'])?(tab
|
|||||||
// 生成子表列表字段
|
// 生成子表列表字段
|
||||||
for(child in table.childList){
|
for(child in table.childList){
|
||||||
%>
|
%>
|
||||||
private List<${@StringUtils.cap(child.className)}> ${@StringUtils.uncap(child.className)}List = ListUtils.newArrayList(); // 子表列表
|
private List<${@StringUtils.cap(child.className)}> ${@StringUtils.uncap(child.classNameSimple)}List = ListUtils.newArrayList(); // 子表列表
|
||||||
<%
|
<%
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -366,12 +366,12 @@ public class ${ClassName} extends ${toBoolean(table.optionMap['isBpmForm'])?(tab
|
|||||||
%>
|
%>
|
||||||
|
|
||||||
@Valid
|
@Valid
|
||||||
public List<${@StringUtils.cap(child.className)}> get${@StringUtils.cap(child.className)}List() {
|
public List<${@StringUtils.cap(child.className)}> get${@StringUtils.cap(child.classNameSimple)}List() {
|
||||||
return ${@StringUtils.uncap(child.className)}List;
|
return ${@StringUtils.uncap(child.classNameSimple)}List;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void set${@StringUtils.cap(child.className)}List(List<${@StringUtils.cap(child.className)}> ${@StringUtils.uncap(child.className)}List) {
|
public void set${@StringUtils.cap(child.classNameSimple)}List(List<${@StringUtils.cap(child.className)}> ${@StringUtils.uncap(child.classNameSimple)}List) {
|
||||||
this.${@StringUtils.uncap(child.className)}List = ${@StringUtils.uncap(child.className)}List;
|
this.${@StringUtils.uncap(child.classNameSimple)}List = ${@StringUtils.uncap(child.classNameSimple)}List;
|
||||||
}
|
}
|
||||||
<% } %>
|
<% } %>
|
||||||
|
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ public class ${ClassName}Service extends ${table.isTreeEntity?'Tree':'Crud'}Serv
|
|||||||
<% for (child in table.childList){ %>
|
<% for (child in table.childList){ %>
|
||||||
${@StringUtils.cap(child.className)} ${@StringUtils.uncap(child.className)} = new ${@StringUtils.cap(child.className)}(entity);
|
${@StringUtils.cap(child.className)} ${@StringUtils.uncap(child.className)} = new ${@StringUtils.cap(child.className)}(entity);
|
||||||
${@StringUtils.uncap(child.className)}.setStatus(${@StringUtils.cap(child.className)}.STATUS_NORMAL);
|
${@StringUtils.uncap(child.className)}.setStatus(${@StringUtils.cap(child.className)}.STATUS_NORMAL);
|
||||||
entity.set${@StringUtils.cap(child.className)}List(${@StringUtils.uncap(child.className)}Dao.findList(${@StringUtils.uncap(child.className)}));
|
entity.set${@StringUtils.cap(child.classNameSimple)}List(${@StringUtils.uncap(child.className)}Dao.findList(${@StringUtils.uncap(child.className)}));
|
||||||
<% } %>
|
<% } %>
|
||||||
}
|
}
|
||||||
return entity;
|
return entity;
|
||||||
@@ -168,7 +168,7 @@ public class ${ClassName}Service extends ${table.isTreeEntity?'Tree':'Crud'}Serv
|
|||||||
<% } %>
|
<% } %>
|
||||||
<% for (child in table.childList) { %>
|
<% for (child in table.childList) { %>
|
||||||
// 保存 ${ClassName}子表
|
// 保存 ${ClassName}子表
|
||||||
for (${@StringUtils.cap(child.className)} ${@StringUtils.uncap(child.className)} : ${className}.get${@StringUtils.cap(child.className)}List()){
|
for (${@StringUtils.cap(child.className)} ${@StringUtils.uncap(child.className)} : ${className}.get${@StringUtils.cap(child.classNameSimple)}List()){
|
||||||
if (!${@StringUtils.cap(child.className)}.STATUS_DELETE.equals(${@StringUtils.uncap(child.className)}.getStatus())){
|
if (!${@StringUtils.cap(child.className)}.STATUS_DELETE.equals(${@StringUtils.uncap(child.className)}.getStatus())){
|
||||||
<%
|
<%
|
||||||
for(c in child.columnList){
|
for(c in child.columnList){
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ for(c in table.columnList){
|
|||||||
%>
|
%>
|
||||||
<% // 生成子表列表字段
|
<% // 生成子表列表字段
|
||||||
for(child in table.childList){ %>
|
for(child in table.childList){ %>
|
||||||
${@StringUtils.uncap(child.className)}List?: any[]; // 子表列表
|
${@StringUtils.uncap(child.classNameSimple)}List?: any[]; // 子表列表
|
||||||
<% } %>
|
<% } %>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
<% if (table.childList.~size > 0){ %>
|
<% if (table.childList.~size > 0){ %>
|
||||||
<BasicForm @register="registerForm">
|
<BasicForm @register="registerForm">
|
||||||
<% for (child in table.childList){ %>
|
<% for (child in table.childList){ %>
|
||||||
<template #${@StringUtils.uncap(child.className)}List>
|
<template #${@StringUtils.uncap(child.classNameSimple)}List>
|
||||||
<BasicTable
|
<BasicTable
|
||||||
@register="register${child.className}Table"
|
@register="register${child.className}Table"
|
||||||
@row-click="handle${child.className}RowClick"
|
@row-click="handle${child.className}RowClick"
|
||||||
@@ -352,10 +352,10 @@ for (c in table.columnList){
|
|||||||
for (child in table.childList){ %>
|
for (child in table.childList){ %>
|
||||||
{
|
{
|
||||||
label: t('${child.comments}'),
|
label: t('${child.comments}'),
|
||||||
field: '${@StringUtils.uncap(child.className)}List',
|
field: '${@StringUtils.uncap(child.classNameSimple)}List',
|
||||||
component: 'Input',
|
component: 'Input',
|
||||||
colProps: { md: 24, lg: 24 },
|
colProps: { md: 24, lg: 24 },
|
||||||
slot: '${@StringUtils.uncap(child.className)}List',
|
slot: '${@StringUtils.uncap(child.classNameSimple)}List',
|
||||||
},
|
},
|
||||||
<%
|
<%
|
||||||
}
|
}
|
||||||
@@ -446,7 +446,7 @@ for (c in table.columnList){
|
|||||||
});
|
});
|
||||||
<% for (child in table.childList){ %>
|
<% for (child in table.childList){ %>
|
||||||
|
|
||||||
const [register${child.className}Table, ${@StringUtils.uncap(child.className)}Table] = useTable({
|
const [register${child.className}Table, ${@StringUtils.uncap(child.classNameSimple)}Table] = useTable({
|
||||||
actionColumn: {
|
actionColumn: {
|
||||||
width: 60,
|
width: 60,
|
||||||
actions: (record: Recordable) => [
|
actions: (record: Recordable) => [
|
||||||
@@ -469,7 +469,7 @@ for (c in table.columnList){
|
|||||||
});
|
});
|
||||||
|
|
||||||
async function set${child.className}TableData(_res: Recordable) {
|
async function set${child.className}TableData(_res: Recordable) {
|
||||||
${@StringUtils.uncap(child.className)}Table.setColumns([
|
${@StringUtils.uncap(child.classNameSimple)}Table.setColumns([
|
||||||
<%
|
<%
|
||||||
for (c in child.columnList){
|
for (c in child.columnList){
|
||||||
if (c.isEdit != '1' || c.isPk == '1'){
|
if (c.isEdit != '1' || c.isPk == '1'){
|
||||||
@@ -577,7 +577,7 @@ for (c in table.columnList){
|
|||||||
}
|
}
|
||||||
%>
|
%>
|
||||||
]);
|
]);
|
||||||
${@StringUtils.uncap(child.className)}Table.setTableData(record.value.${@StringUtils.uncap(child.className)}List || []);
|
${@StringUtils.uncap(child.classNameSimple)}Table.setTableData(record.value.${@StringUtils.uncap(child.classNameSimple)}List || []);
|
||||||
}
|
}
|
||||||
|
|
||||||
function handle${child.className}RowClick(record: Recordable) {
|
function handle${child.className}RowClick(record: Recordable) {
|
||||||
@@ -585,7 +585,7 @@ for (c in table.columnList){
|
|||||||
}
|
}
|
||||||
|
|
||||||
function handle${child.className}Add() {
|
function handle${child.className}Add() {
|
||||||
${@StringUtils.uncap(child.className)}Table.insertTableDataRecord({
|
${@StringUtils.uncap(child.classNameSimple)}Table.insertTableDataRecord({
|
||||||
id: new Date().getTime(),
|
id: new Date().getTime(),
|
||||||
isNewRecord: true,
|
isNewRecord: true,
|
||||||
editable: true,
|
editable: true,
|
||||||
@@ -593,35 +593,35 @@ for (c in table.columnList){
|
|||||||
}
|
}
|
||||||
|
|
||||||
function handle${child.className}Delete(record: Recordable) {
|
function handle${child.className}Delete(record: Recordable) {
|
||||||
${@StringUtils.uncap(child.className)}Table.deleteTableDataRecord(record);
|
${@StringUtils.uncap(child.classNameSimple)}Table.deleteTableDataRecord(record);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function get${child.className}List() {
|
async function get${child.className}List() {
|
||||||
let ${@StringUtils.uncap(child.className)}ListValid = true;
|
let ${@StringUtils.uncap(child.classNameSimple)}ListValid = true;
|
||||||
let ${@StringUtils.uncap(child.className)}List: Recordable[] = [];
|
let ${@StringUtils.uncap(child.classNameSimple)}List: Recordable[] = [];
|
||||||
for (const record of ${@StringUtils.uncap(child.className)}Table.getDataSource()) {
|
for (const record of ${@StringUtils.uncap(child.classNameSimple)}Table.getDataSource()) {
|
||||||
if (!(await record.onEdit?.(false, true))) {
|
if (!(await record.onEdit?.(false, true))) {
|
||||||
${@StringUtils.uncap(child.className)}ListValid = false;
|
${@StringUtils.uncap(child.classNameSimple)}ListValid = false;
|
||||||
}
|
}
|
||||||
${@StringUtils.uncap(child.className)}List.push({
|
${@StringUtils.uncap(child.classNameSimple)}List.push({
|
||||||
...record,
|
...record,
|
||||||
id: !!record.isNewRecord ? '' : record.id,
|
id: !!record.isNewRecord ? '' : record.id,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
for (const record of ${@StringUtils.uncap(child.className)}Table.getDelDataSource()) {
|
for (const record of ${@StringUtils.uncap(child.classNameSimple)}Table.getDelDataSource()) {
|
||||||
if (!!record.isNewRecord) continue;
|
if (!!record.isNewRecord) continue;
|
||||||
${@StringUtils.uncap(child.className)}List.push({
|
${@StringUtils.uncap(child.classNameSimple)}List.push({
|
||||||
...record,
|
...record,
|
||||||
status: '1',
|
status: '1',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (!${@StringUtils.uncap(child.className)}ListValid) {
|
if (!${@StringUtils.uncap(child.classNameSimple)}ListValid) {
|
||||||
throw {
|
throw {
|
||||||
errorFields: [{ name: ['${@StringUtils.uncap(child.className)}List'] }],
|
errorFields: [{ name: ['${@StringUtils.uncap(child.classNameSimple)}List'] }],
|
||||||
message: t('${child.comments}填写有误,请根据提示修正'),
|
message: t('${child.comments}填写有误,请根据提示修正'),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
return ${@StringUtils.uncap(child.className)}List;
|
return ${@StringUtils.uncap(child.classNameSimple)}List;
|
||||||
}
|
}
|
||||||
<% } %>
|
<% } %>
|
||||||
|
|
||||||
@@ -688,7 +688,7 @@ for (c in table.columnList){
|
|||||||
%>
|
%>
|
||||||
};
|
};
|
||||||
<% for (child in table.childList){ %>
|
<% for (child in table.childList){ %>
|
||||||
data.${@StringUtils.uncap(child.className)}List = await get${child.className}List();
|
data.${@StringUtils.uncap(child.classNameSimple)}List = await get${child.className}List();
|
||||||
<% } %>
|
<% } %>
|
||||||
<% if(table.isTreeEntity){ %>
|
<% if(table.isTreeEntity){ %>
|
||||||
data.oldParentCode = record.value.parentCode;
|
data.oldParentCode = record.value.parentCode;
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
<% for (child in table.childList){ %>
|
<% for (child in table.childList){ %>
|
||||||
<template #${@StringUtils.uncap(child.className)}>
|
<template #${@StringUtils.uncap(child.className)}>
|
||||||
<BasicForm @register="register${child.className}Form">
|
<BasicForm @register="register${child.className}Form">
|
||||||
<template #${@StringUtils.uncap(child.className)}List>
|
<template #${@StringUtils.uncap(child.classNameSimple)}List>
|
||||||
<BasicTable
|
<BasicTable
|
||||||
@register="register${child.className}Table"
|
@register="register${child.className}Table"
|
||||||
@row-click="handle${child.className}RowClick"
|
@row-click="handle${child.className}RowClick"
|
||||||
@@ -370,10 +370,10 @@ for (c in table.columnList){
|
|||||||
|
|
||||||
const input${child.className}FormSchemas: FormSchema[] = [
|
const input${child.className}FormSchemas: FormSchema[] = [
|
||||||
{
|
{
|
||||||
field: '${@StringUtils.uncap(child.className)}List',
|
field: '${@StringUtils.uncap(child.classNameSimple)}List',
|
||||||
component: 'Input',
|
component: 'Input',
|
||||||
colProps: { md: 24, lg: 24 },
|
colProps: { md: 24, lg: 24 },
|
||||||
slot: '${@StringUtils.uncap(child.className)}List',
|
slot: '${@StringUtils.uncap(child.classNameSimple)}List',
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
<%
|
<%
|
||||||
@@ -473,7 +473,7 @@ for (c in table.columnList){
|
|||||||
baseColProps: { md: 24, lg: 24 },
|
baseColProps: { md: 24, lg: 24 },
|
||||||
});
|
});
|
||||||
|
|
||||||
const [register${child.className}Table, ${@StringUtils.uncap(child.className)}Table] = useTable({
|
const [register${child.className}Table, ${@StringUtils.uncap(child.classNameSimple)}Table] = useTable({
|
||||||
actionColumn: {
|
actionColumn: {
|
||||||
width: 60,
|
width: 60,
|
||||||
actions: (record: Recordable) => [
|
actions: (record: Recordable) => [
|
||||||
@@ -496,7 +496,7 @@ for (c in table.columnList){
|
|||||||
});
|
});
|
||||||
|
|
||||||
async function set${child.className}TableData(_res: Recordable) {
|
async function set${child.className}TableData(_res: Recordable) {
|
||||||
${@StringUtils.uncap(child.className)}Table.setColumns([
|
${@StringUtils.uncap(child.classNameSimple)}Table.setColumns([
|
||||||
<%
|
<%
|
||||||
for (c in child.columnList){
|
for (c in child.columnList){
|
||||||
if (c.isEdit != '1' || c.isPk == '1'){
|
if (c.isEdit != '1' || c.isPk == '1'){
|
||||||
@@ -604,7 +604,7 @@ for (c in table.columnList){
|
|||||||
}
|
}
|
||||||
%>
|
%>
|
||||||
]);
|
]);
|
||||||
${@StringUtils.uncap(child.className)}Table.setTableData(record.value.${@StringUtils.uncap(child.className)}List || []);
|
${@StringUtils.uncap(child.classNameSimple)}Table.setTableData(record.value.${@StringUtils.uncap(child.classNameSimple)}List || []);
|
||||||
}
|
}
|
||||||
|
|
||||||
function handle${child.className}RowClick(record: Recordable) {
|
function handle${child.className}RowClick(record: Recordable) {
|
||||||
@@ -612,7 +612,7 @@ for (c in table.columnList){
|
|||||||
}
|
}
|
||||||
|
|
||||||
function handle${child.className}Add() {
|
function handle${child.className}Add() {
|
||||||
${@StringUtils.uncap(child.className)}Table.insertTableDataRecord({
|
${@StringUtils.uncap(child.classNameSimple)}Table.insertTableDataRecord({
|
||||||
id: new Date().getTime(),
|
id: new Date().getTime(),
|
||||||
isNewRecord: true,
|
isNewRecord: true,
|
||||||
editable: true,
|
editable: true,
|
||||||
@@ -620,35 +620,35 @@ for (c in table.columnList){
|
|||||||
}
|
}
|
||||||
|
|
||||||
function handle${child.className}Delete(record: Recordable) {
|
function handle${child.className}Delete(record: Recordable) {
|
||||||
${@StringUtils.uncap(child.className)}Table.deleteTableDataRecord(record);
|
${@StringUtils.uncap(child.classNameSimple)}Table.deleteTableDataRecord(record);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function get${child.className}List() {
|
async function get${child.className}List() {
|
||||||
let ${@StringUtils.uncap(child.className)}ListValid = true;
|
let ${@StringUtils.uncap(child.classNameSimple)}ListValid = true;
|
||||||
let ${@StringUtils.uncap(child.className)}List: Recordable[] = [];
|
let ${@StringUtils.uncap(child.classNameSimple)}List: Recordable[] = [];
|
||||||
for (const record of ${@StringUtils.uncap(child.className)}Table.getDataSource()) {
|
for (const record of ${@StringUtils.uncap(child.classNameSimple)}Table.getDataSource()) {
|
||||||
if (!(await record.onEdit?.(false, true))) {
|
if (!(await record.onEdit?.(false, true))) {
|
||||||
${@StringUtils.uncap(child.className)}ListValid = false;
|
${@StringUtils.uncap(child.classNameSimple)}ListValid = false;
|
||||||
}
|
}
|
||||||
${@StringUtils.uncap(child.className)}List.push({
|
${@StringUtils.uncap(child.classNameSimple)}List.push({
|
||||||
...record,
|
...record,
|
||||||
id: !!record.isNewRecord ? '' : record.id,
|
id: !!record.isNewRecord ? '' : record.id,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
for (const record of ${@StringUtils.uncap(child.className)}Table.getDelDataSource()) {
|
for (const record of ${@StringUtils.uncap(child.classNameSimple)}Table.getDelDataSource()) {
|
||||||
if (!!record.isNewRecord) continue;
|
if (!!record.isNewRecord) continue;
|
||||||
${@StringUtils.uncap(child.className)}List.push({
|
${@StringUtils.uncap(child.classNameSimple)}List.push({
|
||||||
...record,
|
...record,
|
||||||
status: '1',
|
status: '1',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (!${@StringUtils.uncap(child.className)}ListValid) {
|
if (!${@StringUtils.uncap(child.classNameSimple)}ListValid) {
|
||||||
throw {
|
throw {
|
||||||
errorFields: [{ name: ['${@StringUtils.uncap(child.className)}List'] }],
|
errorFields: [{ name: ['${@StringUtils.uncap(child.classNameSimple)}List'] }],
|
||||||
message: t('${child.comments}填写有误,请根据提示修正'),
|
message: t('${child.comments}填写有误,请根据提示修正'),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
return ${@StringUtils.uncap(child.className)}List;
|
return ${@StringUtils.uncap(child.classNameSimple)}List;
|
||||||
}
|
}
|
||||||
<% } %>
|
<% } %>
|
||||||
|
|
||||||
@@ -742,7 +742,7 @@ for (c in table.columnList){
|
|||||||
%>
|
%>
|
||||||
};
|
};
|
||||||
<% for (child in table.childList){ %>
|
<% for (child in table.childList){ %>
|
||||||
data.${@StringUtils.uncap(child.className)}List = await get${child.className}List();
|
data.${@StringUtils.uncap(child.classNameSimple)}List = await get${child.className}List();
|
||||||
<% } %>
|
<% } %>
|
||||||
<% if(table.isTreeEntity){ %>
|
<% if(table.isTreeEntity){ %>
|
||||||
data.oldParentCode = record.value.parentCode;
|
data.oldParentCode = record.value.parentCode;
|
||||||
|
|||||||
@@ -148,7 +148,7 @@ public class ${ClassName}Controller extends BaseController {
|
|||||||
* 查询子表数据
|
* 查询子表数据
|
||||||
*/
|
*/
|
||||||
@RequiresPermissions("${permissionPrefix}:view")
|
@RequiresPermissions("${permissionPrefix}:view")
|
||||||
@RequestMapping(value = "${@StringUtils.uncap(child.className)}ListData")
|
@RequestMapping(value = "${@StringUtils.uncap(child.classNameSimple)}ListData")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public Page<${@StringUtils.cap(child.className)}> subListData(${@StringUtils.cap(child.className)} ${@StringUtils.uncap(child.className)}, HttpServletRequest request, HttpServletResponse response) {
|
public Page<${@StringUtils.cap(child.className)}> subListData(${@StringUtils.cap(child.className)} ${@StringUtils.uncap(child.className)}, HttpServletRequest request, HttpServletResponse response) {
|
||||||
${@StringUtils.uncap(child.className)}.setPage(new Page<>(request, response));
|
${@StringUtils.uncap(child.className)}.setPage(new Page<>(request, response));
|
||||||
|
|||||||
@@ -213,7 +213,7 @@ public class ${ClassName} extends ${toBoolean(table.optionMap['isBpmForm'])?(tab
|
|||||||
// 生成子表列表字段
|
// 生成子表列表字段
|
||||||
for(child in table.childList){
|
for(child in table.childList){
|
||||||
%>
|
%>
|
||||||
private List<${@StringUtils.cap(child.className)}> ${@StringUtils.uncap(child.className)}List = ListUtils.newArrayList(); // 子表列表
|
private List<${@StringUtils.cap(child.className)}> ${@StringUtils.uncap(child.classNameSimple)}List = ListUtils.newArrayList(); // 子表列表
|
||||||
<%
|
<%
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -366,12 +366,12 @@ public class ${ClassName} extends ${toBoolean(table.optionMap['isBpmForm'])?(tab
|
|||||||
%>
|
%>
|
||||||
|
|
||||||
@Valid
|
@Valid
|
||||||
public List<${@StringUtils.cap(child.className)}> get${@StringUtils.cap(child.className)}List() {
|
public List<${@StringUtils.cap(child.className)}> get${@StringUtils.cap(child.classNameSimple)}List() {
|
||||||
return ${@StringUtils.uncap(child.className)}List;
|
return ${@StringUtils.uncap(child.classNameSimple)}List;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void set${@StringUtils.cap(child.className)}List(List<${@StringUtils.cap(child.className)}> ${@StringUtils.uncap(child.className)}List) {
|
public void set${@StringUtils.cap(child.classNameSimple)}List(List<${@StringUtils.cap(child.className)}> ${@StringUtils.uncap(child.classNameSimple)}List) {
|
||||||
this.${@StringUtils.uncap(child.className)}List = ${@StringUtils.uncap(child.className)}List;
|
this.${@StringUtils.uncap(child.classNameSimple)}List = ${@StringUtils.uncap(child.classNameSimple)}List;
|
||||||
}
|
}
|
||||||
<% } %>
|
<% } %>
|
||||||
|
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ public class ${ClassName}Service extends ${table.isTreeEntity?'Tree':'Crud'}Serv
|
|||||||
<% for (child in table.childList){ %>
|
<% for (child in table.childList){ %>
|
||||||
${@StringUtils.cap(child.className)} ${@StringUtils.uncap(child.className)} = new ${@StringUtils.cap(child.className)}(entity);
|
${@StringUtils.cap(child.className)} ${@StringUtils.uncap(child.className)} = new ${@StringUtils.cap(child.className)}(entity);
|
||||||
${@StringUtils.uncap(child.className)}.setStatus(${@StringUtils.cap(child.className)}.STATUS_NORMAL);
|
${@StringUtils.uncap(child.className)}.setStatus(${@StringUtils.cap(child.className)}.STATUS_NORMAL);
|
||||||
entity.set${@StringUtils.cap(child.className)}List(${@StringUtils.uncap(child.className)}Dao.findList(${@StringUtils.uncap(child.className)}));
|
entity.set${@StringUtils.cap(child.classNameSimple)}List(${@StringUtils.uncap(child.className)}Dao.findList(${@StringUtils.uncap(child.className)}));
|
||||||
<% } %>
|
<% } %>
|
||||||
}
|
}
|
||||||
return entity;
|
return entity;
|
||||||
@@ -175,7 +175,7 @@ public class ${ClassName}Service extends ${table.isTreeEntity?'Tree':'Crud'}Serv
|
|||||||
<% } %>
|
<% } %>
|
||||||
<% for (child in table.childList) { %>
|
<% for (child in table.childList) { %>
|
||||||
// 保存 ${ClassName}子表
|
// 保存 ${ClassName}子表
|
||||||
for (${@StringUtils.cap(child.className)} ${@StringUtils.uncap(child.className)} : ${className}.get${@StringUtils.cap(child.className)}List()){
|
for (${@StringUtils.cap(child.className)} ${@StringUtils.uncap(child.className)} : ${className}.get${@StringUtils.cap(child.classNameSimple)}List()){
|
||||||
if (!${@StringUtils.cap(child.className)}.STATUS_DELETE.equals(${@StringUtils.uncap(child.className)}.getStatus())){
|
if (!${@StringUtils.cap(child.className)}.STATUS_DELETE.equals(${@StringUtils.uncap(child.className)}.getStatus())){
|
||||||
<%
|
<%
|
||||||
for(c in child.columnList){
|
for(c in child.columnList){
|
||||||
|
|||||||
@@ -4,10 +4,10 @@
|
|||||||
%>
|
%>
|
||||||
<div class="form-unit">\${text('${child.comments}')}</div>
|
<div class="form-unit">\${text('${child.comments}')}</div>
|
||||||
<div class="form-unit-wrap table-form">
|
<div class="form-unit-wrap table-form">
|
||||||
<table id="${@StringUtils.uncap(child.className)}DataGrid"></table>
|
<table id="${@StringUtils.uncap(child.classNameSimple)}DataGrid"></table>
|
||||||
<% if(table.tplCategory != 'query'){ %>
|
<% if(table.tplCategory != 'query'){ %>
|
||||||
\<% if (hasPermi('${permissionPrefix}:edit')){ %>
|
\<% if (hasPermi('${permissionPrefix}:edit')){ %>
|
||||||
<a href="#" id="${@StringUtils.uncap(child.className)}DataGridAddRowBtn" class="btn btn-primary btn-sm mt10 mb10"><i class="fa fa-plus"></i> \${text('增行')}</a>
|
<a href="#" id="${@StringUtils.uncap(child.classNameSimple)}DataGridAddRowBtn" class="btn btn-primary btn-sm mt10 mb10"><i class="fa fa-plus"></i> \${text('增行')}</a>
|
||||||
\<% } %>
|
\<% } %>
|
||||||
<% } %>
|
<% } %>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ var treeselectExists = false;
|
|||||||
for(child in table.childList){
|
for(child in table.childList){
|
||||||
%>
|
%>
|
||||||
\//# // 初始化${child.comments}DataGrid对象
|
\//# // 初始化${child.comments}DataGrid对象
|
||||||
$('#${@StringUtils.uncap(child.className)}DataGrid').dataGrid({
|
$('#${@StringUtils.uncap(child.classNameSimple)}DataGrid').dataGrid({
|
||||||
|
|
||||||
data: \"#{toJson(${className}.${@StringUtils.uncap(child.className)}List)}",
|
data: \"#{toJson(${className}.${@StringUtils.uncap(child.classNameSimple)}List)}",
|
||||||
datatype: 'local', // 设置本地数据
|
datatype: 'local', // 设置本地数据
|
||||||
autoGridHeight: function(){return 'auto'}, // 设置自动高度
|
autoGridHeight: function(){return 'auto'}, // 设置自动高度
|
||||||
|
|
||||||
@@ -164,9 +164,9 @@ if (table.tplCategory != 'query'){
|
|||||||
{header:'\${text("操作")}', name:'actions', width:80, align:'center', formatter: function(val, obj, row, act){
|
{header:'\${text("操作")}', name:'actions', width:80, align:'center', formatter: function(val, obj, row, act){
|
||||||
var actions = [];
|
var actions = [];
|
||||||
if (val == 'new'){
|
if (val == 'new'){
|
||||||
actions.push('<a href="#" onclick="js.confirm(\'\${text("你确认要删除这条数据吗?")}\', function(){$(\'#${@StringUtils.uncap(child.className)}DataGrid\').dataGrid(\'delRowData\',\''+obj.rowId+'\')});return false;"><i class="fa fa-trash-o"></i></a> ');
|
actions.push('<a href="#" onclick="js.confirm(\'\${text("你确认要删除这条数据吗?")}\', function(){$(\'#${@StringUtils.uncap(child.classNameSimple)}DataGrid\').dataGrid(\'delRowData\',\''+obj.rowId+'\')});return false;"><i class="fa fa-trash-o"></i></a> ');
|
||||||
}else{
|
}else{
|
||||||
actions.push('<a href="#" onclick="js.confirm(\'\${text("你确认要删除这条数据吗?")}\', function(){$(\'#${@StringUtils.uncap(child.className)}DataGrid\').dataGrid(\'setRowData\',\''+obj.rowId+'\',null,{display:\'none\'});$(\'#'+obj.rowId+'_status\').val(\''+Global.STATUS_DELETE+'\');});return false;"><i class="fa fa-trash-o"></i></a> ');
|
actions.push('<a href="#" onclick="js.confirm(\'\${text("你确认要删除这条数据吗?")}\', function(){$(\'#${@StringUtils.uncap(child.classNameSimple)}DataGrid\').dataGrid(\'setRowData\',\''+obj.rowId+'\',null,{display:\'none\'});$(\'#'+obj.rowId+'_status\').val(\''+Global.STATUS_DELETE+'\');});return false;"><i class="fa fa-trash-o"></i></a> ');
|
||||||
}
|
}
|
||||||
return actions.join('');
|
return actions.join('');
|
||||||
}, editoptions: {defaultValue: 'new'}}
|
}, editoptions: {defaultValue: 'new'}}
|
||||||
@@ -178,12 +178,12 @@ if (table.tplCategory != 'query'){
|
|||||||
\//# // 编辑表格参数
|
\//# // 编辑表格参数
|
||||||
editGrid: true, // 是否是编辑表格
|
editGrid: true, // 是否是编辑表格
|
||||||
editGridInitRowNum: 1, // 编辑表格的初始化新增行数
|
editGridInitRowNum: 1, // 编辑表格的初始化新增行数
|
||||||
editGridAddRowBtn: $('#${@StringUtils.uncap(child.className)}DataGridAddRowBtn'), // 子表增行按钮
|
editGridAddRowBtn: $('#${@StringUtils.uncap(child.classNameSimple)}DataGridAddRowBtn'), // 子表增行按钮
|
||||||
editGridAddRowBtnToHeader: true, // 子表增行按钮是否显示到表头上
|
editGridAddRowBtnToHeader: true, // 子表增行按钮是否显示到表头上
|
||||||
editGridAddRowInitData: {<% for(pk in child.pkList){ %>${pk.attrName}<% break; }%>: '', status: Global.STATUS_NORMAL}, // 新增行的时候初始化的数据
|
editGridAddRowInitData: {<% for(pk in child.pkList){ %>${pk.attrName}<% break; }%>: '', status: Global.STATUS_NORMAL}, // 新增行的时候初始化的数据
|
||||||
|
|
||||||
\//# // 编辑表格的提交数据参数
|
\//# // 编辑表格的提交数据参数
|
||||||
editGridInputFormListName: '${@StringUtils.uncap(child.className)}List', // 提交的数据列表名
|
editGridInputFormListName: '${@StringUtils.uncap(child.classNameSimple)}List', // 提交的数据列表名
|
||||||
editGridInputFormListAttrs: 'status,<% for(c in child.columnList){if(c.attrName!="status"){%>${c.attrName},<% }} %>', // 提交数据列表的属性字段
|
editGridInputFormListAttrs: 'status,<% for(c in child.columnList){if(c.attrName!="status"){%>${c.attrName},<% }} %>', // 提交数据列表的属性字段
|
||||||
|
|
||||||
\//# // 加载成功后执行事件
|
\//# // 加载成功后执行事件
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ public class ${ClassName}Controller extends BaseController {
|
|||||||
* 查询子表数据
|
* 查询子表数据
|
||||||
*/
|
*/
|
||||||
@RequiresPermissions("${permissionPrefix}:view")
|
@RequiresPermissions("${permissionPrefix}:view")
|
||||||
@RequestMapping(value = "${@StringUtils.uncap(child.className)}ListData")
|
@RequestMapping(value = "${@StringUtils.uncap(child.classNameSimple)}ListData")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public Page<${@StringUtils.cap(child.className)}> subListData(${@StringUtils.cap(child.className)} ${@StringUtils.uncap(child.className)}, HttpServletRequest request, HttpServletResponse response) {
|
public Page<${@StringUtils.cap(child.className)}> subListData(${@StringUtils.cap(child.className)} ${@StringUtils.uncap(child.className)}, HttpServletRequest request, HttpServletResponse response) {
|
||||||
${@StringUtils.uncap(child.className)}.setPage(new Page<>(request, response));
|
${@StringUtils.uncap(child.className)}.setPage(new Page<>(request, response));
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ public class ${ClassName}Service extends ${table.isTreeEntity?'Tree':'Query'}Ser
|
|||||||
<% for (child in table.childList){ %>
|
<% for (child in table.childList){ %>
|
||||||
${@StringUtils.cap(child.className)} ${@StringUtils.uncap(child.className)} = new ${@StringUtils.cap(child.className)}(entity);
|
${@StringUtils.cap(child.className)} ${@StringUtils.uncap(child.className)} = new ${@StringUtils.cap(child.className)}(entity);
|
||||||
${@StringUtils.uncap(child.className)}.setStatus(${@StringUtils.cap(child.className)}.STATUS_NORMAL);
|
${@StringUtils.uncap(child.className)}.setStatus(${@StringUtils.cap(child.className)}.STATUS_NORMAL);
|
||||||
entity.set${@StringUtils.cap(child.className)}List(${@StringUtils.uncap(child.className)}Dao.findList(${@StringUtils.uncap(child.className)}));
|
entity.set${@StringUtils.cap(child.classNameSimple)}List(${@StringUtils.uncap(child.className)}Dao.findList(${@StringUtils.uncap(child.className)}));
|
||||||
<% } %>
|
<% } %>
|
||||||
}
|
}
|
||||||
return entity;
|
return entity;
|
||||||
|
|||||||
Reference in New Issue
Block a user