[关闭]
@Wahson 2019-11-10T19:01:39.000000Z 字数 1447 阅读 477

发票管理模型

wanbo


  1. use payment_db;
  2. create table invoice
  3. (
  4. id bigint auto_increment primary key,
  5. invoice_no varchar(12) not null comment '发票号码',
  6. type smallint(2) not null comment '发票类型invoiceType, 1:专用发票(special)',
  7. type_code varchar(12) not null comment '类别代码',
  8. class smallint(2) not null comment '发票种类,1:进项发票(input_invoice);2:销项发票(output_invoice)',
  9. company_id bigint not null comment '公司id',
  10. company_name varchar(100) not null comment '公司名称',
  11. amount decimal(13, 2) not null comment '开票金额',
  12. amount_with_tax decimal(13, 2) not null comment '含税金额',
  13. attachment_id bigint not null comment '发票附件id',
  14. invoice_by int(5) null comment '开票人,进项发票时为null',
  15. invoice_at datetime null comment '开票时间,进项发票时为null',
  16. created_at timestamp default current_timestamp() not null,
  17. created_by int default 0 not null,
  18. updated_at timestamp default current_timestamp() not null on update current_timestamp(),
  19. updated_by int default 0 not null,
  20. remark varchar(128) null
  21. ) comment '发票' charset = utf8mb4 engine = innoDb;
  22. create table invoice_detail
  23. (
  24. id bigint auto_increment primary key,
  25. invoice_id bigint not null comment 'invoice.id',
  26. related_item_id bigint not null comment '关联子单id',
  27. weight decimal(8, 3) not null comment '开票数量',
  28. tax_rate decimal(5, 4) not null comment '税率',
  29. amount decimal(13, 2) not null comment '开票金额',
  30. created_at timestamp default current_timestamp() not null,
  31. created_by int default 0 not null,
  32. updated_at timestamp default current_timestamp() not null on update current_timestamp(),
  33. updated_by int default 0 not null,
  34. remark varchar(128) null,
  35. key ind_invoice(invoice_id),
  36. key idx_related_item(related_item_id)
  37. ) comment '发票详情' charset = utf8mb4 engine = innoDb;
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注