Blame view

documents/api/source/01-db.rst 19 KB
熊付 committed
1 2 3
数据库设计
=======================

4
销售合同表
熊付 committed
5 6 7 8 9 10 11
++++++++++++

   表名: tb_contract

   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   |  字段名称             |  是否必填   |  类型     |  限制     |  唯一   |  说明                    |
   +=======================+=============+===========+===========+=========+==========================+
王军业 committed
12
   | contract_unid         | *是*        | PK        |   <=32    |  是     | 合同id                   |
熊付 committed
13
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
王军业 committed
14
   | salesperson_unid      | *是*        | string    |   <=255   |  否     |销售员id,通过auth服务获取|
熊付 committed
15
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
16
   | project_unid          | *是*        | FK        |           |  否     | 项目id(int类型)          |
17
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
18
   | customer_unid         | *是*        | FK        |           |  否     | 客户id(int类型)          |
19
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
王军业 committed
20 21
   | province              | *否*        | string    |   <=32    |  否     | 项目所在地的省份,通过   |
   |                       |             |           |           |         | code服务行选择           |
22
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
王军业 committed
23 24
   | city                  | *否*        | string    |   <=32    |  否     | 项目所在地的市,通过     |
   |                       |             |           |           |         | code服务行选择行选择     |
25
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
王军业 committed
26 27
   | county                | *否*        | string    |   <=32    |  否     | 项目所在地的县(区),通 |
   |                       |             |           |           |         | 过code服务进行选择       |
28
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
王军业 committed
29
   | guarantee_period      | *否*        | int       |           |  否     | 质保周期,单位是月       |
30
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
王军业 committed
31
   | sign_date             | *否*        | date      |           |  否     | 签订时间                 |
32
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
王军业 committed
33
   | product_line_type     | *否*        | string    |   <=32    |  否     | 产品线类型,通过code服务 |
34 35
   |                       |             |           |           |         | 进行选择                 |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
王军业 committed
36
   | contract_state        | *否*        | string    |   <=32    |  否     | 合同状态,通过code服务进 |
37 38
   |                       |             |           |           |         | 行选择                   |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
王军业 committed
39
   | contract_type         | *否*        | string    |   <=32    |  否     | 合同类型,通过code服务进 |
40 41
   |                       |             |           |           |         | 行选择                   |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
王军业 committed
42
   | contract_amount       | *否*        | float     |           |  否     | 合同金额                 |
43
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
王军业 committed
44
   | deduct_amount         | *否*        | float     |           |  否     | 抵扣金额                 |
45 46 47
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | contract_amount_note  | *否*        | text      |           |  否     | 合同金额备注             |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
王军业 committed
48
   | stop_amount           | *否*        | float     |           |  否     | 暂停金额                 |              
49 50 51
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | reback_note           | *否*        | text      |           |  否     | 累计回款额备注           |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
王军业 committed
52
   | exemptions_amount     | *否*        | float     |           |  否     | 豁免金额                 |
53 54 55
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | contract_remain_note  | *否*        | text      |           |  否     | 合同余额备注             |          
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
王军业 committed
56
   | is_archive            | *否*        | bool      |           |  否     | 是否归档                 |            
57
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
王军业 committed
58
   | bad_amount            | *否*        | float     |           |  否     | 坏账金额                 |
59 60 61
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | bad_amount_note       | *否*        | text      |           |  否     | 坏账金额备注             |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
王军业 committed
62
   | confirm_income_amount | *否*        | float     |           |  否     | 确定收入金额             |
63
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
王军业 committed
64
   | amount_state_unid     | *否*        | string    |   <=32    |  否     | 账款状态,通过code服务进行|
65 66
   |                       |             |           |           |         | 选择                     |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
王军业 committed
67
   | start_guarantee_date  | *否*        | date      |           |  否     | 维保服务期开始时间       |
68
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
王军业 committed
69
   | end_guarantee_date    | *否*        | date      |           |  否     | 维保服务期结束时间       |
70
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
王军业 committed
71
   | mainten_start_point   | *否*        | string    |   <=32    |  否     | 质保期开始节点           |
72 73 74
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | contract_note         | *否*        | text      |           |  否     | 合同备注                 |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
王军业 committed
75
   | is_delete             | *否*        | bool      |           |  否     | 合同删除标识             |
76 77 78 79 80 81 82 83 84 85 86
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+

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

   表名:tb_payment_agree
   
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   |  字段名称             |  是否必填   |  类型     |  限制     |  唯一   |  说明                    |
   +=======================+=============+===========+===========+=========+==========================+
87
   | payment_unid          | *是*        | PK        |           |  是     | 主键(自增长的int类型)    |
88
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+ 
王军业 committed
89
   | contract_unid         | *是*        | FK        |   <=32    |  否     | 合同编号                 |
90
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
王军业 committed
91
   | payment_type          | *是*        | string    |   <=32    |  否     | 付款类型,通过code服务进 |
92 93
   |                       |             |           |           |         | 行选择                   |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
王军业 committed
94
   | payment_progress      | *是*        | int       |           |  否     | 付款进度                 |
95
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
王军业 committed
96
   | days                  | *是*        | int       |           |  否     | 天数                     |
97
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
王军业 committed
98
   | payment_propority     | *是*        | float     |           |  否     | 付款比例                 |
99
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
王军业 committed
100
   | payment_requirement   | *否*        | text      |           |  否     | 付款条件                 |
