﻿CREATE TABLE WPPDB.PROJECT
(
PROJECT_ID CHAR(36 CHAR) NOT NULL,
CODE VARCHAR(20 CHAR) NOT NULL,
NAME VARCHAR(200 CHAR) NOT NULL,
DESCRIPTION TEXT,
TOPOLOGY CLOB,
CREATED_AT TIMESTAMP(0) DEFAULT CURRENT_TIMESTAMP(),
UPDATED_AT TIMESTAMP(0) DEFAULT CURRENT_TIMESTAMP(),
MODIFIER VARCHAR(40 CHAR),
NOT CLUSTER PRIMARY KEY(PROJECT_ID),
CONSTRAINT CODE UNIQUE(CODE)) STORAGE(ON MAIN, CLUSTERBTR) ;

COMMENT ON COLUMN WPPDB.PROJECT.CODE IS '项目编号';
COMMENT ON COLUMN WPPDB.PROJECT.CREATED_AT IS '创建时间';
COMMENT ON COLUMN WPPDB.PROJECT.DESCRIPTION IS '项目描述';
COMMENT ON COLUMN WPPDB.PROJECT.MODIFIER IS '最近修改者';
COMMENT ON COLUMN WPPDB.PROJECT.NAME IS '项目名称';
COMMENT ON COLUMN WPPDB.PROJECT.PROJECT_ID IS '项目主键';
COMMENT ON COLUMN WPPDB.PROJECT.TOPOLOGY IS '项目拓扑关系';
COMMENT ON COLUMN WPPDB.PROJECT.UPDATED_AT IS '修改时间';


CREATE TABLE WPPDB.SYS_CONFIG
(
ID VARCHAR(40 CHAR) NOT NULL,
SYSNAME VARCHAR(200 CHAR),
WELCOME VARCHAR(500 CHAR),
FUNCATION CLOB,
REMARK CLOB,
VERSIONINFO CLOB,
LASTMODIFYDATE TIMESTAMP(0),
CUSTOM1 VARCHAR(100 CHAR),
CUSTOM2 VARCHAR(100 CHAR),
CUSTOM3 VARCHAR(100 CHAR),
NOT CLUSTER PRIMARY KEY(ID)) STORAGE(ON MAIN, CLUSTERBTR) ;

COMMENT ON TABLE WPPDB.SYS_CONFIG IS '系统全局配置';
COMMENT ON COLUMN WPPDB.SYS_CONFIG.CUSTOM1 IS '备用1';
COMMENT ON COLUMN WPPDB.SYS_CONFIG.CUSTOM2 IS '备用2';
COMMENT ON COLUMN WPPDB.SYS_CONFIG.CUSTOM3 IS '备用3';
COMMENT ON COLUMN WPPDB.SYS_CONFIG.FUNCATION IS '系统功能介绍';
COMMENT ON COLUMN WPPDB.SYS_CONFIG.ID IS 'id';
COMMENT ON COLUMN WPPDB.SYS_CONFIG.LASTMODIFYDATE IS '最近修改日期';
COMMENT ON COLUMN WPPDB.SYS_CONFIG.REMARK IS '备注';
COMMENT ON COLUMN WPPDB.SYS_CONFIG.SYSNAME IS '系统名称';
COMMENT ON COLUMN WPPDB.SYS_CONFIG.VERSIONINFO IS '版本信息';
COMMENT ON COLUMN WPPDB.SYS_CONFIG.WELCOME IS '欢迎词';


CREATE TABLE WPPDB.SYS_DICTIONARY
(
ID VARCHAR(40 CHAR) NOT NULL,
DICTTYPE VARCHAR(20 CHAR) DEFAULT '00' NOT NULL,
ORDERNO INT NOT NULL,
DICTCODE VARCHAR(40 CHAR) NOT NULL,
DICTNAME VARCHAR(100 CHAR) NOT NULL,
CUSTOM1 VARCHAR(1000 CHAR),
CUSTOM2 VARCHAR(100 CHAR),
CUSTOM3 CLOB,
NOT CLUSTER PRIMARY KEY(ID)) STORAGE(ON MAIN, CLUSTERBTR) ;

