V1.0.sql 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310
  1. CREATE TABLE `privatedomain`.`user` (
  2. `id` bigint(20) NOT NULL AUTO_INCREMENT,
  3. `open_id` varchar(32) NOT NULL COMMENT '微信openid',
  4. `phone` varchar(16) NOT NULL COMMENT '手机号',
  5. `nick_name` varchar(32) NOT NULL COMMENT '昵称',
  6. `create_time` timestamp(0) NULL COMMENT '创建时间',
  7. `login_time` timestamp(0) NULL COMMENT '最近登录时间',
  8. PRIMARY KEY (`id`)
  9. ) ENGINE = InnoDB AUTO_INCREMENT = 10101000 COMMENT = '用户表';
  10. CREATE TABLE `privatedomain`.`agency_info` (
  11. `id` bigint(20) NOT NULL AUTO_INCREMENT,
  12. `user_id` bigint(20) NULL COMMENT '用户id',
  13. `contacts` varchar(124) NULL COMMENT '联系人名称',
  14. `phone` varchar(124) NULL COMMENT '联系电话',
  15. `wx_num` varchar(64) NULL COMMENT '联系人微信',
  16. `video_account` varchar(255) NULL COMMENT '视频号名称',
  17. `video_account_fans` integer(10) NULL COMMENT '视频号粉丝数',
  18. PRIMARY KEY (`id`)
  19. ) ENGINE = InnoDB AUTO_INCREMENT = 10010121 COMMENT = '代言资质需完善的信息表';
  20. CREATE TABLE `privatedomain`.`orders` (
  21. `order_no` bigint(20) NOT NULL AUTO_INCREMENT,
  22. `busi_order_type` varchar(20) NULL COMMENT '业务订单类型(业务方区分不同订单)',
  23. `busi_order_name` varchar(32) NULL COMMENT '业务名字',
  24. `subjects` varchar(64) NULL COMMENT '订单信息,支付标题',
  25. `total_amount` decimal(11, 0) NULL COMMENT '订单金额',
  26. `order_status` tinyint(4) NULL COMMENT '订单状态,OrderStatusEnum',
  27. `pay_status` tinyint(4) NULL COMMENT '支付状态,PayStatusEnum',
  28. `pay_no` varchar(64) NULL COMMENT '支付号',
  29. `create_time` timestamp(0) NULL COMMENT '创建时间',
  30. `update_time` timestamp(0) NULL COMMENT '更新时间',
  31. `user_id` bigint(20) NULL COMMENT '用户id',
  32. `content_id` bigint(20) NULL COMMENT '支付内容id',
  33. `refund_time` datetime(0) NULL COMMENT '退款时间',
  34. PRIMARY KEY (`order_no`),
  35. UNIQUE INDEX `orderNo`(`order_no`) USING BTREE,
  36. UNIQUE INDEX `payNo`(`pay_no`(32)) USING BTREE
  37. ) ENGINE = InnoDB AUTO_INCREMENT = 10210013 COMMENT = '订单表';
  38. CREATE TABLE `privatedomain`.`pay_content` (
  39. `id` bigint(20) NOT NULL,
  40. `sn` varchar(32) NULL COMMENT '类型',
  41. `parent_id` bigint(20) NULL COMMENT '父类id',
  42. `quantity` int(10) NULL COMMENT '数量',
  43. `unit_price` decimal(10, 2) NULL COMMENT '原来的单价',
  44. `total_amount` decimal(10, 0) NULL COMMENT '总价',
  45. `remarks` varchar(32) NULL COMMENT '备注',
  46. `status` tinyint(4) NULL COMMENT '状态:0正常,1:下架',
  47. PRIMARY KEY (`id`)
  48. ) ENGINE = InnoDB AUTO_INCREMENT = 11110111 COMMENT = '系统配置的可以消费的数据表';
  49. CREATE TABLE `privatedomain`.`invite_relationship` (
  50. `id` bigint(20) NOT NULL AUTO_INCREMENT,
  51. `user_id` bigint(20) NULL COMMENT '被邀请人id',
  52. `inviter_id` bigint(20) NULL COMMENT '邀请人id',
  53. PRIMARY KEY (`id`)
  54. ) ENGINE = InnoDB AUTO_INCREMENT = 10704000 COMMENT = '邀请关系表';
  55. CREATE TABLE `privatedomain`.`private_domain` (
  56. `id` bigint(20) NOT NULL AUTO_INCREMENT,
  57. `user_id` bigint(20) NOT NULL,
  58. `type` tinyint(2) NULL COMMENT '类型:0会员,1额外购买',
  59. `background_id` bigint(20) NULL COMMENT '背景id',
  60. `qr_code_id` bigint(20) NULL COMMENT '二维码图片id',
  61. `content` varchar(255) NULL COMMENT '文案',
  62. `wechat_num` varchar(255) NULL COMMENT '微信号',
  63. `auto_change_qr` tinyint(2) NULL COMMENT '自动更换二维码开关',
  64. `create_time` timestamp(0) NULL COMMENT '创建时间',
  65. `update_time` timestamp(0) NULL COMMENT '更新时间',
  66. PRIMARY KEY (`id`)
  67. ) ENGINE = InnoDB AUTO_INCREMENT = 34002100 COMMENT = '用户私域站';
  68. CREATE TABLE `privatedomain`.`background_image` (
  69. `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
  70. `user_id` bigint(20) NULL COMMENT '用户id',
  71. `img_src` varchar(255) NULL COMMENT '图片地址',
  72. `status` varchar(255) NULL COMMENT '状态',
  73. `create_time` timestamp(0) NULL COMMENT '创建时间',
  74. `update_time` timestamp(0) NULL COMMENT '更新时间',
  75. PRIMARY KEY (`id`)
  76. ) ENGINE = InnoDB AUTO_INCREMENT = 23001200 COMMENT = '背景图片';
  77. CREATE TABLE `privatedomain`.`user_qr_code` (
  78. `id` bigint(20) NOT NULL AUTO_INCREMENT,
  79. `user_id` bigint(20) NULL COMMENT '用户id',
  80. `qr_code_src` varchar(255) NULL COMMENT '二维码图片地址',
  81. `auto_change` tinyint(2) NULL COMMENT '自动更换',
  82. PRIMARY KEY (`id`)
  83. ) ENGINE = InnoDB AUTO_INCREMENT = 18300000 COMMENT = '用户微信二维码';
  84. CREATE TABLE `system_config` (
  85. `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
  86. `name` varchar(32) DEFAULT NULL COMMENT '名称',
  87. `value` varchar(256) DEFAULT NULL COMMENT '值',
  88. `des` varchar(128) DEFAULT NULL COMMENT '文字描述',
  89. `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间',
  90. `update_time` timestamp NULL DEFAULT NULL COMMENT '更新时间',
  91. `sn` varchar(20) DEFAULT NULL COMMENT '编码',
  92. PRIMARY KEY (`id`)
  93. ) ENGINE=InnoDB AUTO_INCREMENT=10001037 DEFAULT CHARSET=utf8mb4 COMMENT='系统初始化配置参数';
  94. CREATE TABLE `trade_process_error` (
  95. `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
  96. `order_no` varchar(20) DEFAULT NULL COMMENT '订单号',
  97. `create_time` timestamp NULL DEFAULT NULL COMMENT '异常发生时间',
  98. `error_message` varchar(2500) DEFAULT NULL COMMENT '错误信息',
  99. `status` tinyint(4) DEFAULT NULL COMMENT '处理状态',
  100. PRIMARY KEY (`id`)
  101. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  102. CREATE TABLE `privatedomain`.`user_account` (
  103. `id` bigint(20) NOT NULL AUTO_INCREMENT,
  104. `user_id` bigint(20) NULL COMMENT '用户id',
  105. `balance` double(10, 0) NULL COMMENT '余额',
  106. `withdrawal_amount` varchar(255) NULL COMMENT '总提现金额',
  107. PRIMARY KEY (`id`)
  108. ) ENGINE = InnoDB AUTO_INCREMENT = 11230000 COMMENT = '用户钱包';
  109. CREATE TABLE `privatedomain`.`user_account_detail` (
  110. `id` bigint(20) NOT NULL AUTO_INCREMENT,
  111. `user_id` bigint(20) NULL COMMENT '用户id',
  112. `type` tinyint(2) NULL COMMENT '类型:0代言收益,1徒弟收益,2:提现',
  113. `before_balance` double(10, 0) NULL COMMENT '交易钱余额',
  114. `trade_balance` double(10, 0) NULL COMMENT '交易金额',
  115. `after_balance` double(10, 0) NULL COMMENT '交易后金额',
  116. `order_no` bigint(20) NULL COMMENT '订单号',
  117. `disciple_id` bigint(20) NULL COMMENT '徒弟的id',
  118. `create_time` timestamp(0) NULL COMMENT '创建时间',
  119. PRIMARY KEY (`id`)
  120. ) ENGINE = InnoDB AUTO_INCREMENT = 12243400 COMMENT = '用户钱包明细';
  121. CREATE TABLE `admin_permission` (
  122. `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  123. `user_id` int(10) unsigned NOT NULL COMMENT '用户ID',
  124. `role_id` int(10) unsigned NOT NULL COMMENT '角色ID',
  125. `create_uid` int(10) unsigned NOT NULL COMMENT '生成此权限的用户ID',
  126. `module_name` varchar(32) DEFAULT '' COMMENT '模块名称PModule.pname',
  127. `privilege` varchar(64) DEFAULT '' COMMENT '权限信息',
  128. `plateform` varchar(16) NOT NULL DEFAULT '' COMMENT '子系统标识',
  129. `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  130. PRIMARY KEY (`id`),
  131. KEY `apermission_userid_idx` (`user_id`) USING BTREE
  132. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='用户权限明细';
  133. CREATE TABLE `admin_role` (
  134. `role_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  135. `role_name` varchar(32) NOT NULL COMMENT '角色名称',
  136. `role_desc` varchar(255) NOT NULL COMMENT '角色描述',
  137. `create_uid` int(10) unsigned NOT NULL COMMENT '创建用户的id',
  138. `enabled` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '是否可用',
  139. `plateform` varchar(8) NOT NULL DEFAULT '' COMMENT '子系统标识',
  140. `create_time` datetime DEFAULT NULL,
  141. PRIMARY KEY (`role_id`)
  142. ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  143. CREATE TABLE `admin_user` (
  144. `id` int(20) unsigned NOT NULL AUTO_INCREMENT,
  145. `account` varchar(32) NOT NULL DEFAULT '' COMMENT '帐号',
  146. `password` varchar(64) NOT NULL DEFAULT '',
  147. `nameCn` varchar(16) NOT NULL DEFAULT '' COMMENT '中文名',
  148. `nameEn` varchar(16) NOT NULL DEFAULT '' COMMENT '英文名',
  149. `lockFlag` tinyint(1) NOT NULL DEFAULT '0' COMMENT '锁定标识',
  150. `delFlag` tinyint(1) NOT NULL DEFAULT '0' COMMENT '删除标识',
  151. `genUid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建人',
  152. `createTime` datetime DEFAULT NULL COMMENT '创建时间',
  153. PRIMARY KEY (`id`),
  154. UNIQUE KEY `admin_user_acc_idx` (`account`)
  155. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='运营后台用户表';
  156. CREATE TABLE `statistical` (
  157. `id` bigint(20) NOT NULL AUTO_INCREMENT,
  158. `yesterday_register_num` int(10) DEFAULT '0' COMMENT '昨日注册人数',
  159. `yesterday_vip_num` int(10) DEFAULT '0' COMMENT '昨日会员人数',
  160. `yesterday_agency_num` int(10) DEFAULT '0' NULL COMMENT '昨日代言人数',
  161. PRIMARY KEY (`id`)
  162. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
  163. CREATE TABLE `privatedomain`.`video_tutorial` (
  164. `id` bigint(20) NOT NULL AUTO_INCREMENT,
  165. `des` varchar(255) NULL COMMENT '描述',
  166. `video_bg_pic_src` varchar(255) NULL COMMENT '视频封面图片',
  167. `video_src` varchar(255) NULL COMMENT '视频地址',
  168. `official_assistant_id` bigint(20) NULL COMMENT '官方小助手id',
  169. `create_time` timestamp(0) NULL COMMENT '创建时间',
  170. `release_time` timestamp(0) NULL COMMENT '发布时间',
  171. PRIMARY KEY (`id`)
  172. ) ENGINE = InnoDB AUTO_INCREMENT = 34006300 COMMENT = '视频教程表';
  173. CREATE TABLE `privatedomain`.`official_assistant` (
  174. `id` bigint(0) NOT NULL AUTO_INCREMENT,
  175. `nick_name` varchar(255) NULL COMMENT '昵称',
  176. `head_img` varchar(255) NULL COMMENT '头像',
  177. PRIMARY KEY (`id`)
  178. ) ENGINE = InnoDB AUTO_INCREMENT = 21001100 COMMENT = '官方小助手';
  179. CREATE TABLE `user_account_with_draw_detail` (
  180. `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
  181. `user_id` bigint(20) DEFAULT NULL COMMENT '用户id',
  182. `partner_trade_no` varchar(32) DEFAULT NULL COMMENT '微信商户订单号',
  183. `payment_no` varchar(64) DEFAULT NULL COMMENT '微信付款单号',
  184. `pay_fund_order_id` varchar(64) DEFAULT NULL COMMENT '支付资金流水号',
  185. `with_draw_amount` double(20,2) DEFAULT NULL COMMENT '提现金额',
  186. `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间',
  187. `status` tinyint(2) DEFAULT NULL COMMENT '状态',
  188. `verify_user_id` bigint(20) DEFAULT NULL COMMENT '审核人id',
  189. `verify_date` timestamp NULL DEFAULT NULL COMMENT '审核时间',
  190. `remark` varchar(256) DEFAULT NULL COMMENT '备注信息',
  191. `transfer_shortcut_url` varchar(300) DEFAULT NULL COMMENT '转账图片',
  192. PRIMARY KEY (`id`)
  193. ) ENGINE=InnoDB AUTO_INCREMENT=10085299 DEFAULT CHARSET=utf8mb4 COMMENT='用户账户提现详情表\n';
  194. CREATE TABLE `with_draw_verify_log` (
  195. `id` bigint(20) NOT NULL AUTO_INCREMENT,
  196. `order_id` bigint(20) DEFAULT NULL COMMENT '订单id',
  197. `operating_time` timestamp NULL DEFAULT NULL COMMENT '操作时间',
  198. `des` varchar(120) DEFAULT NULL COMMENT '状态说明',
  199. PRIMARY KEY (`id`)
  200. ) ENGINE=InnoDB AUTO_INCREMENT=11201400 DEFAULT CHARSET=utf8mb4 COMMENT='提现审核日志';
  201. -- v1.1.0
  202. CREATE TABLE `privatedomain`.`department` (
  203. `id` bigint(20) NOT NULL COMMENT '创建的部门id',
  204. `name` varchar(255) NULL COMMENT '部门名称',
  205. `parentid` bigint(20) NULL COMMENT '父部门id。根部门为1',
  206. `order` int(20) NULL COMMENT '在父部门中的次序值',
  207. PRIMARY KEY (`id`)
  208. ) COMMENT = '企业微信部门表';
  209. CREATE TABLE `privatedomain`.`employees` (
  210. `id` bigint(20) NOT NULL AUTO_INCREMENT,
  211. `userid` varchar(64) NOT NULL COMMENT '企业微信用户id',
  212. `name` varchar(64) NULL COMMENT '成员名称',
  213. `mobile` varchar(64) NULL COMMENT '手机号码',
  214. `order` int(10) NULL COMMENT '部门内的排序值,默认为0',
  215. `position` varchar(128) NULL COMMENT '职务信息',
  216. `gender` tinyint(3) NULL COMMENT '0表示未定义,1表示男性,2表示女性',
  217. `email` varchar(128) NULL COMMENT '邮箱',
  218. `avatar` varchar(128) NULL COMMENT '头像url',
  219. `thumb_avatar` varchar(128) NULL COMMENT '头像缩略图url',
  220. `telephone` varchar(64) NULL COMMENT '座机',
  221. `alias` varchar(64) NULL COMMENT '别名',
  222. `extattr` varchar(128) NULL COMMENT '扩展属性',
  223. `status` tinyint(3) NULL COMMENT '激活状态: 1=已激活,2=已禁用,4=未激活,5=退出企业',
  224. `qr_code` varchar(255) NULL COMMENT '员工个人二维码,扫描可添加为外部联系人',
  225. `open_userid` varchar(64) NULL COMMENT '全局唯一',
  226. `main_department` int(10) NULL COMMENT '主部门\n',
  227. PRIMARY KEY (`id`),
  228. UNIQUE INDEX `employee_user_id_index`(`userid`) COMMENT '企业微信用户id唯一索引'
  229. ) ENGINE = InnoDB AUTO_INCREMENT = 11001100 COMMENT = '部门成员详情';
  230. CREATE TABLE `department_employee` (
  231. `id` bigint(20) NOT NULL AUTO_INCREMENT,
  232. `employee_userid` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '企业微信用户id',
  233. `department_id` bigint(20) NOT NULL COMMENT '部门id',
  234. PRIMARY KEY (`id`)
  235. ) ENGINE=InnoDB AUTO_INCREMENT=51230100 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='企业微信员工与部门关系表';
  236. CREATE TABLE `privatedomain`.`promote_qr_code` (
  237. `id` bigint(20) NOT NULL AUTO_INCREMENT,
  238. `config_id` varchar(64) NULL COMMENT '新增联系方式的配置id',
  239. `qr_code` varchar(255) NULL COMMENT '二维码',
  240. `name` varchar(64) NULL COMMENT '二维码名称',
  241. `group_id` int(0) NULL COMMENT '分组id',
  242. `state_name` varchar(64) NULL COMMENT '渠道名称',
  243. `state_key` varchar(128) NULL COMMENT '渠道key(企业微信state参数传输值)',
  244. PRIMARY KEY (`id`)
  245. )ENGINE = InnoDB AUTO_INCREMENT = 22301100 COMMENT = '推广引流二维码表';
  246. CREATE TABLE `privatedomain`.`tag` (
  247. `id` int(0) NULL AUTO_INCREMENT,
  248. `name` varchar(64) NULL COMMENT '标签名',
  249. `type` tinyint(3) NULL COMMENT '类型:0:引流渠道,1:引流分组',
  250. `create_time` timestamp(0) NULL COMMENT '创建时间',
  251. PRIMARY KEY (`id`)
  252. ) ENGINE = InnoDB AUTO_INCREMENT = 48421100 COMMENT = '标签表';
  253. CREATE TABLE `privatedomain`.`clientele` (
  254. `id` bigint(20) NOT NULL AUTO_INCREMENT,
  255. `external_userid` varchar(64) NOT NULL COMMENT '外部联系人的userid',
  256. `name` varchar(64) NULL COMMENT '外部联系人的名称',
  257. `avatar` varchar(255) NULL COMMENT '外部联系人的头像',
  258. `type` tinyint(3) NULL COMMENT '外部联系人的类型,1表示该外部联系人是微信用户,2表示该外部联系人是企业微信用户',
  259. `gender` tinyint(3) NULL COMMENT '外部联系人性别 0-未知 1-男性 2-女性',
  260. `unionid` varchar(64) NULL COMMENT '外部联系人在微信开放平台的唯一身份标识',
  261. `follow_userid` varchar(64) NULL COMMENT '添加了此外部联系人的企业成员userid',
  262. `state` varchar(32) NULL COMMENT '企业自定义的state参数',
  263. `add_way` tinyint(3) NULL COMMENT '该成员添加此客户的来源,具体含义详见来源定义',
  264. `createtime` timestamp(0) NULL COMMENT '该成员添加此外部联系人的时间',
  265. PRIMARY KEY (`id`)
  266. ) ENGINE = InnoDB AUTO_INCREMENT = 21212100 COMMENT = '客户详情表';
  267. CREATE TABLE `privatedomain`.`promote_qrcode_and_employees` (
  268. `promote_rq_code_id` bigint(20) NOT NULL COMMENT '推广引流二维码id',
  269. `employee_id` bigint(20) NOT NULL COMMENT '员工id',
  270. `create_time` timestamp(0) NULL COMMENT '创建时间',
  271. PRIMARY KEY (`promote_rq_code_id`)
  272. ) COMMENT = '推广引流活码和员工关联表';
  273. CREATE TABLE `privatedomain`.`tag_and_promote_qrcode` (
  274. `id` bigint(20) NOT NULL AUTO_INCREMENT,
  275. `tag_id` bigint(20) NOT NULL COMMENT '标签id',
  276. `promote_qrcode_id` bigint(20) NOT NULL COMMENT '二维码id',
  277. PRIMARY KEY (`id`)
  278. ) ENGINE = InnoDB COMMENT = '标签与企业微信推广活码关联表';