You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

256 lines
20 KiB
Java

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

SET NAMES utf8mb4;
-- ----------------------------
--
-- ----------------------------
DROP TABLE IF EXISTS `crm_contract`;
CREATE TABLE `crm_contract`
(
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '',
`name` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '',
`customer_id` bigint DEFAULT NULL COMMENT '',
`business_id` bigint DEFAULT NULL COMMENT '',
`process_instance_id` bigint DEFAULT NULL COMMENT '',
`order_date` datetime DEFAULT NULL COMMENT '',
`owner_user_id` bigint DEFAULT NULL COMMENT '',
`no` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '',
`start_time` datetime DEFAULT NULL COMMENT '',
`end_time` datetime DEFAULT NULL COMMENT '',
`price` int DEFAULT NULL COMMENT '',
`discount_percent` int DEFAULT NULL COMMENT '',
`product_price` int DEFAULT NULL COMMENT '',
`ro_user_ids` varchar(4096) DEFAULT NULL COMMENT '',
`rw_user_ids` varchar(4096) DEFAULT NULL COMMENT '',
`contact_id` bigint DEFAULT NULL COMMENT '',
`sign_user_id` bigint DEFAULT NULL COMMENT '',
`contact_last_time` datetime DEFAULT NULL COMMENT '',
--
`remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '',
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '',
`updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '',
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '',
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB
CHARACTER SET = utf8mb4
COLLATE = utf8mb4_unicode_ci COMMENT ='';
DROP TABLE IF EXISTS `crm_clue`;
CREATE TABLE `crm_clue` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '',
`transform_status` tinyint DEFAULT NULL COMMENT '',
`follow_up_status` tinyint DEFAULT NULL COMMENT '',
`name` varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '线',
`customer_id` bigint NOT NULL COMMENT 'id',
`contact_next_time` datetime DEFAULT NULL COMMENT '',
`telephone` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '',
`mobile` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '',
`address` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '',
`owner_user_id` bigint NOT NULL COMMENT '',
`contact_last_time` datetime DEFAULT NULL COMMENT '',
`remark` varchar(500) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '',
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '',
`updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '',
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '',
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB COMMENT = '线' ;
-- ----------------------------
--
-- ----------------------------
DROP TABLE IF EXISTS `crm_business`;
CREATE TABLE `crm_business` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '',
`name` varchar(100) NOT NULL COMMENT '',
`status_type_id` bigint DEFAULT NULL COMMENT '',
`status_id` bigint DEFAULT NULL COMMENT '',
`contact_next_time` datetime DEFAULT NULL COMMENT '',
`customer_id` bigint NOT NULL COMMENT '',
`deal_time` datetime DEFAULT NULL COMMENT '',
`price` decimal(18,2) DEFAULT NULL COMMENT '',
`discount_percent` decimal(10,2) DEFAULT NULL COMMENT '',
`product_price` decimal(18,2) DEFAULT NULL COMMENT '',
`remark` varchar(500) DEFAULT NULL COMMENT '',
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '' COMMENT '',
`updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT '' COMMENT '',
`owner_user_id` bigint DEFAULT NULL COMMENT '',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '',
`update_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '',
`ro_user_ids` longtext NOT NULL COMMENT '',
`rw_user_ids` longtext NOT NULL COMMENT '',
`end_status` int NOT NULL COMMENT '123',
`end_remark` varchar(500) DEFAULT NULL COMMENT '',
`deleted` bit(1) DEFAULT b'0' COMMENT '',
`contact_last_time` datetime DEFAULT NULL COMMENT '',
`follow_up_status` int DEFAULT NULL COMMENT '',
`tenant_id` bigint DEFAULT '0' COMMENT 'ID',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='';
-- ----------------------------
--
-- ----------------------------
DROP TABLE IF EXISTS `crm_receivable`;
CREATE TABLE `crm_receivable` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID',
`no` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '',
`plan_id` bigint(20) NULL DEFAULT NULL COMMENT 'ID',
`customer_id` bigint(20) NULL DEFAULT NULL COMMENT 'ID',
`contract_id` bigint(20) NULL DEFAULT NULL COMMENT 'ID',
`check_status` tinyint(4) NULL DEFAULT NULL COMMENT '',
`process_instance_id` bigint(20) NULL DEFAULT NULL COMMENT '',
`return_time` datetime NULL DEFAULT NULL COMMENT '',
`return_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '',
`price` decimal(10, 2) NULL DEFAULT NULL COMMENT '',
`owner_user_id` bigint(20) NULL DEFAULT NULL COMMENT '',
`batch_id` bigint(20) NULL DEFAULT NULL COMMENT '',
`sort` int(11) NULL DEFAULT NULL COMMENT '',
`data_scope` tinyint(4) NULL DEFAULT 1 COMMENT '1 2 3 4',
`data_scope_dept_ids` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '()',
`status` tinyint(4) NOT NULL COMMENT '0 1',
`remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '',
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '',
`updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '',
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '',
`tenant_id` bigint(20) NOT NULL DEFAULT 0 COMMENT '',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '' ROW_FORMAT = DYNAMIC;
-- ----------------------------
--
-- ----------------------------
DROP TABLE IF EXISTS `crm_receivable_plan`;
CREATE TABLE `crm_receivable_plan` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID',
`index_no` bigint(20) NULL DEFAULT NULL COMMENT '',
`receivable_id` bigint(20) NULL DEFAULT NULL COMMENT 'ID',
`status` tinyint(4) NOT NULL COMMENT '',
`check_status` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '',
`process_instance_id` bigint(20) NULL DEFAULT NULL COMMENT '',
`price` decimal(10, 2) NULL DEFAULT NULL COMMENT '',
`return_time` datetime NULL DEFAULT NULL COMMENT '',
`remind_days` bigint(20) NULL DEFAULT NULL COMMENT '',
`remind_time` datetime NULL DEFAULT NULL COMMENT '',
`customer_id` bigint(20) NULL DEFAULT NULL COMMENT 'ID',
`contract_id` bigint(20) NULL DEFAULT NULL COMMENT 'ID',
`owner_user_id` bigint(20) NULL DEFAULT NULL COMMENT '',
`sort` int(11) NULL DEFAULT NULL COMMENT '',
`remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '',
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '',
`updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '',
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '',
`tenant_id` bigint(20) NOT NULL DEFAULT 0 COMMENT '',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '' ROW_FORMAT = DYNAMIC;
CREATE TABLE `crm_contact` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '',
`name` varchar(128) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '',
`next_time` datetime DEFAULT NULL COMMENT '',
`mobile` varchar(16) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '',
`telephone` varchar(16) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '',
`email` varchar(128) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '',
`post` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '',
`customer_id` bigint(20) DEFAULT NULL COMMENT '',
`address` varchar(256) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '',
`remark` varchar(512) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '',
`creator` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '',
`owner_user_id` bigint DEFAULT NULL COMMENT '',
`create_time` timestamp NULL DEFAULT NULL COMMENT '',
`update_time` timestamp NULL DEFAULT NULL COMMENT '',
`last_time` timestamp NULL DEFAULT NULL COMMENT '',
`updater` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '',
`deleted` bit(1) NOT NULL DEFAULT b'0',
`tenant_id` bigint DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='crm';
-- ----------------------------
--
-- ----------------------------
DROP TABLE IF EXISTS `crm_customer`;
CREATE TABLE `crm_customer` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '',
`name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '',
`follow_up_status` tinyint(1) NOT NULL DEFAULT 0 COMMENT '',
`lock_status` tinyint(1) NOT NULL DEFAULT 0 COMMENT '',
`deal_status` tinyint(1) NOT NULL DEFAULT 0 COMMENT '',
`industry_id` int NULL DEFAULT NULL COMMENT '',
`level` int NULL DEFAULT NULL COMMENT '',
`source` int NULL DEFAULT NULL COMMENT '',
`mobile` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '',
`telephone` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '',
`website` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '',
`qq` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT 'QQ',
`wechat` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '',
`email` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '',
`description` varchar(4096) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '',
`remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '',
`owner_user_id` bigint NULL DEFAULT NULL COMMENT '',
`ro_user_ids` varchar(4096) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '',
`rw_user_ids` varchar(4096) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '',
`area_id` bigint NULL DEFAULT NULL COMMENT '',
`detail_address` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '',
`longitude` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '',
`latitude` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '',
`contact_last_time` datetime NULL DEFAULT NULL COMMENT '',
`contact_next_time` datetime NULL DEFAULT NULL COMMENT '',
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '',
`updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '',
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '',
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '',
PRIMARY KEY (`id`) USING BTREE,
INDEX `owner_user_id`(`owner_user_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '' ROW_FORMAT = Dynamic;
-- ----------------------------
--
-- ----------------------------
DROP TABLE IF EXISTS `crm_business_status`;
CREATE TABLE `crm_business_status` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '',
`type_id` bigint NOT NULL COMMENT '',
`name` varchar(100) NOT NULL COMMENT '',
`percent` varchar(20) DEFAULT NULL COMMENT '',
`sort` int DEFAULT NULL COMMENT '',
`tenant_id` bigint DEFAULT '1' COMMENT 'ID',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT=''
-- ----------------------------
--
-- ----------------------------
DROP TABLE IF EXISTS `crm_business_status_type`;
CREATE TABLE `crm_business_status_type` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '',
`name` varchar(100) NOT NULL COMMENT '',
`dept_ids` varchar(200) NOT NULL COMMENT '使',
`status` bit(1) NOT NULL DEFAULT b'0' COMMENT '',
`creator` varchar(64) NOT NULL COMMENT '',
`create_time` datetime NOT NULL COMMENT '',
`update_time` datetime DEFAULT NULL COMMENT '',
`tenant_id` bigint DEFAULT '1' COMMENT 'ID',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT=''