-- ============================================================================
-- OARMS - LB-1 法律法规管理 DDL
-- Database: DM8 (达梦)
-- Schema: OARMS
-- Version: V2.0.0
-- Date: 2026-05-18
-- Description: 法律条款表
-- ============================================================================

-- ----------------------------------------------------------------------------
-- 1. lb_law_clause - 法律条款
-- ----------------------------------------------------------------------------
CREATE TABLE OARMS.lb_law_clause (
    id                      VARCHAR(50)    NOT NULL,
    clause_code             VARCHAR(30)    NOT NULL,
    law_name                VARCHAR(200)   NOT NULL,
    clause_number           VARCHAR(50)    NOT NULL,
    clause_content          VARCHAR(2000)  NOT NULL,
    clause_content_summary  VARCHAR(200),
    effective_status        TINYINT        NOT NULL DEFAULT 1,
    publish_date            DATE,
    create_by               VARCHAR(50),
    create_time             TIMESTAMP,
    create_name             VARCHAR(50),
    update_by               VARCHAR(50),
    update_time             TIMESTAMP,
    update_name             VARCHAR(50),
    PRIMARY KEY (id)
);

-- 唯一约束
CREATE UNIQUE INDEX IDX_LB_LAW_CLAUSE_CODE ON OARMS.LB_LAW_CLAUSE (CLAUSE_CODE);

-- 普通索引
CREATE INDEX IDX_LB_LAW_CLAUSE_LAW_NAME ON OARMS.LB_LAW_CLAUSE (LAW_NAME);
CREATE INDEX IDX_LB_LAW_CLAUSE_STATUS ON OARMS.LB_LAW_CLAUSE (EFFECTIVE_STATUS);
CREATE INDEX IDX_LB_LAW_CLAUSE_PUBLISH_DATE ON OARMS.LB_LAW_CLAUSE (PUBLISH_DATE);

-- 表注释
COMMENT ON TABLE OARMS.LB_LAW_CLAUSE IS '法律条款';

-- 列注释
COMMENT ON COLUMN OARMS.LB_LAW_CLAUSE.ID IS '主键ID';
COMMENT ON COLUMN OARMS.LB_LAW_CLAUSE.CLAUSE_CODE IS '条款编号';
COMMENT ON COLUMN OARMS.LB_LAW_CLAUSE.LAW_NAME IS '法规名称';
COMMENT ON COLUMN OARMS.LB_LAW_CLAUSE.CLAUSE_NUMBER IS '条款号';
COMMENT ON COLUMN OARMS.LB_LAW_CLAUSE.CLAUSE_CONTENT IS '条款内容';
COMMENT ON COLUMN OARMS.LB_LAW_CLAUSE.CLAUSE_CONTENT_SUMMARY IS '条款摘要';
COMMENT ON COLUMN OARMS.LB_LAW_CLAUSE.EFFECTIVE_STATUS IS '生效状态(1=有效,2=废止)';
COMMENT ON COLUMN OARMS.LB_LAW_CLAUSE.PUBLISH_DATE IS '发布日期';
COMMENT ON COLUMN OARMS.LB_LAW_CLAUSE.CREATE_BY IS '创建人ID';
COMMENT ON COLUMN OARMS.LB_LAW_CLAUSE.CREATE_TIME IS '创建时间';
COMMENT ON COLUMN OARMS.LB_LAW_CLAUSE.CREATE_NAME IS '创建人姓名';
COMMENT ON COLUMN OARMS.LB_LAW_CLAUSE.UPDATE_BY IS '更新人ID';
COMMENT ON COLUMN OARMS.LB_LAW_CLAUSE.UPDATE_TIME IS '更新时间';
COMMENT ON COLUMN OARMS.LB_LAW_CLAUSE.UPDATE_NAME IS '更新人姓名';
