CREATE TABLE `t_supplier`
(
`id` INT UNSIGNED PRIMARY KEY AUTO_INCREMENT COMMENT '主键',
`supno` INT UNSIGNED NOT NULL COMMENT '供货商编号',
`name` VARCHAR(100) NOT NULL COMMENT '供货商名称',
`type` TINYINT UNSIGNED NOT NULL COMMENT '类型:1厂家,2代理商,3个人',
`contact` VARCHAR(20) NOT NULL COMMENT '联系人',
`tel` VARCHAR(15) NOT NULL COMMENT '手机,固定电话',
`address` VARCHAR(200) NOT NULL COMMENT '地址',
`bank_name` VARCHAR(60) COMMENT '银行名称',
`bank_account` VARCHAR(30) COMMENT '银行账号',
`status` TINYINT UNSIGNED NOT NULL COMMENT '状态:1可用,2禁用',
INDEX idx_type (`type`),
INDEX idx_status (`status`),
INDEX idx_supno (`supno`),
UNIQUE unq_supno (`supno`)
) COMMENT = '供货商表';
供货商关联的商品
CREATE TABLE `t_supplier_sku`(
`supplier_id` INT UNSIGNED NOT NULL COMMENT '供货商ID',
`sku_id` INT UNSIGNED NOT NULL COMMENT '商品ID',
PRIMARY KEY(`supplier_id`, `sku_id`) # 复合主键
) COMMENT = '供货商关联商品表';