-- ----------------------------
-- Table structure for watershed_equipment
-- ----------------------------
DROP TABLE IF EXISTS "watershed_equipment";
CREATE TABLE "watershed_equipment" (
  "equipment_id" BIGINT NOT NULL AUTO_INCREMENT,
  "equipment_code" VARCHAR(50) NOT NULL,
  "equipment_name" VARCHAR(100) NOT NULL,
  "equipment_type" VARCHAR(50) NOT NULL,
  "facility_id" BIGINT,
  "facility_name" VARCHAR(100),
  "install_location" VARCHAR(255),
  "install_date" DATE,
  "status" CHAR(1) NOT NULL DEFAULT '0',
  "manufacturer" VARCHAR(100),
  "model" VARCHAR(100),
  "rated_power" DECIMAL(10,2),
  "rated_voltage" DECIMAL(10,2),
  "rated_current" DECIMAL(10,2),
  "maintenance_cycle" INTEGER,
  "last_maintenance_time" DATE,
  "next_maintenance_time" DATE,
  "create_by" VARCHAR(64) DEFAULT '',
  "create_time" DATETIME,
  "update_by" VARCHAR(64) DEFAULT '',
  "update_time" DATETIME,
  "remark" VARCHAR(500) DEFAULT NULL,
  PRIMARY KEY ("equipment_id")
);

-- ----------------------------
-- Records of watershed_equipment
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Checks for watershed_equipment
-- ----------------------------
ALTER TABLE "watershed_equipment" ADD CONSTRAINT "watershed_equipment_check_1" CHECK ("status" IN ('0','1','2','3'));

-- ----------------------------
-- Comments for watershed_equipment
-- ----------------------------
COMMENT ON TABLE "watershed_equipment" IS '机电设备表';
COMMENT ON COLUMN "watershed_equipment"."equipment_id" IS '设备ID';
COMMENT ON COLUMN "watershed_equipment"."equipment_code" IS '设备编号';
COMMENT ON COLUMN "watershed_equipment"."equipment_name" IS '设备名称';
COMMENT ON COLUMN "watershed_equipment"."equipment_type" IS '设备类型';
COMMENT ON COLUMN "watershed_equipment"."facility_id" IS '所属设施ID';
COMMENT ON COLUMN "watershed_equipment"."facility_name" IS '所属设施名称';
COMMENT ON COLUMN "watershed_equipment"."install_location" IS '安装位置';
COMMENT ON COLUMN "watershed_equipment"."install_date" IS '安装日期';
COMMENT ON COLUMN "watershed_equipment"."status" IS '设备状态（0正常运行 1维护中 2故障 3待机）';
COMMENT ON COLUMN "watershed_equipment"."manufacturer" IS '制造商';
COMMENT ON COLUMN "watershed_equipment"."model" IS '型号';
COMMENT ON COLUMN "watershed_equipment"."rated_power" IS '额定功率';
COMMENT ON COLUMN "watershed_equipment"."rated_voltage" IS '额定电压';
COMMENT ON COLUMN "watershed_equipment"."rated_current" IS '额定电流';
COMMENT ON COLUMN "watershed_equipment"."maintenance_cycle" IS '维护周期（天）';
COMMENT ON COLUMN "watershed_equipment"."last_maintenance_time" IS '上次维护时间';
COMMENT ON COLUMN "watershed_equipment"."next_maintenance_time" IS '下次维护时间';
COMMENT ON COLUMN "watershed_equipment"."create_by" IS '创建者';
COMMENT ON COLUMN "watershed_equipment"."create_time" IS '创建时间';
COMMENT ON COLUMN "watershed_equipment"."update_by" IS '更新者';
COMMENT ON COLUMN "watershed_equipment"."update_time" IS '更新时间';
COMMENT ON COLUMN "watershed_equipment"."remark" IS '备注';