-- ============================================================
-- 湛江市智慧人社运营运维（2025-2027年）项目
-- 就业一湛通服务平台 - 企业信息库管理 达梦数据库建表脚本
-- 
-- 依据：《需求规格说明书》第3.1.2.1节 - 企业信息库 详情页面字段设计
-- 数据库：达梦数据库 (DM8)
-- 创建日期：2025-06-02
-- ============================================================

-- ============================================================
-- 表1：企业基本信息表
-- 说明：存储企业基本信息
-- ============================================================
CREATE TABLE ENTERPRISE_INFO
(
    ID                    VARCHAR(36)  NOT NULL,
    COMPANY_NAME          VARCHAR(200) NOT NULL,
    UNIFIED_CREDIT_CODE   VARCHAR(50)  NOT NULL,
    ORG_CODE              VARCHAR(50),
    ESTABLISH_DATE        DATE,
    BUSINESS_STATUS       VARCHAR(50),
    REGISTERED_CAPITAL    VARCHAR(50),
    REG_ADDR_DISTRICT     VARCHAR(200) NOT NULL,
    COMPANY_TYPE          VARCHAR(200) NOT NULL,
    ECONOMY_TYPE          VARCHAR(200) NOT NULL,
    INDUSTRY              VARCHAR(200) NOT NULL,
    IS_LISTED_COMPANY     VARCHAR(10),
    INDUSTRY_FIELD        VARCHAR(200),
    INDUSTRY_ADMIN_DEPT   VARCHAR(200),
    INDUSTRY_TAG          VARCHAR(500),
    COMPANY_PROPERTY_TAG  VARCHAR(500),
    PROVINCE_OR_CITY      VARCHAR(200),
    COMPANY_ATTRIBUTE     VARCHAR(200),
    IS_HEAD_ENTERPRISE    VARCHAR(10),
    IS_KEY_ENTERPRISE     VARCHAR(10),
    IS_KEY_INSTITUTION    VARCHAR(10),
    IS_STRATEGIC_INDUSTRY VARCHAR(10),
    DATA_SOURCE           VARCHAR(50)  NOT NULL,
    COMPANY_TAG           VARCHAR(500),
    STAFF_SIZE            VARCHAR(50)  NOT NULL,
    EMAIL                 VARCHAR(100),
    POSTAL_CODE           VARCHAR(20),
    CONTACT_PERSON        VARCHAR(100) NOT NULL,
    CONTACT_PHONE         VARCHAR(50)  NOT NULL,
    ACCEPT_SMS_PUSH       VARCHAR(10)  NOT NULL,
    OPEN_TO_JOB_SEEKER    VARCHAR(10)  NOT NULL,
    ALLOW_AGENT_SIGNUP    VARCHAR(10)  NOT NULL,
    WEBSITE               VARCHAR(200),
    FAX_NUMBER            VARCHAR(30),
    COMPANY_BENEFITS      VARCHAR(500),
    COMPANY_INTRO         TEXT         NOT NULL,
    OFFICE_ADDR_DISTRICT  VARCHAR(200) NOT NULL,
    OFFICE_ADDRESS        VARCHAR(500) NOT NULL,
    LOGO_IMG              VARCHAR(500),
    PROMOTIONAL_VIDEO     VARCHAR(500),
    PROMOTIONAL_IMAGE     VARCHAR(500),
    CREATE_BY             VARCHAR(50),
    CREATE_TIME           DATETIME     NOT NULL DEFAULT CURRENT_TIMESTAMP,
    UPDATE_BY             VARCHAR(50),
    UPDATE_TIME           DATETIME     NOT NULL DEFAULT CURRENT_TIMESTAMP,
    SYS_ORG_CODE          VARCHAR(50),
    PRIMARY KEY (ID)
);