COMMENT ON TABLE WPPDB.SYS_DICTIONARY IS '数据字典表';
COMMENT ON COLUMN WPPDB.SYS_DICTIONARY.CUSTOM1 IS '备用1';
COMMENT ON COLUMN WPPDB.SYS_DICTIONARY.CUSTOM2 IS '备用2';
COMMENT ON COLUMN WPPDB.SYS_DICTIONARY.CUSTOM3 IS '备用3';
COMMENT ON COLUMN WPPDB.SYS_DICTIONARY.DICTCODE IS '字典编码';
COMMENT ON COLUMN WPPDB.SYS_DICTIONARY.DICTNAME IS '字典名称';
COMMENT ON COLUMN WPPDB.SYS_DICTIONARY.DICTTYPE IS '字典类型  00-系统内置 01-用户配置';
COMMENT ON COLUMN WPPDB.SYS_DICTIONARY.ID IS 'id';
COMMENT ON COLUMN WPPDB.SYS_DICTIONARY.ORDERNO IS '顺序号';


CREATE TABLE WPPDB.SYS_DICTIONARY_ITEMS
(
ID VARCHAR(40 CHAR) NOT NULL,
DICTID VARCHAR(40 CHAR) NOT NULL,
ORDERNO INT NOT NULL,
ITEMCODE VARCHAR(40 CHAR) NOT NULL,
DICTNAME VARCHAR(100 CHAR) NOT NULL,
PARENTCODE VARCHAR(40 CHAR) DEFAULT '',
CUSTOM1 VARCHAR(1000 CHAR),
CUSTOM2 VARCHAR(100 CHAR),
CUSTOM3 CLOB,
NOT CLUSTER PRIMARY KEY(ID)) STORAGE(ON MAIN, CLUSTERBTR) ;

COMMENT ON TABLE WPPDB.SYS_DICTIONARY_ITEMS IS '数据字典明细';
COMMENT ON COLUMN WPPDB.SYS_DICTIONARY_ITEMS.CUSTOM1 IS '备用1';
COMMENT ON COLUMN WPPDB.SYS_DICTIONARY_ITEMS.CUSTOM2 IS '备用2';
COMMENT ON COLUMN WPPDB.SYS_DICTIONARY_ITEMS.CUSTOM3 IS '备用3';
COMMENT ON COLUMN WPPDB.SYS_DICTIONARY_ITEMS.DICTID IS '对应字典ID';
COMMENT ON COLUMN WPPDB.SYS_DICTIONARY_ITEMS.DICTNAME IS '项名称';
COMMENT ON COLUMN WPPDB.SYS_DICTIONARY_ITEMS.ID IS 'id';
COMMENT ON COLUMN WPPDB.SYS_DICTIONARY_ITEMS.ITEMCODE IS '项编码';
COMMENT ON COLUMN WPPDB.SYS_DICTIONARY_ITEMS.ORDERNO IS '顺序号';
COMMENT ON COLUMN WPPDB.SYS_DICTIONARY_ITEMS.PARENTCODE IS '父项编码';


CREATE TABLE WPPDB.SYS_LOG
(
ID BIGINT AUTO_INCREMENT NOT NULL,
USERCODE VARCHAR(200 CHAR),
USERNAME VARCHAR(200 CHAR),
OPTTYPE VARCHAR(20 CHAR),
MODULE VARCHAR(200 CHAR),
DESCRIPTION VARCHAR(400 CHAR),
METHOD VARCHAR(200 CHAR),
PARAMS TEXT,
LOGTIME TIMESTAMP(0),
REQUESTIP VARCHAR(200 CHAR),
BROWSER VARCHAR(200 CHAR),
NOT CLUSTER PRIMARY KEY(ID)) STORAGE(ON MAIN, CLUSTERBTR) AUTO_INCREMENT = 3455487;

