本文主要是介绍Spring+MyBatis+jeasyui 功能树列表,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
java代码 @EnablePaging @RequestMapping(value = "/queryFunctionList.html") @ResponseBody public Map<String, Object> queryFunctionList() { String parentId = ""; List<FunctionDisplay> tables = query(parentId); Map<String, Object> resultMap = new HashMap<String, Object>(); resultMap.put("rows", tables); return resultMap; }private List<FunctionDisplay> query(String parentId){ List<FunctionDisplay> tables = functionService.queryFunctions(parentId); Iterator<FunctionDisplay> iterator = tables.iterator(); while (iterator.hasNext()) { FunctionDisplay fun = iterator.next(); List<FunctionDisplay> list = query(fun.getId()); if (list != null) { fun.setChildren(list); } } return tables; }MyBatis sql语句(可视数据表结构设计更改)
注:fun_superior上级功能<select id="selectFunctions" resultMap="displayMap" parameterType="com.ourangel.box.domain.model.FunctionDisplay">SELECTa.function_id as id,a.function_name as text,a.function_type,a.link,a.fun_superior,a.log_sign,a.order_id,a.description,b.code_name as function_type_name,c.code_name as log_sign_name,d.code_name as del_tag_name,e.function_name as fun_superior_nameFROM oal_tb_function aLEFT JOIN oal_tb_code b ON b.code_id = a.function_type AND b.class_id = "FUNCTION_TYPE"LEFT JOIN oal_tb_code c ON c.code_id = a.log_sign AND c.class_id = "LOG_SIGN_TYPE"LEFT JOIN oal_tb_code d ON d.code_id = a.del_tag AND d.class_id = "DEL_TAG_TYPE"LEFT JOIN oal_tb_function e ON e.function_id = a.fun_superior<where><choose><when test="_parameter!=null and _parameter!=''">a.fun_superior = #{_parameter,jdbcType=VARCHAR}</when><when test="_parameter==null or _parameter==''">a.fun_superior IS NULL</when></choose></where></select>
js代码
$('#displayTable').treegrid({nowrap: true, //是否换行autoRowHeight: false, //自动行高fitColumns: true,fit: true,striped: true,collapsible: true, //是否可折叠remoteSort: true,idField: 'id',singleSelect: true, //是否单选pagination: true, //分页控件scrollbarSize: 0,loadMsg: "数据加载中.....",url:'queryFunctionList.html',idField:'id',treeField:'text',frozenColumns: [[{field: 'ck', checkbox: true},{field: 'id', title: '<span class="columnTitle">功能ID</span>',align:'center', width: 120, sortable: true,formatter:function(value,row){return '<a href="#" style="color:blue; text-decoration:none;" ' + 'οnclick="doDisplay(\'' + row.id + '\');">'+value+'</a>';}}]],columns:[[{field:'text',title:'功能名称',width:180},{field:'functionTypeName',title:'功能类型',width:100,align:'center'},{field:'link',title:'功能链接',width:100,align:'center'},{field:'funSuperiorName',title:'上级功能',width:100,align:'center'},{field:'orderId',title:'排序',width:100,align:'center'},{field:'logSignName',title:'记录日志',width:100,align:'center'},{field:'description',title:'描述',width:100},{field:'delTagName',title:'是否有效',width:100,align:'center'},{field:'update',title:'操作',width:100,align:'center',formatter: function (value, row) {return '<a href="#" style="color:red; text-decoration:none;" ' + 'οnclick="doUpdate(\'' + row.id + '\');">修改</a>';}}]],toolbar: "#dataGridToolbar",onLoadSuccess:function(){$('#displayTable').datagrid('clearSelections');},onLoadError: function (httpRequest) {displayErrorMessage(httpRequest);},pageSize: 20,pageList: [20, 40, 60, 80, 100],beforePageText: '第', //页数文本框前显示的汉字afterPageText: '页 共 {pages} 页',displayMsg: '当前显示 {from} - {to} 条记录 共 {total} 条记录' });
这篇关于Spring+MyBatis+jeasyui 功能树列表的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!