--岗位处理
DROP TABLE MES_POST_HANDLE;
CREATE TABLE MES_POST_HANDLE
(
    ID            NUMBER(20,0) NOT NULL ENABLE,
    TENANT_ID     NVARCHAR2(12),
    CREATE_USER   NUMBER(20,0),
    CREATE_TIME   DATE,
    CREATE_DEPT   NUMBER(20,0),
    UPDATE_USER   NUMBER(20,0),
    UPDATE_TIME   DATE,
    STATUS        NUMBER(11,0) DEFAULT 1,
    IS_DELETED    NUMBER(11,0) DEFAULT 0,
    USER_ID       NUMBER(20,0) NOT NULL ENABLE,
    NAME          NVARCHAR2(32),
    NATION        NVARCHAR2(32),
    AGE           NUMBER(3,0),
    ID_CARD       NVARCHAR2(64),
    NATIVE_PLACE  NVARCHAR2(255),
    DEPT_ID       NUMBER(20,0),
    STATION       NVARCHAR2(255),
    DATA_BIRTH    DATE,
    FACE          NVARCHAR2(32),
    MARRIAGE      CHAR(1),
    SCHOOL        NVARCHAR2(255),
    MAJOR         NVARCHAR2(255),
    EDUCATION     NVARCHAR2(255),
    END_DATE      DATE,
    STAFF_TYPE    NUMBER(3,0),
    JOIN_JOB_DATE DATE,
    SKILL         NUMBER(3,0),
    IN_JOB_DATE   DATE,
    CON_EXP_DATE  DATE,
    ADDRESS       NVARCHAR2(255),
    TO_NEW_JOB    DATE,
    PH_STATUS     NUMBER(3,0),
    CHECK (ID IS NOT NULL) ENABLE,
    PRIMARY KEY (ID)
) TABLESPACE JONHON_MES_DATA;
COMMENT
ON COLUMN MES_POST_HANDLE.CREATE_USER IS '创建人';
COMMENT
ON COLUMN MES_POST_HANDLE.CREATE_TIME IS '创建时间';
COMMENT
ON COLUMN MES_POST_HANDLE.CREATE_DEPT IS '创建部门';
COMMENT
ON COLUMN MES_POST_HANDLE.UPDATE_USER IS '更新人';
COMMENT
ON COLUMN MES_POST_HANDLE.UPDATE_TIME IS '更新时间';
COMMENT
ON COLUMN MES_POST_HANDLE.STATUS IS '状态;1、空闲；2、使用中';
COMMENT
ON COLUMN MES_POST_HANDLE.IS_DELETED IS '删除标记;1:删除，0:正常';
COMMENT
ON COLUMN MES_POST_HANDLE.USER_ID IS '用户ID';
COMMENT
ON COLUMN MES_POST_HANDLE.NAME IS '名称';
COMMENT
ON COLUMN MES_POST_HANDLE.NATION IS '民族';
COMMENT
ON COLUMN MES_POST_HANDLE.AGE IS '年龄';
COMMENT
ON COLUMN MES_POST_HANDLE.ID_CARD IS '身份证号码';
COMMENT
ON COLUMN MES_POST_HANDLE.NATIVE_PLACE IS '籍贯';
COMMENT
ON COLUMN MES_POST_HANDLE.DEPT_ID IS '班组ID';
COMMENT
ON COLUMN MES_POST_HANDLE.STATION IS '所属岗位';
COMMENT
ON COLUMN MES_POST_HANDLE.DATA_BIRTH IS '出生日期';
COMMENT
ON COLUMN MES_POST_HANDLE.FACE IS '政治面貌';
COMMENT
ON COLUMN MES_POST_HANDLE.MARRIAGE IS '婚姻状态(0未婚，1已婚)';
COMMENT
ON COLUMN MES_POST_HANDLE.SCHOOL IS '毕业院校';
COMMENT
ON COLUMN MES_POST_HANDLE.MAJOR IS '所学专业';
COMMENT
ON COLUMN MES_POST_HANDLE.EDUCATION IS '最高学历';
COMMENT
ON COLUMN MES_POST_HANDLE.END_DATE IS '毕业时间';
COMMENT
ON COLUMN MES_POST_HANDLE.STAFF_TYPE IS '用工类型';
COMMENT
ON COLUMN MES_POST_HANDLE.JOIN_JOB_DATE IS '参加工作时间';
COMMENT
ON COLUMN MES_POST_HANDLE.SKILL IS '技能等级';
COMMENT
ON COLUMN MES_POST_HANDLE.IN_JOB_DATE IS '任现职时间';
COMMENT
ON COLUMN MES_POST_HANDLE.CON_EXP_DATE IS '合同到期';
COMMENT
ON COLUMN MES_POST_HANDLE.ADDRESS IS '家庭住址';
COMMENT
ON COLUMN MES_POST_HANDLE.TO_NEW_JOB IS '转岗时间';
COMMENT
ON COLUMN MES_POST_HANDLE.PH_STATUS IS '1实习-培训中,2转岗中,3正常,4下岗中,5离职,6培训合格,7培训不合格';
COMMENT
ON TABLE MES_POST_HANDLE IS '岗位处理';

