Commit 3af9688383ea5aa48d727fefe4cc39917b239555
1 parent
c18f5baa
feat: 调整客户表的字段
Showing
9 changed files
with
173 additions
and
26 deletions
sql/mysql/crm.sql
| @@ -188,32 +188,42 @@ CREATE TABLE `crm_contact` ( | @@ -188,32 +188,42 @@ CREATE TABLE `crm_contact` ( | ||
| 188 | -- ---------------------------- | 188 | -- ---------------------------- |
| 189 | -- 客户表 | 189 | -- 客户表 |
| 190 | -- ---------------------------- | 190 | -- ---------------------------- |
| 191 | -CREATE TABLE `crm_customer` ( | ||
| 192 | - `id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号,主键自增', | ||
| 193 | - `name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '客户名称', | ||
| 194 | - `follow_up_status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '跟进状态', | ||
| 195 | - `lock_status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '锁定状态', | ||
| 196 | - `deal_status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '成交状态', | ||
| 197 | - `mobile` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '手机', | ||
| 198 | - `telephone` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '电话', | ||
| 199 | - `website` varchar(1024) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '网址', | ||
| 200 | - `remark` varchar(500) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '备注', | ||
| 201 | - `owner_user_id` bigint DEFAULT NULL COMMENT '负责人的用户编号', | ||
| 202 | - `ro_user_ids` varchar(4096) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '只读权限的用户编号数组', | ||
| 203 | - `rw_user_ids` varchar(4096) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '读写权限的用户编号数组', | ||
| 204 | - `area_id` bigint DEFAULT NULL COMMENT '地区编号', | ||
| 205 | - `detail_address` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '详细地址', | ||
| 206 | - `contact_last_time` datetime DEFAULT NULL COMMENT '最后跟进时间', | ||
| 207 | - `contact_next_time` datetime DEFAULT NULL COMMENT '下次联系时间', | ||
| 208 | - `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '创建者', | ||
| 209 | - `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', | ||
| 210 | - `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '更新者', | ||
| 211 | - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', | ||
| 212 | - `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', | ||
| 213 | - `tenant_id` bigint NOT NULL DEFAULT '0' COMMENT '租户编号', | ||
| 214 | - PRIMARY KEY (`id`), | ||
| 215 | - KEY `owner_user_id` (`owner_user_id`) | ||
| 216 | -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='客户表'; | 191 | +DROP TABLE IF EXISTS `crm_customer`; |
| 192 | +CREATE TABLE `crm_customer` ( | ||
| 193 | + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号,主键自增', | ||
| 194 | + `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '客户名称', | ||
| 195 | + `follow_up_status` tinyint(1) NOT NULL DEFAULT 0 COMMENT '跟进状态', | ||
| 196 | + `lock_status` tinyint(1) NOT NULL DEFAULT 0 COMMENT '锁定状态', | ||
| 197 | + `deal_status` tinyint(1) NOT NULL DEFAULT 0 COMMENT '成交状态', | ||
| 198 | + `industry_id` int NULL DEFAULT NULL COMMENT '所属行业', | ||
| 199 | + `level` int NULL DEFAULT NULL COMMENT '客户等级', | ||
| 200 | + `source` int NULL DEFAULT NULL COMMENT '客户来源', | ||
| 201 | + `mobile` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '手机', | ||
| 202 | + `telephone` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '电话', | ||
| 203 | + `website` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '网址', | ||
| 204 | + `qq` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT 'QQ', | ||
| 205 | + `wechat` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '微信', | ||
| 206 | + `email` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '邮箱', | ||
| 207 | + `description` varchar(4096) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '客户描述', | ||
| 208 | + `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '备注', | ||
| 209 | + `owner_user_id` bigint NULL DEFAULT NULL COMMENT '负责人的用户编号', | ||
| 210 | + `ro_user_ids` varchar(4096) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '只读权限的用户编号数组', | ||
| 211 | + `rw_user_ids` varchar(4096) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '读写权限的用户编号数组', | ||
| 212 | + `area_id` bigint NULL DEFAULT NULL COMMENT '地区编号', | ||
| 213 | + `detail_address` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '详细地址', | ||
| 214 | + `longitude` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '地理位置经度', | ||
| 215 | + `latitude` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '地理位置维度', | ||
| 216 | + `contact_last_time` datetime NULL DEFAULT NULL COMMENT '最后跟进时间', | ||
| 217 | + `contact_next_time` datetime NULL DEFAULT NULL COMMENT '下次联系时间', | ||
| 218 | + `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者', | ||
| 219 | + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', | ||
| 220 | + `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者', | ||
| 221 | + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', | ||
| 222 | + `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', | ||
| 223 | + `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', | ||
| 224 | + PRIMARY KEY (`id`) USING BTREE, | ||
| 225 | + INDEX `owner_user_id`(`owner_user_id`) USING BTREE | ||
| 226 | +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '客户表' ROW_FORMAT = Dynamic; | ||
| 217 | -- ---------------------------- | 227 | -- ---------------------------- |
| 218 | -- 商机状态表 | 228 | -- 商机状态表 |
| 219 | -- ---------------------------- | 229 | -- ---------------------------- |
sql/mysql/crm_data.sql
| @@ -17,3 +17,42 @@ INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `st | @@ -17,3 +17,42 @@ INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `st | ||
| 17 | INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1400, 7, '微信支付', '7', 'crm_return_type', 0, 'default', '', '', '1', '2023-10-18 21:55:53', '1', '2023-10-18 21:55:53', b'0'); | 17 | INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1400, 7, '微信支付', '7', 'crm_return_type', 0, 'default', '', '', '1', '2023-10-18 21:55:53', '1', '2023-10-18 21:55:53', b'0'); |
| 18 | INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1401, 8, '其他', '8', 'crm_return_type', 0, 'default', '', '', '1', '2023-10-18 21:56:06', '1', '2023-10-18 21:56:06', b'0'); | 18 | INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1401, 8, '其他', '8', 'crm_return_type', 0, 'default', '', '', '1', '2023-10-18 21:56:06', '1', '2023-10-18 21:56:06', b'0'); |
| 19 | 19 | ||
| 20 | + | ||
| 21 | + | ||
| 22 | +INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (188, '客户来源', 'crm_customer_source', 0, 'CRM 客户来源', '1', '2023-10-28 23:00:34', '1', '2023-10-28 15:11:16', b'0', NULL); | ||
| 23 | +INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (187, '客户等级', 'crm_customer_level', 0, 'CRM 客户等级', '1', '2023-10-28 22:59:12', '1', '2023-10-28 15:11:16', b'0', NULL); | ||
| 24 | +INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (186, '客户所属行业', 'crm_customer_industry', 0, 'CRM 客户所属行业', '1', '2023-10-28 22:57:07', '1', '2023-10-28 15:11:16', b'0', NULL); | ||
| 25 | + | ||
| 26 | +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1434, 10, '邮件咨询', '10', 'crm_customer_source', 0, 'default', '', '', '1', '2023-10-28 23:10:33', '1', '2023-10-28 23:10:33', b'0'); | ||
| 27 | +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1433, 9, '电话咨询', '9', 'crm_customer_source', 0, 'default', '', '', '1', '2023-10-28 23:10:18', '1', '2023-10-28 23:10:18', b'0'); | ||
| 28 | +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1432, 8, '陌拜', '8', 'crm_customer_source', 0, 'default', '', '', '1', '2023-10-28 23:10:04', '1', '2023-10-28 23:10:04', b'0'); | ||
| 29 | +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1431, 7, '预约上门', '7', 'crm_customer_source', 0, 'default', '', '', '1', '2023-10-28 23:09:39', '1', '2023-10-28 23:09:39', b'0'); | ||
| 30 | +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1430, 6, '线上咨询', '6', 'crm_customer_source', 0, 'default', '', '', '1', '2023-10-28 23:09:22', '1', '2023-10-28 23:09:22', b'0'); | ||
| 31 | +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1429, 5, '线上注册', '5', 'crm_customer_source', 0, 'default', '', '', '1', '2023-10-28 23:09:12', '1', '2023-10-28 23:09:12', b'0'); | ||
| 32 | +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1428, 4, '转介绍', '4', 'crm_customer_source', 0, 'default', '', '', '1', '2023-10-28 23:08:58', '1', '2023-10-28 23:08:58', b'0'); | ||
| 33 | +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1427, 3, '广告', '3', 'crm_customer_source', 0, 'default', '', '', '1', '2023-10-28 23:08:47', '1', '2023-10-28 23:08:47', b'0'); | ||
| 34 | +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1426, 2, '搜索引擎', '2', 'crm_customer_source', 0, 'default', '', '', '1', '2023-10-28 23:08:39', '1', '2023-10-28 23:08:39', b'0'); | ||
| 35 | +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1425, 1, '促销', '1', 'crm_customer_source', 0, 'default', '', '', '1', '2023-10-28 23:08:29', '1', '2023-10-28 23:08:29', b'0'); | ||
| 36 | +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1424, 3, 'C (非优先客户)', '3', 'crm_customer_level', 0, 'default', '', '', '1', '2023-10-28 23:07:53', '1', '2023-10-28 23:07:53', b'0'); | ||
| 37 | +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1423, 2, 'B (普通客户)', '2', 'crm_customer_level', 0, 'info', '', '', '1', '2023-10-28 23:07:35', '1', '2023-10-28 23:07:35', b'0'); | ||
| 38 | +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1422, 1, 'A (重点客户)', '1', 'crm_customer_level', 0, 'primary', '', '', '1', '2023-10-28 23:07:13', '1', '2023-10-28 23:07:13', b'0'); | ||
| 39 | +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1421, 20, 'T 国际组织', '20', 'crm_customer_industry', 0, 'default', '', '', '1', '2023-10-28 23:06:15', '1', '2023-10-28 23:06:15', b'0'); | ||
| 40 | +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1420, 19, 'S 公共管理、社会保障和社会组织', '19', 'crm_customer_industry', 0, 'default', '', '', '1', '2023-10-28 23:06:05', '1', '2023-10-28 23:06:05', b'0'); | ||
| 41 | +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1419, 18, 'R 文化、体育和娱乐业', '18', 'crm_customer_industry', 0, 'default', '', '', '1', '2023-10-28 23:05:55', '1', '2023-10-28 23:05:55', b'0'); | ||
| 42 | +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1418, 17, 'Q 卫生和社会工作', '17', 'crm_customer_industry', 0, 'default', '', '', '1', '2023-10-28 23:05:44', '1', '2023-10-28 23:05:44', b'0'); | ||
| 43 | +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1417, 16, 'P 教育', '16', 'crm_customer_industry', 0, 'default', '', '', '1', '2023-10-28 23:05:15', '1', '2023-10-28 23:05:15', b'0'); | ||
| 44 | +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1416, 15, 'O 居民服务、修理和其他服务业', '15', 'crm_customer_industry', 0, 'default', '', '', '1', '2023-10-28 23:05:05', '1', '2023-10-28 23:05:05', b'0'); | ||
| 45 | +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1415, 14, 'N 水利、环境和公共设施管理业', '14', 'crm_customer_industry', 0, 'default', '', '', '1', '2023-10-28 23:04:53', '1', '2023-10-28 23:04:53', b'0'); | ||
| 46 | +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1414, 13, 'M 科学研究和技术服务业', '13', 'crm_customer_industry', 0, 'default', '', '', '1', '2023-10-28 23:04:43', '1', '2023-10-28 23:04:43', b'0'); | ||
| 47 | +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1413, 12, 'L 租赁和商务服务业', '12', 'crm_customer_industry', 0, 'default', '', '', '1', '2023-10-28 23:04:33', '1', '2023-10-28 23:04:33', b'0'); | ||
| 48 | +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1412, 11, 'K 房地产业', '11', 'crm_customer_industry', 0, 'default', '', '', '1', '2023-10-28 23:04:15', '1', '2023-10-28 23:04:22', b'0'); | ||
| 49 | +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1411, 10, 'J 金融业', '10', 'crm_customer_industry', 0, 'default', '', '', '1', '2023-10-28 23:03:57', '1', '2023-10-28 23:03:57', b'0'); | ||
| 50 | +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1410, 9, 'I 信息传输、软件和信息技术服务业', '9', 'crm_customer_industry', 0, 'default', '', '', '1', '2023-10-28 23:03:47', '1', '2023-10-28 23:03:47', b'0'); | ||
| 51 | +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1409, 8, 'H 住宿和餐饮业', '8', 'crm_customer_industry', 0, 'default', '', '', '1', '2023-10-28 23:03:37', '1', '2023-10-28 23:03:37', b'0'); | ||
| 52 | +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1408, 7, 'G 交通运输、仓储和邮政业', '7', 'crm_customer_industry', 0, 'default', '', '', '1', '2023-10-28 23:03:27', '1', '2023-10-28 23:03:27', b'0'); | ||
| 53 | +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1407, 6, 'F 批发和零售业', '6', 'crm_customer_industry', 0, 'default', '', '', '1', '2023-10-28 23:03:13', '1', '2023-10-28 23:03:13', b'0'); | ||
| 54 | +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1406, 5, 'E 建筑业', '5', 'crm_customer_industry', 0, 'default', '', '', '1', '2023-10-28 23:03:03', '1', '2023-10-28 23:03:03', b'0'); | ||
| 55 | +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1405, 4, 'D 电力、热力、燃气及水生产和供应业', '4', 'crm_customer_industry', 0, 'default', '', '', '1', '2023-10-28 23:02:54', '1', '2023-10-28 23:02:54', b'0'); | ||
| 56 | +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1404, 3, 'C 制造业', '3', 'crm_customer_industry', 0, 'default', '', '', '1', '2023-10-28 23:02:41', '1', '2023-10-28 23:02:41', b'0'); | ||
| 57 | +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1403, 2, 'B 采矿业', '2', 'crm_customer_industry', 0, 'default', '', '', '1', '2023-10-28 23:02:29', '1', '2023-10-28 23:02:29', b'0'); | ||
| 58 | +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1402, 1, 'A 农、林、牧、渔业', '1', 'crm_customer_industry', 0, 'default', '', '', '1', '2023-10-28 23:02:15', '1', '2023-10-28 23:02:15', b'0'); | ||
| 20 | \ No newline at end of file | 59 | \ No newline at end of file |
yudao-module-crm/yudao-module-crm-api/src/main/java/cn/iocoder/yudao/module/crm/enums/DictTypeConstants.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.enums; | ||
| 2 | + | ||
| 3 | +/** | ||
| 4 | + * System 字典类型的枚举类 | ||
| 5 | + * | ||
| 6 | + * @author 芋道源码 | ||
| 7 | + */ | ||
| 8 | +public interface DictTypeConstants { | ||
| 9 | + | ||
| 10 | + // ========== CRM 模块 ========== | ||
| 11 | + String CRM_CUSTOMER_INDUSTRY = "crm_customer_industry"; // CRM 客户所属行业 | ||
| 12 | + String CRM_CUSTOMER_LEVEL = "crm_customer_level"; // CRM 客户等级 | ||
| 13 | + String CRM_CUSTOMER_SOURCE = "crm_customer_source"; // CRM 客户来源 | ||
| 14 | + | ||
| 15 | +} |
yudao-module-crm/yudao-module-crm-api/src/main/java/cn/iocoder/yudao/module/crm/enums/customer/CrmCustomerLevelEnum.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.enums.customer; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.core.IntArrayValuable; | ||
| 4 | +import lombok.AllArgsConstructor; | ||
| 5 | +import lombok.Getter; | ||
| 6 | + | ||
| 7 | +import java.util.Arrays; | ||
| 8 | + | ||
| 9 | +/** | ||
| 10 | + * CRM 客户等级 | ||
| 11 | + * | ||
| 12 | + * @author Wanwan | ||
| 13 | + */ | ||
| 14 | +@Getter | ||
| 15 | +@AllArgsConstructor | ||
| 16 | +public enum CrmCustomerLevelEnum implements IntArrayValuable { | ||
| 17 | + | ||
| 18 | + IMPORTANT(1, "A (重点客户)"), | ||
| 19 | + GENERAL(2, "B (普通客户)"), | ||
| 20 | + LOW_PRIORITY(3, "C (非优先客户)"); | ||
| 21 | + | ||
| 22 | + public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(CrmCustomerLevelEnum::getStatus).toArray(); | ||
| 23 | + | ||
| 24 | + /** | ||
| 25 | + * 状态 | ||
| 26 | + */ | ||
| 27 | + private final Integer status; | ||
| 28 | + /** | ||
| 29 | + * 状态名 | ||
| 30 | + */ | ||
| 31 | + private final String name; | ||
| 32 | + | ||
| 33 | + @Override | ||
| 34 | + public int[] array() { | ||
| 35 | + return ARRAYS; | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | +} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/CrmCustomerBaseVO.java
| 1 | package cn.iocoder.yudao.module.crm.controller.admin.customer.vo; | 1 | package cn.iocoder.yudao.module.crm.controller.admin.customer.vo; |
| 2 | 2 | ||
| 3 | +import cn.iocoder.yudao.framework.common.validation.InEnum; | ||
| 3 | import cn.iocoder.yudao.framework.common.validation.Mobile; | 4 | import cn.iocoder.yudao.framework.common.validation.Mobile; |
| 4 | import cn.iocoder.yudao.framework.common.validation.Telephone; | 5 | import cn.iocoder.yudao.framework.common.validation.Telephone; |
| 6 | +import cn.iocoder.yudao.module.crm.enums.customer.CrmCustomerLevelEnum; | ||
| 5 | import io.swagger.v3.oas.annotations.media.Schema; | 7 | import io.swagger.v3.oas.annotations.media.Schema; |
| 6 | import lombok.Data; | 8 | import lombok.Data; |
| 7 | import org.springframework.format.annotation.DateTimeFormat; | 9 | import org.springframework.format.annotation.DateTimeFormat; |
| @@ -25,6 +27,16 @@ public class CrmCustomerBaseVO { | @@ -25,6 +27,16 @@ public class CrmCustomerBaseVO { | ||
| 25 | @NotEmpty(message = "客户名称不能为空") | 27 | @NotEmpty(message = "客户名称不能为空") |
| 26 | private String name; | 28 | private String name; |
| 27 | 29 | ||
| 30 | + @Schema(description = "所属行业", example = "1") | ||
| 31 | + private Integer industryId; | ||
| 32 | + | ||
| 33 | + @Schema(description = "客户等级", example = "2") | ||
| 34 | + @InEnum(CrmCustomerLevelEnum.class) | ||
| 35 | + private Integer level; | ||
| 36 | + | ||
| 37 | + @Schema(description = "客户来源", example = "3") | ||
| 38 | + private Integer source; | ||
| 39 | + | ||
| 28 | @Schema(description = "手机", example = "18000000000") | 40 | @Schema(description = "手机", example = "18000000000") |
| 29 | @Mobile | 41 | @Mobile |
| 30 | private String mobile; | 42 | private String mobile; |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/CrmCustomerExcelVO.java
| @@ -4,6 +4,7 @@ import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | @@ -4,6 +4,7 @@ import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | ||
| 4 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; | 4 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; |
| 5 | import cn.iocoder.yudao.module.infra.enums.DictTypeConstants; | 5 | import cn.iocoder.yudao.module.infra.enums.DictTypeConstants; |
| 6 | import com.alibaba.excel.annotation.ExcelProperty; | 6 | import com.alibaba.excel.annotation.ExcelProperty; |
| 7 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 7 | import lombok.Data; | 8 | import lombok.Data; |
| 8 | 9 | ||
| 9 | import java.time.LocalDateTime; | 10 | import java.time.LocalDateTime; |
| @@ -35,6 +36,18 @@ public class CrmCustomerExcelVO { | @@ -35,6 +36,18 @@ public class CrmCustomerExcelVO { | ||
| 35 | @DictFormat(DictTypeConstants.BOOLEAN_STRING) | 36 | @DictFormat(DictTypeConstants.BOOLEAN_STRING) |
| 36 | private Boolean dealStatus; | 37 | private Boolean dealStatus; |
| 37 | 38 | ||
| 39 | + @ExcelProperty(value = "所属行业", converter = DictConvert.class) | ||
| 40 | + @DictFormat(cn.iocoder.yudao.module.crm.enums.DictTypeConstants.CRM_CUSTOMER_INDUSTRY) | ||
| 41 | + private Integer industryId; | ||
| 42 | + | ||
| 43 | + @ExcelProperty(value = "客户等级", converter = DictConvert.class) | ||
| 44 | + @DictFormat(cn.iocoder.yudao.module.crm.enums.DictTypeConstants.CRM_CUSTOMER_LEVEL) | ||
| 45 | + private Integer level; | ||
| 46 | + | ||
| 47 | + @ExcelProperty(value = "客户来源", converter = DictConvert.class) | ||
| 48 | + @DictFormat(cn.iocoder.yudao.module.crm.enums.DictTypeConstants.CRM_CUSTOMER_SOURCE) | ||
| 49 | + private Integer source; | ||
| 50 | + | ||
| 38 | @ExcelProperty("手机") | 51 | @ExcelProperty("手机") |
| 39 | private String mobile; | 52 | private String mobile; |
| 40 | 53 |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/customer/CrmCustomerDO.java
| @@ -12,6 +12,7 @@ import java.time.LocalDateTime; | @@ -12,6 +12,7 @@ import java.time.LocalDateTime; | ||
| 12 | import java.util.List; | 12 | import java.util.List; |
| 13 | 13 | ||
| 14 | // TODO 芋艿:调整下字段 | 14 | // TODO 芋艿:调整下字段 |
| 15 | + | ||
| 15 | /** | 16 | /** |
| 16 | * 客户 DO | 17 | * 客户 DO |
| 17 | * | 18 | * |
| @@ -49,6 +50,21 @@ public class CrmCustomerDO extends BaseDO { | @@ -49,6 +50,21 @@ public class CrmCustomerDO extends BaseDO { | ||
| 49 | */ | 50 | */ |
| 50 | private Boolean dealStatus; | 51 | private Boolean dealStatus; |
| 51 | /** | 52 | /** |
| 53 | + * 所属行业 | ||
| 54 | + * 对应字典 {@link cn.iocoder.yudao.module.crm.enums.DictTypeConstants.CRM_CUSTOMER_INDUSTRY} | ||
| 55 | + */ | ||
| 56 | + private Integer industryId; | ||
| 57 | + /** | ||
| 58 | + * 客户等级 | ||
| 59 | + * 对应字典 {@link cn.iocoder.yudao.module.crm.enums.DictTypeConstants.CRM_CUSTOMER_LEVEL} | ||
| 60 | + */ | ||
| 61 | + private Integer level; | ||
| 62 | + /** | ||
| 63 | + * 客户来源 | ||
| 64 | + * 对应字典 {@link cn.iocoder.yudao.module.crm.enums.DictTypeConstants.CRM_CUSTOMER_SOURCE} | ||
| 65 | + */ | ||
| 66 | + private Integer source; | ||
| 67 | + /** | ||
| 52 | * 手机 | 68 | * 手机 |
| 53 | */ | 69 | */ |
| 54 | private String mobile; | 70 | private String mobile; |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/customer/CrmCustomerMapper.java
| @@ -19,6 +19,7 @@ import java.util.List; | @@ -19,6 +19,7 @@ import java.util.List; | ||
| 19 | public interface CrmCustomerMapper extends BaseMapperX<CrmCustomerDO> { | 19 | public interface CrmCustomerMapper extends BaseMapperX<CrmCustomerDO> { |
| 20 | 20 | ||
| 21 | default PageResult<CrmCustomerDO> selectPage(CrmCustomerPageReqVO reqVO) { | 21 | default PageResult<CrmCustomerDO> selectPage(CrmCustomerPageReqVO reqVO) { |
| 22 | + // TODO @Wanwan 填充负责人,所属部门字段 | ||
| 22 | return selectPage(reqVO, new LambdaQueryWrapperX<CrmCustomerDO>() | 23 | return selectPage(reqVO, new LambdaQueryWrapperX<CrmCustomerDO>() |
| 23 | .likeIfPresent(CrmCustomerDO::getName, reqVO.getName()) | 24 | .likeIfPresent(CrmCustomerDO::getName, reqVO.getName()) |
| 24 | .eqIfPresent(CrmCustomerDO::getMobile, reqVO.getMobile()) | 25 | .eqIfPresent(CrmCustomerDO::getMobile, reqVO.getMobile()) |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/customer/CrmCustomerServiceImpl.java
| 1 | package cn.iocoder.yudao.module.crm.service.customer; | 1 | package cn.iocoder.yudao.module.crm.service.customer; |
| 2 | 2 | ||
| 3 | +import cn.iocoder.yudao.module.system.api.dept.DeptApi; | ||
| 3 | import org.springframework.stereotype.Service; | 4 | import org.springframework.stereotype.Service; |
| 4 | import javax.annotation.Resource; | 5 | import javax.annotation.Resource; |
| 5 | import org.springframework.validation.annotation.Validated; | 6 | import org.springframework.validation.annotation.Validated; |
| @@ -29,6 +30,8 @@ public class CrmCustomerServiceImpl implements CrmCustomerService { | @@ -29,6 +30,8 @@ public class CrmCustomerServiceImpl implements CrmCustomerService { | ||
| 29 | 30 | ||
| 30 | @Resource | 31 | @Resource |
| 31 | private CrmCustomerMapper customerMapper; | 32 | private CrmCustomerMapper customerMapper; |
| 33 | + @Resource | ||
| 34 | + private DeptApi deptApi; | ||
| 32 | 35 | ||
| 33 | @Override | 36 | @Override |
| 34 | public Long createCustomer(CrmCustomerCreateReqVO createReqVO) { | 37 | public Long createCustomer(CrmCustomerCreateReqVO createReqVO) { |