CREATE TABLE IF NOT EXISTS "basic_goods_info" (
    "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
    "goods_name" varchar NOT NULL,
    "goods_id" varchar NOT NULL,
    "goods_type" varchar NOT NULL,
    "goods_type_id" bigint NOT NULL,
    "goods_unit" varchar,
    "goods_specs" varchar,
    "goods_remarks" varchar,
    "goods_img_url" varchar,
    "shelf_life" int,
    "belong_business_id" bigint NOT NULL,
    "belong_business_name" varchar NOT NULL,
    "tenant_id" bigint NOT NULL,
    "create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    "deleted" bit NOT NULL DEFAULT FALSE,
    "creator" varchar DEFAULT '',
    "updater" varchar DEFAULT '',
    PRIMARY KEY ("id")
) COMMENT '商品';

CREATE TABLE IF NOT EXISTS "basic_inputs_info" (
   "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
   "inputs_name" varchar NOT NULL,
   "inputs_id" varchar NOT NULL,
   "inputs_unit" varchar NOT NULL,
   "inputs_specs" varchar,
   "inputs_remarks" varchar NOT NULL,
   "inputs_photo_url" varchar,
   "shelf_life" int NOT NULL,
   "belong_business_id" bigint NOT NULL,
   "belong_business_name" varchar NOT NULL,
   "tenant_id" bigint NOT NULL,
   "create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
   "update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
   "deleted" bit NOT NULL DEFAULT FALSE,
   "creator" varchar DEFAULT '',
   "updater" varchar DEFAULT '',
   PRIMARY KEY ("id")
) COMMENT '投入品';

CREATE TABLE IF NOT EXISTS "basic_goods_input_relational" (
  "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
  "goods_info_id" bigint NOT NULL,
  "inputs_info_id" bigint NOT NULL,
  "tenant_id" bigint NOT NULL,
  "create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  "update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  "deleted" bit NOT NULL DEFAULT FALSE,
  "creator" varchar DEFAULT '',
  "updater" varchar DEFAULT '',
  PRIMARY KEY ("id")
) COMMENT '投入品与商品映射表';