mysql 4层树形菜单查询存储过程怎么写

mysql 4层树形菜单查询存储过程怎么写,第1张

查看存储过程创建语句可运行下列SQL语句:语法show create {procedure|function} sp_name例如查看存储过程myPro的创建语句show create procedure myPro查看自定义函数myFunc的创建语句show create function myFunc

jsp从mysql数据库读取数据,并填充到树形结构菜单并展现出来的实现方法:

1、引入jquery.treeview.js树控件

<script type="text/javascript" src="jquery/easyui/jquery.min.js"></script>

<script type="text/javascript" src="jquery/easyui/jquery.easyui.min.js"></script>

2、jsp页面中获取后台mysql数据,并传到jsp页面来

<%

// 数据库的名字

String dbName = "zap"

// 登录数据库的用户名

String username = "sa"

// 登录数据库的密码

String password = "123"

// 数据库的IP地址,本机可以用 localhost 或者 127.0.0.1

String host = "127.0.0.1"

// 数据库的端口,一般不会修改,默认为1433

int port = 1433

String connectionUrl = "jdbc:sqlserver://" + host + ":" + port + "databaseName=" + dbName + "user=" + username

+ "password=" + password

//

//声明需要使用的资源

// 数据库连接,记得用完了一定要关闭

Connection con = null

// Statement 记得用完了一定要关闭

Statement stmt = null

// 结果集,记得用完了一定要关闭

ResultSet rs = null

try {

// 注册驱动

Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver")

// 获得一个数据库连接

con = DriverManager.getConnection(connectionUrl)

String SQL = "SELECT * from note"

// 创建查询

stmt = con.createStatement()

// 执行查询,拿到结果集

rs = stmt.executeQuery(SQL)

while (rs.next()) {

%>

<tr>

3、填充树形菜单:

{

id : "string" // will be autogenerated if omitted

text: "string" // node text

icon: "string" // string for custom

state : {

opened: boolean // is the node open

disabled : boolean // is the node disabled

selected : boolean // is the node selected

},

children: [] // array of strings or objects

li_attr : {} // attributes for the generated LI node

a_attr : {} // attributes for the generated A node

}

$('#tree').jstree({

'core' : {

'data' : function (obj, cb) {

cb.call(this,

['Root 1', 'Root 2'])

}

}})

二叉树 -->二叉查找树 -->平衡二叉树 -->B树 -->B+树

B树又叫平衡多路查找树。

一棵m阶的B树满足下列条件:

B+树是B树的变体,也是一种多路搜索树, 它与B树的不同之处在于:

B+树优势:

主键及单字段二级索引结构:

主键及多字段二级索引结构:

B+树插入的3种情况:

B+树使用填充因子来控制树的删除变化,50%是填充因子可设的最小值。


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zaji/5905289.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-03-07
下一篇 2023-03-07

发表评论

登录后才能评论

评论列表(0条)

保存