代码生成主键支持为bigint类型;树表代码生成树显示编码字段可以设置为空,不设置的时候不显示树编码,树显示名称字段必须设置

This commit is contained in:
thinkgem
2023-06-13 09:21:09 +08:00
parent c9127c18b1
commit 40c10f4eef
7 changed files with 18 additions and 8 deletions

View File

@@ -11,8 +11,8 @@ package ${packageName}.${moduleName}.web${isNotEmpty(subModuleName)?'.'+subModul
<% if (table.isTreeEntity){ %> <% if (table.isTreeEntity){ %>
import java.util.Map; import java.util.Map;
<% } %> <% } %>
<% if (!table.isTreeEntity || toBoolean(table.optionMap['isImportExport'])){ %>
import java.util.List; import java.util.List;
<% if (!table.isTreeEntity || toBoolean(table.optionMap['isImportExport'])){ %>
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
<% } %> <% } %>
@@ -345,7 +345,11 @@ public class ${ClassName}Controller extends BaseController {
Map<String, Object> map = MapUtils.newHashMap(); Map<String, Object> map = MapUtils.newHashMap();
map.put("id", e.getId()); map.put("id", e.getId());
map.put("pId", e.getParentCode()); map.put("pId", e.getParentCode());
<% if(table.isPkCustom){ %>
map.put("name", StringUtils.getTreeNodeName(isShowCode, e.get${@StringUtils.cap(table.treeViewCodeAttrName)}(), e.get${@StringUtils.cap(table.treeViewNameAttrName)}())); map.put("name", StringUtils.getTreeNodeName(isShowCode, e.get${@StringUtils.cap(table.treeViewCodeAttrName)}(), e.get${@StringUtils.cap(table.treeViewNameAttrName)}()));
<% }else{ %>
map.put("name", e.get${@StringUtils.cap(table.treeViewNameAttrName)}());
<% } %>
map.put("isParent", !e.getIsTreeLeaf()); map.put("isParent", !e.getIsTreeLeaf());
mapList.add(map); mapList.add(map);
} }

View File

