-- 员工表
drop table if exists tb_employee;
create table tb_employee(
  emp_id int(11) comment '员工Id' primary key auto_increment,
  emp_name varchar(55) comment '员工姓名',
  emp_pw varchar(55) comment '员工密码',
  emp_tel varchar(20) comment '员工手机号',
  emp_id_card varchar(20) comment '员工身份证号',
  emp_age int(11) comment '员工年龄',
  emp_gender int(11) comment '员工性别:1-男 2-女',
  emp_address varchar(20) comment '员工住址',
  emp_position varchar(10) comment '员工职位',
  emp_sal decimal(10,2) comment '员工薪资'
)ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci COMMENT='员工表';
insert into tb_employee (emp_name, emp_pw, emp_tel, emp_id_card, emp_age, emp_gender, emp_address, emp_position, emp_sal) values ('李四','lisi','13320560246','320145199702059783',26,1,'北京市大兴区XXX路XX号','普通员工',5000);
select emp_id, emp_name, emp_pw, emp_tel, emp_id_card, emp_age, emp_gender, emp_address, emp_position, emp_sal from tb_employee;

-- 领导表
drop table if exists tb_manager;
create table tb_manager(
  manager_id int(11) comment '领导Id' primary key auto_increment,
  manager_pw varchar(20) comment '领导密码',
  emp_id int(11) comment '员工',
  role_level varchar(10) comment '权限'
)ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci COMMENT='领导表';
insert into tb_manager (manager_id, manager_pw, emp_id, role_level) values ();
select manager_id, manager_pw, emp_id, role_level from tb_manager;



-- 会员表
drop table if exists tb_vip;
create table tb_vip(
  vip_id int(11) comment '会员编号' primary key auto_increment,
  vip_name varchar(20) comment '会员姓名',
  vip_age int(2) comment '会员年龄',
  vip_gender int(11) comment '员工性别:1-男 2-女',
  vip_tel long comment '会员联系方式',
  vip_grade varchar(1) comment '会员等级',
  reg_date datetime comment '注册日期'
)ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci COMMENT='会员表';
insert into tb_vip (vip_name, vip_age, vip_gender, vip_tel, vip_grade, reg_date) values ('张三',20,1,'17373105689',3,'2020-1-1 10:00');
select vip_id, vip_name, vip_age, vip_gender, vip_tel, vip_grade, reg_date from tb_vip;

-- 客户表
drop table if exists tb_customer;
create table tb_customer(
  customer_id int(11) comment '客户编号' primary key auto_increment,
  customer_name varchar(20) comment '客户姓名',
  customer_age varchar(20) comment '客户年龄',
  customer_gender int(11) comment '客户性别:1-男 2-女',
  customer_address varchar(20) comment '客户住址',
  customer_tel varchar(20) comment '客户联系方式'
)ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci COMMENT='客户表';
insert into tb_customer (customer_name, customer_age, customer_gender, customer_address, customer_tel) values ('张三',20,1,'北京市大兴区XXX路XX号','17373105689');
select customer_id, customer_name, customer_age, customer_gender, customer_address, customer_tel from tb_customer;


-- 商品表
drop table if exists tb_merch;
create table tb_merch(
  merch_id int(11) comment '商品编号' primary key auto_increment,
  merch_name varchar(20) comment '商品名称',
  merch_type varchar(10) comment '商品类型',
  merch_price decimal(4,2) comment '价格',
  bar_code varchar(20) comment '条形码',
  sales_pro_price decimal(4,2) comment '促销价',
  factory_id varchar(10) comment '厂商编号',
  provide_id varchar(10) comment '供货商编号',
  merch_dead_time datetime comment '过期日期',
  merch_num int(4) comment '库存数量',
  merch_sta int(10) default 2 comment '商品状态:1-未上架 2-上架 3-下架'
)ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci COMMENT='商品表';
insert into tb_merch (merch_name, merch_type, merch_price, bar_code, sales_pro_price, factory_id, provide_id, merch_dead_time, merch_num)
values ('青芒','生鲜水果',30,'asfdghj',20,'001','0011','2023-11-30',500);
select merch_id, merch_name, merch_type, merch_price, bar_code, sales_pro_price, factory_id, provide_id, merch_dead_time, merch_num, merch_sta from tb_merch;

-- 进货表
drop table if exists tb_import;
create table tb_import(
  list_id int(11) comment '表单编号' primary key auto_increment,
  merch_id int(11) comment '商品编号',
  merch_name varchar(20) comment '商品名称',
  merch_type varchar(10) comment '商品类型',
  merch_price decimal(4,2) comment '价格',
  plan_num int(4) comment '计划进货数',
  import_date date comment '进货日期',
  provide_id varchar(10) comment '供货商编号'
)ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci COMMENT='进货表';