--培训安排
DROP TABLE MES_CULTIVATE_DETAIL;
CREATE TABLE MES_CULTIVATE_DETAIL
(
    ID              NUMBER(20,0) NOT NULL ENABLE,
    TENANT_ID       NVARCHAR2(12),
    CREATE_USER     NUMBER(20,0),
    CREATE_TIME     DATE,
    CREATE_DEPT     NUMBER(20,0),
    UPDATE_USER     NUMBER(20,0),
    UPDATE_TIME     DATE,
    STATUS          NUMBER(11,0) DEFAULT 1,
    IS_DELETED      NUMBER(11,0) DEFAULT 0,
    PH_ID           NUMBER(20,0),
    TYPE            NUMBER(3,0),
    PLAN_ID         NUMBER(20,0),
    TEACHER_ID      NUMBER(20,0),
    TEACHER_NAME    NVARCHAR2(32),
    CA_STATUS       NUMBER(3,0),
    DISTRIBUTE_TIME DATE,
    ATTACH_LINK     NVARCHAR2(255),
    CHECK (ID IS NOT NULL) ENABLE,
    PRIMARY KEY (ID)
) TABLESPACE JONHON_MES_DATA;
COMMENT
ON COLUMN MES_CULTIVATE_DETAIL.CREATE_USER IS '创建人';
COMMENT
ON COLUMN MES_CULTIVATE_DETAIL.CREATE_TIME IS '创建时间';
COMMENT
ON COLUMN MES_CULTIVATE_DETAIL.CREATE_DEPT IS '创建部门';
COMMENT
ON COLUMN MES_CULTIVATE_DETAIL.UPDATE_USER IS '更新人';
COMMENT
ON COLUMN MES_CULTIVATE_DETAIL.UPDATE_TIME IS '更新时间';
COMMENT
ON COLUMN MES_CULTIVATE_DETAIL.STATUS IS '状态;1、空闲；2、使用中';
COMMENT
ON COLUMN MES_CULTIVATE_DETAIL.IS_DELETED IS '删除标记;1:删除，0:正常';
COMMENT
ON COLUMN MES_CULTIVATE_DETAIL.PH_ID IS '岗位处理ID';
COMMENT
ON COLUMN MES_CULTIVATE_DETAIL.TYPE IS '培训类型(1实习,2转岗,3下岗)';
COMMENT
ON COLUMN MES_CULTIVATE_DETAIL.PLAN_ID IS '培训模板ID';
COMMENT
ON COLUMN MES_CULTIVATE_DETAIL.TEACHER_ID IS '培训师ID';
COMMENT
ON COLUMN MES_CULTIVATE_DETAIL.TEACHER_NAME IS '培训师';
COMMENT
ON COLUMN MES_CULTIVATE_DETAIL.CA_STATUS IS '培训状态(1未配置,2等待下发,3已下发-培训中,4已到期,5已培训-待确认,6培训完成)';
COMMENT
ON COLUMN MES_CULTIVATE_DETAIL.DISTRIBUTE_TIME IS '下发时间';
COMMENT
ON COLUMN MES_CULTIVATE_DETAIL.ATTACH_LINK IS '附件链接';
COMMENT
ON TABLE MES_CULTIVATE_DETAIL IS '培训安排';

