Files
LingXi-CRM/server/db/crm.sql
T
yi c8e607c91c
CRM CI / build (push) Waiting to run
chore: update default account and add example data
- Update default login email to xinmi@local.com
- Update default password to 12345678 (and bcrypt hash in crm.sql)
- Add example customers, products, and contracts to init SQL
- Fix Docker env interpolation for VITE_API_BASE_URL
- Hardcode local backend API URL in frontend .env files
- Update README and docs to reflect new default credentials
2026-06-09 19:14:10 +08:00

212 lines
14 KiB
PL/PgSQL

/*
Navicat Premium Data Transfer
Source Server : mysql
Source Server Type : MySQL
Source Server Version : 80031 (8.0.31)
Source Host : localhost:3306
Source Schema : crm
Target Server Type : MySQL
Target Server Version : 80031 (8.0.31)
File Encoding : 65001
Date: 28/01/2023 19:19:16
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for contract
-- ----------------------------
DROP TABLE IF EXISTS `contract`;
CREATE TABLE `contract` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号',
`name` varchar(200) DEFAULT NULL COMMENT '合同名称',
`amount` decimal(10,2) DEFAULT NULL COMMENT '金额',
`begin_time` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT '开始时间',
`over_time` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT '结束时间',
`remarks` varchar(80) DEFAULT NULL COMMENT '备注',
`cid` bigint DEFAULT NULL COMMENT '客户编号',
`productlist` json DEFAULT NULL COMMENT '产品编号和数量',
`status` tinyint DEFAULT NULL COMMENT '状态',
`creator` bigint DEFAULT NULL COMMENT '创建人',
`created` bigint DEFAULT NULL COMMENT '创建时间',
`updated` bigint DEFAULT NULL COMMENT '更新时间',
PRIMARY KEY (`id`),
KEY `idx_creator` (`creator`)
) ENGINE=InnoDB AUTO_INCREMENT=20026 DEFAULT CHARSET=utf8mb3;
-- ----------------------------
-- Records of contract
-- ----------------------------
BEGIN;
INSERT INTO `contract` (`id`, `name`, `amount`, `begin_time`, `over_time`, `remarks`, `cid`, `productlist`, `status`, `creator`, `created`, `updated`) VALUES (20001, '电动车交易1', 89880.00, '2023-01-28', '2023-01-30', '无备注', 1, '[{\"id\": 1, \"name\": \"电动车1\", \"type\": 1, \"unit\": \"台\", \"count\": 10, \"price\": 1498, \"total\": 14980}, {\"id\": 2, \"name\": \"电动车2\", \"type\": 1, \"unit\": \"台\", \"count\": 20, \"price\": 1498, \"total\": 29960}, {\"id\": 3, \"name\": \"电动车3\", \"type\": 1, \"unit\": \"台\", \"count\": 30, \"price\": 1498, \"total\": 44940}]', 1, 29, 1674900672, 0);
INSERT INTO `contract` (`id`, `name`, `amount`, `begin_time`, `over_time`, `remarks`, `cid`, `productlist`, `status`, `creator`, `created`, `updated`) VALUES (20002, '电动车交易2', 89880.00, '2023-01-28', '2023-01-30', '无备注', 2, '[{\"id\": 1, \"name\": \"电动车1\", \"type\": 1, \"unit\": \"台\", \"count\": 10, \"price\": 1498, \"total\": 14980}, {\"id\": 2, \"name\": \"电动车2\", \"type\": 1, \"unit\": \"台\", \"count\": 20, \"price\": 1498, \"total\": 29960}, {\"id\": 3, \"name\": \"电动车3\", \"type\": 1, \"unit\": \"台\", \"count\": 30, \"price\": 1498, \"total\": 44940}]', 1, 29, 1674900672, 0);
INSERT INTO `contract` (`id`, `name`, `amount`, `begin_time`, `over_time`, `remarks`, `cid`, `productlist`, `status`, `creator`, `created`, `updated`) VALUES (20003, '电动车交易3', 89880.00, '2023-01-28', '2023-01-30', '无备注', 3, '[{\"id\": 1, \"name\": \"电动车1\", \"type\": 1, \"unit\": \"台\", \"count\": 10, \"price\": 1498, \"total\": 14980}, {\"id\": 2, \"name\": \"电动车2\", \"type\": 1, \"unit\": \"台\", \"count\": 20, \"price\": 1498, \"total\": 29960}, {\"id\": 3, \"name\": \"电动车3\", \"type\": 1, \"unit\": \"台\", \"count\": 30, \"price\": 1498, \"total\": 44940}]', 2, 29, 1674900672, 0);
INSERT INTO `contract` (`id`, `name`, `amount`, `begin_time`, `over_time`, `remarks`, `cid`, `productlist`, `status`, `creator`, `created`, `updated`) VALUES (20004, '电动车交易4', 89880.00, '2023-01-28', '2023-01-30', '无备注', 4, '[{\"id\": 1, \"name\": \"电动车1\", \"type\": 1, \"unit\": \"台\", \"count\": 10, \"price\": 1498, \"total\": 14980}, {\"id\": 2, \"name\": \"电动车2\", \"type\": 1, \"unit\": \"台\", \"count\": 20, \"price\": 1498, \"total\": 29960}, {\"id\": 3, \"name\": \"电动车3\", \"type\": 1, \"unit\": \"台\", \"count\": 30, \"price\": 1498, \"total\": 44940}]', 1, 29, 1674900672, 1674901109);
INSERT INTO `contract` (`id`, `name`, `amount`, `begin_time`, `over_time`, `remarks`, `cid`, `productlist`, `status`, `creator`, `created`, `updated`) VALUES (20005, '智能家居采购', 150000.00, '2026-06-01', '2026-12-31', '长期合作伙伴', 1, '[{\"id\": 7, \"name\": \"智能锁A1\", \"type\": 1, \"unit\": \"把\", \"count\": 100, \"price\": 800, \"total\": 80000}, {\"id\": 8, \"name\": \"智能网关\", \"type\": 1, \"unit\": \"台\", \"count\": 100, \"price\": 700, \"total\": 70000}]', 1, 29, 1717924318, 0);
INSERT INTO `contract` (`id`, `name`, `amount`, `begin_time`, `over_time`, `remarks`, `cid`, `productlist`, `status`, `creator`, `created`, `updated`) VALUES (20006, '云服务年度订阅', 50000.00, '2026-01-01', '2026-12-31', 'SaaS服务', 2, '[{\"id\": 9, \"name\": \"云空间1TB\", \"type\": 2, \"unit\": \"年\", \"count\": 10, \"price\": 5000, \"total\": 50000}]', 1, 29, 1717924318, 0);
INSERT INTO `contract` (`id`, `name`, `amount`, `begin_time`, `over_time`, `remarks`, `cid`, `productlist`, `status`, `creator`, `created`, `updated`) VALUES (20007, '办公设备更新', 45000.00, '2026-06-10', '2026-06-20', '批量采购', 3, '[{\"id\": 1, \"name\": \"电动车1\", \"type\": 1, \"unit\": \"台\", \"count\": 30, \"price\": 1500, \"total\": 45000}]', 2, 29, 1717924318, 0);
COMMIT;
-- ----------------------------
-- Table structure for customer
-- ----------------------------
DROP TABLE IF EXISTS `customer`;
CREATE TABLE `customer` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号',
`name` varchar(50) DEFAULT NULL COMMENT '名称',
`source` char(15) DEFAULT NULL COMMENT '来源',
`phone` char(12) DEFAULT NULL COMMENT '手机号',
`email` char(20) DEFAULT NULL COMMENT '邮箱',
`industry` char(30) DEFAULT NULL COMMENT '所在行业',
`level` char(10) DEFAULT NULL COMMENT '级别',
`remarks` varchar(200) NOT NULL COMMENT '备注',
`region` char(80) DEFAULT NULL COMMENT '地区',
`address` varchar(255) DEFAULT NULL COMMENT '详细地址',
`status` tinyint DEFAULT NULL COMMENT '成交状态',
`creator` bigint DEFAULT NULL COMMENT '创建人',
`created` bigint DEFAULT NULL COMMENT '创建时间',
`updated` bigint DEFAULT NULL COMMENT '更新时间',
PRIMARY KEY (`id`),
KEY `idx_creator` (`creator`)
) ENGINE=InnoDB AUTO_INCREMENT=70 DEFAULT CHARSET=utf8mb3;
-- ----------------------------
-- Records of customer
-- ----------------------------
BEGIN;
INSERT INTO `customer` (`id`, `name`, `source`, `phone`, `email`, `industry`, `level`, `remarks`, `region`, `address`, `status`, `creator`, `created`, `updated`) VALUES (1, '北京文化有限公司1', '电话咨询', '13050803360', 'bjwenhua@gmail.com', '金融业', '重点客户', '', '北京市,朝阳区', '望京东园615号', 1, 29, 1674899545, 0);
INSERT INTO `customer` (`id`, `name`, `source`, `phone`, `email`, `industry`, `level`, `remarks`, `region`, `address`, `status`, `creator`, `created`, `updated`) VALUES (2, '上海科技贸易公司', '线上注册', '13812345678', 'sh-tech@163.com', '互联网', '重点客户', '意向强烈', '上海市,浦东新区', '张江高科园区', 1, 29, 1717924318, 0);
INSERT INTO `customer` (`id`, `name`, `source`, `phone`, `email`, `industry`, `level`, `remarks`, `region`, `address`, `status`, `creator`, `created`, `updated`) VALUES (3, '广州国际贸易有限责任公司', '搜索引擎', '13987654321', 'gz-trade@qq.com', '外贸', '普通客户', '咨询中', '广东省,广州市', '天河区中信大厦', 1, 29, 1717924318, 0);
INSERT INTO `customer` (`id`, `name`, `source`, `phone`, `email`, `industry`, `level`, `remarks`, `region`, `address`, `status`, `creator`, `created`, `updated`) VALUES (4, '深圳电子技术有限公司', '线下展会', '13500001111', 'sz-elec@gmail.com', '制造业', '重点客户', '老客户推荐', '广东省,深圳市', '南山区科技园', 1, 29, 1717924318, 0);
INSERT INTO `customer` (`id`, `name`, `source`, `phone`, `email`, `industry`, `level`, `remarks`, `region`, `address`, `status`, `creator`, `created`, `updated`) VALUES (5, '杭州电子商务有限公司', '促销活动', '13722223333', 'hz-ec@outlook.com', '零售业', '普通客户', '新成交', '浙江省,杭州市', '余杭区阿里园区旁', 1, 29, 1717924318, 0);
COMMIT;
-- ----------------------------
-- Table structure for mail_config
-- ----------------------------
DROP TABLE IF EXISTS `mail_config`;
CREATE TABLE `mail_config` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号',
`stmp` char(50) DEFAULT NULL COMMENT 'ip地址或域名',
`port` int DEFAULT NULL COMMENT '端口号',
`auth_code` char(80) DEFAULT NULL COMMENT '授权码',
`email` char(80) NOT NULL COMMENT '邮箱账号',
`status` tinyint DEFAULT NULL COMMENT '服务状态',
`creator` bigint DEFAULT NULL COMMENT '创建人',
`created` bigint DEFAULT NULL COMMENT '创建时间',
`updated` bigint DEFAULT NULL COMMENT '更新时间',
PRIMARY KEY (`id`),
KEY `idx_creator` (`creator`)
) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8mb3;
-- ----------------------------
-- Records of mail_config
-- ----------------------------
BEGIN;
INSERT INTO `mail_config` (`id`, `stmp`, `port`, `auth_code`, `email`, `status`, `creator`, `created`, `updated`) VALUES (11, 'smtp.qq.com', 465, 'zrzxsebacrpfdaeg', 'xinmi@local.com', 2, 29, 1674901189, 1674901237);
COMMIT;
-- ----------------------------
-- Table structure for notice
-- ----------------------------
DROP TABLE IF EXISTS `notice`;
CREATE TABLE `notice` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号',
`content` varchar(200) DEFAULT NULL COMMENT '通知内容',
`status` tinyint DEFAULT NULL COMMENT '状态,1-已读,2-未读',
`creator` bigint DEFAULT NULL COMMENT '创建者',
`created` bigint DEFAULT NULL COMMENT '创建时间',
`updated` bigint DEFAULT NULL COMMENT '更新时间',
PRIMARY KEY (`id`),
KEY `idx_creator` (`creator`)
) ENGINE=InnoDB AUTO_INCREMENT=155 DEFAULT CHARSET=utf8mb3;
-- ----------------------------
-- Records of notice
-- ----------------------------
BEGIN;
INSERT INTO `notice` (`id`, `content`, `status`, `creator`, `created`, `updated`) VALUES (133, '你订阅了专业版', 2, 0, 1674803772, 0);
INSERT INTO `notice` (`id`, `content`, `status`, `creator`, `created`, `updated`) VALUES (154, '欢迎使用新米CRM系统!', 2, 29, 1717924318, 0);
COMMIT;
-- ----------------------------
-- Table structure for product
-- ----------------------------
DROP TABLE IF EXISTS `product`;
CREATE TABLE `product` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号',
`name` varchar(50) DEFAULT NULL COMMENT '名称',
`type` tinyint(1) DEFAULT NULL COMMENT '类型',
`unit` char(5) DEFAULT NULL COMMENT '单位',
`code` varchar(80) DEFAULT NULL COMMENT '编码',
`price` decimal(10,2) DEFAULT NULL COMMENT '价格',
`description` varchar(200) DEFAULT NULL COMMENT '描述',
`status` tinyint(1) DEFAULT NULL COMMENT '状态,1-上架,2-下架',
`creator` bigint DEFAULT NULL COMMENT '创建人',
`created` bigint DEFAULT NULL COMMENT '创建时间',
`updated` bigint DEFAULT NULL COMMENT '更新时间',
PRIMARY KEY (`id`),
KEY `idx_creator` (`creator`)
) ENGINE=InnoDB AUTO_INCREMENT=110 DEFAULT CHARSET=utf8mb3;
-- ----------------------------
-- Records of product
-- ----------------------------
BEGIN;
INSERT INTO `product` (`id`, `name`, `type`, `unit`, `code`, `price`, `description`, `status`, `creator`, `created`, `updated`) VALUES (1, '电动车1', 1, '', '004', 1498.00, '代驾折叠电动车', 1, 29, 1671191995, 0);
INSERT INTO `product` (`id`, `name`, `type`, `unit`, `code`, `price`, `description`, `status`, `creator`, `created`, `updated`) VALUES (7, '智能锁A1', 1, '', 'SL001', 800.00, '指纹/密码/蓝牙多种解锁方式', 1, 29, 1717924318, 0);
INSERT INTO `product` (`id`, `name`, `type`, `unit`, `code`, `price`, `description`, `status`, `creator`, `created`, `updated`) VALUES (8, '智能网关', 1, '', 'GW001', 700.00, '支持Zigbee/WiFi/蓝牙', 1, 29, 1717924318, 0);
INSERT INTO `product` (`id`, `name`, `type`, `unit`, `code`, `price`, `description`, `status`, `creator`, `created`, `updated`) VALUES (9, '云空间1TB', 2, '', 'CS001', 5000.00, '企业级云存储服务', 1, 29, 1717924318, 0);
INSERT INTO `product` (`id`, `name`, `type`, `unit`, `code`, `price`, `description`, `status`, `creator`, `created`, `updated`) VALUES (10, '技术咨询服务', 2, '', 'SR001', 1000.00, '一小时专家在线咨询', 1, 29, 1717924318, 0);
COMMIT;
-- ----------------------------
-- Table structure for subscribe
-- ----------------------------
DROP TABLE IF EXISTS `subscribe`;
CREATE TABLE `subscribe` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号',
`uid` bigint DEFAULT NULL COMMENT '用户编号',
`version` tinyint DEFAULT NULL COMMENT '版本,1-免费版,2-专业版,3-高级版',
`expired` bigint DEFAULT NULL COMMENT '到期时间',
`created` bigint DEFAULT NULL COMMENT '创建时间',
`updated` bigint DEFAULT NULL COMMENT '更新时间',
PRIMARY KEY (`id`),
KEY `idx_uid` (`uid`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb3;
-- ----------------------------
-- Records of subscribe
-- ----------------------------
BEGIN;
INSERT INTO `subscribe` (`id`, `uid`, `version`, `expired`, `created`, `updated`) VALUES (4, 29, 2, 1735660800, 1674803772, 0);
COMMIT;
-- ----------------------------
-- Table structure for user
-- ----------------------------
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT '编号',
`email` char(30) DEFAULT NULL COMMENT '邮箱',
`password` varchar(200) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT '密码',
`name` char(10) DEFAULT NULL COMMENT '名称',
`status` tinyint DEFAULT '1' COMMENT '状态,1-正常,2-注销',
`created` bigint DEFAULT NULL COMMENT '创建时间',
`updated` bigint DEFAULT NULL COMMENT '更新时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=30 DEFAULT CHARSET=utf8mb3;
-- ----------------------------
-- Records of user
-- ----------------------------
BEGIN;
INSERT INTO `user` (`id`, `email`, `password`, `name`, `status`, `created`, `updated`) VALUES (29, 'xinmi@local.com', '$2b$10$CwWU/aIv/vgj7UnkpD1cW.O4oKuoCNWg3/srt3SUs5PXzmwZdi40e', '管理员', 1, 1671191625, 0);
COMMIT;
SET FOREIGN_KEY_CHECKS = 1;