-- ----------------------------
-- Table structure for DICT - 字典
-- Target   : SQLite
-- Author   : wangbing
-- Date:    : 2020-03-09
-- ----------------------------
CREATE TABLE IF NOT EXISTS SYS_DICT (
    "ID" BIGINT PRIMARY KEY NOT NULL,
    "DICT_NAME" VARCHAR(50),
    "DICT_COMMENT" VARCHAR(50),
    "VERSION" VARCHAR(50),
    "VALID" BOOLEAN,
    "ROW_VERSION" BIGINT NOT NULL,
    "IS_DELETED" BOOLEAN NOT NULL,
    "CREATE_BY" BIGINT NOT NULL,
    "CREATE_TIME" DATETIME NOT NULL,
    "LAST_UPDATE_BY" BIGINT,
    "LAST_UPDATE_TIME" DATETIME
);
-- ----------------------------
-- Table structure for DICT_ITEM - 字典项
-- Target   : SQLite
-- Author   : wangbing
-- Date:    : 2020-03-09
-- ----------------------------
CREATE TABLE IF NOT EXISTS SYS_DICT_ITEM (
    "ID" BIGINT PRIMARY KEY NOT NULL,
    "DICT_NAME" VARCHAR(50),
    "KEY" VARCHAR(20),
    "VALUE" VARCHAR(50),
    "SORT" MEDIUMINT,
    "VALID" BOOLEAN,
    "ROW_VERSION" BIGINT NOT NULL,
    "IS_DELETED" BOOLEAN NOT NULL,
    "CREATE_BY" BIGINT NOT NULL,
    "CREATE_TIME" DATETIME NOT NULL,
    "LAST_UPDATE_BY" BIGINT,
    "LAST_UPDATE_TIME" DATETIME
);
-- ----------------------------
-- Table structure for RES - 资源
-- Target   : SQLite
-- Author   : wangbing
-- Date:    : 2020-03-09
-- ----------------------------
CREATE TABLE IF NOT EXISTS SYS_RES (
    "ID" BIGINT PRIMARY KEY NOT NULL,
    "RES_CODE" VARCHAR(50) NOT NULL,
    "RES_NAME" VARCHAR(50) NOT NULL,
    "RES_TYPE" VARCHAR(20) NOT NULL,
    "RES_VALUE" VARCHAR(250),
    "SUP_CODE" VARCHAR(50),
    "SUP_NAME" VARCHAR(50),
    "VALID" BOOLEAN NOT NULL,
    "ROW_VERSION" BIGINT NOT NULL,
    "IS_DELETED" BOOLEAN NOT NULL,
    "CREATE_BY" BIGINT NOT NULL,
    "CREATE_TIME" DATETIME NOT NULL,
    "LAST_UPDATE_BY" BIGINT,
    "LAST_UPDATE_TIME" DATETIME
);
-- ----------------------------
-- Table structure for USER - 用户
-- Target   : SQLite
-- Author   : wangbing
-- Date:    : 2020-03-09
-- ----------------------------
CREATE TABLE IF NOT EXISTS SYS_USER (
    "ID" BIGINT PRIMARY KEY NOT NULL,
    "USER_NAME" VARCHAR(100) NOT NULL,
    "USER_CODE" VARCHAR(50) NOT NULL,
    "USER_ALIAS" VARCHAR(50),
    "USER_PWD" VARCHAR(50) NOT NULL,
    "USER_STATUS" VARCHAR(20) NOT NULL,
    "DEPT_ID" BIGINT,
    "DEPT_CODE" VARCHAR(50),
    "DEPT_NAME" VARCHAR(100),
    "ROW_VERSION" BIGINT NOT NULL,
    "IS_DELETED" BOOLEAN NOT NULL,
    "CREATE_BY" BIGINT NOT NULL,
    "CREATE_TIME" DATETIME NOT NULL,
    "LAST_UPDATE_BY" BIGINT,
    "LAST_UPDATE_TIME" DATETIME
);
-- ----------------------------
-- Table structure for DEPT - 部门
-- Target   : SQLite
-- Author   : wangbing
-- Date:    : 2020-03-09
-- ----------------------------
CREATE TABLE IF NOT EXISTS SYS_DEPT (
    "ID" BIGINT PRIMARY KEY NOT NULL,
    "DEPT_CODE" VARCHAR(50) NOT NULL,
    "DEPT_NAME" VARCHAR(100) NOT NULL,
    "DEPT_ALIAS" VARCHAR(50),
    "SUP_CODE" VARCHAR(50),
    "SUP_NAME" VARCHAR(100),
    "VALID" BOOLEAN NOT NULL,
    "ROW_VERSION" BIGINT NOT NULL,
    "IS_DELETED" BOOLEAN NOT NULL,
    "CREATE_BY" BIGINT NOT NULL,
    "CREATE_TIME" DATETIME NOT NULL,
    "LAST_UPDATE_BY" BIGINT,
    "LAST_UPDATE_TIME" DATETIME
);
-- ----------------------------
-- Table structure for ROLE - 角色
-- Target   : SQLite
-- Author   : wangbing
-- Date:    : 2020-03-09
-- ----------------------------
CREATE TABLE IF NOT EXISTS SYS_ROLE (
    "ID" BIGINT PRIMARY KEY NOT NULL,
    "CODE" VARCHAR(50) NOT NULL,
    "NAME" VARCHAR(50) NOT NULL,
    "COMMENT" VARCHAR(50),
    "ROW_VERSION" BIGINT NOT NULL,
    "IS_DELETED" BOOLEAN NOT NULL,
    "CREATE_BY" BIGINT NOT NULL,
    "CREATE_TIME" DATETIME NOT NULL,
    "LAST_UPDATE_BY" BIGINT,
    "LAST_UPDATE_TIME" DATETIME
);
-- ----------------------------
-- Table structure for TOKENS - 通行证
-- Target   : SQLite
-- Author   : wangbing
-- Date:    : 2020-03-09
-- ----------------------------
CREATE TABLE IF NOT EXISTS SYS_TOKENS (
    "ID" BIGINT PRIMARY KEY NOT NULL,
    "TOKEN" VARCHAR(50) NOT NULL,
    "USER_ID" BIGINT NOT NULL,
    "USER_NAME" VARCHAR(50) NOT NULL,
    "LOGIN_TIME" DATETIME NOT NULL,
    "VALID_TIME" DATETIME NOT NULL,
    "VALID" BOOLEAN NOT NULL,
    "DEPT_ID" BIGINT,
    "DEPT_CODE" VARCHAR(50),
    "DEPT_NAME" VARCHAR(100),
    "TERMINAL_TYPE" VARCHAR(20),
    "TERMINAL_IP" VARCHAR(50),
    "TERMINAL_INFO" VARCHAR(500),
    "ROW_VERSION" BIGINT NOT NULL,
    "IS_DELETED" BOOLEAN NOT NULL,
    "CREATE_BY" BIGINT NOT NULL,
    "CREATE_TIME" DATETIME NOT NULL,
    "LAST_UPDATE_BY" BIGINT,
    "LAST_UPDATE_TIME" DATETIME
);
-- ----------------------------
-- Table structure for FILE - 文件
-- Target   : SQLite
-- Author   : wangbing
-- Date:    : 2020-03-09
-- ----------------------------
CREATE TABLE IF NOT EXISTS SYS_FILE (
    "ID" BIGINT PRIMARY KEY NOT NULL,
    "NAME" VARCHAR(250),
    "FILE_TYPE" VARCHAR(20),
    "ATTRIBUTE1" VARCHAR(50),
    "ATTRIBUTE2" VARCHAR(50),
    "LOCATION" VARCHAR(500),
    "URL" VARCHAR(500),
    "URL_DOWNLOAD" VARCHAR(500),
    "ROW_VERSION" BIGINT NOT NULL,
    "IS_DELETED" BOOLEAN NOT NULL,
    "CREATE_BY" BIGINT NOT NULL,
    "CREATE_TIME" DATETIME NOT NULL,
    "LAST_UPDATE_BY" BIGINT,
    "LAST_UPDATE_TIME" DATETIME
);
-- ----------------------------
-- Table structure for USER_ROLE - 用户角色授权
-- Target   : SQLite
-- Author   : wangbing
-- Date:    : 2020-03-09
-- ----------------------------
CREATE TABLE IF NOT EXISTS SYS_USER_ROLE (
    "ID" BIGINT PRIMARY KEY NOT NULL,
    "USER_ID" BIGINT NOT NULL,
    "USER_CODE" VARCHAR(50) NOT NULL,
    "ROLE_ID" BIGINT NOT NULL,
    "ROLE_CODE" VARCHAR(50) NOT NULL,
    "ROW_VERSION" BIGINT NOT NULL,
    "IS_DELETED" BOOLEAN NOT NULL,
    "CREATE_BY" BIGINT NOT NULL,
    "CREATE_TIME" DATETIME NOT NULL,
    "LAST_UPDATE_BY" BIGINT,
    "LAST_UPDATE_TIME" DATETIME
);
-- ----------------------------
-- Table structure for ROLE_RES - 角色资源关系
-- Target   : SQLite
-- Author   : wangbing
-- Date:    : 2020-03-09
-- ----------------------------
CREATE TABLE IF NOT EXISTS SYS_ROLE_RES (
    "ID" BIGINT PRIMARY KEY NOT NULL,
    "ROLE_ID" BIGINT NOT NULL,
    "ROLE_CODE" VARCHAR(50) NOT NULL,
    "RES_ID" BIGINT NOT NULL,
    "RES_CODE" VARCHAR(50) NOT NULL,
    "ROW_VERSION" BIGINT NOT NULL,
    "IS_DELETED" BOOLEAN NOT NULL,
    "CREATE_BY" BIGINT NOT NULL,
    "CREATE_TIME" DATETIME NOT NULL,
    "LAST_UPDATE_BY" BIGINT,
    "LAST_UPDATE_TIME" DATETIME
);
-- ----------------------------
-- Table structure for LOG_ERR - 错误日志
-- Target   : SQLite
-- Author   : wangbing
-- Date:    : 2020-03-09
-- ----------------------------
CREATE TABLE IF NOT EXISTS SYS_LOG_ERR (
    "ID" BIGINT PRIMARY KEY NOT NULL,
    "LOG_ERR_TYPE" VARCHAR(20),
    "TITLE" VARCHAR(50) NOT NULL,
    "CONTENT" TEXT,
    "LOG_ERR_RESULT" VARCHAR(20) NOT NULL,
    "ATTRIBUTE1" VARCHAR(50),
    "ATTRIBUTE2" VARCHAR(50),
    "ATTRIBUTE3" VARCHAR(50),
    "ROW_VERSION" BIGINT NOT NULL,
    "IS_DELETED" BOOLEAN NOT NULL,
    "CREATE_BY" BIGINT NOT NULL,
    "CREATE_TIME" DATETIME NOT NULL,
    "LAST_UPDATE_BY" BIGINT,
    "LAST_UPDATE_TIME" DATETIME
);
