修复代码生成树表异常

dep_wangsr
RuoYi 5 years ago committed by Limy
parent c80eb8fd11
commit 5def610df8

@ -75,6 +75,10 @@ public class VelocityUtils
{ {
context.put("tree_parent_code", paramsObj.getString(GenConstants.TREE_PARENT_CODE)); context.put("tree_parent_code", paramsObj.getString(GenConstants.TREE_PARENT_CODE));
} }
if (paramsObj.containsKey(GenConstants.TREE_NAME))
{
context.put("tree_name", paramsObj.getString(GenConstants.TREE_NAME));
}
} }
/** /**

@ -28,10 +28,9 @@
<div class="col-sm-8"> <div class="col-sm-8">
<div class="input-group"> <div class="input-group">
#set($BusinessName=$businessName.substring(0,1).toUpperCase() + ${businessName.substring(1)}) #set($BusinessName=$businessName.substring(0,1).toUpperCase() + ${businessName.substring(1)})
#set($deptId = "${className}?.deptId") #set($treeId = "${className}?.${treeCode}")
#set($deptName = "${className}?.deptName") <input id="treeId" name="${treeParentCode}" type="hidden" th:value="${${treeId}}"/>
<input id="treeId" name="${treeParentCode}" type="hidden" th:value="${${deptId}}"/> <input class="form-control" type="text" onclick="select${BusinessName}Tree()" id="treeName" readonly="true" th:value="${${treeName}}"#if($column.required) required#end>
<input class="form-control" type="text" onclick="select${BusinessName}Tree()" id="treeName" readonly="true" th:value="${${deptName}}"#if($column.required) required#end>
<span class="input-group-addon"><i class="fa fa-search"></i></span> <span class="input-group-addon"><i class="fa fa-search"></i></span>
</div> </div>
</div> </div>

@ -29,8 +29,6 @@
<div class="col-sm-8"> <div class="col-sm-8">
<div class="input-group"> <div class="input-group">
#set($BusinessName=$businessName.substring(0,1).toUpperCase() + ${businessName.substring(1)}) #set($BusinessName=$businessName.substring(0,1).toUpperCase() + ${businessName.substring(1)})
#set($deptId = "${className}?.deptId")
#set($deptName = "${className}?.deptName")
<input id="treeId" name="${treeParentCode}" type="hidden" th:field="*{${treeParentCode}}" /> <input id="treeId" name="${treeParentCode}" type="hidden" th:field="*{${treeParentCode}}" />
<input class="form-control" type="text" onclick="select${BusinessName}Tree()" id="treeName" readonly="true" th:field="*{parentName}"#if($column.required) required#end> <input class="form-control" type="text" onclick="select${BusinessName}Tree()" id="treeName" readonly="true" th:field="*{parentName}"#if($column.required) required#end>
<span class="input-group-addon"><i class="fa fa-search"></i></span> <span class="input-group-addon"><i class="fa fa-search"></i></span>

@ -31,7 +31,7 @@
<th:block th:include="include :: ztree-js" /> <th:block th:include="include :: ztree-js" />
<script th:inline="javascript"> <script th:inline="javascript">
$(function() { $(function() {
var url = ctx + "system/${businessName}/treeData"; var url = ctx + "${moduleName}/${businessName}/treeData";
var options = { var options = {
url: url, url: url,
expandLevel: 2, expandLevel: 2,

@ -57,7 +57,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="select${ClassName}Vo"/> <include refid="select${ClassName}Vo"/>
where ${pkColumn.columnName} = #{${pkColumn.javaField}} where ${pkColumn.columnName} = #{${pkColumn.javaField}}
#elseif($table.tree) #elseif($table.tree)
select#foreach($column in $columns) t.$column.columnName,#end p.dept_name as parent_name select#foreach($column in $columns) t.$column.columnName,#end p.${tree_name} as parent_name
from ${tableName} t from ${tableName} t
left join ${tableName} p on p.${pkColumn.columnName} = t.${tree_parent_code} left join ${tableName} p on p.${pkColumn.columnName} = t.${tree_parent_code}
where t.${pkColumn.columnName} = #{${pkColumn.javaField}} where t.${pkColumn.columnName} = #{${pkColumn.javaField}}

Loading…
Cancel
Save