CREATE TABLE IF NOT EXISTS CONTRACT_COST_ITEM
(
    ID               INT AUTO_INCREMENT NOT NULL,
    COST_ID          INT                NULL comment '合同成本id',
    TITLE            VARCHAR(255)       NULL comment '名称',
    SPECIFICATION    VARCHAR(255)       NULL comment '规格',
    UNIT             VARCHAR(255)       NULL comment '单位',
    IN_EX_TAX_PRICE  double default 0 not null comment '不含税进项单价',
    IN_TAX_RATE      double default 0 not null comment '进项税率',
    IN_TAX_PRICE     double default 0 not null comment '不含税进项总价',
    IN_QUANTITY      double default 0 not null comment '进项数量',
    OUT_EX_TAX_PRICE double default 0 not null comment '不含税出项单价',
    OUT_TAX_RATE     double default 0 not null comment '出项税率',
    OUT_TAX_PRICE    double default 0 not null comment '不含税出项总价',
    OUT_QUANTITY     double default 0 not null comment '出项数量',
    REMARK           VARCHAR(255)       NULL comment '备注',
    CREATE_TIME      DATETIME           NULL comment '创建时间',
    CREATE_BY        INT                NULL comment '创建人',
    UPDATE_TIME      DATETIME           NULL comment '更新时间',
    UPDATE_BY        INT                NULL comment '更新人',
    CONSTRAINT pk_contract_cost_item PRIMARY KEY (ID)
);

ALTER TABLE PROJECT_COST_ITEM
    ADD CONSTRAINT FK_CONTRACT_COST_ITEM_ON_COST FOREIGN KEY (COST_ID) REFERENCES PROJECT_COST (ID);

ALTER TABLE PROJECT_COST_ITEM
    ADD CONSTRAINT FK_CONTRACT_COST_ITEM_ON_CREATE_BY FOREIGN KEY (CREATE_BY) REFERENCES EMPLOYEE (ID);

ALTER TABLE PROJECT_COST_ITEM
    ADD CONSTRAINT FK_CONTRACT_COST_ITEM_ON_UPDATE_BY FOREIGN KEY (UPDATE_BY) REFERENCES EMPLOYEE (ID);