Skip to content

Commit

Permalink
Merge remote-tracking branch 'up/feature-milestone2' into feature-mil…
Browse files Browse the repository at this point in the history
…estone2
  • Loading branch information
caryliao(廖飞强) committed Aug 30, 2024
2 parents 9a3d6e6 + e372119 commit ded0976
Show file tree
Hide file tree
Showing 49 changed files with 2,017 additions and 265 deletions.
57 changes: 57 additions & 0 deletions db/wedpr_ddl.sql
Original file line number Diff line number Diff line change
Expand Up @@ -342,3 +342,60 @@ CREATE TABLE IF NOT EXISTS wedpr_cert (
INDEX idx_agency_name (agency_name),
INDEX idx_cert_status (cert_status)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin ROW_FORMAT=DYNAMIC;
-- the api credential table
create table if not exists `wedpr_api_credential_table`(
`id` varchar(64) not null comment "id",
`access_key_id` varchar(255) not null comment "访问ID(用于标志用户)",
`access_key_secret` VARCHAR(1024) not null comment "访问密钥",
`owner` varchar(255) not null comment "属主",
`status` varchar(1024) not null comment "状态",
`desc` text comment "描述信息",
`create_time` DATETIME DEFAULT CURRENT_TIMESTAMP comment "创建时间",
`last_update_time` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP comment "更新时间",
primary key (`id`),
index access_key_id_index(`access_key_id`(128)),
index owner_index(`owner`(128)),
index status_index(`status`(128))
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin ROW_FORMAT=DYNAMIC;

-- the service publish related tables
create table if not exists wedpr_published_service(
`service_id` varchar(64) not null comment "发布的服务ID",
`service_name` varchar(1024) not null comment "服务名称",
`service_desc` text default null comment "服务描述",
`service_type` varchar(1024) not null comment "发布的服务类型, 如pir/lr/xgb",
`service_config` longtext comment "服务配置",
`owner` varchar(255) not null comment "属主",
`agency` varchar(255) not null comment "所属机构",
`create_time` DATETIME DEFAULT CURRENT_TIMESTAMP comment "创建时间",
`last_update_time` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP comment "更新时间",
primary key (`service_id`),
index service_name_index(`service_name`(128)),
index service_type_index(`service_type`(128)),
index owner_index(`owner`(128)),
index agency_index(`agency`(128))
)ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin ROW_FORMAT=DYNAMIC;

create table if not exists wedpr_service_auth_table(
`id` varchar(64) not null comment "ID",
`service_id` varchar(64) not null comment "服务ID",
`access_key_id` varchar(255) not null comment "访问ID(用于标志用户)",
`expire_time` DATETIME not null comment "过期时间",
`apply_time` DATETIME DEFAULT CURRENT_TIMESTAMP comment "申请时间",
`last_update_time` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP comment "更新时间",
primary key (`id`),
index service_id_index(`service_id`(128)),
index access_key_id_index(`access_key_id`(128))
)ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin ROW_FORMAT=DYNAMIC;

create table if not exists wedpr_service_invoke_table(
`invoke_id` varchar(64) not null comment "调用ID",
`service_id` varchar(64) not null comment "调用的服务ID",
`invoke_user` varchar(1024) not null comment "调用者",
`invoke_agency` varchar(1024) not null comment "调用方所属机构",
`invoke_time` DATETIME DEFAULT CURRENT_TIMESTAMP comment "调用时间",
`last_update_time` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP comment "更新时间",
primary key (`invoke_id`),
index service_id_index(`service_id`),
index invoker_index(`invoke_agency`(64), `invoke_user`(64))
)ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin ROW_FORMAT=DYNAMIC;
6 changes: 6 additions & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ project(":wedpr-components-spi").projectDir=file("wedpr-components/spi")
include "wedpr-components-transport"
project(":wedpr-components-transport").projectDir=file("wedpr-components/transport")

include "wedpr-components-crypto"
project(":wedpr-components-crypto").projectDir=file("wedpr-components/crypto")

include "wedpr-components-api-credential"
project(":wedpr-components-api-credential").projectDir=file("wedpr-components/api-credential")

include ":wedpr-components-jupyter-intergration"
project(":wedpr-components-jupyter-intergration").projectDir=file("wedpr-components/env-integration/jupyter")

Expand Down
214 changes: 214 additions & 0 deletions wedpr-admin/db/wedpr_admin_ddl.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,214 @@
-- the wedpr config table
create table if not exists `wedpr_config_table`(
`config_key` varchar(128) not null comment "配置项主键",
`config_value` longtext not null comment "配置项的值",
`create_time` datetime DEFAULT CURRENT_TIMESTAMP comment "配置创建时间",
`last_update_time` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP comment "配置更新时间",
primary key(`config_key`)
)ENGINE=InnoDB default charset=utf8mb4 default collate=utf8mb4_bin ROW_FORMAT=DYNAMIC;

CREATE TABLE if not exists `wedpr_dataset_permission` (
`id` VARCHAR(64) NOT NULL COMMENT '数据集权限id',
`dataset_id` VARCHAR(64) NOT NULL COMMENT '数据集id',
`permission_type` int(8) NOT NULL COMMENT '权限类型',
`permission_scope` VARCHAR(255) NOT NULL COMMENT '权限范围',
`permission_subject_id` TEXT NOT NULL COMMENT '数据集授权对象的id',
`expired_at` DATE NOT NULL DEFAULT '9999-12-31',
`create_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
`update_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
INDEX dataset_id_index (`dataset_id`),
INDEX permission_type_index (`permission_type`),
INDEX permission_scope_index (`permission_scope`),
INDEX expired_at_index (`expired_at`)
)ENGINE='InnoDB' DEFAULT CHARSET='utf8mb4' COLLATE='utf8mb4_bin' ROW_FORMAT=DYNAMIC COMMENT '数据集权限表';

-- 创建机构表
CREATE TABLE IF NOT EXISTS wedpr_agency (
agency_id VARCHAR(64) NOT NULL comment "机构编号",
agency_name VARCHAR(64) NOT NULL comment "机构名",
agency_desc text NOT NULL comment "机构描述",
agency_contact VARCHAR(64) NOT NULL comment "机构联系人",
contact_phone VARCHAR(64) NOT NULL comment "联系电话",
gateway_endpoint VARCHAR(64) NOT NULL comment "网关地址",
agency_status TINYINT DEFAULT 0 NOT NULL comment "机构状态(0:启用,1:禁用)",
user_count INT DEFAULT 0 comment "机构用户数",
create_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
update_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
create_by VARCHAR(20) NOT NULL DEFAULT '',
update_by VARCHAR(20) NOT NULL DEFAULT '',
PRIMARY KEY (agency_id),
INDEX idx_agency_name (agency_name)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin ROW_FORMAT=DYNAMIC;

-- 创建机构证书表
CREATE TABLE IF NOT EXISTS wedpr_cert (
cert_id VARCHAR(64) NOT NULL comment "证书id",
agency_id VARCHAR(64) NOT NULL comment "机构编号",
agency_name VARCHAR(64) NOT NULL comment "机构名",
csr_file_name VARCHAR(64) NOT NULL comment "机构证书请求文件名",
csr_file_text text NOT NULL comment "机构证书请求文件内容",
cert_file_text text NOT NULL comment "机构证书文件内容",
expire_time DATETIME NOT NULL comment "过期时间",
cert_status TINYINT DEFAULT 0 NOT NULL comment "证书状态(0:无证书,1:有效,2:过期,3:禁用)",
create_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
update_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
create_by VARCHAR(20) NOT NULL DEFAULT '',
update_by VARCHAR(20) NOT NULL DEFAULT '',
PRIMARY KEY (cert_id),
INDEX idx_agency_name (agency_name),
INDEX idx_cert_status (cert_status)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin ROW_FORMAT=DYNAMIC;

CREATE TABLE if not exists `wedpr_dataset` (
`dataset_id` VARCHAR(64) NOT NULL COMMENT '数据集id',
`dataset_title` VARCHAR(1024) NOT NULL COMMENT '数据集标题',
`dataset_label` VARCHAR(1024) NOT NULL COMMENT '数据集标签',
`dataset_desc` TEXT NOT NULL COMMENT '数据集描述',
`dataset_fields` TEXT COMMENT '数据源字段以及预览信息',
`dataset_version_hash` VARCHAR(64) DEFAULT '' COMMENT '数据集hash',
`dataset_size` bigint DEFAULT 0 COMMENT '数据集大小',
`dataset_record_count` bigint DEFAULT 0 COMMENT '数据集记录数目',
`dataset_column_count` int DEFAULT 0 COMMENT '数据集列数目',
`dataset_storage_type` VARCHAR(255) DEFAULT '' COMMENT '数据集存储类型',
`dataset_storage_path` VARCHAR(1024) DEFAULT '' COMMENT '数据集存储路径',
`owner_agency_name` VARCHAR(255) NOT NULL COMMENT '数据集所属机构名称',
`owner_user_name` VARCHAR(1024) NOT NULL COMMENT '数据集所属用户名',
`data_source_type` VARCHAR(255) NOT NULL COMMENT '数据源类型 : CSV、DB、XLSX、FPS、HDFS、HIVE',
`data_source_meta` TEXT NOT NULL COMMENT '数据源参数信息,JSON字符串',
`visibility` int(8) NOT NULL COMMENT '数据集可见性, 0: 私有,1: 公开可见',
`visibility_details` TEXT NOT NULL COMMENT '数据源可见范围描述, visibility 为1时有效',
`approval_chain` TEXT NOT NULL COMMENT '审批链信息',
`status` tinyint(4) NOT NULL COMMENT '数据集状态, 0: 有效,其他无效',
`status_desc` VARCHAR(1024) NOT NULL COMMENT '数据集状态描述',
`create_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
`update_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`dataset_id`),
INDEX dataset_title_index (`dataset_title`(128)),
INDEX owner_agency_name_index (`owner_agency_name`),
INDEX owner_user_name_index (`owner_user_name`(128)),
INDEX create_at_index (`create_at`),
INDEX update_at_index (`update_at`)
)ENGINE='InnoDB' DEFAULT CHARSET='utf8mb4' COLLATE='utf8mb4_bin' ROW_FORMAT=DYNAMIC COMMENT '数据集记录表';

create table if not exists `wedpr_project_table`(
`id` varchar(64) not null comment "项目ID",
`name` varchar(1024) not null comment "项目名称",
`desc` varchar(1024) not null comment "项目描述",
`owner` varchar(255) not null comment "项目属主",
`owner_agency` varchar(255) not null comment "项目所属机构",
`project_type` varchar(255) not null comment "项目类型(Export/Wizard)",
`label` varchar(1024) comment "项目标签",
`create_time` DATETIME DEFAULT CURRENT_TIMESTAMP comment "项目创建时间",
`last_update_time` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP comment "项目更新时间",
primary key (`id`),
unique index name_index(`name`(128)),
index owner_index(`owner`(128), `owner_agency`(128)),
index project_type_index(`project_type`(128)),
index label_index(`label`(128))
)ENGINE=InnoDB default charset=utf8mb4 default collate=utf8mb4_bin ROW_FORMAT=DYNAMIC;

create table if not exists `wedpr_job_table`(
`id` varchar(64) not null comment "任务ID",
`name` varchar(1024) comment "任务名称",
`project_name` varchar(1024) comment "任务所属项目",
`owner` varchar(255) not null comment "任务发起人",
`owner_agency` varchar(255) not null comment "任务发起机构",
`job_type` varchar(255) not null comment "任务类型",
`parties` text comment "任务相关机构信息(json)",
`param` longtext comment "任务参数(json)",
`status` varchar(255) comment "任务状态",
`job_result` longtext comment "任务执行结果(json)",
`create_time` DATETIME DEFAULT CURRENT_TIMESTAMP comment "任务创建时间",
`last_update_time` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP comment "任务更新时间",
primary key(`id`),
index name_index(`name`(128)),
index owner_index(`owner`(128)),
index owner_agency_index(`owner_agency`(128)),
index project_index(`project_name`(128)),
index status_index(`status`(128))
)ENGINE=InnoDB default charset=utf8mb4 default collate=utf8mb4_bin ROW_FORMAT=DYNAMIC;

-- 创建用户组表
CREATE TABLE IF NOT EXISTS wedpr_group (
group_id VARCHAR(64) NOT NULL,
group_name VARCHAR(64) NOT NULL,
admin_name VARCHAR(64) NOT NULL DEFAULT '',
create_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
update_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
create_by VARCHAR(20) NOT NULL DEFAULT '',
update_by VARCHAR(20) NOT NULL DEFAULT '',
status TINYINT DEFAULT 0,
PRIMARY KEY (group_id),
INDEX idx_group_name (group_name),
INDEX idx_admin_name (admin_name)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin ROW_FORMAT=DYNAMIC;

-- 创建用户组详情表
CREATE TABLE IF NOT EXISTS wedpr_group_detail (
group_id VARCHAR(64) NOT NULL,
username VARCHAR(128) NOT NULL,
create_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
update_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
create_by VARCHAR(20) NOT NULL DEFAULT '',
update_by VARCHAR(20) NOT NULL DEFAULT '',
status TINYINT DEFAULT 0,
PRIMARY KEY (group_id, username),
INDEX idx_username (username)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin ROW_FORMAT=DYNAMIC;

-- 创建用户表
CREATE TABLE IF NOT EXISTS wedpr_user (
username VARCHAR(128) NOT NULL,
email VARCHAR(128),
password VARCHAR(256),
phone VARCHAR(64),
try_count int(10),
allowed_timestamp BIGINT(20),
create_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
update_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
create_by VARCHAR(20) NOT NULL DEFAULT '',
update_by VARCHAR(20) NOT NULL DEFAULT '',
status TINYINT DEFAULT 0,
PRIMARY KEY (username),
INDEX idx_email (email),
INDEX idx_phone (phone)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin ROW_FORMAT=DYNAMIC;

-- 创建用户角色表
CREATE TABLE IF NOT EXISTS wedpr_user_role (
username VARCHAR(128) NOT NULL,
role_id VARCHAR(64) NOT NULL,
create_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
update_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
create_by VARCHAR(20) NOT NULL DEFAULT '',
update_by VARCHAR(20) NOT NULL DEFAULT '',
PRIMARY KEY (username, role_id),
INDEX idx_role_id (role_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin ROW_FORMAT=DYNAMIC;

-- 创建角色权限表
CREATE TABLE IF NOT EXISTS wedpr_role_permission (
role_id VARCHAR(64) NOT NULL,
role_name VARCHAR(64) NOT NULL,
permission_id VARCHAR(64) NOT NULL,
create_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
update_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
create_by VARCHAR(20) NOT NULL DEFAULT '',
update_by VARCHAR(20) NOT NULL DEFAULT '',
PRIMARY KEY (role_id, permission_id),
INDEX idx_role_name (role_name ),
INDEX idx_permission_id (permission_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin ROW_FORMAT=DYNAMIC;

-- 创建权限表
CREATE TABLE IF NOT EXISTS wedpr_permission (
permission_id VARCHAR(64) NOT NULL,
permission_name VARCHAR(128) NOT NULL,
permission_content TEXT NOT NULL,
create_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
update_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
create_by VARCHAR(20) NOT NULL DEFAULT '',
update_by VARCHAR(20) NOT NULL DEFAULT '',
PRIMARY KEY (permission_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin ROW_FORMAT=DYNAMIC;
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.webank.wedpr.components.admin.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.webank.wedpr.components.dataset.dao.Dataset;

/**
* 数据集记录表 Mapper 接口
*
* @author caryliao
* @since 2024-08-29
*/
public interface WedprDatasetMapper extends BaseMapper<Dataset> {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.webank.wedpr.components.admin.mapper.WedprDatasetMapper">

<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.webank.wedpr.components.dataset.dao.Dataset">
<id column="dataset_id" property="datasetId" />
<result column="dataset_title" property="datasetTitle" />
<result column="dataset_label" property="datasetLabel" />
<result column="dataset_desc" property="datasetDesc" />
<result column="dataset_fields" property="datasetFields" />
<result column="dataset_version_hash" property="datasetVersionHash" />
<result column="dataset_size" property="datasetSize" />
<result column="dataset_record_count" property="datasetRecordCount" />
<result column="dataset_column_count" property="datasetColumnCount" />
<result column="dataset_storage_type" property="datasetStorageType" />
<result column="dataset_storage_path" property="datasetStoragePath" />
<result column="owner_agency_name" property="ownerAgencyName" />
<result column="owner_user_name" property="ownerUserName" />
<result column="data_source_type" property="dataSourceType" />
<result column="data_source_meta" property="dataSourceMeta" />
<result column="visibility" property="visibility" />
<result column="visibility_details" property="visibilityDetails" />
<result column="approval_chain" property="approvalChain" />
<result column="status" property="status" />
<result column="status_desc" property="statusDesc" />
<result column="create_at" property="createAt" />
<result column="update_at" property="updateAt" />
</resultMap>

</mapper>
9 changes: 9 additions & 0 deletions wedpr-components/api-credential/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Apply the java-library plugin to add support for Java Library
plugins {
id 'java'
}
dependencies{
compile project(":wedpr-components-mybatis")
compile project(":wedpr-components-uuid")
compile project(":wedpr-components-crypto")
}
Loading

0 comments on commit ded0976

Please sign in to comment.