Files
2026-06-25 14:58:52 +08:00

77 lines
3.8 KiB
SQL

create table if not exists fp_member_user (
member_id bigint not null comment '会员ID',
username varchar(64) not null comment '会员账号',
password varchar(255) not null comment '登录密码',
nick_name varchar(64) default null comment '会员昵称',
email varchar(128) default null comment '邮箱',
phonenumber varchar(32) default null comment '手机号',
status char(1) default '0' comment '状态',
expire_time datetime default null comment '到期时间',
last_login_ip varchar(128) default null comment '最近登录IP',
last_login_time datetime default null comment '最近登录时间',
remark varchar(500) default null comment '备注',
create_by varchar(64) default '' comment '创建者',
create_time datetime default null comment '创建时间',
update_by varchar(64) default '' comment '更新者',
update_time datetime default null comment '更新时间',
primary key (member_id),
unique key uk_member_username (username)
) engine=InnoDB comment='会员用户表';
create table if not exists fp_profile_group (
group_id bigint not null comment '主键ID',
user_id bigint not null comment '所属用户ID',
group_name varchar(64) not null comment '分组名称',
is_default char(1) default '0' comment '是否默认分组',
group_color varchar(16) default null comment '分组颜色',
sort_order int default 0 comment '排序',
remark varchar(500) default null comment '备注',
create_by varchar(64) default '' comment '创建者',
create_time datetime default null comment '创建时间',
update_by varchar(64) default '' comment '更新者',
update_time datetime default null comment '更新时间',
primary key (group_id),
unique key uk_profile_group_user_name (user_id, group_name)
) engine=InnoDB comment='浏览器环境分组表';
set @add_group_id_column_sql = (
select if (
exists (
select 1
from information_schema.columns
where table_schema = database()
and table_name = 'fp_profile'
and column_name = 'group_id'
),
'select 1',
'alter table fp_profile add column group_id bigint default null comment ''分组ID'' after profile_name'
)
);
prepare stmt_add_group_id_column from @add_group_id_column_sql;
execute stmt_add_group_id_column;
deallocate prepare stmt_add_group_id_column;
insert into sys_menu
select '3210', '会员管理', '3000', '10', 'member', 'browser/member/index', '', 1, 0, 'C', '0', '0', 'browser:member:list', 'user', 'admin', sysdate(), '', null, '浏览器会员菜单'
where not exists (select 1 from sys_menu where menu_id = '3210');
insert into sys_menu
select '3211', '会员查询', '3210', '1', '#', '', '', 1, 0, 'F', '0', '0', 'browser:member:query', '#', 'admin', sysdate(), '', null, ''
where not exists (select 1 from sys_menu where menu_id = '3211');
insert into sys_menu
select '3212', '会员新增', '3210', '2', '#', '', '', 1, 0, 'F', '0', '0', 'browser:member:add', '#', 'admin', sysdate(), '', null, ''
where not exists (select 1 from sys_menu where menu_id = '3212');
insert into sys_menu
select '3213', '会员修改', '3210', '3', '#', '', '', 1, 0, 'F', '0', '0', 'browser:member:edit', '#', 'admin', sysdate(), '', null, ''
where not exists (select 1 from sys_menu where menu_id = '3213');
insert into sys_menu
select '3214', '会员删除', '3210', '4', '#', '', '', 1, 0, 'F', '0', '0', 'browser:member:remove', '#', 'admin', sysdate(), '', null, ''
where not exists (select 1 from sys_menu where menu_id = '3214');
insert into sys_menu
select '3215', '会员状态修改', '3210', '5', '#', '', '', 1, 0, 'F', '0', '0', 'browser:member:edit', '#', 'admin', sysdate(), '', null, ''
where not exists (select 1 from sys_menu where menu_id = '3215');