-- 创建表结构
CREATE TABLE if not exists supplier_ms.INVENTORY
(
    ID          INT AUTO_INCREMENT NOT NULL,
    CODE        VARCHAR(255)       NULL comment '编码',
    NAME        VARCHAR(255)       NULL comment '名称',
    tax         FLOAT              NULL comment '税率',
    price       DOUBLE             NULL comment '价格',
    unit        VARCHAR(255)       NULL comment '单位',
    create_date date               NULL comment '创建时间',
    update_date datetime           NULL comment '更新时间',
    CONSTRAINT pk_nverntory PRIMARY KEY (id)
);


select c1_0.ID,
       c1_0.AMOUNT,
       c1_0.CODE,
       c1_0.COMPANY_ID,
       c1_0.CREATED,
       c1_0.DESCRIPTION,
       c1_0.BM_EMPLOYEE_ID,
       c1_0.END_DATE,
       c1_0.EXEC_AMOUNT,
       c1_0.EXEC_QUANTITY,
       c1_0.EXEC_UNTAX_AMOUNT,
       c1_0.GROUP_ID,
       c1_0.GUID,
       c1_0.BM_HANDLER_ID,
       c1_0.INURE_DATE,
       c1_0.INURE_PERSON_ID,
       c1_0.KIND_ID,
       c1_0.NAME,
       c1_0.ORDER_DATE,
       c1_0.PARENT_CODE,
       c1_0.PATH,
       c1_0.PAY_WAY,
       c1_0.PROJECT_ID,
       c1_0.SETUP_DATE,
       c1_0.SETUP_PERSON_ID,
       c1_0.STANDARD_CONTRACT_TEXT,
       c1_0.STANDARD_PAY_WAY,
       c1_0.START_DATE,
       c1_0.STATE,
       c1_0.TOTAL_AMOUNT,
       c1_0.TOTAL_QUANTITY,
       c1_0.TOTAL_UNTAX_AMOUNT,
       c1_0.TYPE_ID,
       c1_0.VARY_DATE,
       c1_0.VARY_PERSON_ID,
       c1_0.VERSION
from CONTRACT c1_0
where c1_0.ID in ((select ci1_0.CONTRACT_ID from CONTRACT_ITEM ci1_0 where ci1_0.INVENTORY_ID = ?))