COMMENT ON TABLE WPPDB.SYS_LOG IS '系统操作日志';
COMMENT ON COLUMN WPPDB.SYS_LOG.BROWSER IS '浏览器类型';
COMMENT ON COLUMN WPPDB.SYS_LOG.DESCRIPTION IS '日志描述';
COMMENT ON COLUMN WPPDB.SYS_LOG.ID IS 'ID';
COMMENT ON COLUMN WPPDB.SYS_LOG.LOGTIME IS '创建时间';
COMMENT ON COLUMN WPPDB.SYS_LOG.METHOD IS '操作方法';
COMMENT ON COLUMN WPPDB.SYS_LOG.MODULE IS '模块名称';
COMMENT ON COLUMN WPPDB.SYS_LOG.OPTTYPE IS '操作类型 00-登录 01-新增 02-修改 03-删除 06-查询 09其他';
COMMENT ON COLUMN WPPDB.SYS_LOG.PARAMS IS '方法参数';
COMMENT ON COLUMN WPPDB.SYS_LOG.REQUESTIP IS '请求IP';
COMMENT ON COLUMN WPPDB.SYS_LOG.USERCODE IS '用户账号';
COMMENT ON COLUMN WPPDB.SYS_LOG.USERNAME IS '用户名称';


CREATE OR REPLACE INDEX WPPDB.LOG_CREATE_TIME_INDEX ON WPPDB.SYS_LOG(LOGTIME ASC) STORAGE(ON MAIN, CLUSTERBTR)  WITHOUT CLU_REC_ADDR ;
CREATE OR REPLACE INDEX WPPDB.INX_LOG_TYPE ON WPPDB.SYS_LOG(OPTTYPE ASC) STORAGE(ON MAIN, CLUSTERBTR)  WITHOUT CLU_REC_ADDR ;

CREATE TABLE WPPDB.SYS_MENU
(
ID VARCHAR(40 CHAR) NOT NULL,
SYSTEMCODE VARCHAR(2 CHAR) NOT NULL,
TYPE VARCHAR(2 CHAR) NOT NULL,
CODE VARCHAR(20 CHAR) NOT NULL,
NAME VARCHAR(100 CHAR) NOT NULL,
ICON VARCHAR(100 CHAR),
ISLINK VARCHAR(2 CHAR),
OPTURL VARCHAR(200 CHAR),
PERMISSION VARCHAR(100 CHAR),
PARENTID VARCHAR(40 CHAR),
ORDERNO INT,
ISDISPLAY VARCHAR(2 CHAR),
LASTMODIFIER VARCHAR(40 CHAR),
LASTMODIFYDATE TIMESTAMP(0),
CUSTOM1 VARCHAR(100 CHAR),
CUSTOM2 VARCHAR(100 CHAR),
CUSTOM3 VARCHAR(100 CHAR),
NOT CLUSTER PRIMARY KEY(ID)) STORAGE(ON MAIN, CLUSTERBTR) ;

COMMENT ON TABLE WPPDB.SYS_MENU IS '菜单及按钮';
COMMENT ON COLUMN WPPDB.SYS_MENU.CODE IS '在系统内自动生成';
COMMENT ON COLUMN WPPDB.SYS_MENU.CUSTOM1 IS '备用1';
COMMENT ON COLUMN WPPDB.SYS_MENU.CUSTOM2 IS '备用2';
COMMENT ON COLUMN WPPDB.SYS_MENU.CUSTOM3 IS '备用3';
COMMENT ON COLUMN WPPDB.SYS_MENU.ICON IS '图标地址';
COMMENT ON COLUMN WPPDB.SYS_MENU.ID IS 'id';
COMMENT ON COLUMN WPPDB.SYS_MENU.ISDISPLAY IS '0-不显示 1-显示';
COMMENT ON COLUMN WPPDB.SYS_MENU.ISLINK IS '是否外链';
COMMENT ON COLUMN WPPDB.SYS_MENU.LASTMODIFIER IS '最近修改者';
COMMENT ON COLUMN WPPDB.SYS_MENU.LASTMODIFYDATE IS '最近修改日期';
COMMENT ON COLUMN WPPDB.SYS_MENU.NAME IS '名称';
COMMENT ON COLUMN WPPDB.SYS_MENU.OPTURL IS '内部模块路径或者外链地址';
COMMENT ON COLUMN WPPDB.SYS_MENU.ORDERNO IS '排序号';
COMMENT ON COLUMN WPPDB.SYS_MENU.PARENTID IS '顶级为0';
COMMENT ON COLUMN WPPDB.SYS_MENU.PERMISSION IS '权限控制标识';
COMMENT ON COLUMN WPPDB.SYS_MENU.SYSTEMCODE IS '1-web  2-pad  3-mobile';
COMMENT ON COLUMN WPPDB.SYS_MENU.TYPE IS '0-目录 1-菜单 2-按钮';