@@ -190,7 +190,7 @@ public class ${ClassName} extends ${toBoolean(table.optionMap['isBpmForm'])?(tab
} }
} }
// 如果不是基类属性 // 如果不是基类属性
else if(!@StringUtils.equalsIgnoreCase(c.columnName, 'id') && !c.isSuperColumn){ else if(!@StringUtils.equalsIgnoreCase(c.simpleAttrName, 'id') && !c.isSuperColumn){
// 父类对象 // 父类对象
if(table.parentExists && table.parentTableFkName == c.columnName){ if(table.parentExists && table.parentTableFkName == c.columnName){
%> %>
@@ -297,7 +297,7 @@ public class ${ClassName} extends ${toBoolean(table.optionMap['isBpmForm'])?(tab
<% <%
} }
// 如果不是基类属性 // 如果不是基类属性
}else if(!@StringUtils.equalsIgnoreCase(c.columnName, 'id') && !c.isSuperColumn){ }else if(!@StringUtils.equalsIgnoreCase(c.simpleAttrName, 'id') && !c.isSuperColumn){
%> %>
<% <%

View File

@@ -50,9 +50,11 @@ for(pk in table.pkList){
} }
if(table.isTreeEntity){ if(table.isTreeEntity){
%> %>
<% if(table.isPkCustom){ %>
<span class="cursor-pointer" @click="expandCollapse(record)"> <span class="cursor-pointer" @click="expandCollapse(record)">
( {{ record.${table.treeViewCodeAttrName} }} ) ( {{ record.${table.treeViewCodeAttrName} }} )
</span> </span>
<% } %>
<a @click="handleForm({ ${idParam} })"> <a @click="handleForm({ ${idParam} })">
{{ record.${table.treeViewNameAttrName} }} {{ record.${table.treeViewNameAttrName} }}
</a> </a>

View File

@@ -11,8 +11,8 @@ package ${packageName}.${moduleName}.web${isNotEmpty(subModuleName)?'.'+subModul
<% if (table.isTreeEntity){ %> <% if (table.isTreeEntity){ %>
import java.util.Map; import java.util.Map;
<% } %> <% } %>
<% if (!table.isTreeEntity || toBoolean(table.optionMap['isImportExport'])){ %>
import java.util.List; import java.util.List;
<% if (!table.isTreeEntity || toBoolean(table.optionMap['isImportExport'])){ %>
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
<% } %> <% } %>
@@ -345,7 +345,11 @@ public class ${ClassName}Controller extends BaseController {
Map<String, Object> map = MapUtils.newHashMap(); Map<String, Object> map = MapUtils.newHashMap();
map.put("id", e.getId()); map.put("id", e.getId());
map.put("pId", e.getParentCode()); map.put("pId", e.getParentCode());
<% if(table.isPkCustom){ %>
map.put("name", StringUtils.getTreeNodeName(isShowCode, e.get${@StringUtils.cap(table.treeViewCodeAttrName)}(), e.get${@StringUtils.cap(table.treeViewNameAttrName)}())); map.put("name", StringUtils.getTreeNodeName(isShowCode, e.get${@StringUtils.cap(table.treeViewCodeAttrName)}(), e.get${@StringUtils.cap(table.treeViewNameAttrName)}()));
<% }else{ %>
map.put("name", e.get${@StringUtils.cap(table.treeViewNameAttrName)}());
<% } %>
map.put("isParent", !e.getIsTreeLeaf()); map.put("isParent", !e.getIsTreeLeaf());
mapList.add(map); mapList.add(map);
} }

View File

@@ -190,7 +190,7 @@ public class ${ClassName} extends ${toBoolean(table.optionMap['isBpmForm'])?(tab
} }
} }
// 如果不是基类属性 // 如果不是基类属性
else if(!@StringUtils.equalsIgnoreCase(c.columnName, 'id') && !c.isSuperColumn){ else if(!@StringUtils.equalsIgnoreCase(c.simpleAttrName, 'id') && !c.isSuperColumn){
// 父类对象 // 父类对象
if(table.parentExists && table.parentTableFkName == c.columnName){ if(table.parentExists && table.parentTableFkName == c.columnName){
%> %>
@@ -297,7 +297,7 @@ public class ${ClassName} extends ${toBoolean(table.optionMap['isBpmForm'])?(tab
<% <%
} }
// 如果不是基类属性 // 如果不是基类属性
}else if(!@StringUtils.equalsIgnoreCase(c.columnName, 'id') && !c.isSuperColumn){ }else if(!@StringUtils.equalsIgnoreCase(c.simpleAttrName, 'id') && !c.isSuperColumn){
%> %>
<% <%

View File

@@ -19,7 +19,7 @@ $('#dataGrid').dataGrid({
if(c.attrName == table.treeViewNameAttrName){ if(c.attrName == table.treeViewNameAttrName){
%> %>
{header:'\${text("${c.columnLabel}")}', name:'${c.attrName}', index:'a.${c.columnName}', width:250, align:"left", frozen:true, formatter: function(val, obj, row, act){ {header:'\${text("${c.columnLabel}")}', name:'${c.attrName}', index:'a.${c.columnName}', width:250, align:"left", frozen:true, formatter: function(val, obj, row, act){
return '( '+row.${table.treeViewCodeAttrName}+' ) '+'<a href="\${ctx}/${urlPrefix}/form?${idParam}" class="btnList" data-title="\${text("${isQueryTpl?'查看':'编辑'}${functionNameSimple}")}">'+(val||row.id)+'</a>'; return <% if(table.isPkCustom){ %>'( '+row.${table.treeViewCodeAttrName}+' ) '+<% } %>'<a href="\${ctx}/${urlPrefix}/form?${idParam}" class="btnList" data-title="\${text("${isQueryTpl?'查看':'编辑'}${functionNameSimple}")}">'+(val||row.id)+'</a>';
}}, }},
<% <%
firstColumn = false; firstColumn = false;

View File

@@ -13,7 +13,7 @@ selectNum = 0, dataGrid = $('#dataGrid').dataGrid({
if(c.attrName == table.treeViewNameAttrName){ if(c.attrName == table.treeViewNameAttrName){
%> %>
{header:'\${text("${c.columnLabel}")}', name:'${c.attrName}', index:'a.${c.columnName}', width:250, align:"left", frozen:true, formatter: function(val, obj, row, act){ {header:'\${text("${c.columnLabel}")}', name:'${c.attrName}', index:'a.${c.columnName}', width:250, align:"left", frozen:true, formatter: function(val, obj, row, act){
return '( '+row.${table.treeViewCodeAttrName}+' ) '+(val||row.id); return <% if(table.isPkCustom){ %>'( '+row.${table.treeViewCodeAttrName}+' ) '+<% } %>(val||row.id);
}}, }},
<% <%
firstColumn = false; firstColumn = false;