Appearance
在这之前,确保 一、在新建项目时,确保安装了
这三个依赖; 二、要在resource/application.yml中配置好数据库连接; 三、已经启动MySQL服务,并创建了相应的数据库;
在idea中创建数据表:
- CREATE TABLE
menus( idbigint(20) NOT NULL AUTO_INCREMENT COMMENT '
菜单
- id',
levelint(11) NOT NULL DEFAULT '1' COMMENT '
菜单等级
- ',
namevarchar(11) NOT NULL DEFAULT '' COMMENT '
菜单名
- ',
notevarchar(500) DEFAULT NULL COMMENT '
备注
- ',
create_timedatetime NOT NULL COMMENT '
创建时间
- ',
update_timedatetime NOT NULL COMMENT '
更新时间
', deleted tinyint(4) NOT NULL DEFAULT '0' COMMENT ' 删除标志
- ',
- PRIMARY KEY (
id) USING BTREE, - UNIQUE KEY
menus_id_uindex(id) USING BTREE - ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='
菜单表';
点执行,创建出新表menus
再创建两条测试数据 INSERT INTO `menus` (`id`, `level`, `name`, `update_time`, `note`, `create_time`, `deleted`) VALUES (1, 1, '首页', '2021-08-22 13:44:51', '首页
', '2021-08-22 13:44:51', 0); INSERT INTO menus (id, level, name, update_time, note, create_time, deleted) VALUES (1444693273867198466, 1, ' 科室管理', '2021-10-03 15:58:38', '科室管理科室管理', '2021-10-03 15:58:16', 0);
创建组织机构表 在这里,我用idea的图形工具创建了一个organization表
- create table organization
- (
- name char not null comment '
名称
- ',
- nick_name char not null comment '
称呼
- ',
- id int auto_increment
- primary key,
- short_name char null,
- parent char null comment '
父节点名称
- ',
- level tinyint null comment '
层级
- ',
- hasChildren tinyint(1) null comment '
是否叶子节点
- '
- )
- comment '
组织和部门设置';