101
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
王军业 committed
102

103 104 105 106 107 108 109 110 111 112
   
   
合同回款信息表
++++++++++++++++++

   表名:tb_return_info
   
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   |  字段名称             |  是否必填   |  类型     |  限制     |  唯一   |  说明                    |
   +=======================+=============+===========+===========+=========+==========================+
113
   | reback_unid           | *是*        | PK        |           |  是     | 主键(自增长的int类型)    |
114
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+ 
王军业 committed
115
   | contract_unid         | *是*        | FK        |   <=32    |  否     | 合同编号                 |
116
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
王军业 committed
117
   | reback_progress       | *是*        | int       |           |  否     | 回款进度                 |
118
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
王军业 committed
119
   | reback_date           | *是*        | date      |           |  否     | 回款时间                 |
120
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
王军业 committed
121
   | actual_reback_amount  | *是*        | float     |           |  否     | 实际回款数额             |
122 123 124 125 126 127 128 129 130 131 132 133 134
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | reback_note           | *否*        | text      |           |  否     | 回款备注                 |          
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   
   
合同开票信息表
+++++++++++++++++++++

   表名:tb_receipt
   
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   |  字段名称             |  是否必填   |  类型     |  限制     |  唯一   |  说明                    |
   +=======================+=============+===========+===========+=========+==========================+
135
   | receipt_unid          | *是*        | PK        |           |  是     |主键(自增长的int类型)     |
136
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
王军业 committed
137
   | contract_unid         | *是*        | FK        |   <=32    |  否     | 合同编号                 |
138
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
王军业 committed
139
   | receipt_progress      | *是*        | int       |           |  否     | 开票进度                 |
140
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
王军业 committed
141
   | receipt_amount        | *是*        | float     |           |  否     | 开票金额                 |
142
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
王军业 committed
143
   | oa_flow_id            | *是*        | string    |   <=32    |  否     | oa流水号                 |
144
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
王军业 committed
145
   | receipt_note          | *否*        | text      |           |  否     | 发票备注                 |
146
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
王军业 committed
147
   | create_date           | *是*        | date      |           |  否     | 开票日期                 |
148 149 150 151 152 153 154 155 156 157 158
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   
   
发货信息表
++++++++++++++++

   表名:tb_deliver_goods
   
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   |  字段名称             |  是否必填   |  类型     |  限制     |  唯一   |  说明                    |
   +=======================+=============+===========+===========+=========+==========================+
159
   | deliver_unid          | *是*        | PK        |           |  是     | 主键(自增长的int类型)    |
160
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
王军业 committed
161 162 163
   | contract_unid         | *是*        | FK        |   <=32    |  否     | 合同编号                 |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | deliver_goods_date    | *是*        | date      |           |  否     | 发货日期                 |
164
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
熊付 committed
165
   | goods_acceptanc_date  | *是*        | date      |           |  否     | 到货验收日期             |
166 167 168 169 170 171
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   
   
工程验收信息表
+++++++++++++++++++

熊付 committed
172
   表名:tb_project_acceptanc
173 174 175 176
   
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   |  字段名称             |  是否必填   |  类型     |  限制     |  唯一   |  说明                    |
   +=======================+=============+===========+===========+=========+==========================+
177
   | acceptanc_unid        | *是*        | PK        |           |  是     | 主键(自增长的int类型)    |
178
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
王军业 committed
179
   | contract_unid         | *是*        | FK        |   <=32    |  否     | 合同编号                 |
180
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
熊付 committed
181
   | acceptanc_type        | *是*        | string    |   <=32    |  否     | 验收类型(1为初验、2为终验|
182
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
熊付 committed
183
   | acceptanc_date        | *是*        | date      |           |  否     | 验收时间                 |
184
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
熊付 committed
185
   | acceptanc_note        | *否*        | text      |           |  否     | 验收备注                 |              
186 187 188 189 190 191 192 193 194 195 196
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   
   
附件表
++++++++++++

   表名:tb_appendix
   
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   |  字段名称             |  是否必填   |  类型     |  限制     |  唯一   |  说明                    |
   +=======================+=============+===========+===========+=========+==========================+
197
   | appendix_unid         | *是*        | PK        |           |  是     | 附件主键(自增长的int类型)|
王军业 committed
198
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
王军业 committed
199 200
   | business_table        | *是*        | string    |   <=32    |  否     | 业务表名                 |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
201
   | business_unid         | *是*        | string    |   <=32    |  否     | 业务表主键               |
王军业 committed
202
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
王军业 committed
203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222
   | appendix_name         | *是*        | string    |   <=255   |  否     | 附件文件名               |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | appendix_type         | *是*        | string    |   <=32    |  否     | 附件类型                 |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | appendix_url          | *是*        | string    |   <=255   |  否     | 附件下载地址             |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   
   

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

   表名:tb_project

   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   |  字段名称             |  是否必填   |  类型     |  限制     |  唯一   |  说明                    |
   +=======================+=============+===========+===========+=========+==========================+
223
   | project_unid          | *是*        | PK        |           |  是     | 项目id(自增长的int类型)  |
王军业 committed
224 225 226 227 228 229 230 231 232 233 234 235 236
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   | project_name          | *是*        | string    |   <=255   |  是     | 项目名称                 |
   +-----------------------+-------------+-----------+-----------+---------+--------------------------+
   
   
客户表
++++++++++++

   表名:tb_customer

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