image.png

  1. CREATE TABLE `t_supplier`
  2. (
  3. `id` INT UNSIGNED PRIMARY KEY AUTO_INCREMENT COMMENT '主键',
  4. `supno` INT UNSIGNED NOT NULL COMMENT '供货商编号',
  5. `name` VARCHAR(100) NOT NULL COMMENT '供货商名称',
  6. `type` TINYINT UNSIGNED NOT NULL COMMENT '类型:1厂家,2代理商,3个人',
  7. `contact` VARCHAR(20) NOT NULL COMMENT '联系人',
  8. `tel` VARCHAR(15) NOT NULL COMMENT '手机,固定电话',
  9. `address` VARCHAR(200) NOT NULL COMMENT '地址',
  10. `bank_name` VARCHAR(60) COMMENT '银行名称',
  11. `bank_account` VARCHAR(30) COMMENT '银行账号',
  12. `status` TINYINT UNSIGNED NOT NULL COMMENT '状态:1可用,2禁用',
  13. INDEX idx_type (`type`),
  14. INDEX idx_status (`status`),
  15. INDEX idx_supno (`supno`),
  16. UNIQUE unq_supno (`supno`)
  17. ) COMMENT = '供货商表';

供货商关联的商品

  1. CREATE TABLE `t_supplier_sku`(
  2. `supplier_id` INT UNSIGNED NOT NULL COMMENT '供货商ID',
  3. `sku_id` INT UNSIGNED NOT NULL COMMENT '商品ID',
  4. PRIMARY KEY(`supplier_id`, `sku_id`) # 复合主键
  5. ) COMMENT = '供货商关联商品表';