Spring+MyBatis+jeasyui 功能树列表

2024-09-09 06:32

本文主要是介绍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语句(可视数据表结构设计更改)
    <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>
注:fun_superior上级功能


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 功能树列表的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/1150420

相关文章

Spring Cloud LoadBalancer 负载均衡详解

《SpringCloudLoadBalancer负载均衡详解》本文介绍了如何在SpringCloud中使用SpringCloudLoadBalancer实现客户端负载均衡,并详细讲解了轮询策略和... 目录1. 在 idea 上运行多个服务2. 问题引入3. 负载均衡4. Spring Cloud Load

Springboot中分析SQL性能的两种方式详解

《Springboot中分析SQL性能的两种方式详解》文章介绍了SQL性能分析的两种方式:MyBatis-Plus性能分析插件和p6spy框架,MyBatis-Plus插件配置简单,适用于开发和测试环... 目录SQL性能分析的两种方式:功能介绍实现方式:实现步骤:SQL性能分析的两种方式:功能介绍记录

在 Spring Boot 中使用 @Autowired和 @Bean注解的示例详解

《在SpringBoot中使用@Autowired和@Bean注解的示例详解》本文通过一个示例演示了如何在SpringBoot中使用@Autowired和@Bean注解进行依赖注入和Bean... 目录在 Spring Boot 中使用 @Autowired 和 @Bean 注解示例背景1. 定义 Stud

如何通过海康威视设备网络SDK进行Java二次开发摄像头车牌识别详解

《如何通过海康威视设备网络SDK进行Java二次开发摄像头车牌识别详解》:本文主要介绍如何通过海康威视设备网络SDK进行Java二次开发摄像头车牌识别的相关资料,描述了如何使用海康威视设备网络SD... 目录前言开发流程问题和解决方案dll库加载不到的问题老旧版本sdk不兼容的问题关键实现流程总结前言作为

Python如何计算两个不同类型列表的相似度

《Python如何计算两个不同类型列表的相似度》在编程中,经常需要比较两个列表的相似度,尤其是当这两个列表包含不同类型的元素时,下面小编就来讲讲如何使用Python计算两个不同类型列表的相似度吧... 目录摘要引言数字类型相似度欧几里得距离曼哈顿距离字符串类型相似度Levenshtein距离Jaccard相

SpringBoot中使用 ThreadLocal 进行多线程上下文管理及注意事项小结

《SpringBoot中使用ThreadLocal进行多线程上下文管理及注意事项小结》本文详细介绍了ThreadLocal的原理、使用场景和示例代码,并在SpringBoot中使用ThreadLo... 目录前言技术积累1.什么是 ThreadLocal2. ThreadLocal 的原理2.1 线程隔离2

springboot将lib和jar分离的操作方法

《springboot将lib和jar分离的操作方法》本文介绍了如何通过优化pom.xml配置来减小SpringBoot项目的jar包大小,主要通过使用spring-boot-maven-plugin... 遇到一个问题,就是每次maven package或者maven install后target中的ja

Java中八大包装类举例详解(通俗易懂)

《Java中八大包装类举例详解(通俗易懂)》:本文主要介绍Java中的包装类,包括它们的作用、特点、用途以及如何进行装箱和拆箱,包装类还提供了许多实用方法,如转换、获取基本类型值、比较和类型检测,... 目录一、包装类(Wrapper Class)1、简要介绍2、包装类特点3、包装类用途二、装箱和拆箱1、装

如何利用Java获取当天的开始和结束时间

《如何利用Java获取当天的开始和结束时间》:本文主要介绍如何使用Java8的LocalDate和LocalDateTime类获取指定日期的开始和结束时间,展示了如何通过这些类进行日期和时间的处... 目录前言1. Java日期时间API概述2. 获取当天的开始和结束时间代码解析运行结果3. 总结前言在J

Java深度学习库DJL实现Python的NumPy方式

《Java深度学习库DJL实现Python的NumPy方式》本文介绍了DJL库的背景和基本功能,包括NDArray的创建、数学运算、数据获取和设置等,同时,还展示了如何使用NDArray进行数据预处理... 目录1 NDArray 的背景介绍1.1 架构2 JavaDJL使用2.1 安装DJL2.2 基本操