01-db.rst.txt 19 KB
数据库设计
=======================

销售合同表
++++++++++++

   表名: tb_contract

   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   |  字段名称             |  是否必填   |  类型     |  限制     |  唯一   |  说明                    |
   +=======================+=============+===========+===========+=========+==========================+
   | contract_unid         | *是*        | PK        |   <=32    |  是     | 合同id                   |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | salesperson_unid      | *是*        | string    |   <=255   |  否     |销售员id,通过auth服务获取|
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | project_unid          | *是*        | FK        |           |  否     | 项目id(int类型)          |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | customer_unid         | *是*        | FK        |           |  否     | 客户id(int类型)          |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | province              | *否*        | string    |   <=32    |  否     | 项目所在地的省份,通过   |
   |                       |             |           |           |         | code服务行选择           |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | city                  | *否*        | string    |   <=32    |  否     | 项目所在地的市,通过     |
   |                       |             |           |           |         | code服务行选择行选择     |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | county                | *否*        | string    |   <=32    |  否     | 项目所在地的县(区),通 |
   |                       |             |           |           |         | 过code服务进行选择       |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | guarantee_period      | *否*        | int       |           |  否     | 质保周期,单位是月       |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | sign_date             | *否*        | date      |           |  否     | 签订时间                 |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | product_line_type     | *否*        | string    |   <=32    |  否     | 产品线类型,通过code服务 |
   |                       |             |           |           |         | 进行选择                 |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | contract_state        | *否*        | string    |   <=32    |  否     | 合同状态,通过code服务进 |
   |                       |             |           |           |         | 行选择                   |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | contract_type         | *否*        | string    |   <=32    |  否     | 合同类型,通过code服务进 |
   |                       |             |           |           |         | 行选择                   |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | contract_amount       | *否*        | float     |           |  否     | 合同金额                 |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | deduct_amount         | *否*        | float     |           |  否     | 抵扣金额                 |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | contract_amount_note  | *否*        | text      |           |  否     | 合同金额备注             |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | stop_amount           | *否*        | float     |           |  否     | 暂停金额                 |              
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | reback_note           | *否*        | text      |           |  否     | 累计回款额备注           |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | exemptions_amount     | *否*        | float     |           |  否     | 豁免金额                 |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | contract_remain_note  | *否*        | text      |           |  否     | 合同余额备注             |          
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | is_archive            | *否*        | bool      |           |  否     | 是否归档                 |            
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | bad_amount            | *否*        | float     |           |  否     | 坏账金额                 |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | bad_amount_note       | *否*        | text      |           |  否     | 坏账金额备注             |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | confirm_income_amount | *否*        | float     |           |  否     | 确定收入金额             |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | amount_state_unid     | *否*        | string    |   <=32    |  否     | 账款状态,通过code服务进行|
   |                       |             |           |           |         | 选择                     |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | start_guarantee_date  | *否*        | date      |           |  否     | 维保服务期开始时间       |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | end_guarantee_date    | *否*        | date      |           |  否     | 维保服务期结束时间       |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | mainten_start_point   | *否*        | string    |   <=32    |  否     | 质保期开始节点           |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | contract_note         | *否*        | text      |           |  否     | 合同备注                 |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | is_delete             | *否*        | bool      |           |  否     | 合同删除标识             |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+

   
付款约定表
++++++++++++

   表名:tb_payment_agree
   
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   |  字段名称             |  是否必填   |  类型     |  限制     |  唯一   |  说明                    |
   +=======================+=============+===========+===========+=========+==========================+
   | payment_unid          | *是*        | PK        |           |  是     | 主键(自增长的int类型)    |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+ 
   | contract_unid         | *是*        | FK        |   <=32    |  否     | 合同编号                 |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | payment_type          | *是*        | string    |   <=32    |  否     | 付款类型,通过code服务进 |
   |                       |             |           |           |         | 行选择                   |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | payment_progress      | *是*        | int       |           |  否     | 付款进度                 |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | days                  | *是*        | int       |           |  否     | 天数                     |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | payment_propority     | *是*        | float     |           |  否     | 付款比例                 |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | payment_requirement   | *否*        | text      |           |  否     | 付款条件                 |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+

   
   