--证书类型
DROP TABLE MES_CERTIFICATE_TYPE;
CREATE TABLE MES_CERTIFICATE_TYPE
(
    ID                            NUMBER(20,0) NOT NULL ENABLE,
    TENANT_ID                     NVARCHAR2(12),
    CREATE_USER                   NUMBER(20,0),
    CREATE_TIME                   DATE,
    CREATE_DEPT                   NUMBER(20,0),
    UPDATE_USER                   NUMBER(20,0),
    UPDATE_TIME                   DATE,
    STATUS                        NUMBER(11,0) DEFAULT 1,
    IS_DELETED                    NUMBER(11,0) DEFAULT 0,
    NAME                          NVARCHAR2(255),
    VALIDITY_PERIOD               NUMBER(3,0),
    AIRWORTHINESS_VALIDITY_PERIOD NUMBER(3,0),
    ASTRONAUT_VALIDITY_PERIOD     NUMBER(3,0),
    CHECK (ID IS NOT NULL) ENABLE,
    PRIMARY KEY (ID)
) TABLESPACE JONHON_MES_DATA;
COMMENT
ON COLUMN MES_CERTIFICATE_TYPE.CREATE_USER IS '创建人';
COMMENT
ON COLUMN MES_CERTIFICATE_TYPE.CREATE_TIME IS '创建时间';
COMMENT
ON COLUMN MES_CERTIFICATE_TYPE.CREATE_DEPT IS '创建部门';
COMMENT
ON COLUMN MES_CERTIFICATE_TYPE.UPDATE_USER IS '更新人';
COMMENT
ON COLUMN MES_CERTIFICATE_TYPE.UPDATE_TIME IS '更新时间';
COMMENT
ON COLUMN MES_CERTIFICATE_TYPE.STATUS IS '状态;1、空闲；2、使用中';
COMMENT
ON COLUMN MES_CERTIFICATE_TYPE.IS_DELETED IS '删除标记;1:删除，0:正常';
COMMENT
ON COLUMN MES_CERTIFICATE_TYPE.NAME IS '证书名称';
COMMENT
ON COLUMN MES_CERTIFICATE_TYPE.VALIDITY_PERIOD IS '证书有效期';
COMMENT
ON COLUMN MES_CERTIFICATE_TYPE.AIRWORTHINESS_VALIDITY_PERIOD IS '适航有效期';
COMMENT
ON COLUMN MES_CERTIFICATE_TYPE.ASTRONAUT_VALIDITY_PERIOD IS '宇航有效期';
COMMENT
ON TABLE MES_CERTIFICATE_TYPE IS '证书类型';

