
# 设备台账
create table `product-inventory-management`.device_repair
(
    id                 bigint auto_increment
        primary key,
    device_ledger_id   varchar(255) not null comment '设备台账id',
    repair_time        timestamp    null comment '报修日期',
    repair_name        varchar(255) not null comment '报修人',
    remark             varchar(255) not null comment '故障现象',
    maintenance_name   varchar      not null comment '维修人',
    maintenance_time   timestamp    null comment '维修时间',
    maintenance_result varchar(255) null comment '维修结果',
    status             int default 0 comment '状态',
    create_time        datetime     null comment '录入时间',
    update_time        datetime     null comment '更新时间',
    create_user        varchar(255) not null comment '录入人',
    update_user        varchar(255) not null comment '更新人',
    tenant_id          bigint       not null comment '租户id'
);

# 设备维修
create table `product-inventory-management`.device_ledger
(
    id                           bigint auto_increment
        primary key,
    device_name                  varchar(255) not null comment '设备名称',
    device_model                 varchar(255) not null comment '规格型号',
    supplier_name                varchar(255) not null comment '供应商',
    unit                         varchar(255) not null comment '单位',
    number                       decimal      not null comment '数量',
    tax_including_price_unit     decimal      not null comment '含税单价',
    tax_including_price_total    decimal      not null comment '含税总价',
    tax_rate                     decimal      not null comment '税率',
    un_tax_including_price_total decimal      not null comment '不含税总价',
    create_time                  timestamp    null comment '录入时间',
    update_time                  timestamp    null comment '更新时间',
    create_user                  varchar(255) not null comment '录入人',
    update_user                  varchar(255) not null comment '更新人',
    tenant_id                    bigint       not null comment '租户id'
);

create table `product-inventory-management`.device_maintenance
(
    id                 bigint auto_increment
        primary key,
    device_ledger_id   varchar(255) not null comment '设备台账id',
    maintenance__plan_time        timestamp    null comment '计划保养日期',
    maintenance_actually_name   varchar(255)      not null comment '实际保养人',
    maintenance_actually_time   timestamp    null comment '实际保养日期',
    maintenance_result int not null  default 0 comment '保养结果 0 维修 1 完好',
    status             int not null  default 0 comment '状态 0 待保养 1 完结',
    create_time        datetime     null comment '录入时间',
    update_time        datetime     null comment '更新时间',
    create_user        varchar(255) not null comment '录入人',
    update_user        varchar(255) not null comment '更新人',
    tenant_id          bigint       not null comment '租户id'
);