合同回款信息表
++++++++++++++++++

   表名:tb_return_info
   
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   |  字段名称             |  是否必填   |  类型     |  限制     |  唯一   |  说明                    |
   +=======================+=============+===========+===========+=========+==========================+
   | reback_unid           | *是*        | PK        |           |  是     | 主键(自增长的int类型)    |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+ 
   | contract_unid         | *是*        | FK        |   <=32    |  否     | 合同编号                 |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | reback_progress       | *是*        | int       |           |  否     | 回款进度                 |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | reback_date           | *是*        | date      |           |  否     | 回款时间                 |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | actual_reback_amount  | *是*        | float     |           |  否     | 实际回款数额             |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | reback_note           | *否*        | text      |           |  否     | 回款备注                 |          
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   
   
合同开票信息表
+++++++++++++++++++++

   表名:tb_receipt
   
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   |  字段名称             |  是否必填   |  类型     |  限制     |  唯一   |  说明                    |
   +=======================+=============+===========+===========+=========+==========================+
   | receipt_unid          | *是*        | PK        |           |  是     |主键(自增长的int类型)     |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | contract_unid         | *是*        | FK        |   <=32    |  否     | 合同编号                 |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | receipt_progress      | *是*        | int       |           |  否     | 开票进度                 |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | receipt_amount        | *是*        | float     |           |  否     | 开票金额                 |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | oa_flow_id            | *是*        | string    |   <=32    |  否     | oa流水号                 |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | receipt_note          | *否*        | text      |           |  否     | 发票备注                 |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | create_date           | *是*        | date      |           |  否     | 开票日期                 |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   
   
发货信息表
++++++++++++++++

   表名:tb_deliver_goods
   
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   |  字段名称             |  是否必填   |  类型     |  限制     |  唯一   |  说明                    |
   +=======================+=============+===========+===========+=========+==========================+
   | deliver_unid          | *是*        | PK        |           |  是     | 主键(自增长的int类型)    |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | contract_unid         | *是*        | FK        |   <=32    |  否     | 合同编号                 |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | deliver_goods_date    | *是*        | date      |           |  否     | 发货日期                 |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | goods_acceptanc_date  | *是*        | date      |           |  否     | 到货验收日期             |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   
   
工程验收信息表
+++++++++++++++++++

   表名:tb_project_acceptanc
   
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   |  字段名称             |  是否必填   |  类型     |  限制     |  唯一   |  说明                    |
   +=======================+=============+===========+===========+=========+==========================+
   | acceptanc_unid        | *是*        | PK        |           |  是     | 主键(自增长的int类型)    |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | contract_unid         | *是*        | FK        |   <=32    |  否     | 合同编号                 |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | acceptanc_type        | *是*        | string    |   <=32    |  否     | 验收类型(1为初验、2为终验|
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | acceptanc_date        | *是*        | date      |           |  否     | 验收时间                 |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | acceptanc_note        | *否*        | text      |           |  否     | 验收备注                 |              
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   
   
附件表
++++++++++++

   表名:tb_appendix
   
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   |  字段名称             |  是否必填   |  类型     |  限制     |  唯一   |  说明                    |
   +=======================+=============+===========+===========+=========+==========================+
   | appendix_unid         | *是*        | PK        |           |  是     | 附件主键(自增长的int类型)|
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | business_table        | *是*        | string    |   <=32    |  否     | 业务表名                 |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | business_unid         | *是*        | string    |   <=32    |  否     | 业务表主键               |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | appendix_name         | *是*        | string    |   <=255   |  否     | 附件文件名               |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | appendix_type         | *是*        | string    |   <=32    |  否     | 附件类型                 |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | appendix_url          | *是*        | string    |   <=255   |  否     | 附件下载地址             |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   
   

   
   
   
项目表
++++++++++++

   表名:tb_project

   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   |  字段名称             |  是否必填   |  类型     |  限制     |  唯一   |  说明                    |
   +=======================+=============+===========+===========+=========+==========================+
   | project_unid          | *是*        | PK        |           |  是     | 项目id(自增长的int类型)  |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | project_name          | *是*        | string    |   <=255   |  是     | 项目名称                 |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   
   
客户表
++++++++++++

   表名:tb_customer

   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   |  字段名称             |  是否必填   |  类型     |  限制     |  唯一   |  说明                    |
   +=======================+=============+===========+===========+=========+==========================+
   | customer_unid         | *是*        | PK        |           |  是     | 客户id(自增长的int类型)  |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | customer_name         | *是*        | string    |   <=255   |  是     | 客户名称                 |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+