CREATE TABLE WPPDB.SYS_MESSAGE
(
ID VARCHAR(40 CHAR) NOT NULL,
CREATETIME TIMESTAMP(0) NOT NULL,
TYPE VARCHAR(2 CHAR) NOT NULL,
TITLE VARCHAR(100 CHAR) NOT NULL,
CONTENT VARCHAR(400 CHAR) NOT NULL,
SENDER_NAME VARCHAR(40 CHAR),
RECEIVER_CODES VARCHAR(1000 CHAR),
RECEIVER_NAMES VARCHAR(1000 CHAR),
STATUS VARCHAR(2 CHAR) DEFAULT '1' NOT NULL,
VALIDPERIOD INT DEFAULT 24,
READTIME TIMESTAMP(0),
CUSTOM1 VARCHAR(100 CHAR),
CUSTOM2 VARCHAR(100 CHAR),
CUSTOM3 VARCHAR(100 CHAR),
NOT CLUSTER PRIMARY KEY(ID)) STORAGE(ON MAIN, CLUSTERBTR) ;

COMMENT ON TABLE WPPDB.SYS_MESSAGE IS '消息通知';
COMMENT ON COLUMN WPPDB.SYS_MESSAGE.CONTENT IS '消息内容';
COMMENT ON COLUMN WPPDB.SYS_MESSAGE.CREATETIME IS '创建时间：排序';
COMMENT ON COLUMN WPPDB.SYS_MESSAGE.CUSTOM1 IS '备用1';
COMMENT ON COLUMN WPPDB.SYS_MESSAGE.CUSTOM2 IS '备用2';
COMMENT ON COLUMN WPPDB.SYS_MESSAGE.CUSTOM3 IS '备用3';
COMMENT ON COLUMN WPPDB.SYS_MESSAGE.ID IS 'ID';
COMMENT ON COLUMN WPPDB.SYS_MESSAGE.READTIME IS '已阅时间';
COMMENT ON COLUMN WPPDB.SYS_MESSAGE.RECEIVER_CODES IS '接收者代码 人员账号列表';
COMMENT ON COLUMN WPPDB.SYS_MESSAGE.RECEIVER_NAMES IS '接收者名称：为空 即为所有人，人员名称列表';
COMMENT ON COLUMN WPPDB.SYS_MESSAGE.SENDER_NAME IS '发送者名称，定时器，人员';
COMMENT ON COLUMN WPPDB.SYS_MESSAGE.STATUS IS '状态：1、初始创建 2-消息已阅 9-消息过期';
COMMENT ON COLUMN WPPDB.SYS_MESSAGE.TITLE IS '消息标题';
COMMENT ON COLUMN WPPDB.SYS_MESSAGE.TYPE IS '消息类型：1-定时任务 2-工作流触发 3-人工触发';
COMMENT ON COLUMN WPPDB.SYS_MESSAGE.VALIDPERIOD IS '有效期：小时';


CREATE TABLE WPPDB.SYS_ORGANIZATION
(
ID VARCHAR(40 CHAR) NOT NULL,
ORGTYPE VARCHAR(2 CHAR) NOT NULL,
ORGCODE VARCHAR(20 CHAR) NOT NULL,
ORGNAME VARCHAR(100 CHAR) NOT NULL,
PARENTID VARCHAR(40 CHAR),
MANAGER VARCHAR(40 CHAR),
ISVAILD VARCHAR(2 CHAR) DEFAULT '1' NOT NULL,
DESCRIPTION VARCHAR(1000 CHAR),
LASTMODIFIER VARCHAR(40 CHAR),
LASTMODIFYDATE TIMESTAMP(0),
CUSTOM1 VARCHAR(100 CHAR),
CUSTOM2 VARCHAR(100 CHAR),
CUSTOM3 VARCHAR(100 CHAR),
NOT CLUSTER PRIMARY KEY(ID)) STORAGE(ON MAIN, CLUSTERBTR) ;

