标签:_id nts uid varchar ble 实现 nod exist 多级
树结构在开发中经常遇到。例如:部门、菜单、员工架构等等。下面用部门作为例子构造部门结构树
1、部门表:dept
-- ---------------------------- -- Table structure for dept -- ---------------------------- DROP TABLE IF EXISTS `dept`; CREATE TABLE `dept` ( `id` varchar(36) NOT NULL, `name` varchar(255) DEFAULT NULL, `parent_id` varchar(36) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2、实体类:Dept
public class Dept implements Serializable { private static final long serialVersionUID = -2809004220612317111L; //ID private String id; //部门名称 private String name; //父ID private String parentId; //get/set方法省略 }
标签:_id nts uid varchar ble 实现 nod exist 多级
原文地址:https://www.cnblogs.com/chenweichu/p/10041198.html