-- 会计科目表
CREATE TABLE oa_cw_accounting_subject (
  id INT PRIMARY KEY,
  name VARCHAR(255),
  code VARCHAR(50),
  category VARCHAR(50),
  description TEXT,
  created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  created_by VARCHAR(255),
  updated_by VARCHAR(255),
  tenant_id INT,
  is_enabled BOOLEAN,
  sort_id INT,
  remark TEXT,
  app_id INT
);

-- 客户表
CREATE TABLE oa_cw_customer (
  id INT PRIMARY KEY,
  name VARCHAR(255),
  address VARCHAR(255),
  email VARCHAR(100),
  phone VARCHAR(20),
  created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  created_by VARCHAR(255),
  updated_by VARCHAR(255),
  tenant_id INT,
  is_enabled BOOLEAN,
  sort_id INT,
  remark TEXT,
  app_id INT
);

-- 账户表
CREATE TABLE oa_cw_account (
  id INT PRIMARY KEY,
  name VARCHAR(255),
  type VARCHAR(50),
  balance DECIMAL(18, 2),
  created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  created_by VARCHAR(255),
  updated_by VARCHAR(255),
  tenant_id INT,
  is_enabled BOOLEAN,
  sort_id INT,
  remark TEXT,
  app_id INT
);

-- 收款单表
CREATE TABLE oa_cw_receipt (
  id INT PRIMARY KEY,
  customer_id INT,
  amount DECIMAL(18, 2),
  received_date DATE,
  created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  created_by VARCHAR(255),
  updated_by VARCHAR(255),
  tenant_id INT,
  is_enabled BOOLEAN,
  sort_id INT,
  remark TEXT,
  app_id INT,
  FOREIGN KEY (customer_id) REFERENCES oa_cw_customer(id)
);

-- 支付单表
CREATE TABLE oa_cw_payment (
  id INT PRIMARY KEY,
  supplier_id INT,
  amount DECIMAL(18, 2),
  paid_date DATE,
  created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  created_by VARCHAR(255),
  updated_by VARCHAR(255),
  tenant_id INT,
  is_enabled BOOLEAN,
  sort_id INT,
  remark TEXT,
  app_id INT,
  FOREIGN KEY (supplier_id) REFERENCES oa_cw_supplier(id)
);

-- 供应商表
CREATE TABLE oa_cw_supplier (
  id INT PRIMARY KEY,
  name VARCHAR(255),
  address VARCHAR(255),
  email VARCHAR(100),
  phone VARCHAR(20),
  created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  created_by VARCHAR(255),
  updated_by VARCHAR(255),
  tenant_id INT,
  is_enabled BOOLEAN,
  sort_id INT,
  remark TEXT,
  app_id INT
);
文档更新时间: 2023-09-16 10:01   作者:admin