mirror of
https://github.com/continew-org/continew-admin.git
synced 2025-09-10 08:57:14 +08:00
refactor: 💥 优化系统内置类型数据标识
1.系统内置类型数据标识由 type 调整为 is_system 2.优化部分表的非空字段
This commit is contained in:
@@ -39,30 +39,30 @@ VALUES
|
||||
|
||||
-- 初始化默认部门
|
||||
INSERT IGNORE INTO `sys_dept`
|
||||
(`id`, `name`, `parent_id`, `ancestors`, `description`, `sort`, `status`, `type`, `create_user`, `create_time`, `update_user`, `update_time`)
|
||||
(`id`, `name`, `parent_id`, `ancestors`, `description`, `sort`, `status`, `is_system`, `create_user`, `create_time`, `update_user`, `update_time`)
|
||||
VALUES
|
||||
(1, 'Xxx科技有限公司', 0, '0', '系统初始部门', 1, 1, 1, 1, NOW(), NULL, NULL),
|
||||
(2, '天津总部', 1, '0,1', NULL, 1, 1, 2, 1, NOW(), NULL, NULL),
|
||||
(3, '研发部', 2, '0,1,2', NULL, 1, 1, 2, 1, NOW(), NULL, NULL),
|
||||
(4, 'UI部', 2, '0,1,2', NULL, 2, 1, 2, 1, NOW(), NULL, NULL),
|
||||
(5, '测试部', 2, '0,1,2', NULL, 3, 1, 2, 1, NOW(), NULL, NULL),
|
||||
(6, '运维部', 2, '0,1,2', NULL, 4, 1, 2, 1, NOW(), NULL, NULL),
|
||||
(7, '研发一组', 3, '0,1,2,3', NULL, 1, 1, 2, 1, NOW(), NULL, NULL),
|
||||
(8, '研发二组', 3, '0,1,2,3', NULL, 2, 2, 2, 1, NOW(), NULL, NULL);
|
||||
(1, 'Xxx科技有限公司', 0, '0', '系统初始部门', 1, 1, b'1', 1, NOW(), NULL, NULL),
|
||||
(2, '天津总部', 1, '0,1', NULL, 1, 1, b'0', 1, NOW(), NULL, NULL),
|
||||
(3, '研发部', 2, '0,1,2', NULL, 1, 1, b'0', 1, NOW(), NULL, NULL),
|
||||
(4, 'UI部', 2, '0,1,2', NULL, 2, 1, b'0', 1, NOW(), NULL, NULL),
|
||||
(5, '测试部', 2, '0,1,2', NULL, 3, 1, b'0', 1, NOW(), NULL, NULL),
|
||||
(6, '运维部', 2, '0,1,2', NULL, 4, 1, b'0', 1, NOW(), NULL, NULL),
|
||||
(7, '研发一组', 3, '0,1,2,3', NULL, 1, 1, b'0', 1, NOW(), NULL, NULL),
|
||||
(8, '研发二组', 3, '0,1,2,3', NULL, 2, 2, b'0', 1, NOW(), NULL, NULL);
|
||||
|
||||
-- 初始化默认角色
|
||||
INSERT IGNORE INTO `sys_role`
|
||||
(`id`, `name`, `code`, `data_scope`, `description`, `sort`, `status`, `type`, `create_user`, `create_time`, `update_user`, `update_time`)
|
||||
(`id`, `name`, `code`, `data_scope`, `description`, `sort`, `status`, `is_system`, `create_user`, `create_time`, `update_user`, `update_time`)
|
||||
VALUES
|
||||
(1, '超级管理员', 'admin', 1, '系统初始角色', 1, 1, 1, 1, NOW(), NULL, NULL),
|
||||
(2, '测试人员', 'test', 5, NULL, 2, 1, 2, 1, NOW(), NULL, NULL);
|
||||
(1, '超级管理员', 'admin', 1, '系统初始角色', 1, 1, b'1', 1, NOW(), NULL, NULL),
|
||||
(2, '测试人员', 'test', 5, NULL, 2, 1, b'0', 1, NOW(), NULL, NULL);
|
||||
|
||||
-- 初始化默认用户:admin/admin123;test/123456
|
||||
INSERT IGNORE INTO `sys_user`
|
||||
(`id`, `username`, `nickname`, `password`, `gender`, `email`, `phone`, `avatar`, `description`, `status`, `type`, `pwd_reset_time`, `dept_id`, `create_user`, `create_time`, `update_user`, `update_time`)
|
||||
(`id`, `username`, `nickname`, `password`, `gender`, `email`, `phone`, `avatar`, `description`, `status`, `is_system`, `pwd_reset_time`, `dept_id`, `create_user`, `create_time`, `update_user`, `update_time`)
|
||||
VALUES
|
||||
(1, 'admin', '超级管理员', '9802815bcc5baae7feb1ae0d0566baf2', 1, 'charles7c@126.com', '18888888888', NULL, '系统初始用户', 1, 1, NOW(), 1, 1, NOW(), NULL, NULL),
|
||||
(2, 'test', '测试员', '8e114197e1b33783a00542ad67e80516', 2, NULL, NULL, NULL, NULL, 2, 2, NOW(), 5, 1, NOW(), NULL, NULL);
|
||||
(1, 'admin', '超级管理员', '9802815bcc5baae7feb1ae0d0566baf2', 1, 'charles7c@126.com', '18888888888', NULL, '系统初始用户', 1, b'1', NULL, 1, 1, NOW(), NULL, NULL),
|
||||
(2, 'test', '测试员', '8e114197e1b33783a00542ad67e80516', 2, NULL, NULL, NULL, NULL, 2, b'0', NULL, 5, 1, NOW(), NULL, NULL);
|
||||
|
||||
-- 初始化默认角色和菜单关联数据
|
||||
INSERT IGNORE INTO `sys_role_menu`
|
||||
|
@@ -4,18 +4,18 @@
|
||||
CREATE TABLE IF NOT EXISTS `sys_menu` (
|
||||
`id` bigint(20) UNSIGNED AUTO_INCREMENT COMMENT 'ID',
|
||||
`title` varchar(50) NOT NULL COMMENT '菜单标题',
|
||||
`parent_id` bigint(20) UNSIGNED DEFAULT 0 COMMENT '上级菜单ID',
|
||||
`type` tinyint(1) UNSIGNED DEFAULT 1 COMMENT '菜单类型(1:目录,2:菜单,3:按钮)',
|
||||
`parent_id` bigint(20) UNSIGNED NOT NULL DEFAULT 0 COMMENT '上级菜单ID',
|
||||
`type` tinyint(1) UNSIGNED NOT NULL DEFAULT 1 COMMENT '菜单类型(1:目录,2:菜单,3:按钮)',
|
||||
`path` varchar(512) DEFAULT NULL COMMENT '路由地址',
|
||||
`name` varchar(50) DEFAULT NULL COMMENT '组件名称',
|
||||
`component` varchar(255) DEFAULT NULL COMMENT '组件路径',
|
||||
`icon` varchar(255) DEFAULT NULL COMMENT '菜单图标',
|
||||
`is_external` bit(1) DEFAULT b'0' COMMENT '是否外链',
|
||||
`is_cache` bit(1) DEFAULT b'0' COMMENT '是否缓存',
|
||||
`is_hidden` bit(1) DEFAULT b'0' COMMENT '是否隐藏',
|
||||
`is_external` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否外链',
|
||||
`is_cache` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否缓存',
|
||||
`is_hidden` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否隐藏',
|
||||
`permission` varchar(255) DEFAULT NULL COMMENT '权限标识',
|
||||
`sort` int(11) UNSIGNED DEFAULT 999 COMMENT '菜单排序',
|
||||
`status` tinyint(1) UNSIGNED DEFAULT 1 COMMENT '状态(1:启用,2:禁用)',
|
||||
`sort` int UNSIGNED NOT NULL DEFAULT 999 COMMENT '菜单排序',
|
||||
`status` tinyint(1) UNSIGNED NOT NULL DEFAULT 1 COMMENT '状态(1:启用,2:禁用)',
|
||||
`create_user` bigint(20) UNSIGNED NOT NULL COMMENT '创建人',
|
||||
`create_time` datetime NOT NULL COMMENT '创建时间',
|
||||
`update_user` bigint(20) UNSIGNED DEFAULT NULL COMMENT '修改人',
|
||||
@@ -30,12 +30,12 @@ CREATE TABLE IF NOT EXISTS `sys_menu` (
|
||||
CREATE TABLE IF NOT EXISTS `sys_dept` (
|
||||
`id` bigint(20) UNSIGNED AUTO_INCREMENT COMMENT 'ID',
|
||||
`name` varchar(50) NOT NULL COMMENT '部门名称',
|
||||
`parent_id` bigint(20) UNSIGNED DEFAULT 0 COMMENT '上级部门ID',
|
||||
`parent_id` bigint(20) UNSIGNED NOT NULL DEFAULT 0 COMMENT '上级部门ID',
|
||||
`ancestors` varchar(512) DEFAULT '' COMMENT '祖级列表',
|
||||
`description` varchar(512) DEFAULT NULL COMMENT '描述',
|
||||
`sort` int(11) UNSIGNED DEFAULT 999 COMMENT '部门排序',
|
||||
`status` tinyint(1) UNSIGNED DEFAULT 1 COMMENT '状态(1:启用,2:禁用)',
|
||||
`type` tinyint(1) UNSIGNED DEFAULT 2 COMMENT '类型(1:系统内置,2:自定义)',
|
||||
`sort` int UNSIGNED NOT NULL DEFAULT 999 COMMENT '部门排序',
|
||||
`status` tinyint(1) UNSIGNED NOT NULL DEFAULT 1 COMMENT '状态(1:启用,2:禁用)',
|
||||
`is_system` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否为系统内置数据',
|
||||
`create_user` bigint(20) UNSIGNED NOT NULL COMMENT '创建人',
|
||||
`create_time` datetime NOT NULL COMMENT '创建时间',
|
||||
`update_user` bigint(20) UNSIGNED DEFAULT NULL COMMENT '修改人',
|
||||
@@ -51,11 +51,11 @@ CREATE TABLE IF NOT EXISTS `sys_role` (
|
||||
`id` bigint(20) UNSIGNED AUTO_INCREMENT COMMENT 'ID',
|
||||
`name` varchar(50) NOT NULL COMMENT '角色名称',
|
||||
`code` varchar(50) NOT NULL COMMENT '角色编码',
|
||||
`data_scope` tinyint(1) DEFAULT 4 COMMENT '数据权限(1:全部数据权限,2:本部门及以下数据权限,3:本部门数据权限,4:仅本人数据权限,5:自定义数据权限)',
|
||||
`data_scope` tinyint(1) NOT NULL DEFAULT 4 COMMENT '数据权限(1:全部数据权限,2:本部门及以下数据权限,3:本部门数据权限,4:仅本人数据权限,5:自定义数据权限)',
|
||||
`description` varchar(512) DEFAULT NULL COMMENT '描述',
|
||||
`sort` int(11) UNSIGNED DEFAULT 999 COMMENT '角色排序',
|
||||
`status` tinyint(1) UNSIGNED DEFAULT 1 COMMENT '状态(1:启用,2:禁用)',
|
||||
`type` tinyint(1) UNSIGNED DEFAULT 2 COMMENT '类型(1:系统内置,2:自定义)',
|
||||
`sort` int UNSIGNED NOT NULL DEFAULT 999 COMMENT '角色排序',
|
||||
`status` tinyint(1) UNSIGNED NOT NULL DEFAULT 1 COMMENT '状态(1:启用,2:禁用)',
|
||||
`is_system` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否为系统内置数据',
|
||||
`create_user` bigint(20) UNSIGNED NOT NULL COMMENT '创建人',
|
||||
`create_time` datetime NOT NULL COMMENT '创建时间',
|
||||
`update_user` bigint(20) UNSIGNED DEFAULT NULL COMMENT '修改人',
|
||||
@@ -84,13 +84,13 @@ CREATE TABLE IF NOT EXISTS `sys_user` (
|
||||
`username` varchar(50) NOT NULL COMMENT '用户名',
|
||||
`nickname` varchar(50) DEFAULT NULL COMMENT '昵称',
|
||||
`password` varchar(255) DEFAULT NULL COMMENT '密码',
|
||||
`gender` tinyint(1) UNSIGNED DEFAULT 0 COMMENT '性别(0:未知,1:男,2:女)',
|
||||
`gender` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '性别(0:未知,1:男,2:女)',
|
||||
`email` varchar(100) DEFAULT NULL COMMENT '邮箱',
|
||||
`phone` varchar(50) DEFAULT NULL COMMENT '手机号码',
|
||||
`avatar` varchar(255) DEFAULT NULL COMMENT '头像地址',
|
||||
`description` varchar(512) DEFAULT NULL COMMENT '描述',
|
||||
`status` tinyint(1) UNSIGNED DEFAULT 1 COMMENT '状态(1:启用,2:禁用)',
|
||||
`type` tinyint(1) UNSIGNED DEFAULT 2 COMMENT '类型(1:系统内置,2:自定义)',
|
||||
`status` tinyint(1) UNSIGNED NOT NULL DEFAULT 1 COMMENT '状态(1:启用,2:禁用)',
|
||||
`is_system` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否为系统内置数据',
|
||||
`pwd_reset_time` datetime DEFAULT NULL COMMENT '最后一次修改密码时间',
|
||||
`dept_id` bigint(20) UNSIGNED NOT NULL COMMENT '部门ID',
|
||||
`create_user` bigint(20) UNSIGNED NOT NULL COMMENT '创建人',
|
||||
@@ -120,11 +120,11 @@ CREATE TABLE IF NOT EXISTS `sys_log` (
|
||||
`request_method` varchar(10) NOT NULL COMMENT '请求方式',
|
||||
`request_headers` text DEFAULT NULL COMMENT '请求头',
|
||||
`request_body` text DEFAULT NULL COMMENT '请求体',
|
||||
`status_code` int(11) UNSIGNED NOT NULL COMMENT '状态码',
|
||||
`status_code` int UNSIGNED NOT NULL COMMENT '状态码',
|
||||
`response_headers` text DEFAULT NULL COMMENT '响应头',
|
||||
`response_body` mediumtext DEFAULT NULL COMMENT '响应体',
|
||||
`elapsed_time` bigint(20) UNSIGNED NOT NULL COMMENT '请求耗时(ms)',
|
||||
`status` tinyint(1) UNSIGNED DEFAULT 1 COMMENT '操作状态(1:成功,2:失败)',
|
||||
`status` tinyint(1) UNSIGNED NOT NULL DEFAULT 1 COMMENT '操作状态(1:成功,2:失败)',
|
||||
`client_ip` varchar(100) DEFAULT NULL COMMENT '客户端IP',
|
||||
`location` varchar(255) DEFAULT NULL COMMENT 'IP归属地',
|
||||
`browser` varchar(100) DEFAULT NULL COMMENT '浏览器',
|
||||
|
@@ -9,7 +9,7 @@ CREATE TABLE IF NOT EXISTS `gen_config` (
|
||||
`business_name` varchar(50) NOT NULL COMMENT '业务名称',
|
||||
`author` varchar(100) NOT NULL COMMENT '作者',
|
||||
`table_prefix` varchar(20) DEFAULT NULL COMMENT '表前缀',
|
||||
`is_override` bit(1) DEFAULT b'0' COMMENT '是否覆盖',
|
||||
`is_override` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否覆盖',
|
||||
`create_time` datetime NOT NULL COMMENT '创建时间',
|
||||
`update_time` datetime DEFAULT NULL COMMENT '修改时间',
|
||||
PRIMARY KEY (`table_name`) USING BTREE
|
||||
@@ -22,10 +22,10 @@ CREATE TABLE IF NOT EXISTS `gen_field_config` (
|
||||
`field_name` varchar(64) NOT NULL COMMENT '字段名称',
|
||||
`field_type` varchar(25) NOT NULL COMMENT '字段类型',
|
||||
`comment` varchar(512) DEFAULT NULL COMMENT '注释',
|
||||
`is_required` bit(1) DEFAULT b'1' COMMENT '是否必填',
|
||||
`show_in_list` bit(1) DEFAULT b'1' COMMENT '是否在列表中显示',
|
||||
`show_in_form` bit(1) DEFAULT b'1' COMMENT '是否在表单中显示',
|
||||
`show_in_query` bit(1) DEFAULT b'1' COMMENT '是否在查询中显示',
|
||||
`is_required` bit(1) NOT NULL DEFAULT b'1' COMMENT '是否必填',
|
||||
`show_in_list` bit(1) NOT NULL DEFAULT b'1' COMMENT '是否在列表中显示',
|
||||
`show_in_form` bit(1) NOT NULL DEFAULT b'1' COMMENT '是否在表单中显示',
|
||||
`show_in_query` bit(1) NOT NULL DEFAULT b'1' COMMENT '是否在查询中显示',
|
||||
`form_type` tinyint(1) UNSIGNED DEFAULT NULL COMMENT '表单类型',
|
||||
`query_type` tinyint(1) UNSIGNED DEFAULT NULL COMMENT '查询方式',
|
||||
`create_time` datetime NOT NULL COMMENT '创建时间',
|
||||
@@ -39,7 +39,7 @@ CREATE TABLE IF NOT EXISTS `sys_announcement` (
|
||||
`type` varchar(30) NOT NULL COMMENT '类型',
|
||||
`effective_time` datetime DEFAULT NULL COMMENT '生效时间',
|
||||
`terminate_time` datetime DEFAULT NULL COMMENT '终止时间',
|
||||
`sort` int(11) UNSIGNED DEFAULT 999 COMMENT '排序',
|
||||
`sort` int UNSIGNED NOT NULL DEFAULT 999 COMMENT '排序',
|
||||
`create_user` bigint(20) UNSIGNED NOT NULL COMMENT '创建人',
|
||||
`create_time` datetime NOT NULL COMMENT '创建时间',
|
||||
`update_user` bigint(20) UNSIGNED DEFAULT NULL COMMENT '修改人',
|
||||
|
@@ -13,9 +13,9 @@ VALUES
|
||||
|
||||
-- 初始化默认字典
|
||||
INSERT IGNORE INTO `sys_dict`
|
||||
(`id`, `name`, `code`, `description`, `create_user`, `create_time`, `update_user`, `update_time`)
|
||||
(`id`, `name`, `code`, `description`, `is_system`, `create_user`, `create_time`, `update_user`, `update_time`)
|
||||
VALUES
|
||||
(1, '公告类型', 'announcement_type', NULL, 1, NOW(), NULL, NULL);
|
||||
(1, '公告类型', 'announcement_type', NULL, b'1', 1, NOW(), NULL, NULL);
|
||||
|
||||
-- 初始化默认字典项
|
||||
INSERT IGNORE INTO `sys_dict_item`
|
||||
|
@@ -6,6 +6,7 @@ CREATE TABLE IF NOT EXISTS `sys_dict` (
|
||||
`name` varchar(50) NOT NULL COMMENT '字典名称',
|
||||
`code` varchar(30) NOT NULL COMMENT '字典编码',
|
||||
`description` varchar(512) DEFAULT NULL COMMENT '描述',
|
||||
`is_system` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否为系统内置数据',
|
||||
`create_user` bigint(20) UNSIGNED NOT NULL COMMENT '创建人',
|
||||
`create_time` datetime NOT NULL COMMENT '创建时间',
|
||||
`update_user` bigint(20) UNSIGNED DEFAULT NULL COMMENT '修改人',
|
||||
@@ -20,7 +21,7 @@ CREATE TABLE IF NOT EXISTS `sys_dict_item` (
|
||||
`label` varchar(50) NOT NULL COMMENT '字典标签',
|
||||
`value` varchar(30) NOT NULL COMMENT '字典值',
|
||||
`color` varchar(30) DEFAULT NULL COMMENT '背景颜色',
|
||||
`sort` int(11) UNSIGNED DEFAULT 999 COMMENT '字典项排序',
|
||||
`sort` int UNSIGNED NOT NULL DEFAULT 999 COMMENT '字典项排序',
|
||||
`description` varchar(512) DEFAULT NULL COMMENT '描述',
|
||||
`dict_id` bigint(20) UNSIGNED NOT NULL COMMENT '字典ID',
|
||||
`create_user` bigint(20) UNSIGNED NOT NULL COMMENT '创建人',
|
||||
|
Reference in New Issue
Block a user