#生产班组表
drop table if exists production_team;
create table production_team
(
    id          bigint auto_increment primary key,
    team_name   varchar(100) not null comment '班组名称',
    remark      text null comment '备注',
    tenant_id   bigint       not null comment '租户id',
    create_time datetime null comment '创建时间',
    update_time datetime null comment '更新时间',
    index       idx_team_name (team_name),
);

#班组台账与用户关联表
drop table if exists production_team_user_rel;
create table production_team_user_rel
(
    id                 bigint auto_increment primary key,
    production_team_id bigint  not null comment '生产班组id',
    sys_user_id        bigint  not null comment '系统用户id',
    is_leader          tinyint not null default 0 comment '是否为班组长 0否 1是',
    tenant_id          bigint  not null comment '租户id',
    create_time        datetime null comment '创建时间',
    update_time        datetime null comment '更新时间',
    index              idx_production_team_id (production_team_id),
    index              idx_sys_user_id (sys_user_id),
    unique idx_production_team_user (production_team_id, sys_user_id)
);
