account.sql 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  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_company_app` (
  15. company_id int unsigned not null,
  16. app_id varchar(100) not null,
  17. primary key(company_id, app_id)
  18. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='公司绑定应用';
  19. create table `ac_account` (
  20. id int unsigned primary key not null auto_increment,
  21. username varchar(100) not null comment '账号',
  22. password varchar(100) not null comment '加密密码',
  23. salt varchar(100) not null comment '加密盐值',
  24. realname varchar(100) comment '真实姓名',
  25. email varchar(100) comment '邮箱',
  26. mobile varchar(100) not null comment '手机号',
  27. type int comment '账户类型 0 - 管理账户, 1 - 普通账户',
  28. enabled bool comment '是否启用',
  29. creator_id int unsigned,
  30. create_time datetime,
  31. updater_id int unsigned,
  32. update_time datetime
  33. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='个人账户';
  34. create table `ac_account_company` (
  35. company_id int unsigned,
  36. account_id int unsigned,
  37. primary key(company_id, account_id)
  38. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='账户绑定企业';
  39. create table `ac_role` (
  40. id int unsigned primary key not null auto_increment,
  41. code varchar(100) not null comment '编号',
  42. name varchar(300) not null comment '名称',
  43. description varchar(1000) comment '描述',
  44. type int comment '角色类型 0 - 管理角色, 1 - 普通角色',
  45. company_id int unsigned,
  46. creator_id int unsigned,
  47. create_time datetime,
  48. updater_id int unsigned,
  49. update_time datetime
  50. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='角色';
  51. create table `ac_account_role` (
  52. company_id int unsigned,
  53. account_id int unsigned,
  54. role_id int unsigned,
  55. primary key(account_id, role_id)
  56. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='账户绑定角色';
  57. create table `ac_resource_module` (
  58. id int unsigned primary key not null auto_increment,
  59. app_id varchar(100) comment '应用',
  60. name varchar(100) comment '名称'
  61. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='资源模块';
  62. create table `ac_resource_group` (
  63. id int unsigned primary key not null auto_increment,
  64. app_id varchar(100) comment '应用',
  65. module_id int unsigned not null,
  66. name varchar(100) comment '名称'
  67. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='资源分组';
  68. create table `ac_resource` (
  69. id int unsigned primary key not null auto_increment,
  70. app_id varchar(100) comment '应用',
  71. group_id int unsigned not null,
  72. name varchar(1000) comment '名称',
  73. type varchar(100) comment '类型 MENU,BUTTON,API',
  74. url varchar(300) comment 'URL',
  75. method varchar(10) comment 'Http Method: POST/GET/PUT/DELETE',
  76. classify varchar(30) comment '分组'
  77. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='资源';
  78. create table `ac_role_resource` (
  79. app_id varchar(100) comment '应用',
  80. company_id int unsigned,
  81. role_id int unsigned,
  82. resource_id int unsigned,
  83. primary key(role_id, resource_id)
  84. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='角色绑定资源';
  85. # 账号
  86. insert into ac_account(id,username,password,salt,realname,email,mobile,type,enabled,
  87. creator_id,create_time,updater_id,update_time)
  88. values (1,'18888888888','3e8451e274a8ee847872194e584a4145','18888888888','Administrator',
  89. 'admin@usoftchina.com', '18888888888', 0, 1, 1, now(), 1, now());
  90. # 公司
  91. insert into ac_company(id, name, business_code, address, logo_url, creator_id, create_time, updater_id, update_time)
  92. values (1, '测试账套', '000000000000000000','深圳市南山区粤海街道高新技术产业园科技南五路英唐大厦六楼',
  93. 'https://co-image.qichacha.com/CompanyImage/104eb3c232bbac93393a5e204d6a47d1.jpg?x-oss-process=style/qcc_cmp',
  94. 1, now(), 1, now());
  95. insert into ac_company_app(company_id, app_id) values (1, 'trade-app');
  96. insert into ac_account_company(account_id, company_id) values (1, 1);
  97. # 角色
  98. insert into ac_role(id,code,name,description,type,company_id,creator_id,create_time,updater_id,update_time)
  99. values (1, 'ROLE_ADMIN', '管理员', '公司管理人员,拥有所有权限', 0, 1, 1, now(), 1, now());
  100. insert into ac_role(id,code,name,description,type,company_id,creator_id,create_time,updater_id,update_time)
  101. values (2, 'ROLE_NORMAL', '普通用户', '公司普通用户', 0, 1, 1, now(), 1, now());
  102. insert into ac_account_role(company_id, account_id, role_id) values (1, 1, 1);
  103. # 资源模块
  104. insert into ac_resource_module(id, app_id, name) values (1, 'trade-app', '采购');
  105. insert into ac_resource_module(id, app_id, name) values (2, 'trade-app', '销售');
  106. insert into ac_resource_module(id, app_id, name) values (3, 'trade-app', '库存');
  107. insert into ac_resource_module(id, app_id, name) values (4, 'trade-app', '资金');
  108. insert into ac_resource_module(id, app_id, name) values (5, 'trade-app', '资料');
  109. # 资源组
  110. insert into ac_resource_group(id, app_id, module_id, name) values (1, 'trade-app', 1, '采购单');
  111. insert into ac_resource_group(id, app_id, module_id, name) values (2, 'trade-app', 1, '采购验收单');
  112. insert into ac_resource_group(id, app_id, module_id, name) values (3, 'trade-app', 1, '采购验退单');
  113. insert into ac_resource_group(id, app_id, module_id, name) values (4, 'trade-app', 1, '采购询价单');
  114. insert into ac_resource_group(id, app_id, module_id, name) values (5, 'trade-app', 1, '采购明细表');
  115. insert into ac_resource_group(id, app_id, module_id, name) values (6, 'trade-app', 1, '采购付款一览表');
  116. insert into ac_resource_group(id, app_id, module_id, name) values (7, 'trade-app', 2, '销售订单');
  117. insert into ac_resource_group(id, app_id, module_id, name) values (8, 'trade-app', 2, '销售出货单');
  118. insert into ac_resource_group(id, app_id, module_id, name) values (9, 'trade-app', 2, '销售退货单');
  119. insert into ac_resource_group(id, app_id, module_id, name) values (10, 'trade-app', 2, '以销定购');
  120. insert into ac_resource_group(id, app_id, module_id, name) values (11, 'trade-app', 2, '销售明细表');
  121. insert into ac_resource_group(id, app_id, module_id, name) values (12, 'trade-app', 2, '销售收款一览表');
  122. insert into ac_resource_group(id, app_id, module_id, name) values (13, 'trade-app', 2, '销售利润表');
  123. insert into ac_resource_group(id, app_id, module_id, name) values (14, 'trade-app', 3, '调拨单');
  124. insert into ac_resource_group(id, app_id, module_id, name) values (15, 'trade-app', 3, '制造单');
  125. insert into ac_resource_group(id, app_id, module_id, name) values (16, 'trade-app', 3, '其它入库单');
  126. insert into ac_resource_group(id, app_id, module_id, name) values (17, 'trade-app', 3, '其它出库单');
  127. insert into ac_resource_group(id, app_id, module_id, name) values (18, 'trade-app', 3, '盘点单');
  128. insert into ac_resource_group(id, app_id, module_id, name) values (19, 'trade-app', 3, '物料出入库明细表');
  129. insert into ac_resource_group(id, app_id, module_id, name) values (20, 'trade-app', 3, '物料收发汇总表');
  130. insert into ac_resource_group(id, app_id, module_id, name) values (21, 'trade-app', 3, '物料库存数量金额表');
  131. insert into ac_resource_group(id, app_id, module_id, name) values (22, 'trade-app', 4, '付款单');
  132. insert into ac_resource_group(id, app_id, module_id, name) values (23, 'trade-app', 4, '收款单');
  133. insert into ac_resource_group(id, app_id, module_id, name) values (24, 'trade-app', 4, '核销单');
  134. insert into ac_resource_group(id, app_id, module_id, name) values (25, 'trade-app', 4, '其它收支单');
  135. insert into ac_resource_group(id, app_id, module_id, name) values (26, 'trade-app', 4, '资金转存');
  136. insert into ac_resource_group(id, app_id, module_id, name) values (27, 'trade-app', 4, '供应商对账单');
  137. insert into ac_resource_group(id, app_id, module_id, name) values (28, 'trade-app', 4, '应付账款明细表');
  138. insert into ac_resource_group(id, app_id, module_id, name) values (29, 'trade-app', 4, '客户对账单');
  139. insert into ac_resource_group(id, app_id, module_id, name) values (30, 'trade-app', 4, '应收款明细表');
  140. insert into ac_resource_group(id, app_id, module_id, name) values (31, 'trade-app', 4, '资金账户余额表');
  141. insert into ac_resource_group(id, app_id, module_id, name) values (32, 'trade-app', 5, '客户资料');
  142. insert into ac_resource_group(id, app_id, module_id, name) values (33, 'trade-app', 5, '供应商管理');
  143. insert into ac_resource_group(id, app_id, module_id, name) values (34, 'trade-app', 5, '商品管理');
  144. insert into ac_resource_group(id, app_id, module_id, name) values (35, 'trade-app', 5, '仓库管理');
  145. insert into ac_resource_group(id, app_id, module_id, name) values (36, 'trade-app', 5, '职员管理');
  146. insert into ac_resource_group(id, app_id, module_id, name) values (37, 'trade-app', 5, '账户管理');
  147. insert into ac_resource_group(id, app_id, module_id, name) values (38, 'trade-app', 5, '发货地址管理');
  148. insert into ac_resource_group(id, app_id, module_id, name) values (39, 'trade-app', 5, '客户类别');
  149. insert into ac_resource_group(id, app_id, module_id, name) values (40, 'trade-app', 5, '供应商类别');
  150. insert into ac_resource_group(id, app_id, module_id, name) values (41, 'trade-app', 5, '商品类别');
  151. insert into ac_resource_group(id, app_id, module_id, name) values (42, 'trade-app', 5, '支出类别');
  152. insert into ac_resource_group(id, app_id, module_id, name) values (43, 'trade-app', 5, '收入类别');
  153. insert into ac_resource_group(id, app_id, module_id, name) values (44, 'trade-app', 5, '物料品牌');
  154. insert into ac_resource_group(id, app_id, module_id, name) values (45, 'trade-app', 5, '计量单位');
  155. insert into ac_resource_group(id, app_id, module_id, name) values (46, 'trade-app', 5, '结算方式');
  156. insert into ac_resource_group(id, app_id, module_id, name) values (47, 'trade-app', 5, '辅助属性');
  157. insert into ac_resource_group(id, app_id, module_id, name) values (48, 'trade-app', 5, '客户物料编码');
  158. insert into ac_resource_group(id, app_id, module_id, name) values (49, 'trade-app', 5, '单据编码规则');
  159. # 资源
  160. insert into ac_resource(id, app_id, name, group_id, type, url, method, classify) values
  161. (1,'trade-app', '查询',1,'MENU','/api/purchase/purchase/list','GET','QUERY');
  162. insert into ac_resource(id, app_id, name, group_id, type, url, method, classify) values
  163. (2,'trade-app', '新增',1,'MENU','/api/purchase/purchase/save','POST','ADD');
  164. insert into ac_resource(id, app_id, name, group_id, type, url, method, classify) values
  165. (3,'trade-app', '修改',1,'BUTTON','/api/purchase/purchase/save','POST','UPDATE');
  166. insert into ac_resource(id, app_id, name, group_id, type, url, method, classify) values
  167. (4,'trade-app', '审核',1,'BUTTON','/api/purchase/purchase/audit','POST','AUDIT');
  168. insert into ac_resource(id, app_id, name, group_id, type, url, method, classify) values
  169. (5,'trade-app', '审核',1,'BUTTON','/api/purchase/purchase/batchAudit','POST','AUDIT');
  170. insert into ac_resource(id, app_id, name, group_id, type, url, method, classify) values
  171. (6,'trade-app', '反审核',1,'BUTTON','/api/purchase/purchase/unAudit','POST','UNAUDIT');
  172. insert into ac_resource(id, app_id, name, group_id, type, url, method, classify) values
  173. (7,'trade-app', '反审核',1,'BUTTON','/api/purchase/purchase/batchUnAudit','POST','UNAUDIT');
  174. insert into ac_resource(id, app_id, name, group_id, type, url, method, classify) values
  175. (8,'trade-app', '删除',1,'BUTTON','/api/purchase/purchase/delete','GET','DELETE');
  176. insert into ac_resource(id, app_id, name, group_id, type, url, method, classify) values
  177. (9,'trade-app', '打印',1,'BUTTON','/api/purchase/purchase/print','GET','PRINT');