COMMENT ON TABLE WPPDB.SYS_ORGANIZATION IS '系统组织框架';
COMMENT ON COLUMN WPPDB.SYS_ORGANIZATION.CUSTOM1 IS '备用1';
COMMENT ON COLUMN WPPDB.SYS_ORGANIZATION.CUSTOM2 IS '备用2';
COMMENT ON COLUMN WPPDB.SYS_ORGANIZATION.CUSTOM3 IS '备用3';
COMMENT ON COLUMN WPPDB.SYS_ORGANIZATION.DESCRIPTION IS '描述';
COMMENT ON COLUMN WPPDB.SYS_ORGANIZATION.ID IS 'id';
COMMENT ON COLUMN WPPDB.SYS_ORGANIZATION.ISVAILD IS '1-是 0-否';
COMMENT ON COLUMN WPPDB.SYS_ORGANIZATION.LASTMODIFIER IS '最近修改者';
COMMENT ON COLUMN WPPDB.SYS_ORGANIZATION.LASTMODIFYDATE IS '最近修改日期';
COMMENT ON COLUMN WPPDB.SYS_ORGANIZATION.MANAGER IS '组织负责人';
COMMENT ON COLUMN WPPDB.SYS_ORGANIZATION.ORGCODE IS '两位一级';
COMMENT ON COLUMN WPPDB.SYS_ORGANIZATION.ORGNAME IS '组织名称';
COMMENT ON COLUMN WPPDB.SYS_ORGANIZATION.ORGTYPE IS '1-公司 -2-部门';
COMMENT ON COLUMN WPPDB.SYS_ORGANIZATION.PARENTID IS '上级id';


CREATE TABLE WPPDB.SYS_QUARTZ_JOB
(
ID VARCHAR(40 CHAR) NOT NULL,
ORDERNO INT NOT NULL,
JOB_NAME VARCHAR(200 CHAR) NOT NULL,
JOB_CLASS VARCHAR(200 CHAR) NOT NULL,
JOB_METHOD VARCHAR(200 CHAR),
JOB_CRON VARCHAR(300 CHAR),
JOB_PARAMS VARCHAR(200 CHAR),
DESCRIPTION VARCHAR(400 CHAR),
STATUS VARCHAR(2 CHAR) DEFAULT '1' NOT NULL,
LASTMODIFIER VARCHAR(40 CHAR) NOT NULL,
LASTMODIFYDATE TIMESTAMP(0) NOT NULL,
CUSTOM1 VARCHAR(100 CHAR),
CUSTOM2 VARCHAR(100 CHAR),
CUSTOM3 VARCHAR(100 CHAR),
NOT CLUSTER PRIMARY KEY(ID)) STORAGE(ON MAIN, CLUSTERBTR) ;

COMMENT ON TABLE WPPDB.SYS_QUARTZ_JOB IS '定时任务';
COMMENT ON COLUMN WPPDB.SYS_QUARTZ_JOB.CUSTOM1 IS '备用1';
COMMENT ON COLUMN WPPDB.SYS_QUARTZ_JOB.CUSTOM2 IS '备用2';
COMMENT ON COLUMN WPPDB.SYS_QUARTZ_JOB.CUSTOM3 IS '备用3';
COMMENT ON COLUMN WPPDB.SYS_QUARTZ_JOB.DESCRIPTION IS '任务描述';
COMMENT ON COLUMN WPPDB.SYS_QUARTZ_JOB.ID IS 'ID';
COMMENT ON COLUMN WPPDB.SYS_QUARTZ_JOB.JOB_CLASS IS '执行类名称';
COMMENT ON COLUMN WPPDB.SYS_QUARTZ_JOB.JOB_CRON IS '时间周期表达式';
COMMENT ON COLUMN WPPDB.SYS_QUARTZ_JOB.JOB_METHOD IS '执行方法名称';
COMMENT ON COLUMN WPPDB.SYS_QUARTZ_JOB.JOB_NAME IS '任务名称';
COMMENT ON COLUMN WPPDB.SYS_QUARTZ_JOB.JOB_PARAMS IS '方法参数';
COMMENT ON COLUMN WPPDB.SYS_QUARTZ_JOB.LASTMODIFIER IS '最近修改者';
COMMENT ON COLUMN WPPDB.SYS_QUARTZ_JOB.LASTMODIFYDATE IS '最近修改日期';
COMMENT ON COLUMN WPPDB.SYS_QUARTZ_JOB.ORDERNO IS '排序号';
COMMENT ON COLUMN WPPDB.SYS_QUARTZ_JOB.STATUS IS '状态：0-暂停、1-启用';