--培训计划模板
DROP TABLE MES_TRAINING_PLAN;
CREATE TABLE MES_TRAINING_PLAN
(
    ID                NUMBER(20,0) NOT NULL ENABLE,
    TENANT_ID         NVARCHAR2(12),
    CREATE_USER       NUMBER(20,0),
    CREATE_TIME       DATE,
    CREATE_DEPT       NUMBER(20,0),
    UPDATE_USER       NUMBER(20,0),
    UPDATE_TIME       DATE,
    STATUS            NUMBER(11,0) DEFAULT 1,
    IS_DELETED        NUMBER(11,0) DEFAULT 0,
    NAME              NVARCHAR2(255),
    CYCLE             NUMBER(5,0),
    TEACHER_ID        NUMBER(20,0),
    TEACHER_NAME      NVARCHAR2(32),
    EARLY_WARNING_DAY NUMBER(5,0),
    MEMO              NVARCHAR2(255),
    ATTACH_LINK       NVARCHAR2(255),
    CHECK (ID IS NOT NULL) ENABLE,
    PRIMARY KEY (ID)
) TABLESPACE JONHON_MES_DATA;
COMMENT
ON COLUMN MES_TRAINING_PLAN.CREATE_USER IS '创建人';
COMMENT
ON COLUMN MES_TRAINING_PLAN.CREATE_TIME IS '创建时间';
COMMENT
ON COLUMN MES_TRAINING_PLAN.CREATE_DEPT IS '创建部门';
COMMENT
ON COLUMN MES_TRAINING_PLAN.UPDATE_USER IS '更新人';
COMMENT
ON COLUMN MES_TRAINING_PLAN.UPDATE_TIME IS '更新时间';
COMMENT
ON COLUMN MES_TRAINING_PLAN.STATUS IS '状态;1、空闲；2、使用中';
COMMENT
ON COLUMN MES_TRAINING_PLAN.IS_DELETED IS '删除标记;1:删除，0:正常';
COMMENT
ON COLUMN MES_TRAINING_PLAN.NAME IS '培训计划名称';
COMMENT
ON COLUMN MES_TRAINING_PLAN.CYCLE IS '培训周期(天)';
COMMENT
ON COLUMN MES_TRAINING_PLAN.TEACHER_ID IS '培训师ID';
COMMENT
ON COLUMN MES_TRAINING_PLAN.TEACHER_NAME IS '培训师名称';
COMMENT
ON COLUMN MES_TRAINING_PLAN.EARLY_WARNING_DAY IS '预警周期(天)';
COMMENT
ON COLUMN MES_TRAINING_PLAN.MEMO IS '备注';
COMMENT
ON COLUMN MES_TRAINING_PLAN.ATTACH_LINK IS '附件链接';
COMMENT
ON TABLE MES_TRAINING_PLAN IS '培训计划模板';

--岗位证书维护
DROP TABLE MES_CERTIFICATE_MAINTENANCE;
CREATE TABLE MES_CERTIFICATE_MAINTENANCE
(
    ID                 NUMBER(20,0) NOT NULL ENABLE,
    TENANT_ID          NVARCHAR2(12),
    CREATE_USER        NUMBER(20,0),
    CREATE_TIME        DATE,
    CREATE_DEPT        NUMBER(20,0),
    UPDATE_USER        NUMBER(20,0),
    UPDATE_TIME        DATE,
    STATUS             NUMBER(11,0) DEFAULT 1,
    IS_DELETED         NUMBER(11,0) DEFAULT 0,
    PH_ID              NUMBER(20,0),
    CERTIFICATE_ID     NUMBER(20,0),
    CERTIFICATE_CODE   NVARCHAR2(20),
    CERTIFICATE_DATE   DATE,
    AIRWORTHINESS_DATE DATE,
    ASTRONAUT_DATE     DATE,
    MAINTENANCE_STATUS NUMBER(3,0),
    CHECK (ID IS NOT NULL) ENABLE,
    PRIMARY KEY (ID)
) TABLESPACE JONHON_MES_DATA;
COMMENT
ON COLUMN MES_CERTIFICATE_MAINTENANCE.CREATE_USER IS '创建人';
COMMENT
ON COLUMN MES_CERTIFICATE_MAINTENANCE.CREATE_TIME IS '创建时间';
COMMENT
ON COLUMN MES_CERTIFICATE_MAINTENANCE.CREATE_DEPT IS '创建部门';
COMMENT
ON COLUMN MES_CERTIFICATE_MAINTENANCE.UPDATE_USER IS '更新人';
COMMENT
ON COLUMN MES_CERTIFICATE_MAINTENANCE.UPDATE_TIME IS '更新时间';
COMMENT
ON COLUMN MES_CERTIFICATE_MAINTENANCE.STATUS IS '状态;1、空闲；2、使用中';
COMMENT
ON COLUMN MES_CERTIFICATE_MAINTENANCE.IS_DELETED IS '删除标记;1:删除，0:正常';
COMMENT
ON COLUMN MES_CERTIFICATE_MAINTENANCE.PH_ID IS '岗位处理ID';
COMMENT
ON COLUMN MES_CERTIFICATE_MAINTENANCE.CERTIFICATE_ID IS '证书类型ID';
COMMENT
ON COLUMN MES_CERTIFICATE_MAINTENANCE.CERTIFICATE_CODE IS '证书编号';
COMMENT
ON COLUMN MES_CERTIFICATE_MAINTENANCE.CERTIFICATE_DATE IS '证书日期';
COMMENT
ON COLUMN MES_CERTIFICATE_MAINTENANCE.AIRWORTHINESS_DATE IS '适航日期';
COMMENT
ON COLUMN MES_CERTIFICATE_MAINTENANCE.ASTRONAUT_DATE IS '宇航日期';
COMMENT
ON COLUMN MES_CERTIFICATE_MAINTENANCE.MAINTENANCE_STATUS IS '维护状态(1正常,2到期,3离职)';
COMMENT
ON TABLE MES_CERTIFICATE_MAINTENANCE IS '证书维护';

