account.sql 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. CREATE DATABASE `saas_account` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
  2. use `saas_account`;
  3. create table `ac_company` (
  4. id int unsigned primary key not null auto_increment,
  5. name varchar(500) not null comment '名称',
  6. business_code varchar(100) comment '商业登记证号',
  7. address varchar(500) comment '注册地址',
  8. logo_url varchar(500) comment 'Logo',
  9. creator_id int unsigned,
  10. create_time datetime,
  11. updater_id int unsigned,
  12. update_time datetime
  13. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='公司';
  14. create table `ac_account` (
  15. id int unsigned primary key not null auto_increment,
  16. username varchar(100) not null comment '账号',
  17. password varchar(100) not null comment '加密密码',
  18. salt varchar(100) not null comment '加密盐值',
  19. realname varchar(100) comment '真实姓名',
  20. email varchar(100) comment '邮箱',
  21. mobile varchar(100) not null comment '手机号',
  22. type int comment '账户类型 0, 1',
  23. creator_id int unsigned,
  24. create_time datetime,
  25. updater_id int unsigned,
  26. update_time datetime
  27. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='个人账户';
  28. create table `ac_account_company` (
  29. company_id int unsigned,
  30. account_id int unsigned
  31. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='账户绑定企业';
  32. create table `ac_role` (
  33. id int unsigned primary key not null auto_increment,
  34. code varchar(100) not null comment '编号',
  35. name varchar(300) not null comment '名称',
  36. description varchar(1000) comment '描述',
  37. company_id int unsigned,
  38. creator_id int unsigned,
  39. create_time datetime,
  40. updater_id int unsigned,
  41. update_time datetime
  42. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='角色';
  43. create table `ac_account_role` (
  44. account_id int unsigned,
  45. role_id int unsigned
  46. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='账户绑定角色';
  47. create table `ac_resource` (
  48. id int unsigned primary key not null auto_increment,
  49. code varchar(100) not null comment '编号',
  50. name varchar(300) not null comment '名称',
  51. description varchar(1000) comment '描述',
  52. type varchar(100) comment '类型 MENU,BUTTON,API',
  53. url varchar(300) comment 'URL',
  54. method varchar(10) comment 'Http Method: POST/GET/PUT/DELETE',
  55. order_num int,
  56. company_id int unsigned,
  57. creator_id int unsigned,
  58. create_time datetime,
  59. updater_id int unsigned,
  60. update_time datetime
  61. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='角色';
  62. create table `ac_role_resource` (
  63. role_id int unsigned,
  64. resource_id int unsigned
  65. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='角色绑定资源';
  66. insert into ac_account(id,username,password,salt,realname,email,mobile,type,
  67. creator_id,create_time,updater_id,update_time)
  68. values (1,'18888888888','3e8451e274a8ee847872194e584a4145','18888888888','Administrator',
  69. 'admin@usoftchina.com', '18888888888', 0, 1, now(), 1, now());
  70. insert into ac_company(name, business_code, address, logo_url, creator_id, create_time, updater_id, update_time)
  71. values ('测试账套', '000000000000000000','深圳市南山区粤海街道高新技术产业园科技南五路英唐大厦六楼',
  72. 'https://co-image.qichacha.com/CompanyImage/104eb3c232bbac93393a5e204d6a47d1.jpg?x-oss-process=style/qcc_cmp',
  73. 1, now(), 1, now());