CREATE TABLE WPPDB.SYS_ROLE
(
ID VARCHAR(40 CHAR) NOT NULL,
ROLECODE VARCHAR(3 CHAR) NOT NULL,
ROLENAME VARCHAR(100 CHAR) NOT NULL,
LEVEL VARCHAR(2 CHAR) NOT NULL,
DESCRIPTION VARCHAR(1000 CHAR),
ORGSCOPE VARCHAR(1000 CHAR),
OPTSCOPE VARCHAR(2000 CHAR),
BUSSCOPE VARCHAR(2000 CHAR),
ISVAILD VARCHAR(2 CHAR) DEFAULT '1' NOT NULL,
LASTMODIFIER VARCHAR(40 CHAR),
LASTMODIFYDATE TIMESTAMP(0),
CUSTOM1 VARCHAR(100 CHAR),
CUSTOM2 VARCHAR(100 CHAR),
CUSTOM3 VARCHAR(100 CHAR),
NOT CLUSTER PRIMARY KEY(ID)) STORAGE(ON MAIN, CLUSTERBTR) ;

COMMENT ON TABLE WPPDB.SYS_ROLE IS '系统角色';
COMMENT ON COLUMN WPPDB.SYS_ROLE.BUSSCOPE IS 'json格式自定义业务范围';
COMMENT ON COLUMN WPPDB.SYS_ROLE.CUSTOM1 IS '备用1';
COMMENT ON COLUMN WPPDB.SYS_ROLE.CUSTOM2 IS '备用2';
COMMENT ON COLUMN WPPDB.SYS_ROLE.CUSTOM3 IS '备用3';
COMMENT ON COLUMN WPPDB.SYS_ROLE.DESCRIPTION IS '描述';
COMMENT ON COLUMN WPPDB.SYS_ROLE.ID IS 'id';
COMMENT ON COLUMN WPPDB.SYS_ROLE.ISVAILD IS '1-是 0-否';
COMMENT ON COLUMN WPPDB.SYS_ROLE.LASTMODIFIER IS '最近修改者';
COMMENT ON COLUMN WPPDB.SYS_ROLE.LASTMODIFYDATE IS '最近修改日期';
COMMENT ON COLUMN WPPDB.SYS_ROLE.LEVEL IS '1-超级管理员 2-单位管理员 3-普通用户';
COMMENT ON COLUMN WPPDB.SYS_ROLE.OPTSCOPE IS '多个操作代码（菜单、按钮）';
COMMENT ON COLUMN WPPDB.SYS_ROLE.ORGSCOPE IS 'org1,org2';
COMMENT ON COLUMN WPPDB.SYS_ROLE.ROLECODE IS '系统生成，三位编号';
COMMENT ON COLUMN WPPDB.SYS_ROLE.ROLENAME IS '角色名称';


CREATE TABLE WPPDB.SYS_ROLE_MENU
(
ID VARCHAR(40 CHAR) NOT NULL,
ROLEID VARCHAR(40 CHAR) NOT NULL,
MENUID VARCHAR(40 CHAR) NOT NULL,
NOT CLUSTER PRIMARY KEY(ID)) STORAGE(ON MAIN, CLUSTERBTR) ;

COMMENT ON TABLE WPPDB.SYS_ROLE_MENU IS '系统角色权限对照';
COMMENT ON COLUMN WPPDB.SYS_ROLE_MENU.ID IS 'id';
COMMENT ON COLUMN WPPDB.SYS_ROLE_MENU.MENUID IS '权限id';
COMMENT ON COLUMN WPPDB.SYS_ROLE_MENU.ROLEID IS '角色id';


CREATE TABLE WPPDB.SYS_ROLE_USERS
(
ID VARCHAR(40 CHAR) NOT NULL,
ROLEID VARCHAR(40 CHAR) NOT NULL,
USERID VARCHAR(40 CHAR) NOT NULL,
NOT CLUSTER PRIMARY KEY(ID)) STORAGE(ON MAIN, CLUSTERBTR) ;

