install.sql 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. -- ----------------------------
  2. -- Table structure for oa_contract_cate
  3. -- ----------------------------
  4. DROP TABLE IF EXISTS `oa_contract_cate`;
  5. CREATE TABLE `oa_contract_cate` (
  6. `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
  7. `title` varchar(100) NOT NULL DEFAULT '' COMMENT '合同类别名称',
  8. `status` tinyint(1) NOT NULL DEFAULT 1 COMMENT '状态:-1删除 0禁用 1启用',
  9. `create_time` int(11) NOT NULL DEFAULT 0 COMMENT '创建时间',
  10. `update_time` int(11) NOT NULL DEFAULT 0 COMMENT '更新时间',
  11. PRIMARY KEY (`id`) USING BTREE
  12. ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COMMENT = '合同类别';
  13. -- ----------------------------
  14. -- Records of oa_contract_cate
  15. -- ----------------------------
  16. INSERT INTO `oa_contract_cate` VALUES (1, '销售合同', 1, 1637987189, 0);
  17. INSERT INTO `oa_contract_cate` VALUES (2, '采购合同', 1, 1637987199, 0);
  18. INSERT INTO `oa_contract_cate` VALUES (3, '租赁合同', 1, 1637987199, 0);
  19. INSERT INTO `oa_contract_cate` VALUES (4, '委托协议', 1, 1637987199, 0);
  20. INSERT INTO `oa_contract_cate` VALUES (5, '代理协议', 1, 1637987199, 0);
  21. INSERT INTO `oa_contract_cate` VALUES (6, '其他合同', 1, 1637987199, 0);
  22. -- ----------------------------
  23. -- Table structure for oa_contract
  24. -- ----------------------------
  25. DROP TABLE IF EXISTS `oa_contract`;
  26. CREATE TABLE `oa_contract` (
  27. `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
  28. `pid` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '父协议id',
  29. `code` varchar(255) NOT NULL DEFAULT '' COMMENT '合同编号',
  30. `name` varchar(255) NOT NULL DEFAULT '' COMMENT '合同名称',
  31. `cate_id` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '分类id',
  32. `type` tinyint(1) NOT NULL DEFAULT 0 COMMENT '合同性质:0未设置,1普通合同、2框架合同、3补充协议、4其他合同',
  33. `subject_id` varchar(255) NOT NULL DEFAULT '' COMMENT '签约主体',
  34. `customer_id` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '关联客户ID,预设数据',
  35. `customer` varchar(255) NOT NULL DEFAULT '' COMMENT '客户名称',
  36. `customer_name` varchar(255) NOT NULL DEFAULT '' COMMENT '客户代表',
  37. `customer_mobile` varchar(255) NOT NULL DEFAULT '' COMMENT '客户电话',
  38. `customer_address` varchar(255) NOT NULL DEFAULT '' COMMENT '客户地址',
  39. `start_time` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '合同开始时间',
  40. `end_time` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '合同结束时间',
  41. `admin_id` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '创建人',
  42. `prepared_uid` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '合同制定人',
  43. `sign_uid` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '合同签订人',
  44. `keeper_uid` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '合同保管人',
  45. `share_ids` varchar(500) NOT NULL DEFAULT '' COMMENT '共享人员,如:1,2,3',
  46. `sign_time` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '合同签订时间',
  47. `sign_did` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '合同签订部门',
  48. `cost` decimal(15, 2) NOT NULL DEFAULT 0.00 COMMENT '合同金额',
  49. `is_tax` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否含税:0未含税,1含税',
  50. `tax` decimal(15, 2) NOT NULL DEFAULT 0.00 COMMENT '税点',
  51. `check_status` tinyint(1) NOT NULL DEFAULT 0 COMMENT '合同状态:0待审核,1审核中,2审核通过,3审核不通过,4撤销审核,5已中止,6已作废',
  52. `check_step_sort` int(11) NOT NULL DEFAULT 0 COMMENT '当前审批步骤',
  53. `check_admin_ids` varchar(500) NOT NULL DEFAULT '' COMMENT '当前审批人ID,如:1,2,3',
  54. `flow_admin_ids` varchar(500) NOT NULL DEFAULT '' COMMENT '历史审批人ID,如:1,2,3',
  55. `last_admin_id` varchar(200) NOT NULL DEFAULT '0' COMMENT '上一审批人',
  56. `copy_uids` varchar(500) NOT NULL DEFAULT '' COMMENT '抄送人ID,如:1,2,3',
  57. `check_uid` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '审核人',
  58. `check_time` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '审核时间',
  59. `check_remark` text NULL COMMENT '审核备注信息',
  60. `stop_uid` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '中止人',
  61. `stop_time` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '中止时间',
  62. `stop_remark` text NULL COMMENT '中止备注信息',
  63. `void_uid` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '作废人',
  64. `void_time` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '作废时间',
  65. `void_remark` text NULL COMMENT '作废备注信息',
  66. `archive_status` tinyint(1) NOT NULL DEFAULT 0 COMMENT '归档状态:0未归档,1已归档',
  67. `archive_uid` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '归档人',
  68. `archive_time` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '归档时间',
  69. `remark` text NULL COMMENT '备注信息',
  70. `create_time` int(11) NOT NULL DEFAULT 0 COMMENT '添加时间',
  71. `update_time` int(11) NOT NULL DEFAULT 0 COMMENT '修改时间',
  72. `delete_time` int(11) NOT NULL DEFAULT 0 COMMENT '删除时间',
  73. PRIMARY KEY (`id`) USING BTREE
  74. ) ENGINE = InnoDB AUTO_INCREMENT = 1000 CHARACTER SET = utf8mb4 COMMENT = '合同表';
  75. -- ----------------------------
  76. -- Table structure for oa_contract_file
  77. -- ----------------------------
  78. DROP TABLE IF EXISTS `oa_contract_file`;
  79. CREATE TABLE `oa_contract_file` (
  80. `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
  81. `contract_id` int(11) UNSIGNED NOT NULL COMMENT '关联合同id',
  82. `file_id` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '相关联附件id',
  83. `admin_id` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '创建人',
  84. `create_time` int(11) NOT NULL DEFAULT 0 COMMENT '创建时间',
  85. `update_time` int(11) NOT NULL DEFAULT 0 COMMENT '修改时间',
  86. `delete_time` int(11) NOT NULL DEFAULT 0 COMMENT '删除时间',
  87. PRIMARY KEY (`id`) USING BTREE
  88. ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COMMENT = '合同附件关联表';
  89. -- ----------------------------
  90. -- Table structure for oa_contract_log
  91. -- ----------------------------
  92. DROP TABLE IF EXISTS `oa_contract_log`;
  93. CREATE TABLE `oa_contract_log` (
  94. `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
  95. `action` varchar(100) NOT NULL DEFAULT 'edit' COMMENT '动作:add,edit,del,check,upload',
  96. `field` varchar(100) NOT NULL DEFAULT '' COMMENT '字段',
  97. `contract_id` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '关联合同id',
  98. `admin_id` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '操作人',
  99. `old_content` text NULL COMMENT '修改前的内容',
  100. `new_content` text NULL COMMENT '修改后的内容',
  101. `remark` text NULL COMMENT '补充备注',
  102. `create_time` int(11) NOT NULL DEFAULT 0 COMMENT '创建时间',
  103. PRIMARY KEY (`id`) USING BTREE
  104. ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COMMENT = '合同操作记录表';
  105. INSERT INTO `oa_data_auth` VALUES ((SELECT MAX(id) +1 FROM `oa_data_auth` a), '合同管理员','contract_admin','拥有该权限的员工可以查看、编辑、作废、中止所有合同。', 'contract', '',1,1,0,'','','',1656143065, 0);