From b03cac3e5ab0b4e32c895f5682ab16448b6abe73 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Sun, 1 Dec 2024 13:52:48 +0800 Subject: [PATCH] bugfix --- models/mysql.ddl.sql | 295 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 295 insertions(+) create mode 100644 models/mysql.ddl.sql diff --git a/models/mysql.ddl.sql b/models/mysql.ddl.sql new file mode 100644 index 0000000..3adf09f --- /dev/null +++ b/models/mysql.ddl.sql @@ -0,0 +1,295 @@ + +-- ./acc_detail.xlsx + + + + + +drop table if exists acc_detail; +CREATE TABLE acc_detail +( + + `id` VARCHAR(32) comment 'id', + `accountid` VARCHAR(32) comment '账户id', + `acc_no` int comment '明细顺序号', + `acc_date` date comment '记账日期', + `acc_timestamp` TIMESTAMP DEFAULT CURRENT_TIMESTAMP comment '记账时间戳', + `acc_dir` VARCHAR(1) comment '记账方向', + `summary` VARCHAR(255) comment '摘要', + `amount` double(18,2) comment '记账金额', + `balance` double(18,2) comment '账户余额', + `acclogid` VARCHAR(32) comment '账务流水id' + + +,primary key(id) + + +) +engine=innodb +default charset=utf8 +comment '账户明细表' +; + + +-- ./account_config.xlsx + + + + + +drop table if exists account_config; +CREATE TABLE account_config +( + + `id` VARCHAR(32) comment 'id', + `partytype` VARCHAR(255) comment '参与方类型', + `subjectname` VARCHAR(32) comment '科目名称' + + +,primary key(id) + + +) +engine=innodb +default charset=utf8 +comment '账户配置表' +; + + +-- ./accounting_config.xlsx + + + + + +drop table if exists accounting_config; +CREATE TABLE accounting_config +( + + `id` VARCHAR(32) comment 'id', + `action` VARCHAR(255) comment '交易', + `specstr` VARCHAR(255) comment '特性', + `accounting_orgtype` VARCHAR(256) comment '账务机构', + `accounting_dir` VARCHAR(255) comment '记账方向', + `orgtype` VARCHAR(32) comment '机构类型', + `subjectname` VARCHAR(21) comment '科目名', + `amt_pattern` VARCHAR(255) comment '金额模板' + + +,primary key(id) + + +) +engine=innodb +default charset=utf8 +comment '记账配置表' +; + + +-- ./ledger.xlsx + + + + + +drop table if exists ledger; +CREATE TABLE ledger +( + + `id` VARCHAR(32) comment 'id', + `accounting_orgid` VARCHAR(32) comment '账本机构', + `subjectid` VARCHAR(32) comment '科目号', + `acc_date` date comment '账务日期', + `d_balance` double(18,2) comment '借方余额', + `c_balance` double(18,2) comment '贷方余额' + + +,primary key(id) + + +) +engine=innodb +default charset=utf8 +comment '总账表' +; + + +-- ./subject.xlsx + + + + + +drop table if exists subject; +CREATE TABLE subject +( + + `id` VARCHAR(32) comment 'id', + `name` VARCHAR(255) comment '科目名称', + `balance_side` VARCHAR(1) comment '余额方向', + `subjecttype` VARCHAR(30) comment '科目类别' + + +,primary key(id) + + +) +engine=innodb +default charset=utf8 +comment '科目表' +; + + +-- ./bill_detail.xlsx + + + + + +drop table if exists bill_detail; +CREATE TABLE bill_detail +( + + `id` VARCHAR(32) comment 'id', + `accounting_orgid` VARCHAR(32) comment '账务机构id', + `billid` VARCHAR(32) comment '账单ID', + `description` VARCHAR(255) comment '账务说明', + `participantid` VARCHAR(32) comment '记账方id', + `participanttype` VARCHAR(255) comment '记账方类型', + `subjectname` VARCHAR(255) comment '科目名称', + `accounting_dir` VARCHAR(255) comment '记账方向', + `amount` double(18,2) comment '账单金额' + + +,primary key(id) + + +) +engine=innodb +default charset=utf8 +comment '账单明细' +; + + +-- ./acc_balance.xlsx + + + + + +drop table if exists acc_balance; +CREATE TABLE acc_balance +( + + `id` VARCHAR(32) comment 'id', + `accountid` VARCHAR(32) comment '账户id', + `acc_date` date comment '记账日期', + `balance` double(18,6) comment '账户余额' + + +,primary key(id) + + +) +engine=innodb +default charset=utf8 +comment '账户余额表' +; + + +-- ./account.xlsx + + + + + +drop table if exists account; +CREATE TABLE account +( + + `id` VARCHAR(32) comment 'id', + `accounting_orgid` VARCHAR(32) comment '账本机构', + `orgid` VARCHAR(32) comment '机构id', + `subjectid` VARCHAR(21) comment '科目号', + `balance_at` VARCHAR(1) comment '余额方向', + `max_detailno` int comment '最大明细顺序号' + + +,primary key(id) + + +) +engine=innodb +default charset=utf8 +comment '机构账户表' +; + +CREATE UNIQUE INDEX account_idx1 ON account(accounting_orgid,orgid,subjectid); + +-- ./accounting_log.xlsx + + + + + +drop table if exists accounting_log; +CREATE TABLE accounting_log +( + + `id` VARCHAR(32) comment 'id', + `accountid` VARCHAR(32) comment '账户id', + `acc_date` date comment '记账日期', + `acc_timestamp` TIMESTAMP DEFAULT CURRENT_TIMESTAMP comment '记账时间戳', + `acc_dir` VARCHAR(1) comment '记账方向', + `summary` VARCHAR(255) comment '摘要', + `amount` double(18,2) comment '记账金额', + `billid` VARCHAR(32) comment '账单id' + + +,primary key(id) + + +) +engine=innodb +default charset=utf8 +comment '账务流水表' +; + + +-- ./bill.xlsx + + + + + +drop table if exists bill; +CREATE TABLE bill +( + + `id` VARCHAR(32) comment 'id', + `customerid` VARCHAR(32) comment '客户编号', + `orderid` VARCHAR(32) comment '订单编号', + `ordergoodsid` VARCHAR(32) comment '订单明细id', + `business_op` VARCHAR(255) comment '业务操作', + `provider_amt` double(18,2) comment '未折扣金额', + `quantity` int comment '购买数量', + `amount` double(18,2) comment '金额', + `bill_date` date comment '账单日期', + `bill_timestamp` TIMESTAMP DEFAULT CURRENT_TIMESTAMP comment '账单时间戳', + `bill_state` VARCHAR(1) comment '账单状态', + `productid` VARCHAR(32) comment '产品id', + `providerid` VARCHAR(32) comment '供应商id', + `provider_billid` VARCHAR(256) comment '供应商账单id', + `resourceid` VARCHAR(32) comment '资源id' + + +,primary key(id) + + +) +engine=innodb +default charset=utf8 +comment '账单' +; + +