COMMENT
ON TABLE ENTERPRISE_INFO IS '企业基本信息表';
COMMENT
ON COLUMN ENTERPRISE_INFO.ID IS '主键ID';
COMMENT
ON COLUMN ENTERPRISE_INFO.COMPANY_NAME IS '单位名称';
COMMENT
ON COLUMN ENTERPRISE_INFO.UNIFIED_CREDIT_CODE IS '统一社会信用代码';
COMMENT
ON COLUMN ENTERPRISE_INFO.ORG_CODE IS '组织机构代码';
COMMENT
ON COLUMN ENTERPRISE_INFO.ESTABLISH_DATE IS '成立日期';
COMMENT
ON COLUMN ENTERPRISE_INFO.BUSINESS_STATUS IS '经营状态（登记在册/破产/注销/被兼并/其他）';
COMMENT
ON COLUMN ENTERPRISE_INFO.REGISTERED_CAPITAL IS '注册资本（万元）';
COMMENT
ON COLUMN ENTERPRISE_INFO.REG_ADDR_DISTRICT IS '注册地址行政区划（参考省一体化平台字典）';
COMMENT
ON COLUMN ENTERPRISE_INFO.COMPANY_TYPE IS '单位类型（企业/机关/事业单位等）';
COMMENT
ON COLUMN ENTERPRISE_INFO.ECONOMY_TYPE IS '经济类型（参考省一体化平台字典）';
COMMENT
ON COLUMN ENTERPRISE_INFO.INDUSTRY IS '所属行业（参考省一体化平台字典）';
COMMENT
ON COLUMN ENTERPRISE_INFO.IS_LISTED_COMPANY IS '是否上市公司（是/否）';
COMMENT
ON COLUMN ENTERPRISE_INFO.INDUSTRY_FIELD IS '行业领域（人工智能与机器人/半导体与集成电路/新材料等）';
COMMENT
ON COLUMN ENTERPRISE_INFO.INDUSTRY_ADMIN_DEPT IS '行业主管部门（以省一体化平台数据回流为准）';
COMMENT
ON COLUMN ENTERPRISE_INFO.INDUSTRY_TAG IS '产业标签（以省一体化平台数据回流为准）';
COMMENT
ON COLUMN ENTERPRISE_INFO.COMPANY_PROPERTY_TAG IS '单位属性标签（以省一体化平台数据回流为准）';
COMMENT
ON COLUMN ENTERPRISE_INFO.PROVINCE_OR_CITY IS '省属或所属地市（以省一体化平台数据回流为准）';
COMMENT
ON COLUMN ENTERPRISE_INFO.COMPANY_ATTRIBUTE IS '单位属性（以省一体化平台数据回流为准）';
COMMENT
ON COLUMN ENTERPRISE_INFO.IS_HEAD_ENTERPRISE IS '是否为头部企业（以省一体化平台数据回流为准）';
COMMENT
ON COLUMN ENTERPRISE_INFO.IS_KEY_ENTERPRISE IS '是否为重点企业（以省一体化平台数据回流为准）';
COMMENT
ON COLUMN ENTERPRISE_INFO.IS_KEY_INSTITUTION IS '是否为重点事业单位（以省一体化平台数据回流为准）';
COMMENT
ON COLUMN ENTERPRISE_INFO.IS_STRATEGIC_INDUSTRY IS '是否属于20个战略性产业集群（以省一体化平台数据回流为准）';
COMMENT
ON COLUMN ENTERPRISE_INFO.DATA_SOURCE IS '数据来源（省系统/市系统/其他）';
COMMENT
ON COLUMN ENTERPRISE_INFO.COMPANY_TAG IS '单位标签（以省一体化平台数据回流为准，非单位主动录入）';
COMMENT
ON COLUMN ENTERPRISE_INFO.STAFF_SIZE IS '人员规模（49人及以下/50-99人/100-299人/300-499人/500-999人/1000-9999人/10000人及以上）';
COMMENT
ON COLUMN ENTERPRISE_INFO.EMAIL IS '电子邮箱';
COMMENT
ON COLUMN ENTERPRISE_INFO.POSTAL_CODE IS '邮政编码';
COMMENT
ON COLUMN ENTERPRISE_INFO.CONTACT_PERSON IS '联系人';
COMMENT
ON COLUMN ENTERPRISE_INFO.CONTACT_PHONE IS '联系方式';
COMMENT
ON COLUMN ENTERPRISE_INFO.ACCEPT_SMS_PUSH IS '接收平台短信推送（是/否）';
COMMENT
ON COLUMN ENTERPRISE_INFO.OPEN_TO_JOB_SEEKER IS '面向求职者会员开放（是/否）';
COMMENT
ON COLUMN ENTERPRISE_INFO.ALLOW_AGENT_SIGNUP IS '是否允许人社部门代报名（是/否）';
COMMENT
ON COLUMN ENTERPRISE_INFO.WEBSITE IS '单位网站';
COMMENT
ON COLUMN ENTERPRISE_INFO.FAX_NUMBER IS '传真号码';
COMMENT
ON COLUMN ENTERPRISE_INFO.COMPANY_BENEFITS IS '单位福利';
COMMENT
ON COLUMN ENTERPRISE_INFO.COMPANY_INTRO IS '单位简介（富文本框）';
COMMENT
ON COLUMN ENTERPRISE_INFO.OFFICE_ADDR_DISTRICT IS '办公地址行政区划（参考省一体化平台字典）';
COMMENT
ON COLUMN ENTERPRISE_INFO.OFFICE_ADDRESS IS '办公地址';
COMMENT
ON COLUMN ENTERPRISE_INFO.LOGO_IMG IS 'logo图片';
COMMENT
ON COLUMN ENTERPRISE_INFO.PROMOTIONAL_VIDEO IS '宣传视频';
COMMENT
ON COLUMN ENTERPRISE_INFO.PROMOTIONAL_IMAGE IS '宣传图片';
COMMENT
ON COLUMN ENTERPRISE_INFO.CREATE_BY IS '创建人';
COMMENT
ON COLUMN ENTERPRISE_INFO.CREATE_TIME IS '创建时间';
COMMENT
ON COLUMN ENTERPRISE_INFO.UPDATE_BY IS '修改人';
COMMENT
ON COLUMN ENTERPRISE_INFO.UPDATE_TIME IS '更新时间';
COMMENT
ON COLUMN ENTERPRISE_INFO.SYS_ORG_CODE IS '组织机构编号';