#原料表
drop table if exists raw_material;
create table raw_material
(
    id               bigint auto_increment primary key,
    product_model_id bigint not null default 0 comment '产品型号id',
    batch_no         varchar(255) null comment '批次号',
    check_type       tinyint null comment '检验类型 0入场检 1车间检 2出厂检',
    check_result     tinyint null comment '检验结果 0合格 1不合格',
    inspect_state    tinyint null comment '类别(0:未提交;1:已提交)',
    check_user_name  varchar(255) null comment '检验员名称',
    check_time       date null comment '检验日期',
    create_time      datetime null comment '录入时间',
    update_time      datetime null comment '更新时间',
    index            idx_product_model_id (product_model_id)
);

drop table if exists raw_material_quality_inspect_item;
create table raw_material_quality_inspect_item
(
    id                      bigint auto_increment primary key,
    raw_material_id         bigint not null default 0 comment '原料id',
    quality_inspect_item_id bigint not null default 0 comment '质量检验项id',
    create_time             datetime null comment '录入时间',
    update_time             datetime null comment '更新时间',
    unique idx_raw_material_id_quality_inspect_item_id (raw_material_id, quality_inspect_item_id)
);

alter table approve_process
    add approve_record_id bigint not null default 0;