Files
BMS/bms-back/sql/customer+supplier/customer.sql
T
2026-09-09 17:37:31 +08:00

55 lines
3.6 KiB
SQL
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
DROP TABLE IF EXISTS `bms_customer`;
CREATE TABLE `bms_customer` (
`customer_id` VARCHAR(32) NOT NULL AUTO_INCREMENT COMMENT '客户ID',
`customer_code` varchar(50) NOT NULL COMMENT '客户编码',
`customer_name` varchar(100) NOT NULL COMMENT '客户名称',
`customer_code_dw` varchar(50) DEFAULT '' COMMENT '对外代码',
`credit_code` varchar(18) DEFAULT '' COMMENT '统一社会信用代码',
-- 业务类型(字典:直客、同行、集运)
`customer_type` char(1) DEFAULT '0' COMMENT '业务类型(0直客 1同行 2集运)',
`is_enable` char(1) DEFAULT '0' COMMENT '启用状态(0正常 1停用)',
-- 销售归属
`sales_user_id` varchar(64) DEFAULT '' COMMENT '业务员用户ID',
`sales_user` varchar(50) DEFAULT '' COMMENT '业务员姓名',
-- 财务等信息
`ed` decimal(15,2) DEFAULT 0.00 COMMENT '资金额度(元)',
`zq` int(11) DEFAULT 0 COMMENT '回款账期(天)',
`settlement_user_id` varchar(64) DEFAULT '' COMMENT '结算员用户ID',
`settlement_user` varchar(50) DEFAULT '' COMMENT '结算员姓名',
`service_user_id` varchar(64) DEFAULT '' COMMENT '客服用户ID',
`service_user` varchar(50) DEFAULT '' COMMENT '客服姓名',
`settlement_type` char(1) DEFAULT '0' COMMENT '结算方式(0月结 1周结 2日结)',
`temp_ed` decimal(15,2) DEFAULT 0.00 COMMENT '临时额度(元)',
`account_balance` decimal(15,2) DEFAULT 0.00 COMMENT '账户余额(元)',
`foreign_currency_balance` decimal(15,2) DEFAULT 0.00 COMMENT '外币余额(元)',
`weight_threshold` decimal(15,2) DEFAULT 0.00 COMMENT '重量阈值(kg)',
`throw_ratio` decimal(15,2) DEFAULT 0.00 COMMENT '抛比(%)',
`credit_ed` decimal(15,2) DEFAULT 0.00 COMMENT '信用额度(元)',
`product_ids` varchar(1000) DEFAULT NULL COMMENT '绑定产品ID(多个产品ID用逗号分隔,支持批量操作)',
-- ========== 附件字段(新增) ==========
`logo_oss_id` bigint(20) DEFAULT NULL COMMENT '客户Logo(图片,关联sys_oss.oss_id)',
`attachment_ids` varchar(1000) DEFAULT NULL COMMENT '附件资料(多个oss_id用逗号分隔,支持PDF/图片/压缩包等)',
-- 备注
`remark` varchar(500) DEFAULT NULL COMMENT '备注说明',
-- 若依标准审计字段
`create_by` varchar(64) DEFAULT '' COMMENT '创建者',
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
`update_by` varchar(64) DEFAULT '' COMMENT '更新者',
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
`del_flag` char(1) DEFAULT '0' COMMENT '删除标记(0正常 2删除)',
PRIMARY KEY (`customer_id`)
-- UNIQUE KEY `uk_customer_code` (`customer_code`),
-- UNIQUE KEY `uk_credit_code` (`credit_code`),
-- KEY `idx_sales_user_id` (`sales_user_id`),
-- KEY `idx_customer_type` (`customer_type`),
-- KEY `idx_is_enable` (`is_enable`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='客户主表';