昨天 684e4306a08feeae188070f264148e6765da8dcf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# 往来付款回款流水表
# 客户往来取 party_type=1 and direction=1 作为「回款」列(返回字段 receiptRecordAmount)
# 供应商往来取 party_type=2 and direction=2 作为「付款」列(返回字段 paymentRecordAmount)
# 注意:direction 取值按页面固定,不要按下面 §方向 的字面(1付款 2回款)去选
# 合作商往来取 party_type=3 and direction=1 作为「已付款」列
drop table if exists payment_record;
create table payment_record
(
    id             bigint auto_increment primary key,
    party_type     tinyint        not null comment '往来方类型 1客户 2供应商 3合作商',
    party_id       bigint         not null comment '客户id或供应商id',
    direction      tinyint        not null comment '方向 1付款 2回款',
    amount         decimal(18, 2) not null default 0 comment '金额',
    record_date    date           null comment '发生日期',
    payment_method varchar(64)    null comment '付款/回款方式',
    remark         varchar(500)   null comment '备注',
    tenant_id      bigint         null comment '租户ID',
    dept_id        bigint         null comment '部门ID',
    create_user    int            null comment '创建人ID',
    create_time    datetime       null comment '创建时间',
    update_user    int            null comment '更新人ID',
    update_time    datetime       null comment '更新时间',
    index idx_party (party_type, party_id),
    index idx_direction (direction)
);