You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
3.1 KiB
44 lines
3.1 KiB
-- ---------------------------- |
|
-- by AI |
|
-- ---------------------------- |
|
|
|
-- 创建销售区域表 |
|
CREATE TABLE `sales_region` ( |
|
`region_id` bigint NOT NULL AUTO_INCREMENT COMMENT '销售区域ID', |
|
`region_name` varchar(100) NOT NULL COMMENT '销售区域名称', |
|
`country_id` int NOT NULL COMMENT '国家ID', |
|
`user_id` bigint NOT NULL COMMENT '负责用户ID', |
|
`status` char(1) DEFAULT '0' COMMENT '状态(0正常 1停用)', |
|
`del_flag` char(1) DEFAULT '0' COMMENT '删除标志(0代表存在 2代表删除)', |
|
`create_by` varchar(64) DEFAULT '' COMMENT '创建者', |
|
`create_time` datetime DEFAULT NULL COMMENT '创建时间', |
|
`update_by` varchar(64) DEFAULT '' COMMENT '更新者', |
|
`update_time` datetime DEFAULT NULL COMMENT '更新时间', |
|
`remark` varchar(500) DEFAULT NULL COMMENT '备注', |
|
PRIMARY KEY (`region_id`), |
|
KEY `idx_country_id` (`country_id`), |
|
KEY `idx_user_id` (`user_id`), |
|
CONSTRAINT `fk_sales_region_country` FOREIGN KEY (`country_id`) REFERENCES `iso3166_country` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT, |
|
CONSTRAINT `fk_sales_region_user` FOREIGN KEY (`user_id`) REFERENCES `sys_user` (`user_id`) ON DELETE RESTRICT ON UPDATE RESTRICT |
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='销售区域表'; |
|
|
|
--------------------------------------- |
|
-- 菜单 SQL |
|
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) |
|
values('销售区域管理', '1', '1', 'region', 'system/region/index', 1, 0, 'C', '0', '0', 'system:region:list', 'international', 'admin', sysdate(), '', null, '销售区域管理菜单'); |
|
|
|
-- 按钮父菜单ID |
|
SELECT @parentId := LAST_INSERT_ID(); |
|
|
|
-- 按钮 SQL |
|
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) |
|
values('销售区域查询', @parentId, '1', '#', '', 1, 0, 'F', '0', '0', 'system:region:query', '#', 'admin', sysdate(), '', null, ''); |
|
|
|
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) |
|
values('销售区域新增', @parentId, '2', '#', '', 1, 0, 'F', '0', '0', 'system:region:add', '#', 'admin', sysdate(), '', null, ''); |
|
|
|
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) |
|
values('销售区域修改', @parentId, '3', '#', '', 1, 0, 'F', '0', '0', 'system:region:edit', '#', 'admin', sysdate(), '', null, ''); |
|
|
|
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) |
|
values('销售区域删除', @parentId, '4', '#', '', 1, 0, 'F', '0', '0', 'system:region:remove', '#', 'admin', sysdate(), '', null, ''); |