Files
fad_oa/script/sql/progress.sql

98 lines
6.9 KiB
SQL
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

create table if not exists sys_oa_project
(
project_id bigint not null comment 'ID'
primary key,
project_name varchar(126) default '' null comment '项目名称',
project_num varchar(64) default '' null comment '项目编号',
project_type char null comment '项目类型(1中标2其他)',
address varchar(126) default '' null comment '项目地址',
funds decimal(24, 2) null comment '项目总款',
functionary varchar(32) default '' null comment '项目负责人',
begin_time datetime null comment '开始日期',
finish_time datetime null comment '结束日期',
delivery varchar(64) null comment '交货期',
guarantee varchar(64) null comment '质保期',
introduction varchar(256) default '' null comment '项目介绍',
project_grade char default '0' null comment '优先级0一般 1中 2高',
project_status char default '0' null comment '状态0进行中 1完结',
contract_id bigint null comment '关联合同ID',
invoice_name varchar(64) collate utf8mb4_general_ci null comment '开票单位名称',
invoice_number varchar(32) collate utf8mb4_general_ci null comment '纳税人识别号',
invoice_address varchar(128) collate utf8mb4_general_ci null comment '开票地址电话',
invoice_bank varchar(128) collate utf8mb4_general_ci null comment '开户行及账号',
accessory text null comment '附件',
bail json null comment '履约保证金',
remark varchar(256) null comment '备注',
create_by varchar(32) default '' null comment '创建者',
create_time datetime null comment '创建时间',
update_by varchar(32) default '' null comment '更新者',
update_time datetime null comment '更新时间',
is_postpone int default 0 null comment '是否延期',
postpone_reason varchar(1024) null comment '延期原因',
postpone_time datetime null comment '延期至日期',
color varchar(20) null comment '代表颜色',
trade_type int default 0 null comment '交易类型',
pre_pay double default 0 null comment '预付款'
)
comment '项目管理表' charset = utf8mb4;
create table if not exists oa_progress
(
progress_id bigint auto_increment comment '主键ID'
primary key,
project_id bigint default 0 not null comment '所属项目ID(可根据实际需要)',
type tinyint default 1 not null comment '进度类型1-项目进度2-付款进度(可根据实际约定)',
progress_name varchar(200) default '' not null comment '进度名称',
parent_id bigint default 0 not null comment '父进度ID0或NULL表示没有父节点',
create_by varchar(40) default '' not null comment '创建者',
create_time datetime default CURRENT_TIMESTAMP not null comment '创建时间',
update_by varchar(40) default '' not null comment '更新者',
update_time datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '更新时间',
del_flag tinyint default 0 not null comment '删除标志0-正常1-删除',
sort int default 0 not null comment '排序字段(如需)',
remark varchar(500) default '' not null comment '备注(如需)',
status int default 0 null comment '状态位',
amount int default 0 null comment '设备数量',
time_remark varchar(200) null comment '时间(备注)',
contact_phone varchar(20) null comment '联系人电话'
)
comment '项目进度主表';
create index idx_parent_id
on oa_progress (parent_id);
create index idx_project_id
on oa_progress (project_id);
create index idx_type
on oa_progress (type);
create table if not exists oa_progress_detail
(
detail_id bigint auto_increment comment '主键ID'
primary key,
progress_id bigint not null comment '关联的进度ID关联 project_progress.id',
detail_name varchar(50) null comment '子进度名称',
plan_start_date date null comment '计划开始日期(项目进度)',
plan_end_date date null comment '计划结束日期(项目进度)',
actual_start_date date null comment '实际开始日期(项目进度)',
actual_end_date date null comment '实际结束日期(项目进度)',
complete_percent decimal(5, 2) default 0.00 not null comment '完成百分比(项目进度)',
plan_pay_date date null comment '计划付款日期(付款进度)',
pay_amount decimal(18, 2) default 0.00 not null comment '应付金额(付款进度)',
paid_amount decimal(18, 2) default 0.00 not null comment '已付金额(付款进度)',
detail_status int default 0 null comment '子进度状态',
create_by varchar(40) default '' not null comment '创建者',
create_time datetime default CURRENT_TIMESTAMP not null comment '创建时间',
update_by varchar(40) default '' not null comment '更新者',
update_time datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '更新时间',
del_flag tinyint default 0 not null comment '删除标志0-正常1-删除',
remark varchar(500) default '' not null comment '备注(如需)',
department varchar(30) null comment '负责部门'
)
comment '项目进度/付款进度扩展表';
create index idx_progress_id
on oa_progress_detail (progress_id);