--岗位设备维护
DROP TABLE MES_EQUIPMENT_MAINTENANCE;
CREATE TABLE MES_EQUIPMENT_MAINTENANCE
(
    ID                        NUMBER(20,0) NOT NULL ENABLE,
    TENANT_ID                 NVARCHAR2(12),
    CREATE_USER               NUMBER(20,0),
    CREATE_TIME               DATE,
    CREATE_DEPT               NUMBER(20,0),
    UPDATE_USER               NUMBER(20,0),
    UPDATE_TIME               DATE,
    STATUS                    NUMBER(11,0) DEFAULT 1,
    IS_DELETED                NUMBER(11,0) DEFAULT 0,
    PH_ID                     NUMBER(20,0),
    EQUIPMENT_ID              NUMBER(20,0),
    EQUIPMENT_VALIDITY_PERIOD NUMBER(5,0),
    EQUIPMENT_DATE            DATE,
    MAINTENANCE_STATUS        NUMBER(3,0),
    CHECK (ID IS NOT NULL) ENABLE,
    PRIMARY KEY (ID)
) TABLESPACE JONHON_MES_DATA;
COMMENT
ON COLUMN MES_EQUIPMENT_MAINTENANCE.CREATE_USER IS '创建人';
COMMENT
ON COLUMN MES_EQUIPMENT_MAINTENANCE.CREATE_TIME IS '创建时间';
COMMENT
ON COLUMN MES_EQUIPMENT_MAINTENANCE.CREATE_DEPT IS '创建部门';
COMMENT
ON COLUMN MES_EQUIPMENT_MAINTENANCE.UPDATE_USER IS '更新人';
COMMENT
ON COLUMN MES_EQUIPMENT_MAINTENANCE.UPDATE_TIME IS '更新时间';
COMMENT
ON COLUMN MES_EQUIPMENT_MAINTENANCE.STATUS IS '状态;1、空闲；2、使用中';
COMMENT
ON COLUMN MES_EQUIPMENT_MAINTENANCE.IS_DELETED IS '删除标记;1:删除，0:正常';
COMMENT
ON COLUMN MES_EQUIPMENT_MAINTENANCE.PH_ID IS '岗位处理ID';
COMMENT
ON COLUMN MES_EQUIPMENT_MAINTENANCE.EQUIPMENT_ID IS '设备ID';
COMMENT
ON COLUMN MES_EQUIPMENT_MAINTENANCE.EQUIPMENT_VALIDITY_PERIOD IS '设备有效期';
COMMENT
ON COLUMN MES_EQUIPMENT_MAINTENANCE.EQUIPMENT_DATE IS '设备日期';
COMMENT
ON COLUMN MES_EQUIPMENT_MAINTENANCE.MAINTENANCE_STATUS IS '维护状态(1正常,2到期,3离职)';
COMMENT
ON TABLE MES_EQUIPMENT_MAINTENANCE IS '岗位设备维护';