COMMENT ON TABLE WPPDB.SYS_ROLE_USERS IS '系统角色用户对照';
COMMENT ON COLUMN WPPDB.SYS_ROLE_USERS.ID IS 'id';
COMMENT ON COLUMN WPPDB.SYS_ROLE_USERS.ROLEID IS '角色id';
COMMENT ON COLUMN WPPDB.SYS_ROLE_USERS.USERID IS '用户id';


CREATE TABLE WPPDB.SYS_USER
(
ID VARCHAR(40 CHAR) NOT NULL,
USERTYPE VARCHAR(20 CHAR) DEFAULT '' NOT NULL,
USERNAME VARCHAR(100 CHAR) NOT NULL,
NICKNAME VARCHAR(255 CHAR) NOT NULL,
PASSWORD VARCHAR(200 CHAR),
SEX VARCHAR(2 CHAR),
EMAIL VARCHAR(100 CHAR),
PHONE VARCHAR(20 CHAR),
AVATAR VARCHAR(100 CHAR),
ORGID VARCHAR(40 CHAR) NOT NULL,
STATUS VARCHAR(2 CHAR) DEFAULT '1' NOT NULL,
PWDRESETTIME TIMESTAMP(0),
LASTMODIFIER VARCHAR(40 CHAR),
LASTMODIFYDATE TIMESTAMP(0),
CUSTOM1 VARCHAR(100 CHAR),
CUSTOM2 VARCHAR(100 CHAR),
CUSTOM3 VARCHAR(100 CHAR),
NOT CLUSTER PRIMARY KEY(ID)) STORAGE(ON MAIN, CLUSTERBTR) ;

COMMENT ON TABLE WPPDB.SYS_USER IS '系统用户';
COMMENT ON COLUMN WPPDB.SYS_USER.AVATAR IS '用户头像';
COMMENT ON COLUMN WPPDB.SYS_USER.CUSTOM1 IS '备用1';
COMMENT ON COLUMN WPPDB.SYS_USER.CUSTOM2 IS '备用2';
COMMENT ON COLUMN WPPDB.SYS_USER.CUSTOM3 IS '备用3';
COMMENT ON COLUMN WPPDB.SYS_USER.EMAIL IS '邮箱';
COMMENT ON COLUMN WPPDB.SYS_USER.ID IS 'id';
COMMENT ON COLUMN WPPDB.SYS_USER.LASTMODIFIER IS '最近修改者';
COMMENT ON COLUMN WPPDB.SYS_USER.LASTMODIFYDATE IS '最近修改日期';
COMMENT ON COLUMN WPPDB.SYS_USER.NICKNAME IS '用户昵称(中文)';
COMMENT ON COLUMN WPPDB.SYS_USER.ORGID IS '所属组织';
COMMENT ON COLUMN WPPDB.SYS_USER.PASSWORD IS '登录密码';
COMMENT ON COLUMN WPPDB.SYS_USER.PHONE IS '手机号';
COMMENT ON COLUMN WPPDB.SYS_USER.PWDRESETTIME IS '密码修改时间';
COMMENT ON COLUMN WPPDB.SYS_USER.SEX IS '性别 0-男 1-女';
COMMENT ON COLUMN WPPDB.SYS_USER.STATUS IS '1-有效 0-停用';
COMMENT ON COLUMN WPPDB.SYS_USER.USERNAME IS '用户名称（账号）';
COMMENT ON COLUMN WPPDB.SYS_USER.USERTYPE IS '用户类型 0-管理员 1-普通用户';


CREATE TABLE WPPDB.SYS_USER_MENU
(
USERID VARCHAR(40 CHAR) NOT NULL,
MENUID VARCHAR(40 CHAR),
ORDERNO INT,
OPTURL VARCHAR(200 CHAR)) STORAGE(ON MAIN, CLUSTERBTR) ;

COMMENT ON COLUMN WPPDB.SYS_USER_MENU.MENUID IS '权限id';
COMMENT ON COLUMN WPPDB.SYS_USER_MENU.OPTURL IS '内部模块路径或者外链地址';
COMMENT ON COLUMN WPPDB.SYS_USER_MENU.ORDERNO IS '排序号';
COMMENT ON COLUMN WPPDB.SYS_USER_MENU.USERID IS '用户id';



