Unverified Commit c384175d authored by zhu-mingye's avatar zhu-mingye Committed by GitHub

[Feature][admin,web] merge tenant to dev branch (#1093)

* add tenant implementation (#776)

* add tenant implement

* add tenant implement

* fix get tenants

* add tenants in the normal process

* update application.yml file mysql info

* fix tenant in normal process

* fix login

* add file agreement  and update dlink_history.sql

* fix application.yml file

* fix system init

* fix tenant bug

* fix tenant bug

* fix tenant bug

* fix tenant bug

* fix application.yml
Co-authored-by: 's avatartangxiuhong <tangxiuhong@cangshu.vip>
Co-authored-by: 's avataraiwenmo <32723967+aiwenmo@users.noreply.github.com>

* [Feature-812][admin,web] add FragmentVariable manager && resourcecenter page (#813)

* add FragmentVariable manager

* added resourcecenter

* fix sql file , mapper.xml

* added NameSpaceForm PasswordForm

* added NameSpaceForm PasswordForm (#820)

* Delete SqlParserTest.java

* Optimized for multi-tenant

* [optimization][admin] Optimized for multi-tenant (#834)

* Delete SqlParserTest.java

* Optimized for multi-tenant
Co-authored-by: 's avataraiwenmo <32723967+aiwenmo@users.noreply.github.com>

* Render multi tenant forms on login (#841)

* [Feature-823][web] Multi tenant front end implementation  (#847)

* Implementation of multi tenant login

* UserManager,RoleManager,TenantManager,NameSpaceManager implementation

* fix NameSpaceForm RoleForm

* optimize multi tenant (#848)

* fix get tenants by role id bug

* fix add tenant key no unique

* fix login get tenants interceptor

* optimize multi tenant

* optimize multi tenant
Co-authored-by: 's avatartangxiuhong <tangxiuhong@cangshu.vip>

* fix multi tenant add role and delete role (#865)

* fix multi tenant add role and delete role

* fix multi tenant add role and delete role
Co-authored-by: 's avatartangxiuhong <tangxiuhong@cangshu.vip>

* Optimization of multi tenant &&  Optimize form rendering  (#876)

* 优化多租户相关问题

* 优化用户赋权角色表单渲染

* 优化用户赋权角色表单渲染

* 优化资源中心左右表单渲染

* Optimization of multi tenant && Optimize form rendering 

Optimization of multi tenant && Optimize form rendering

* optimization multi tenant  of delete roles &&  optimization multi tenant web render (#887)

* 用户授权角色穿梭框优化

* 用户授权角色穿梭框删除handleSearch

* 优化角色删除及其关联命名空间删除的逻辑

* 修复角色选择命名空间回显问题

* 优化用户关联角色渲染 (#888)

* [Feature-890][admin] Implementation of user role management

* Realization of user empowerment role function(#893)

* merge dev to dev-tenant (#1006)

* Optimization StudioConsole's StudioProcess click show flinksql the div overflow (#802)

* [Document-793][doc] docs hotfix (#815)

* docs hotfix

* Fix Chinese README link error and add English README. (#817)

* Added ignore of logs folder in git ignore file. (#807)

* [Optimization-810][Common] Added Maven Wrapper (#811)

* add maven wrapper

* add maven-wrapper.jar

* update .gitignore

* Fix jobhistory bug (#805)

* jobHistory bug modify

* jobHistory bug modify

* jobHistory bug modify

* update roadmap (#822)
Co-authored-by: 's avatargodkaikai <32723967+godkaikai@users.noreply.github.com>

* Optimize cdc SQLSinkBuilder KafkaSinkBuilder, filter to process (#806)

* 优化 cdc SQLSinkBuilder KafkaSinkBuilder, filter to process

* change "_" to "."

* change "db" to config.getSchemaFieldName()

* change "tableMap key" to table.getSchemaTableName()

* [Fix-818][connector] fix when the data is flushed with an exception and no new data is entered subsequently (#824)

Co-authored-by: lucas.wu <1220671715>

* [Document-835][doc] Update the home page and basic information of the document (#836)
Co-authored-by: 's avatarwenmo <32723967+wenmo@users.noreply.github.com>

* remove sensitive info for more api. (#829)
Co-authored-by: 's avatardzygcc <avadar@qq.com>

* [fix 833] [dlink-client] Error with SQLSinkBuilder.buildRow (#833) (#842)
Co-authored-by: 's avatarqiaoyiming <wenpin@tianmagroup.com>

* [Optimization-819][dlink-client] CDCSOURCE with timestamp and timezone (#843)

change default timezone = UTC ,
set timezone with setting sink.timezone
(#819)
Co-authored-by: 's avatarqiaoyiming <wenpin@tianmagroup.com>

* [Optimization-849][client,executor] Replace sql separator and change default sql separator into ;\n (#850)
Co-authored-by: 's avatarwenmo <32723967+wenmo@users.noreply.github.com>

* fix execute error by flink 1.14.4 (#851)

* Optimize code style import order. (#853)

* fix SQLSinkBuilder.buildRow in flink-client-1.11 and flink-client-1.12 (#864)

change Row.withPositions() to new Row()

* 修复字符乱码和时区不正确以及增加datastream实现 (#845)

* fix: MYSQL CDC JsonDebeziumDeserializationSchema 字节转字符提定字符编码 UTF-8

* fix: MYSQL CDC SQLSinkBuilder 转换mysql 类型datetime时,时区不正确,应该设置UTC实区

* [Feature]:
   1:增加datastream-starrocks 实现,目前strrocks官网jar只到1.14对应的flink版本
   2:增加datastream-kafka-json 实现,主要实现抽像出必须的记录数据,增加扩展op、is_delete、schemaName,tableName,ts_ms等字段,方便业务使用

* [optimization]:优化调整重复代码

[optimization]:优化调整重复代码

* [Feature-794][*] Modify version into 0.6.7-SNAPSHOT (#866)
Co-authored-by: 's avatarwenmo <32723967+wenmo@users.noreply.github.com>

* Added  git file ignore (#867)

* 修改 dlink-conector-pulsar-1.14 (#871)

<!--新增 pulsar-client-api jar 解决找不到SubscriptionType报错-->

Co-authored-by: wzh8384 <wzh615961806>

* 使用dlink链接Flink1.14.4,SavePoint停止任务时会出现,这个问题我jackjson进行了升级就解决了,Flink1.14.4版本引用的是2.12.1 (#872)

* Using connection pooling to fix jdbc multi-connection problem (#873)
Co-authored-by: 's avatarliuxiaofeng <liuxiaofeng@xcxd.com>

* [Fix-803] [Client] Fix TypeConvert-ColumnType Enumeration usage error (#878)
Co-authored-by: 's avatarwenmo <32723967+wenmo@users.noreply.github.com>

* [bug and doc] Fix yarn per job resource release (#863)

* [文档]:
1. 补充部署细节。
2. 增加一些 flink sql 案例。

* [bug修复]:
修复 yarn per job 、 batch 模式下任务完成后,yarn 不自动释放 flink JM 角色资源的问题,任务以 detached 模式运行。

* [Fix-832][doc] add Practice Sharing of FlinkSQL Extending Redis (#879)
Co-authored-by: 's avatarhzymarine <marinehuang163@163.com>

* [Feature-868][Common] Added github workflow to check the checkstyle, test and build of each PR (#869)

* Added github workflow to check the checkstyle, test and build of each PR.

* Specify the checkstyle file.

* Added dlink-admin module code style (#889)

* [Optimization][Style]Added dlink-alert module code style. (#891)

* Added dlink-alert module code style.

* update alert plugin module code style

* Added dlink-common module code style. (#892)

* Added dlink-catalog module code style. (#895)

* Added dlink-app module code style. (#899)

* Optimized connection pooling and connection creation (#900)
Co-authored-by: 's avatarliuxiaofeng <liuxiaofeng@xcxd.com>

* feature 全局变量管理增删改查实现 (#906)

* [Feature-907][pom] Change Flink base version into 1.14 (#908)
Co-authored-by: 's avatarwenmo <32723967+wenmo@users.noreply.github.com>

* Added dlink-connectors module code style. (#913)

* [Feature-915][admin,core] Add global variables takes effect in flinksql (#916)
Co-authored-by: 's avatarwenmo <32723967+wenmo@users.noreply.github.com>

* Added dlink-daemon module code style. (#918)

* Added dlink-executor module code style. (#919)

* [Optimization][Style]  Added dlink-core module code style (#917)

* Added dlink-core module code style.

* fix AbstractTrans error

* Added dlink-client module code style. (#898)

* Added dlink-function and dlink-gateway module code style (#920)

* Add a license description to the pom file. (#922)

* Added dlink-metadata module code style. (#921)

* [Feature-923][*] Build column lineage base on flink logical plan (#924)

* [Feature-923][*] Build column lineage base on flink logical plan

* [Feature-923][*] Dynamic add getColumnOrigins method to class RelMdColumnOrigins by javassist
Co-authored-by: 's avatarwenmo <32723967+wenmo@users.noreply.github.com>

* [Optimization-932][pom] Optimizate package and auto.sh by loading classpaths (#933)
Co-authored-by: 's avatarwenmo <32723967+wenmo@users.noreply.github.com>

* 'dlink-client-hadoop打包增加ServicesResourceTransformer' (#935)

* [Optimization-943][pom] Optimizate config and static dir packaging (#944)
Co-authored-by: 's avatarwenmo <32723967+wenmo@users.noreply.github.com>

* flinkSQL supports the posgresql CDC function and the full database synchronization function. (#925)

* 修改点:
1、dlink-flink1.14增加postgres cdc connector,支持flinksql开发。
2、整库同步增加支持postgres数据库。

* 修改点:
1、METADATA_TYPE与dlink-meta中保持一致,避免Driver找不到lib的情况;
2、url中/后改为databasename,原来代码中填schema名是不正确的。

* postgresCDCBuilder改为首字母大写。

* Modify checkstyle to be a required item. (#948)

* 支持sqlserver cdc功能,测试同步doris通过。 (#951)

* 增加sqlserver-cdc支持,可以通过手写finksql完成sqlservercdc同步,但是不支持cdcsource模式.

* 修改报名\类名为sqlserver

* 增加sqlserver-cdc支持,可以通过手写finksql完成sqlservercdc同步,但是不支持cdcsource模式.

* 优化trycatch异常日志打印代码

* 支持sqlservercdc功能
Co-authored-by: 's avatar金鑫 <jinyanhui@huansi.net>

* Fix cluster submission taskId is empty (#862)

* The bug that the cluster information cannot be obtained in the savepoint save list

* Add taskId in case dlink maintains sql

* format code

* enhance manage logic

* 1. fix taskId is 0
2. reformat code

* reformat code

* refactor imports

* [Optimization][Style] Configure global checkstyle validation. (#953)

* Configure global checkstyle validation.

* Configure global checkstyle validation.

* [Feature] Add swagger api doc (#954)

* Add swagger api doc

* update datasource config info in the application file

* [Fix-840] [web] fix registration document type filter condition error (#959)

* Sqlserver增加date类型数据转换规则 (#958)

* sqlserver增加date类型数据转换规则.

* sqlserver增加date类型数据转换规则.
Co-authored-by: 's avatar金鑫 <jinyanhui@huansi.net>

* [Fix][dlink-gateway]修复k8s Application、Yarn Application、Yarn PerJob提交任务时未指定集群配置MasterMemoryMB、TaskManagerMemoryMB、SlotsPerTaskManager (#970)

* [Fix][dlink-gateway]修复k8s Application、Yarn Application、Yarn PerJob提交任务时未指定集群配置MasterMemoryMB、TaskManagerMemoryMB、SlotsPerTaskManager

* cdcsource增加多目标库同步功能 (#969)

单目标使用 'sink.*'
多目标使用 'sink[N].*', N为0开始的index索引.
Co-authored-by: 's avatar金鑫 <jinyanhui@huansi.net>

* 修复问题: (#949)

解决KafkaSinkBuilder没有序列化会报错的问题。

* Create PostgreSqlQuery.java (#971)

优化PG库"schema_name"查询

* [Fix][dlink-gateway]修复k8s application模式提交失败,优化增加获取JobId等待时间 (#972)

* [Fix][dlink-gateway]修复k8s Application、Yarn Application、Yarn PerJob提交任务时未指定集群配置MasterMemoryMB、TaskManagerMemoryMB、SlotsPerTaskManager

* [Fix][dlink-gateway]修复k8s Application、Yarn Application、Yarn PerJob提交任务时未指定集群配置MasterMemoryMB、TaskManagerMemoryMB、SlotsPerTaskManager

* [Fix][dlink-gateway]修复k8s application模式提交失败,优化增加获取JobId等待时间,

* [Fix][dlink-common]扩展系统配置参数添加jobid的最大等待时间

* [Bug] fix the banner of dlink admin app (#977)

* [Bug] fix the banner of dlink admin app

* remove banners

* [Optimization-981][metadata] Doris support more syntax (#982)
Co-authored-by: 's avatarwenmo <32723967+wenmo@users.noreply.github.com>

* [Optimization-983][client] Optimizate Doris datastream sink (#984)
Co-authored-by: 's avatarwenmo <32723967+wenmo@users.noreply.github.com>

* Optimizing Deployment Documents (#980)

* [feature] [dlink-admin] File upload (#939)

* add a table, name: dlink_upload_file_record

* File upload implement

* Modify function name and javadoc

* [Feature-987][admin] ClusterConfig and jar add upload file (#988)
Co-authored-by: 's avatarwenmo <32723967+wenmo@users.noreply.github.com>

* optimization Some problems in front-end (#986)

* 修订TypeImformation原因,自定义隐函数不能在Flink 1.14.x 版本以上运行。 (#973)

1.引入泛型,以自适应多种数据类型;
2.直接返回Map<K,V>,避免数据转换

* [Feature-989][metadata] Add StarRocks datasource (#990)
Co-authored-by: 's avatarwenmo <32723967+wenmo@users.noreply.github.com>

* [Optimization-882][web] Collapse all directories by default on datastudio's directory panel (#991)
Co-authored-by: 's avatarwenmo <32723967+wenmo@users.noreply.github.com>

* [Feature-946][alarm] Alarm after task monitoring retry (#992)

* [Feature-946][alarm] Alarm after task monitoring retry

* Format code
Co-authored-by: 's avatarwenmo <32723967+wenmo@users.noreply.github.com>

* [Optimization-881][datastudio] Optimizate FlinkSql explain exception message (#993)
Co-authored-by: 's avatarwenmo <32723967+wenmo@users.noreply.github.com>

* fix code checkstyle

* 渲染用户选择租户菜单

* 优化注册全局变量时被拦截的问题

* 优化用户选择租户菜单

* 优化一些代码
Co-authored-by: 's avatarKerwin <37063904+zhuangchong@users.noreply.github.com>
Co-authored-by: 's avatarmydq <42607771+mydq@users.noreply.github.com>
Co-authored-by: 's avataraiwenmo <32723967+aiwenmo@users.noreply.github.com>
Co-authored-by: 's avatargodkaikai <32723967+godkaikai@users.noreply.github.com>
Co-authored-by: 's avatarZackYoung <42713096+zackyoungh@users.noreply.github.com>
Co-authored-by: 's avatarlucas.wu <1220671715@qq.com>
Co-authored-by: 's avatarwenmo <32723967+wenmo@users.noreply.github.com>
Co-authored-by: 's avatardzygcc <dzygcc@gmail.com>
Co-authored-by: 's avatardzygcc <avadar@qq.com>
Co-authored-by: 's avatarchrofram <32118314+chrofram@users.noreply.github.com>
Co-authored-by: 's avatarqiaoyiming <wenpin@tianmagroup.com>
Co-authored-by: 's avatarwindWheel <1817802738@qq.com>
Co-authored-by: 's avatarzhongjingq <51869301+zhongjingq@users.noreply.github.com>
Co-authored-by: 's avatarzhonggui.wang <17490539+wangzhonggui@users.noreply.github.com>
Co-authored-by: 's avatarsunyanqing01 <43230630+sunyanqing01@users.noreply.github.com>
Co-authored-by: 's avatarxiaofeng <46049797+XiaoF-Liu@users.noreply.github.com>
Co-authored-by: 's avatarliuxiaofeng <liuxiaofeng@xcxd.com>
Co-authored-by: 's avatar第一片心意 <107013241+ziqiang-wang@users.noreply.github.com>
Co-authored-by: 's avatarhzymarine <50948904+hzymarine@users.noreply.github.com>
Co-authored-by: 's avatarhzymarine <marinehuang163@163.com>
Co-authored-by: 's avatarlnnlab <35280765+lnnlab@users.noreply.github.com>
Co-authored-by: 's avatarmengyejiang <403905717@qq.com>
Co-authored-by: 's avatar金鑫 <jinxincoding@gmail.com>
Co-authored-by: 's avatar金鑫 <jinyanhui@huansi.net>
Co-authored-by: 's avatarrafael <46079067+rafaelxie@users.noreply.github.com>
Co-authored-by: 's avatarcong <274902531@qq.com>
Co-authored-by: 's avatarzhujunjieit <42972147+zhujunjieit@users.noreply.github.com>
Co-authored-by: 's avatarleo65535 <leo65535@163.com>
Co-authored-by: 's avatarbyd-android-2017 <17773406760@189.cn>

* fix tenant bug (#1010)

* optimization choose tenant

* [optimization][*] optimization tenant code checkstyles (#1037)

* optimizer tenant,add user and tenant relation. (#1070)

* Implementation of tenant assignment user function and related code optimization (#1071)

* [Fix][web] Fix tenant assignment user function code (#1073)

* Implementation of tenant assignment user function and related code optimization

* fix tenant assignment user function code

* fix tenant assignment user function code

* [Optimize][web,admin] Optimize tenant selection (#1081)

* Implementation of tenant assignment user function and related code optimization

* fix tenant assignment user function code

* fix tenant assignment user function code

* Optimize tenant selection

* [Optimize][web] change resource center to authentication center (#1082)

* [optimization][web] Tips for optimizing batch deletion (#1085)

* Fix merged problems

* Fix merged sql file problems

* Fix merged sql file problems

* Fix merged init bug

* Fix merged user info bug

* Fix merged web bug

* Optimize internationalization

* Optimize internationalization

* reduction readme.md

* reduction readme.md

* reduction  readme.md
Co-authored-by: 's avatarXiuhongTang <t_spider@aliyun.com>
Co-authored-by: 's avatartangxiuhong <tangxiuhong@cangshu.vip>
Co-authored-by: 's avataraiwenmo <32723967+aiwenmo@users.noreply.github.com>
Co-authored-by: 's avatarwenmo <32723967+wenmo@users.noreply.github.com>
Co-authored-by: 's avatarKerwin <37063904+zhuangchong@users.noreply.github.com>
Co-authored-by: 's avatarmydq <42607771+mydq@users.noreply.github.com>
Co-authored-by: 's avatargodkaikai <32723967+godkaikai@users.noreply.github.com>
Co-authored-by: 's avatarZackYoung <42713096+zackyoungh@users.noreply.github.com>
Co-authored-by: 's avatarlucas.wu <1220671715@qq.com>
Co-authored-by: 's avatardzygcc <dzygcc@gmail.com>
Co-authored-by: 's avatardzygcc <avadar@qq.com>
Co-authored-by: 's avatarchrofram <32118314+chrofram@users.noreply.github.com>
Co-authored-by: 's avatarqiaoyiming <wenpin@tianmagroup.com>
Co-authored-by: 's avatarwindWheel <1817802738@qq.com>
Co-authored-by: 's avatarzhongjingq <51869301+zhongjingq@users.noreply.github.com>
Co-authored-by: 's avatarzhonggui.wang <17490539+wangzhonggui@users.noreply.github.com>
Co-authored-by: 's avatarsunyanqing01 <43230630+sunyanqing01@users.noreply.github.com>
Co-authored-by: 's avatarxiaofeng <46049797+XiaoF-Liu@users.noreply.github.com>
Co-authored-by: 's avatarliuxiaofeng <liuxiaofeng@xcxd.com>
Co-authored-by: 's avatar第一片心意 <107013241+ziqiang-wang@users.noreply.github.com>
Co-authored-by: 's avatarhzymarine <50948904+hzymarine@users.noreply.github.com>
Co-authored-by: 's avatarhzymarine <marinehuang163@163.com>
Co-authored-by: 's avatarlnnlab <35280765+lnnlab@users.noreply.github.com>
Co-authored-by: 's avatarmengyejiang <403905717@qq.com>
Co-authored-by: 's avatar金鑫 <jinxincoding@gmail.com>
Co-authored-by: 's avatar金鑫 <jinyanhui@huansi.net>
Co-authored-by: 's avatarrafael <46079067+rafaelxie@users.noreply.github.com>
Co-authored-by: 's avatarcong <274902531@qq.com>
Co-authored-by: 's avatarzhujunjieit <42972147+zhujunjieit@users.noreply.github.com>
Co-authored-by: 's avatarleo65535 <leo65535@163.com>
Co-authored-by: 's avatarbyd-android-2017 <17773406760@189.cn>
parent 6222f508
......@@ -16,7 +16,7 @@ Dinky 是一个 `开箱即用` 、`易扩展` ,以 `Apache Flink` 为基础,
其主要功能如下:
- 沉浸式 FlinkSQL 数据开发:自动提示补全、语法高亮、语句美化、在线调试、语法校验、执行计划、MetaStore、血缘分析、版本对比等
- 支持 FlinkSQL 多版本开发及多种执行模式:Local、Standalone、Yarn/Kubernetes Session、Yarn Per-Job、Yarn/Kubernetes Application
- 支持 FlinkSQL 多版本开发及多种执行模式:Local、Standalone、Yarn/Kubernetes Session、Yarn Per-Job、Yarn/Kubernetes Application
- 支持 Apache Flink 生态:Connector、FlinkCDC、Table Store 等
- 支持 FlinkSQL 语法增强:表值聚合函数、全局变量、执行环境、语句合并、整库同步、共享会话等
- 支持 FlinkCDC 整库实时入仓入湖、多库输出、自动建表
......
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.dlink.configure;
import com.dlink.context.RequestContext;
import java.util.List;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.handler.TenantLineHandler;
import com.baomidou.mybatisplus.extension.plugins.inner.TenantLineInnerInterceptor;
import com.google.common.collect.Lists;
import lombok.extern.slf4j.Slf4j;
import net.sf.jsqlparser.expression.Expression;
import net.sf.jsqlparser.expression.LongValue;
import net.sf.jsqlparser.expression.NullValue;
/**
* mybatisPlus config class
*/
@Configuration
@MapperScan("com.dlink.mapper")
@Slf4j
public class MybatisPlusConfig {
private static final List<String> IGNORE_TABLE_NAMES = Lists.newArrayList(
"dlink_namespace"
, "dlink_alert_group"
, "dlink_alert_history"
, "dlink_alert_instance"
, "dlink_catalogue"
, "dlink_cluster"
, "dlink_cluster_configuration"
, "dlink_database"
//,"dlink_fragment"
, "dlink_history"
, "dlink_jar"
, "dlink_job_history"
, "dlink_job_instance"
,"dlink_role"
, "dlink_savepoints"
, "dlink_task"
, "dlink_task_statement"
, "dlink_task_version"
);
@Bean
public MybatisPlusInterceptor mybatisPlusInterceptor() {
log.info("mybatis plus interceptor execute");
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
interceptor.addInnerInterceptor(new TenantLineInnerInterceptor(new TenantLineHandler() {
@Override
public Expression getTenantId() {
Integer tenantId = (Integer) RequestContext.get();
if (tenantId == null) {
log.warn("request context tenant id is null");
return new NullValue();
}
return new LongValue(tenantId);
}
@Override
public boolean ignoreTable(String tableName) {
return !IGNORE_TABLE_NAMES.contains(tableName);
}
}));
return interceptor;
}
}
\ No newline at end of file
......@@ -19,6 +19,8 @@
package com.dlink.configure;
import com.dlink.interceptor.TenantInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
......@@ -40,7 +42,25 @@ public class SaTokenConfigure implements WebMvcConfigurer {
registry.addInterceptor(new SaRouteInterceptor())
.addPathPatterns("/api/**")
.excludePathPatterns("/api/login")
.excludePathPatterns("/api/geTenants")
.excludePathPatterns("/openapi/**");
registry.addInterceptor(new TenantInterceptor())
.addPathPatterns("/api/alertGroup/**")
.addPathPatterns("/api/alertHistory/**")
.addPathPatterns("/api/alertInstance/**")
.addPathPatterns("/api/catalogue/**")
.addPathPatterns("/api/clusterConfiguration/**")
.addPathPatterns("/api/cluster/**")
.addPathPatterns("/api/database/**")
.addPathPatterns("/api/history/**")
.addPathPatterns("/api/jobInstance/**")
.addPathPatterns("/api/namespace/**")
.addPathPatterns("/api/savepoints/**")
.addPathPatterns("/api/statement/**")
.addPathPatterns("/api/task/**")
.addPathPatterns("/api/role/**")
//.addPathPatterns("/api/fragment/**")
.addPathPatterns("/api/jar/*");
}
}
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.dlink.context;
/**
* request context
*/
public class RequestContext {
private static final ThreadLocal<Object> threadLocal = new ThreadLocal<>();
public static void set(Object value) {
threadLocal.set(value);
}
public static Object get() {
return threadLocal.get();
}
public static void remove() {
threadLocal.remove();
}
}
\ No newline at end of file
......@@ -30,6 +30,7 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import cn.dev33.satoken.stp.StpUtil;
......@@ -57,7 +58,7 @@ public class AdminController {
if (Asserts.isNull(loginUTO.isAutoLogin())) {
loginUTO.setAutoLogin(false);
}
return userService.loginUser(loginUTO.getUsername(), loginUTO.getPassword(), loginUTO.isAutoLogin());
return userService.loginUser(loginUTO);
}
/**
......@@ -80,4 +81,12 @@ public class AdminController {
return Result.failed("获取失败");
}
}
/**
* get tenant
*/
@RequestMapping("/geTenants")
public Result getTenants(@RequestParam("username") String username) {
return userService.getTenants(username);
}
}
......@@ -60,12 +60,13 @@ public class ClusterConfigurationController {
*/
@PutMapping
public Result saveOrUpdate(@RequestBody ClusterConfiguration clusterConfiguration) {
Integer id = clusterConfiguration.getId();
TestResult testResult = clusterConfigurationService.testGateway(clusterConfiguration);
clusterConfiguration.setIsAvailable(testResult.isAvailable());
if (clusterConfigurationService.saveOrUpdate(clusterConfiguration)) {
return Result.succeed(Asserts.isNotNull(clusterConfiguration.getId()) ? "修改成功" : "新增成功");
return Result.succeed(Asserts.isNotNull(id) ? "修改成功" : "新增成功");
} else {
return Result.failed(Asserts.isNotNull(clusterConfiguration.getId()) ? "修改失败" : "新增失败");
return Result.failed(Asserts.isNotNull(id) ? "修改失败" : "新增失败");
}
}
......
......@@ -60,8 +60,9 @@ public class ClusterController {
@PutMapping
public Result saveOrUpdate(@RequestBody Cluster cluster) throws Exception {
cluster.setAutoRegisters(false);
Integer id = cluster.getId();
clusterService.registersCluster(cluster);
return Result.succeed(Asserts.isNotNull(cluster.getId()) ? "修改成功" : "新增成功");
return Result.succeed(Asserts.isNotNull(id) ? "修改成功" : "新增成功");
}
/**
......
......@@ -130,7 +130,7 @@ public class JarController {
List<String> udfCodes = allUDF.stream().map(Task::getStatement).collect(Collectors.toList());
Map<String, List<String>> resultMap = UDFUtil.buildJar(udfCodes);
String msg = StrUtil.format("udf jar生成成功,jar文件在{};\n本次成功 class:{}。\n失败 class:{}"
, PathConstant.UDF_JAR_TMP_PATH, resultMap.get("success"), resultMap.get("failed"));
, PathConstant.UDF_JAR_TMP_PATH, resultMap.get("success"), resultMap.get("failed"));
return Result.succeed(resultMap, msg);
}
}
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.dlink.controller;
import com.dlink.assertion.Asserts;
import com.dlink.common.result.ProTableResult;
import com.dlink.common.result.Result;
import com.dlink.model.Namespace;
import com.dlink.service.NamespaceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.fasterxml.jackson.databind.JsonNode;
import lombok.extern.slf4j.Slf4j;
@Slf4j
@RestController
@RequestMapping("/api/namespace")
public class NamespaceController {
@Autowired
private NamespaceService namespaceService;
/**
* create or update namespace
*
* @return delete result code
*/
@PutMapping
public Result saveOrUpdate(@RequestBody Namespace namespace) {
Integer id = namespace.getId();
if (namespaceService.saveOrUpdate(namespace)) {
return Result.succeed(Asserts.isNotNull(id) ? "修改成功" : "新增成功");
} else {
return Result.failed(Asserts.isNotNull(id) ? "修改失败" : "新增失败");
}
}
/**
* delete namespace by id
*
* @return delete result code
*/
@DeleteMapping()
public Result deleteNamespaceById(@RequestBody JsonNode para) {
return namespaceService.deleteNamespaceById(para);
}
/**
* query namespace list
*/
@PostMapping
public ProTableResult<Namespace> listNamespaces(@RequestBody JsonNode para) {
return namespaceService.selectForProTable(para);
}
}
\ No newline at end of file
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.dlink.controller;
import com.dlink.common.result.ProTableResult;
import com.dlink.common.result.Result;
import com.dlink.model.Role;
import com.dlink.model.UserRole;
import com.dlink.service.RoleService;
import com.dlink.service.UserRoleService;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.fasterxml.jackson.databind.JsonNode;
import lombok.extern.slf4j.Slf4j;
@Slf4j
@RestController
@RequestMapping("/api/role")
public class RoleController {
@Autowired
private RoleService roleService;
@Autowired
private UserRoleService userRoleService;
/**
* create or update role
*
* @return delete result code
*/
@PutMapping
public Result saveOrUpdateRole(@RequestBody Role role) {
return roleService.saveOrUpdateRole(role);
}
/**
* delete tenant by id
*
* @return delete result code
*/
@DeleteMapping
public Result deleteMul(@RequestBody JsonNode para) {
return roleService.deleteRoles(para);
}
/**
* query role list
*/
@PostMapping
public ProTableResult<Role> listRoles(@RequestBody JsonNode para) {
return roleService.selectForProTable(para, true);
}
/**
* 获取所有的角色列表以及当前用户的角色 ids
*/
@GetMapping(value = "/getRolesAndIdsByUserId")
public Result getRolesAndIdsByUserId(@RequestParam Integer id) {
List<Role> roleList = roleService.list();
Map result = new HashMap();
result.put("roles", roleList);
List<UserRole> userRoleList = userRoleService.getUserRoleByUserId(id);
List<Integer> userRoleIds = new ArrayList<>();
for (UserRole userRole : userRoleList) {
userRoleIds.add(userRole.getRoleId());
}
result.put("roleIds", userRoleIds);
return Result.succeed(result, "获取成功");
}
}
\ No newline at end of file
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.dlink.controller;
import com.dlink.common.result.ProTableResult;
import com.dlink.common.result.Result;
import com.dlink.model.Tenant;
import com.dlink.service.TenantService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.fasterxml.jackson.databind.JsonNode;
import lombok.extern.slf4j.Slf4j;
@Slf4j
@RestController
@RequestMapping("/api/tenant")
public class TenantController {
@Autowired
private TenantService tenantService;
/**
* create or update tenant
*
* @return delete result code
*/
@PutMapping
public Result saveOrUpdate(@RequestBody Tenant tenant) {
return tenantService.saveOrUpdateTenant(tenant);
}
/**
* delete tenant by id
*
* @return delete result code
*/
@DeleteMapping()
public Result deleteTenantById(@RequestBody JsonNode para) {
return tenantService.deleteTenantById(para);
}
/**
* query tenant list
*/
@PostMapping
public ProTableResult<Tenant> listTenants(@RequestBody JsonNode para) {
return tenantService.selectForProTable(para, true);
}
/**
* give tenant grant user
*
* @return
*/
@PutMapping(value = "/grantTenantToUser")
public Result distributeUser(@RequestBody JsonNode para) {
return tenantService.distributeUsers(para);
}
@PostMapping(value = "/switchTenant")
public Result switchTenant(@RequestBody JsonNode para) {
return tenantService.switchTenant(para);
}
}
\ No newline at end of file
......@@ -24,19 +24,26 @@ import com.dlink.common.result.ProTableResult;
import com.dlink.common.result.Result;
import com.dlink.dto.ModifyPasswordDTO;
import com.dlink.model.User;
import com.dlink.model.UserTenant;
import com.dlink.service.UserService;
import com.dlink.service.UserTenantService;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.fasterxml.jackson.databind.JsonNode;
import lombok.extern.slf4j.Slf4j;
......@@ -54,6 +61,9 @@ public class UserController {
@Autowired
private UserService userService;
@Autowired
private UserTenantService userTenantService;
/**
* 新增或者更新
*/
......@@ -122,6 +132,30 @@ public class UserController {
@PostMapping("/modifyPassword")
public Result modifyPassword(@RequestBody ModifyPasswordDTO modifyPasswordDTO) {
return userService.modifyPassword(modifyPasswordDTO.getUsername(), modifyPasswordDTO.getPassword(),
modifyPasswordDTO.getNewPassword());
modifyPasswordDTO.getNewPassword());
}
/**
* give user grant role
*
* @return
*/
@PutMapping(value = "/grantRole")
public Result grantRole(@RequestBody JsonNode para) {
return userService.grantRole(para);
}
@GetMapping("/getUserListByTenantId")
public Result getUserListByTenantId(@RequestParam("id") Integer id) {
List<User> userList = userService.list();
Map result = new HashMap();
result.put("users", userList);
List<UserTenant> userTenants = userTenantService.getBaseMapper().selectList(new QueryWrapper<UserTenant>().eq("tenant_id", id));
List<Integer> userIds = new ArrayList<>();
for (UserTenant userTenant : userTenants) {
userIds.add(userTenant.getUserId());
}
result.put("userIds", userIds);
return Result.succeed(result, "获取成功");
}
}
......@@ -34,6 +34,7 @@ import lombok.Setter;
@Setter
public class CatalogueTaskDTO {
private Integer id;
private Integer tenantId;
private Integer parentId;
private boolean isLeaf;
private String name;
......
......@@ -33,5 +33,6 @@ import lombok.Setter;
public class LoginUTO {
private String username;
private String password;
private Integer tenantId;
private boolean autoLogin;
}
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.dlink.dto;
import com.dlink.model.Role;
import com.dlink.model.Tenant;
import com.dlink.model.User;
import java.util.List;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class UserDTO {
private User user;
private List<Role> roleList;
private List<Tenant> tenantList;
private Tenant currentTenant;
}
......@@ -69,7 +69,7 @@ public class WebExceptionHandler {
return Result.notLogin("该用户未登录!");
}
@ResponseStatus(HttpStatus.BAD_REQUEST) //设置状态码为 400
@ResponseStatus(HttpStatus.BAD_REQUEST) // 设置状态码为 400
@ExceptionHandler({MethodArgumentNotValidException.class})
public Result<String> paramExceptionHandler(MethodArgumentNotValidException e) {
BindingResult exceptions = e.getBindingResult();
......@@ -93,5 +93,4 @@ public class WebExceptionHandler {
logger.error("ERROR:", e);
return Result.failed(e.getMessage());
}
}
......@@ -20,10 +20,12 @@
package com.dlink.init;
import com.dlink.assertion.Asserts;
import com.dlink.context.RequestContext;
import com.dlink.daemon.task.DaemonFactory;
import com.dlink.daemon.task.DaemonTaskConfig;
import com.dlink.job.FlinkJobTask;
import com.dlink.model.JobInstance;
import com.dlink.model.Tenant;
import com.dlink.scheduler.client.ProjectClient;
import com.dlink.scheduler.config.DolphinSchedulerProperties;
import com.dlink.scheduler.exception.SchedulerException;
......@@ -31,6 +33,7 @@ import com.dlink.scheduler.model.Project;
import com.dlink.service.JobInstanceService;
import com.dlink.service.SysConfigService;
import com.dlink.service.TaskService;
import com.dlink.service.TenantService;
import java.util.ArrayList;
import java.util.List;
......@@ -63,13 +66,19 @@ public class SystemInit implements ApplicationRunner {
@Autowired
private TaskService taskService;
@Autowired
private TenantService tenantService;
@Autowired
private DolphinSchedulerProperties dolphinSchedulerProperties;
private static Project project;
@Override
public void run(ApplicationArguments args) throws Exception {
List<Tenant> tenants = tenantService.list();
sysConfigService.initSysConfig();
taskService.initDefaultFlinkSQLEnv();
for (Tenant tenant : tenants) {
RequestContext.set(tenant.getId());
taskService.initDefaultFlinkSQLEnv(tenant.getId());
}
initTaskMonitor();
initDolphinScheduler();
}
......
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.dlink.interceptor;
import com.dlink.context.RequestContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.web.servlet.HandlerInterceptor;
import com.mysql.cj.util.StringUtils;
import lombok.extern.slf4j.Slf4j;
/**
* tenant interceptor
*/
@Slf4j
public class TenantInterceptor implements HandlerInterceptor {
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
String tenantId = request.getHeader("tenantId");
log.info("tenant interceptor preHandle execute ; current tenant id: 【" + tenantId + "】");
if (!StringUtils.isNullOrEmpty(tenantId)) {
RequestContext.set(Integer.valueOf(tenantId));
}
return HandlerInterceptor.super.preHandle(request, response, handler);
}
}
\ No newline at end of file
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.dlink.mapper;
import com.dlink.db.mapper.SuperMapper;
import com.dlink.model.Namespace;
import org.apache.ibatis.annotations.Mapper;
/**
* namespace mapper interface
*/
@Mapper
public interface NamespaceMapper extends SuperMapper<Namespace> {
}
\ No newline at end of file
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.dlink.mapper;
import com.dlink.db.mapper.SuperMapper;
import com.dlink.model.Role;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Set;
/**
* role mapper interface
*/
@Mapper
public interface RoleMapper extends SuperMapper<Role> {
List<Role> getRoleByIds(@Param("roleIds") Set<Integer> roleIds);
List<Role> getRoleByTenantIdAndIds(@Param("tenantId") String tenantId, @Param("roleIds") Set<Integer> roleIds);
int deleteByIds(@Param("ids") List<Integer> ids);
}
\ No newline at end of file
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.dlink.mapper;
import com.dlink.db.mapper.SuperMapper;
import com.dlink.model.RoleNamespace;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* role namespace mapper interface
*/
@Mapper
public interface RoleNamespaceMapper extends SuperMapper<RoleNamespace> {
/**
* delete user role relation by role id
*
* @param roleIds role id
* @return
*/
int deleteByRoleIds(@Param("roleIds") List<Integer> roleIds);
}
\ No newline at end of file
......@@ -33,6 +33,4 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface StatementMapper extends SuperMapper<Statement> {
int insert(Statement statement);
}
......@@ -41,4 +41,6 @@ public interface TaskMapper extends SuperMapper<Task> {
List<Task> queryOnLineTaskByDoneStatus(@Param("parentIds") List<Integer> parentIds
, @Param("stepIds") List<Integer> stepIds, @Param("includeNull") boolean includeNull
, @Param("jobStatuses") List<String> jobStatuses);
Task getTaskByNameAndTenantId(@Param("name") String name, @Param("tenantId") Integer tenantId);
}
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.dlink.mapper;
import com.dlink.db.mapper.SuperMapper;
import com.dlink.model.Tenant;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Set;
/**
* tenant mapper interface
*/
@Mapper
public interface TenantMapper extends SuperMapper<Tenant> {
List<Tenant> getTenantByIds(@Param("tenantIds") Set<Integer> tenantIds);
}
\ No newline at end of file
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.dlink.mapper;
import com.dlink.db.mapper.SuperMapper;
import com.dlink.model.UserRole;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* user role mapper interface
*/
@Mapper
public interface UserRoleMapper extends SuperMapper<UserRole> {
/**
* @param userId userId
* @return user role relation
*/
List<UserRole> getUserRoleByUserId(@Param("userId") int userId);
/**
* delete user role relation
*
* @param userRoleList list
* @return int
*/
int deleteBathRelation(@Param("userRoleList") List<UserRole> userRoleList);
/**
* delete user role relation by role id
*
* @param roleIds role id
* @return delete status
*/
int deleteByRoleIds(@Param("roleIds") List<Integer> roleIds);
}
\ No newline at end of file
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.dlink.mapper;
import com.dlink.db.mapper.SuperMapper;
import com.dlink.model.UserTenant;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface UserTenantMapper extends SuperMapper<UserTenant> {
/**
* @param userId userId
* @return user role tenant
*/
List<UserTenant> getUserTenantByUserId(@Param("userId") int userId);
}
......@@ -42,6 +42,8 @@ public class AlertGroup extends SuperEntity {
private static final long serialVersionUID = 7027411164191682344L;
private Integer tenantId;
private String alertInstanceIds;
private String note;
......
......@@ -47,6 +47,8 @@ public class AlertHistory implements Serializable {
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
private Integer tenantId;
private Integer alertGroupId;
private Integer jobInstanceId;
......
......@@ -38,6 +38,8 @@ import lombok.EqualsAndHashCode;
public class AlertInstance extends SuperEntity {
private static final long serialVersionUID = -3435401513220527001L;
private Integer tenantId;
private String type;
private String params;
......
......@@ -39,6 +39,8 @@ public class Catalogue extends SuperEntity {
private static final long serialVersionUID = 4659379420249868394L;
private Integer tenantId;
private Integer taskId;
private String type;
......
......@@ -41,6 +41,8 @@ public class Cluster extends SuperEntity {
private static final long serialVersionUID = 3104721227014487321L;
private Integer tenantId;
@TableField(fill = FieldFill.INSERT)
private String alias;
......
......@@ -47,6 +47,8 @@ public class ClusterConfiguration extends SuperEntity {
private static final long serialVersionUID = 5830130188542066241L;
private Integer tenantId;
@TableField(fill = FieldFill.INSERT)
private String alias;
......
......@@ -44,6 +44,8 @@ public class DataBase extends SuperEntity {
private static final long serialVersionUID = -5002272138861566408L;
private Integer tenantId;
@TableField(fill = FieldFill.INSERT)
private String alias;
......
......@@ -43,28 +43,48 @@ public class History implements Serializable {
private static final long serialVersionUID = 4058280957630503072L;
private Integer id;
private Integer tenantId;
private Integer clusterId;
private Integer clusterConfigurationId;
private String session;
private String jobId;
private String jobName;
private String jobManagerAddress;
private Integer status;
private String statement;
private String type;
private String error;
private String result;
@TableField(exist = false)
private ObjectNode config;
private String configJson;
private LocalDateTime startTime;
private LocalDateTime endTime;
private Integer taskId;
@TableField(exist = false)
private String statusText;
@TableField(exist = false)
private String clusterAlias;
@TableField(exist = false)
private String taskAlias;
......
......@@ -44,6 +44,8 @@ public class Jar extends SuperEntity {
@TableField(fill = FieldFill.INSERT)
private String alias;
private Integer tenantId;
private String type;
private String path;
......
......@@ -45,6 +45,8 @@ public class JobHistory implements Serializable {
private Integer id;
private Integer tenantId;
@TableField(exist = false)
private ObjectNode job;
......
......@@ -48,6 +48,8 @@ public class JobInstance implements Serializable {
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
private Integer tenantId;
private String name;
private Integer taskId;
......
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.dlink.model;
import java.io.Serializable;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* namespace used to control permissions
*/
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("dlink_namespace")
public class Namespace implements Serializable {
private static final long serialVersionUID = -5960332046748903443L;
/**
* id
*/
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
/**
* tenant id
*/
private Integer tenantId;
/**
* namespace code
*/
private String namespaceCode;
/**
* is enabled
*/
private Boolean enabled;
/**
* note
*/
private String note;
/**
* create time
*/
@TableField(fill = FieldFill.INSERT)
private LocalDateTime createTime;
/**
* update time
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
private LocalDateTime updateTime;
/**
* tenant
*/
@TableField(exist = false)
private Tenant tenant;
}
\ No newline at end of file
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.dlink.model;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* role
*/
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("dlink_role")
public class Role implements Serializable {
private static final long serialVersionUID = 6877230738922824958L;
/**
* id
*/
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
/**
* tenant id
*/
private Integer tenantId;
/**
* role code
*/
private String roleCode;
/**
* role name
*/
private String roleName;
/**
* is delete
*/
private Boolean isDelete;
/**
* note
*/
private String note;
/**
* create time
*/
@TableField(fill = FieldFill.INSERT)
private LocalDateTime createTime;
/**
* update time
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
private LocalDateTime updateTime;
/**
* namespace list
*/
@TableField(exist = false)
private List<Namespace> namespaces;
/**
* namespace namespaceIds
*/
@TableField(exist = false)
private String namespaceIds;
/**
* tenant
*/
@TableField(exist = false)
private Tenant tenant;
}
\ No newline at end of file
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.dlink.model;
import java.io.Serializable;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("dlink_role_namespace")
public class RoleNamespace implements Serializable {
private static final long serialVersionUID = 304808291890721691L;
/**
* id
*/
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
/**
* role id
*/
private Integer roleId;
/**
* namespace id
*/
private Integer namespaceId;
/**
* create time
*/
@TableField(fill = FieldFill.INSERT)
private LocalDateTime createTime;
/**
* update time
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
private LocalDateTime updateTime;
}
\ No newline at end of file
......@@ -50,6 +50,8 @@ public class Savepoints implements Serializable {
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
private Integer tenantId;
@NotNull(message = "作业ID不能为空", groups = {Save.class})
private Integer taskId;
......
......@@ -41,5 +41,7 @@ public class Statement implements Serializable {
private Integer id;
private Integer tenantId;
private String statement;
}
......@@ -52,11 +52,14 @@ public class Task extends SuperEntity {
private static final long serialVersionUID = 5988972129893667154L;
@TableField(fill = FieldFill.INSERT)
private String alias;
private String dialect;
private Integer tenantId;
private String type;
private Integer checkPoint;
......@@ -152,7 +155,7 @@ public class Task extends SuperEntity {
boolean fg = Asserts.isNull(fragment) ? false : fragment;
boolean sts = Asserts.isNull(statementSet) ? false : statementSet;
return new JobConfig(type, step, false, false, useRemote, clusterId, clusterConfigurationId,jid, getId(),
alias, fg, sts, batchModel, checkPoint, parallelism, savePointStrategy, savePointPath, map);
alias, fg, sts, batchModel, checkPoint, parallelism, savePointStrategy, savePointPath, map);
}
public JsonNode parseJsonNode() {
......
......@@ -51,6 +51,11 @@ public class TaskVersion implements Serializable {
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
/**
* tenant id
*/
private Integer tenantId;
/**
* 作业ID
*/
......
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.dlink.model;
import java.io.Serializable;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* tenant use to isolate data
*/
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("dlink_tenant")
public class Tenant implements Serializable {
private static final long serialVersionUID = -7782313413034278131L;
/**
* id
*/
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
/**
* code
*/
private String tenantCode;
/**
* note
*/
private String note;
/**
* is delete
*/
private Boolean isDelete;
/**
* create time
*/
@TableField(fill = FieldFill.INSERT)
private LocalDateTime createTime;
/**
* update time
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
private LocalDateTime updateTime;
}
\ No newline at end of file
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.dlink.model;
import java.io.Serializable;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("dlink_user_role")
public class UserRole implements Serializable {
private static final long serialVersionUID = -6123386787317880485L;
/**
* id
*/
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
/**
* user id
*/
private Integer userId;
/**
* role id
*/
private Integer roleId;
/**
* create time
*/
@TableField(fill = FieldFill.INSERT)
private LocalDateTime createTime;
/**
* update time
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
private LocalDateTime updateTime;
}
\ No newline at end of file
package com.dlink.model;
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
import java.io.Serializable;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("dlink_user_tenant")
public class UserTenant implements Serializable {
private static final long serialVersionUID = -6123386787317880405L;
/**
* id
*/
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
/**
* user id
*/
private Integer userId;
/**
* tenant id
*/
private Integer tenantId;
/**
* create time
*/
@TableField(fill = FieldFill.INSERT)
private LocalDateTime createTime;
/**
* update time
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
private LocalDateTime updateTime;
}
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.dlink.service;
import com.dlink.common.result.ProTableResult;
import com.dlink.common.result.Result;
import com.dlink.db.service.ISuperService;
import com.dlink.model.Namespace;
import com.fasterxml.jackson.databind.JsonNode;
public interface NamespaceService extends ISuperService<Namespace> {
/**
* delete namespace by id
*
* @param para namespace id
* @return delete result code
*/
Result deleteNamespaceById(JsonNode para);
@Override
ProTableResult<Namespace> selectForProTable(JsonNode para);
}
\ No newline at end of file
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.dlink.service;
import com.dlink.db.service.ISuperService;
import com.dlink.model.RoleNamespace;
import java.util.List;
public interface RoleNamespaceService extends ISuperService<RoleNamespace> {
/**
* delete user role relation by role id
*
* @param roleIds role id
* @return
*/
boolean deleteByRoleIds(List<Integer> roleIds);
}
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.dlink.service;
import com.dlink.common.result.ProTableResult;
import com.dlink.common.result.Result;
import com.dlink.db.service.ISuperService;
import com.dlink.model.Role;
import java.util.List;
import java.util.Set;
import com.fasterxml.jackson.databind.JsonNode;
public interface RoleService extends ISuperService<Role> {
/**
* delete role
*
* @param para role id
* @return delete result code
*/
Result deleteRoles(JsonNode para);
Result saveOrUpdateRole(Role role);
List<Role> getRoleByIds(Set<Integer> roleIds);
List<Role> getRoleByTenantIdAndIds(String tenantId, Set<Integer> roleIds);
boolean deleteByIds(List<Integer> ids);
@Override
ProTableResult<Role> selectForProTable(JsonNode para);
}
\ No newline at end of file
......@@ -59,7 +59,7 @@ public interface TaskService extends ISuperService<Task> {
List<Task> listFlinkSQLEnv();
Task initDefaultFlinkSQLEnv();
Task initDefaultFlinkSQLEnv(Integer tenantId);
String exportSql(Integer id);
......@@ -110,4 +110,6 @@ public interface TaskService extends ISuperService<Task> {
void selectSavepointOffLineTask(TaskOperatingResult taskOperatingResult);
Task getTaskByNameAndTenantId(String name, Integer tenantId);
}
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.dlink.service;
import com.dlink.common.result.Result;
import com.dlink.db.service.ISuperService;
import com.dlink.model.Tenant;
import java.util.List;
import java.util.Set;
import com.fasterxml.jackson.databind.JsonNode;
public interface TenantService extends ISuperService<Tenant> {
/**
* delete tenant by id
*
* @param para tenant id
* @return delete result code
*/
Result deleteTenantById(JsonNode para);
/**
* add or update tenant
*
* @param tenant tenant info
* @return add or update code
*/
Result saveOrUpdateTenant(Tenant tenant);
/**
* @param tenantCode tenant code
* @return Tenant
*/
Tenant getTenantByTenantCode(String tenantCode);
/**
* @param tenant tenant info
* @return modify code
*/
boolean modifyTenant(Tenant tenant);
List<Tenant> getTenantByIds(Set<Integer> tenantIds);
Result distributeUsers(JsonNode para);
Result switchTenant(JsonNode para);
}
\ No newline at end of file
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.dlink.service;
import com.dlink.db.service.ISuperService;
import com.dlink.model.UserRole;
import java.util.List;
public interface UserRoleService extends ISuperService<UserRole> {
/**
* delete user role relation by user id
*
* @param userId user id
* @return delete row num
*/
int delete(int userId);
/**
* query user role relation by userId
*
* @param userId user id
* @return delete row num
*/
List<UserRole> getUserRoleByUserId(int userId);
/**
* delete user role relation by userId and roleId
*
* @param userRoleList
* @return
*/
int deleteBathRelation(List<UserRole> userRoleList);
/**
* delete user role relation by role id
*
* @param roleIds role id
* @return
*/
boolean deleteByRoleIds(List<Integer> roleIds);
}
......@@ -21,8 +21,11 @@ package com.dlink.service;
import com.dlink.common.result.Result;
import com.dlink.db.service.ISuperService;
import com.dlink.dto.LoginUTO;
import com.dlink.model.User;
import com.fasterxml.jackson.databind.JsonNode;
/**
* UserService
*
......@@ -39,7 +42,11 @@ public interface UserService extends ISuperService<User> {
boolean removeUser(Integer id);
Result loginUser(String username, String password, boolean isRemember);
Result loginUser(LoginUTO loginUTO);
User getUserByUsername(String username);
Result grantRole(JsonNode para);
Result getTenants(String username);
}
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.dlink.service;
import com.dlink.db.service.ISuperService;
import com.dlink.model.UserTenant;
import java.util.List;
public interface UserTenantService extends ISuperService<UserTenant> {
/**
* @param userId userId
* @return user role tenant
*/
List<UserTenant> getUserTenantByUserId(int userId);
}
......@@ -85,6 +85,7 @@ public class CatalogueServiceImpl extends SuperServiceImpl<CatalogueMapper, Cata
task.setDialect(catalogueTaskDTO.getDialect());
taskService.saveOrUpdateTask(task);
Catalogue catalogue = new Catalogue();
catalogue.setTenantId(catalogueTaskDTO.getTenantId());
catalogue.setName(catalogueTaskDTO.getAlias());
catalogue.setIsLeaf(true);
catalogue.setTaskId(task.getId());
......@@ -189,8 +190,8 @@ public class CatalogueServiceImpl extends SuperServiceImpl<CatalogueMapper, Cata
Statement statementServiceById = statementService.getById(catalogue.getTaskId());
//新建作业的sql语句
Statement statement = new Statement();
statement.setStatement(statementServiceById.getStatement());
statement.setId(newTask.getId());
statement.setStatement(statementServiceById.getStatement());
statementService.save(statement);
Catalogue one = this.getOne(new LambdaQueryWrapper<Catalogue>().eq(Catalogue::getTaskId, catalogue.getTaskId()));
......
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.dlink.service.impl;
import com.dlink.assertion.Asserts;
import com.dlink.common.result.ProTableResult;
import com.dlink.common.result.Result;
import com.dlink.db.service.impl.SuperServiceImpl;
import com.dlink.mapper.NamespaceMapper;
import com.dlink.model.Namespace;
import com.dlink.model.RoleNamespace;
import com.dlink.model.Tenant;
import com.dlink.service.NamespaceService;
import com.dlink.service.RoleNamespaceService;
import com.dlink.service.TenantService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.fasterxml.jackson.databind.JsonNode;
@Service
public class NamespaceServiceImpl extends SuperServiceImpl<NamespaceMapper, Namespace> implements NamespaceService {
@Autowired
private RoleNamespaceService roleNamespaceService;
@Autowired
private TenantService tenantService;
@Override
public ProTableResult<Namespace> selectForProTable(JsonNode para) {
ProTableResult<Namespace> namespaceProTableResult = super.selectForProTable(para);
namespaceProTableResult.getData().forEach(namespace -> {
Tenant tenant = tenantService.getBaseMapper().selectById(namespace.getTenantId());
namespace.setTenant(tenant);
});
return namespaceProTableResult;
}
@Transactional(rollbackFor = Exception.class)
@Override
public Result deleteNamespaceById(JsonNode para) {
for (JsonNode item : para) {
Integer id = item.asInt();
Namespace namespace = getById(id);
if (Asserts.isNull(namespace)) {
return Result.failed("名称空间不存在");
}
Long roleNamespaceCount = roleNamespaceService.getBaseMapper().selectCount(new QueryWrapper<RoleNamespace>().eq("namespace_id", id));
if (roleNamespaceCount > 0) {
return Result.failed("删除名称空间失败,该名称空间被角色绑定");
}
boolean result = removeById(id);
if (result) {
return Result.succeed("删除名称空间成功");
} else {
return Result.failed("删除名称空间失败");
}
}
return Result.failed("名称空间不存在");
}
}
\ No newline at end of file
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.dlink.service.impl;
import com.dlink.db.service.impl.SuperServiceImpl;
import com.dlink.mapper.RoleNamespaceMapper;
import com.dlink.model.RoleNamespace;
import com.dlink.service.RoleNamespaceService;
import java.util.List;
import org.springframework.stereotype.Service;
@Service
public class RoleNamespaceServiceImpl extends SuperServiceImpl<RoleNamespaceMapper, RoleNamespace> implements RoleNamespaceService {
@Override
public boolean deleteByRoleIds(List<Integer> roleIds) {
return baseMapper.deleteByRoleIds(roleIds) > 0;
}
}
\ No newline at end of file
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.dlink.service.impl;
import com.dlink.assertion.Asserts;
import com.dlink.common.result.ProTableResult;
import com.dlink.common.result.Result;
import com.dlink.db.service.impl.SuperServiceImpl;
import com.dlink.mapper.RoleMapper;
import com.dlink.model.Namespace;
import com.dlink.model.Role;
import com.dlink.model.RoleNamespace;
import com.dlink.model.Tenant;
import com.dlink.model.UserRole;
import com.dlink.service.NamespaceService;
import com.dlink.service.RoleNamespaceService;
import com.dlink.service.RoleService;
import com.dlink.service.TenantService;
import com.dlink.service.UserRoleService;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.fasterxml.jackson.databind.JsonNode;
/**
* role service impl
*/
@Service
public class RoleServiceImpl extends SuperServiceImpl<RoleMapper, Role> implements RoleService {
private static final Logger LOG = LoggerFactory.getLogger(RoleServiceImpl.class);
@Autowired
private RoleNamespaceService roleNamespaceService;
@Autowired
private UserRoleService userRoleService;
@Autowired
private RoleService roleService;
@Autowired
private TenantService tenantService;
@Autowired
private NamespaceService namespaceService;
@Transactional(rollbackFor = Exception.class)
@Override
public Result saveOrUpdateRole(Role role) {
if (Asserts.isNull(role.getId())) {
Role roleCode = roleService.getOne(new QueryWrapper<Role>().eq("role_code", role.getRoleCode()));
if (Asserts.isNotNull(roleCode)) {
return Result.failed("角色编号:【" + role.getRoleCode() + "】已存在");
}
}
boolean roleSaveOrUpdate = saveOrUpdate(role);
boolean roleNamespaceSaveOrUpdate = false;
if (roleSaveOrUpdate) {
List<RoleNamespace> roleNamespaceList = roleNamespaceService.getBaseMapper().selectList(new QueryWrapper<RoleNamespace>().eq("role_id", role.getId()));
roleNamespaceService.removeByIds(roleNamespaceList.stream().map(RoleNamespace::getId).collect(Collectors.toList()));
List<RoleNamespace> arrayListRoleNamespace = new ArrayList<>();
String[] idsList = role.getNamespaceIds().split(",");
for (String namespaceId : idsList) {
RoleNamespace roleNamespace = new RoleNamespace();
roleNamespace.setRoleId(role.getId());
roleNamespace.setNamespaceId(Integer.valueOf(namespaceId));
arrayListRoleNamespace.add(roleNamespace);
}
roleNamespaceSaveOrUpdate = roleNamespaceService.saveBatch(arrayListRoleNamespace);
}
if (roleSaveOrUpdate && roleNamespaceSaveOrUpdate) {
return Result.succeed("保存成功");
} else {
return Result.failed("保存失败");
}
}
@Transactional(rollbackFor = Exception.class)
@Override
public Result deleteRoles(JsonNode para) {
if (para.size() > 0) {
List<Integer> error = new ArrayList<>();
for (final JsonNode item : para) {
Integer id = item.asInt();
boolean roleNameSpaceRemove = roleNamespaceService.remove(new QueryWrapper<RoleNamespace>().eq("role_id", id));
boolean userRoleRemove = userRoleService.remove(new QueryWrapper<UserRole>().eq("role_id", id));
Role role = getById(id);
role.setIsDelete(true);
boolean removeById = roleService.updateById(role);
if (!removeById && !roleNameSpaceRemove && !userRoleRemove) {
error.add(id);
}
}
if (error.size() == 0) {
return Result.succeed("删除成功");
} else {
return Result.succeed("删除部分成功,但" + error.toString() + "删除失败,共" + error.size() + "次失败。");
}
} else {
return Result.failed("请选择要删除的记录");
}
}
@Override
public List<Role> getRoleByIds(Set<Integer> roleIds) {
return baseMapper.getRoleByIds(roleIds);
}
@Override
public List<Role> getRoleByTenantIdAndIds(String tenantId, Set<Integer> roleIds) {
return baseMapper.getRoleByTenantIdAndIds(tenantId, roleIds);
}
@Override
public boolean deleteByIds(List<Integer> ids) {
return baseMapper.deleteByIds(ids) > 0;
}
@Override
public ProTableResult<Role> selectForProTable(JsonNode para, boolean isDelete) {
ProTableResult<Role> roleProTableResult = super.selectForProTable(para, isDelete);
roleProTableResult.getData().forEach(role -> {
List<Namespace> namespaceArrayList = new ArrayList<>();
List<Integer> idsList = new ArrayList<>();
Tenant tenant = tenantService.getBaseMapper().selectById(role.getTenantId());
roleNamespaceService.list(new QueryWrapper<RoleNamespace>().eq("role_id", role.getId())).forEach(roleNamespace -> {
Namespace namespaceServiceById = namespaceService.getById(roleNamespace.getNamespaceId());
namespaceArrayList.add(namespaceServiceById);
idsList.add(roleNamespace.getNamespaceId());
});
role.setTenant(tenant);
role.setNamespaces(namespaceArrayList);
String result = idsList.stream().map(Object::toString).collect(Collectors.joining(","));
role.setNamespaceIds(result);
});
return roleProTableResult;
}
}
\ No newline at end of file
......@@ -401,12 +401,17 @@ public class TaskServiceImpl extends SuperServiceImpl<TaskMapper, Task> implemen
}
@Override
public Task initDefaultFlinkSQLEnv() {
public Task initDefaultFlinkSQLEnv(Integer tenantId) {
String separator = SystemConfiguration.getInstances().getSqlSeparator();
separator = separator.replace("\\r", "\r").replace("\\n", "\n");
Task defaultFlinkSQLEnvTask = new Task();
defaultFlinkSQLEnvTask.setId(1);
defaultFlinkSQLEnvTask.setName("dlink_default_catalog");
String name = "dlink_default_catalog";
Task defaultFlinkSQLEnvTask = getTaskByNameAndTenantId(name, tenantId);
if (null == defaultFlinkSQLEnvTask) {
defaultFlinkSQLEnvTask = new Task();
}
// defaultFlinkSQLEnvTask.setId(1);
defaultFlinkSQLEnvTask.setName(name);
defaultFlinkSQLEnvTask.setAlias("DefaultCatalog");
defaultFlinkSQLEnvTask.setDialect(Dialect.FLINKSQLENV.getValue());
StringBuilder sb = new StringBuilder();
......@@ -427,15 +432,25 @@ public class TaskServiceImpl extends SuperServiceImpl<TaskMapper, Task> implemen
sb.append(separator);
defaultFlinkSQLEnvTask.setStatement(sb.toString());
defaultFlinkSQLEnvTask.setFragment(true);
defaultFlinkSQLEnvTask.setTenantId(tenantId);
defaultFlinkSQLEnvTask.setEnabled(true);
saveOrUpdate(defaultFlinkSQLEnvTask);
Statement statement = new Statement();
statement.setId(1);
statement.setId(defaultFlinkSQLEnvTask.getId());
statement.setTenantId(tenantId);
statement.setStatement(sb.toString());
statementService.saveOrUpdate(statement);
return defaultFlinkSQLEnvTask;
}
@Override
public Task getTaskByNameAndTenantId(String name, Integer tenantId) {
Task task = baseMapper.getTaskByNameAndTenantId(name, tenantId);
return task;
}
@Override
public String exportSql(Integer id) {
Task task = getTaskInfoById(id);
......@@ -474,7 +489,7 @@ public class TaskServiceImpl extends SuperServiceImpl<TaskMapper, Task> implemen
Task task = getTaskInfoById(id);
Assert.check(task);
if (JobLifeCycle.DEVELOP.equalsValue(task.getStep())) {
//KubernetesApplaction is not sql, skip sqlExplain verify
// KubernetesApplaction is not sql, skip sqlExplain verify
if (!Dialect.KUBERNETES_APPLICATION.equalsVal(task.getDialect())) {
List<SqlExplainResult> sqlExplainResults = explainTask(id);
for (SqlExplainResult sqlExplainResult : sqlExplainResults) {
......@@ -684,7 +699,7 @@ public class TaskServiceImpl extends SuperServiceImpl<TaskMapper, Task> implemen
if (GatewayType.KUBERNETES_APPLICATION.equalsValue(cluster.getType())) {
Statement statement = statementService.getById(cluster.getTaskId());
Map<String, Object> gatewayConfig = JSONUtil.toMap(statement.getStatement(),String.class,Object.class);
Map<String, Object> gatewayConfig = JSONUtil.toMap(statement.getStatement(), String.class, Object.class);
jobConfig.buildGatewayConfig(gatewayConfig);
jobConfig.getGatewayConfig().getClusterConfig().setAppId(cluster.getName());
useGateway = true;
......@@ -726,7 +741,7 @@ public class TaskServiceImpl extends SuperServiceImpl<TaskMapper, Task> implemen
private JobConfig buildJobConfig(Task task) {
boolean isJarTask = Dialect.FLINKJAR.equalsVal(task.getDialect())
|| Dialect.KUBERNETES_APPLICATION.equalsVal(task.getDialect());
|| Dialect.KUBERNETES_APPLICATION.equalsVal(task.getDialect());
if (!isJarTask && Asserts.isNotNull(task.getFragment()) ? task.getFragment() : false) {
String flinkWithSql = dataBaseService.getEnabledFlinkWithSql();
if (Asserts.isNotNullString(flinkWithSql)) {
......@@ -744,14 +759,14 @@ public class TaskServiceImpl extends SuperServiceImpl<TaskMapper, Task> implemen
if (!JobManager.useGateway(config.getType())) {
config.setAddress(clusterService.buildEnvironmentAddress(config.isUseRemote(), task.getClusterId()));
}
//support custom K8s app submit, rather than clusterConfiguration
// support custom K8s app submit, rather than clusterConfiguration
else if (Dialect.KUBERNETES_APPLICATION.equalsVal(task.getDialect())
&& GatewayType.KUBERNETES_APPLICATION.equalsValue(config.getType())) {
Map<String, Object> gatewayConfig = JSONUtil.toMap(task.getStatement(),String.class,Object.class);
&& GatewayType.KUBERNETES_APPLICATION.equalsValue(config.getType())) {
Map<String, Object> gatewayConfig = JSONUtil.toMap(task.getStatement(), String.class, Object.class);
config.buildGatewayConfig(gatewayConfig);
} else {
Map<String, Object> gatewayConfig = clusterConfigurationService.getGatewayConfig(task.getClusterConfigurationId());
//submit application type with clusterConfiguration
// submit application type with clusterConfiguration
if (GatewayType.YARN_APPLICATION.equalsValue(config.getType()) || GatewayType.KUBERNETES_APPLICATION.equalsValue(config.getType())) {
if (!isJarTask) {
SystemConfiguration systemConfiguration = SystemConfiguration.getInstances();
......
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.dlink.service.impl;
import com.dlink.assertion.Asserts;
import com.dlink.common.result.Result;
import com.dlink.context.RequestContext;
import com.dlink.db.service.impl.SuperServiceImpl;
import com.dlink.mapper.TenantMapper;
import com.dlink.model.Namespace;
import com.dlink.model.Role;
import com.dlink.model.Tenant;
import com.dlink.model.UserTenant;
import com.dlink.service.NamespaceService;
import com.dlink.service.RoleService;
import com.dlink.service.TenantService;
import com.dlink.service.UserTenantService;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.fasterxml.jackson.databind.JsonNode;
@Service
public class TenantServiceImpl extends SuperServiceImpl<TenantMapper, Tenant> implements TenantService {
@Autowired
private RoleService roleService;
@Autowired
private NamespaceService namespaceService;
@Autowired
private UserTenantService userTenantService;
@Override
public Result saveOrUpdateTenant(Tenant tenant) {
Integer tenantId = tenant.getId();
if (Asserts.isNull(tenantId)) {
Tenant tenantByTenantCode = getTenantByTenantCode(tenant.getTenantCode());
if (Asserts.isNotNull(tenantByTenantCode)) {
return Result.failed("该租户已存在");
}
tenant.setIsDelete(false);
if (save(tenant)) {
RequestContext.set(tenant.getId());
return Result.succeed("新增成功");
}
return Result.failed("新增失败");
} else {
if (modifyTenant(tenant)) {
return Result.failed("修改成功");
}
return Result.failed("新增失败");
}
}
@Override
public Tenant getTenantByTenantCode(String tenantCode) {
return getOne(new QueryWrapper<Tenant>().eq("tenant_code", tenantCode).eq("is_delete", 0));
}
@Override
public boolean modifyTenant(Tenant tenant) {
if (Asserts.isNull(tenant.getId())) {
return false;
}
return updateById(tenant);
}
@Transactional(rollbackFor = Exception.class)
@Override
public Result<String> deleteTenantById(JsonNode para) {
for (JsonNode item : para) {
Integer id = item.asInt();
Tenant tenant = getById(id);
if (Asserts.isNull(tenant)) {
return Result.failed("租户不存在");
}
Long tenantRoleCount = roleService.getBaseMapper().selectCount(new QueryWrapper<Role>().eq("tenant_id", id));
if (tenantRoleCount > 0) {
return Result.failed("删除租户失败,该租户已绑定角色");
}
Long tenantNamespaceCount = namespaceService.getBaseMapper().selectCount(new QueryWrapper<Namespace>().eq("tenant_id", id));
if (tenantNamespaceCount > 0) {
return Result.failed("删除租户失败,该租户已绑定名称空间");
}
tenant.setIsDelete(true);
boolean result = updateById(tenant);
if (result) {
return Result.succeed("删除成功");
} else {
return Result.failed("删除失败");
}
}
return Result.failed("删除租户不存在");
}
@Override
public List<Tenant> getTenantByIds(Set<Integer> tenantIds) {
return baseMapper.getTenantByIds(tenantIds);
}
/**
* Assign users to specified tenants
*
* @param para
* @return
*/
@Override
@Transactional(rollbackFor = Exception.class)
public Result distributeUsers(JsonNode para) {
if (para.size() > 0) {
List<UserTenant> tenantUserList = new ArrayList<>();
Integer tenantId = para.get("tenantId").asInt();
userTenantService.remove(new QueryWrapper<UserTenant>().eq("tenant_id", tenantId));
JsonNode tenantUserJsonNode = para.get("users");
for (JsonNode ids : tenantUserJsonNode) {
UserTenant userTenant = new UserTenant();
userTenant.setTenantId(tenantId);
userTenant.setUserId(ids.asInt());
tenantUserList.add(userTenant);
}
// save or update user role
boolean result = userTenantService.saveOrUpdateBatch(tenantUserList, 1000);
if (result) {
return Result.succeed("分配用户成功");
} else {
return Result.failed("分配用户失败");
}
} else {
return Result.failed("请选择要分配的用户");
}
}
@Override
public Result switchTenant(JsonNode para) {
if (para.size() > 0) {
Integer tenantId = para.get("tenantId").asInt();
RequestContext.remove();
RequestContext.set(tenantId);
return Result.succeed("切换租户成功");
} else {
return Result.failed("无法切换租户,获取不到租户信息");
}
}
}
\ No newline at end of file
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.dlink.service.impl;
import com.dlink.db.service.impl.SuperServiceImpl;
import com.dlink.mapper.UserRoleMapper;
import com.dlink.model.UserRole;
import com.dlink.service.UserRoleService;
import java.util.List;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
@Service
public class UserRoleServiceImpl extends SuperServiceImpl<UserRoleMapper, UserRole> implements UserRoleService {
@Override
public int delete(int userId) {
LambdaQueryWrapper<UserRole> wrapper = Wrappers.lambdaQuery();
wrapper.eq(UserRole::getUserId, userId);
return baseMapper.delete(wrapper);
}
@Override
public List<UserRole> getUserRoleByUserId(int userId) {
return baseMapper.getUserRoleByUserId(userId);
}
@Override
public int deleteBathRelation(List<UserRole> userRoleList) {
return baseMapper.deleteBathRelation(userRoleList);
}
@Override
public boolean deleteByRoleIds(List<Integer> roleIds) {
return baseMapper.deleteByRoleIds(roleIds) > 0;
}
}
\ No newline at end of file
......@@ -21,14 +21,34 @@ package com.dlink.service.impl;
import com.dlink.assertion.Asserts;
import com.dlink.common.result.Result;
import com.dlink.context.RequestContext;
import com.dlink.db.service.impl.SuperServiceImpl;
import com.dlink.dto.LoginUTO;
import com.dlink.dto.UserDTO;
import com.dlink.mapper.UserMapper;
import com.dlink.model.Role;
import com.dlink.model.Tenant;
import com.dlink.model.User;
import com.dlink.model.UserRole;
import com.dlink.model.UserTenant;
import com.dlink.service.RoleService;
import com.dlink.service.TenantService;
import com.dlink.service.UserRoleService;
import com.dlink.service.UserService;
import com.dlink.service.UserTenantService;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.fasterxml.jackson.databind.JsonNode;
import cn.dev33.satoken.secure.SaSecureUtil;
import cn.dev33.satoken.stp.StpUtil;
......@@ -44,6 +64,18 @@ public class UserServiceImpl extends SuperServiceImpl<UserMapper, User> implemen
private static final String DEFAULT_PASSWORD = "123456";
@Autowired
private UserRoleService userRoleService;
@Autowired
private UserTenantService userTenantService;
@Autowired
private RoleService roleService;
@Autowired
private TenantService tenantService;
@Override
public Result registerUser(User user) {
User userByUsername = getUserByUsername(user.getUsername());
......@@ -96,30 +128,68 @@ public class UserServiceImpl extends SuperServiceImpl<UserMapper, User> implemen
}
@Override
public Result loginUser(String username, String password, boolean isRemember) {
User user = getUserByUsername(username);
public Result loginUser(LoginUTO loginUTO) {
User user = getUserByUsername(loginUTO.getUsername());
if (Asserts.isNull(user)) {
return Result.failed("账号或密码错误");
}
String userPassword = user.getPassword();
if (Asserts.isNullString(password)) {
if (Asserts.isNullString(loginUTO.getPassword())) {
return Result.failed("密码不能为空");
}
if (Asserts.isEquals(SaSecureUtil.md5(password), userPassword)) {
if (Asserts.isEquals(SaSecureUtil.md5(loginUTO.getPassword()), userPassword)) {
if (user.getIsDelete()) {
return Result.failed("账号不存在");
}
if (!user.getEnabled()) {
return Result.failed("账号已被禁用");
}
StpUtil.login(user.getId(), isRemember);
StpUtil.getSession().set("user", user);
return Result.succeed(user, "登录成功");
// 将前端入参 租户id 放入上下文
RequestContext.set(loginUTO.getTenantId());
// get user tenants and roles
UserDTO userDTO = getUserALLBaseInfo(loginUTO, user);
StpUtil.login(user.getId(), loginUTO.isAutoLogin());
StpUtil.getSession().set("user", userDTO);
return Result.succeed(userDTO, "登录成功");
} else {
return Result.failed("账号或密码错误");
}
}
private UserDTO getUserALLBaseInfo(LoginUTO loginUTO, User user) {
UserDTO userDTO = new UserDTO();
List<Role> roleList = new LinkedList<>();
List<Tenant> tenantList = new LinkedList<>();
List<UserRole> userRoles = userRoleService.getUserRoleByUserId(user.getId());
List<UserTenant> userTenants = userTenantService.getUserTenantByUserId(user.getId());
Tenant currentTenant = tenantService.getBaseMapper().selectById(loginUTO.getTenantId());
userRoles.forEach(userRole -> {
Role role = roleService.getBaseMapper().selectById(userRole.getRoleId());
if (Asserts.isNotNull(role)) {
roleList.add(role);
}
});
userTenants.forEach(userTenant -> {
Tenant tenant = tenantService.getBaseMapper().selectOne(new QueryWrapper<Tenant>().eq("id", userTenant.getTenantId()));
if (Asserts.isNotNull(tenant)) {
tenantList.add(tenant);
}
});
userDTO.setUser(user);
userDTO.setRoleList(roleList);
userDTO.setTenantList(tenantList);
userDTO.setCurrentTenant(currentTenant);
return userDTO;
}
@Override
public User getUserByUsername(String username) {
User user = getOne(new QueryWrapper<User>().eq("username", username));
......@@ -128,4 +198,49 @@ public class UserServiceImpl extends SuperServiceImpl<UserMapper, User> implemen
}
return user;
}
@Override
@Transactional(rollbackFor = Exception.class)
public Result grantRole(JsonNode para) {
if (para.size() > 0) {
List<UserRole> userRoleList = new ArrayList<>();
Integer userId = para.get("userId").asInt();
userRoleService.remove(new QueryWrapper<UserRole>().eq("user_id", userId));
JsonNode userRoleJsonNode = para.get("roles");
for (JsonNode ids : userRoleJsonNode) {
UserRole userRole = new UserRole();
userRole.setUserId(userId);
userRole.setRoleId(ids.asInt());
userRoleList.add(userRole);
}
// save or update user role
boolean result = userRoleService.saveOrUpdateBatch(userRoleList, 1000);
if (result) {
return Result.succeed("用户授权角色成功");
} else {
return Result.failed("用户授权角色失败");
}
} else {
return Result.failed("请选择要授权的角色");
}
}
@Override
public Result getTenants(String username) {
User user = getUserByUsername(username);
if (Asserts.isNull(user)) {
return Result.failed("该账号不存在,获取租户失败");
}
List<UserTenant> userTenants = userTenantService.getUserTenantByUserId(user.getId());
if (userTenants.size() == 0) {
return Result.failed("用户未绑定租户,获取租户失败");
}
Set<Integer> tenantIds = new HashSet<>();
userTenants.forEach(userTenant -> tenantIds.add(userTenant.getTenantId()));
List<Tenant> tenants = tenantService.getTenantByIds(tenantIds);
return Result.succeed(tenants, "获取成功");
}
}
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.dlink.service.impl;
import com.dlink.db.service.impl.SuperServiceImpl;
import com.dlink.mapper.UserTenantMapper;
import com.dlink.model.UserTenant;
import com.dlink.service.UserTenantService;
import java.util.List;
import org.springframework.stereotype.Service;
@Service
public class UserTenantServiceImpl extends SuperServiceImpl<UserTenantMapper, UserTenant> implements UserTenantService {
@Override
public List<UserTenant> getUserTenantByUserId(int userId) {
return baseMapper.getUserTenantByUserId(userId);
}
}
:: Spring Boot :: ${spring-boot.formatted-version}
______ _ __
|_ _ `. (_) [ | _
| | `. \ __ _ .--. | | / ] _ __
......
<?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.dlink.mapper.NamespaceMapper">
<sql id="baseSql">
id,tenant_id,namespace_code,enabled,note,create_time,update_time
</sql>
<select id="selectForProTable" resultType="com.dlink.model.Namespace">
select
<include refid="baseSql"/>
from
dlink_namespace a
<where>
1=1
<if test='param.tenantId!=null and param.tenantId!=""'>
and tenant_id = #{param.tenantId}
</if>
<if test='param.namespaceCode!=null and param.namespaceCode!=""'>
and namespace_code like "%${param.namespaceCode}%"
</if>
<if test='param.createTime!=null and param.createTime!=""'>
and create_time <![CDATA[>=]]> str_to_date( #{param.createTime},'%Y-%m-%d %H:%i:%s')
</if>
<if test='param.updateTime!=null and param.updateTime!=""'>
and update_time <![CDATA[>=]]> str_to_date( #{param.updateTime},'%Y-%m-%d %H:%i:%s')
</if>
<if test='ew.sqlSegment!=null and ew.sqlSegment!="" and !ew.sqlSegment.startsWith(" ORDER BY")'>
and
</if>
<if test='ew.sqlSegment!=null and ew.sqlSegment!=""'>
${ew.sqlSegment}
</if>
</where>
</select>
</mapper>
\ No newline at end of file
<?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.dlink.mapper.RoleMapper">
<resultMap id="roleResultMap" type="com.dlink.model.Role">
<id property="id" column="id"/>
<result property="tenantId" column="tenant_id"/>
<result property="roleCode" column="role_code"/>
<result property="roleName" column="role_name"/>
<result property="isDelete" column="is_delete"/>
<result property="note" column="note"/>
<result property="createTime" column="create_time"/>
<result property="updateTime" column="update_time"/>
<collection property="namespaces" ofType="com.dlink.model.Namespace"
resultMap="namespaceResultMap"></collection>
</resultMap>
<resultMap id="namespaceResultMap" type="com.dlink.model.Namespace">
<id property="id" column="id"/>
<result property="tenantId" column="tenant_id"/>
<result property="namespaceCode" column="namespace_code"/>
<result property="enabled" column="enabled"/>
<result property="note" column="note"/>
<result property="createTime" column="create_time"/>
<result property="updateTime" column="update_time"/>
</resultMap>
<sql id="role">
select dr.id
, dr.tenant_id
, dr.role_code
, dr.role_name
, dr.note
, dr.create_time
, dr.update_time
, dn.id as dn_id
, dn.namespace_code
, dn.enabled
, dn.note dn_note
, dn.create_time as dn_create_time
, dn.update_time dn_update_time
from dlink_role dr
join dlink_role_namespace drn
on dr.id = drn.role_id
join dlink_namespace dn
on drn.namespace_id = dn.id
</sql>
<select id="selectForProTable" resultType="com.dlink.model.Role">
select
a.*
from dlink_role a
<where>
1=1
<if test='param.tenantId!=null and param.tenantId!=""'>
and tenant_id = '${param.tenantId}'
</if>
<if test='param.roleCode!=null and param.roleCode!=""'>
and role_code = '${param.roleCode}'
</if>
<if test='param.roleName!=null and param.roleName!=""'>
and role_name like "%${param.roleName}%"
</if>
<if test='param.createTime!=null and param.createTime!=""'>
and create_time <![CDATA[>=]]> str_to_date( #{param.createTime},'%Y-%m-%d %H:%i:%s')
</if>
<if test='param.updateTime!=null and param.updateTime!=""'>
and update_time <![CDATA[>=]]> str_to_date( #{param.updateTime},'%Y-%m-%d %H:%i:%s')
</if>
<if test='ew.sqlSegment!=null and ew.sqlSegment!="" and !ew.sqlSegment.startsWith(" ORDER BY")'>
and
</if>
<if test='ew.sqlSegment!=null and ew.sqlSegment!=""'>
${ew.sqlSegment}
</if>
</where>
</select>
<select id="getRoleByIds" resultType="com.dlink.model.Role">
select id
,tenant_id
,role_code
,role_name
,is_delete
,note
,create_time
,update_time
from dlink_role
where id in
<foreach collection="roleIds" item="id" separator="," open="(" close=")" index="">
#{id}
</foreach>
</select>
<select id="getRoleByTenantIdAndIds" resultType="com.dlink.model.Role">
select id
,tenant_id
,role_code
,role_name
,is_delete
,note
,create_time
,update_time
from dlink_role
<where>
1=1
<if test='tenantId!=null and tenantId!=""'>
and tenant_id = '${tenantId}'
</if>
and id in
<foreach collection="roleIds" item="id" separator="," open="(" close=")" index="">
#{id}
</foreach>
</where>
</select>
</mapper>
\ No newline at end of file
<?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.dlink.mapper.RoleNamespaceMapper">
<sql id="baseSql">
id,role_id,namespace_id
</sql>
<select id="selectForProTable" resultType="com.dlink.model.RoleNamespace">
select
<include refid="baseSql"/>
from
dlink_role_namespace
<where>
1=1
<if test='param.roleId!=null and param.roleId!=""'>
and role_id = #{param.roleId}
</if>
<if test='param.namespaceId!=null and param.namespaceId!=""'>
and namespace_id = #{param.namespaceId}
</if>
<if test='ew.sqlSegment!=null and ew.sqlSegment!="" and !ew.sqlSegment.startsWith(" ORDER BY")'>
and
</if>
<if test='ew.sqlSegment!=null and ew.sqlSegment!=""'>
${ew.sqlSegment}
</if>
</where>
</select>
<delete id="deleteByRoleIds" parameterType="java.util.List">
DELETE FROM dlink_role_namespace
WHERE role_id IN
<foreach collection="roleIds" item="item" open="(" separator="," close=")">
${item}
</foreach>
</delete>
</mapper>
\ No newline at end of file
......@@ -11,10 +11,6 @@
id,statement
</sql>
<insert id="insert">
insert into dlink_task_statement (id,statement) values (#{id},#{statement})
</insert>
<select id="selectForProTable" resultType="com.dlink.model.Task">
select
a.*
......
<?xml version="1.0" encoding="UTF-8"?>
<!--
~
~ Licensed to the Apache Software Foundation (ASF) under one or more
~ contributor license agreements. See the NOTICE file distributed with
~ this work for additional information regarding copyright ownership.
~ The ASF licenses this file to You under the Apache License, Version 2.0
~ (the "License"); you may not use this file except in compliance with
~ the License. You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
~
-->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.dlink.mapper.TaskMapper">
<select id="selectForProTable" resultType="com.dlink.model.Task">
select
a.*
......@@ -37,23 +55,42 @@
where `name` REGEXP '${name}_[0-9]$'
</select>
<select id="getTaskByNameAndTenantId" resultType="com.dlink.model.Task">
select *
from dlink_task
where 1 = 1
and name = "${name}"
and tenant_id = ${tenantId}
</select>
<select id="queryOnLineTaskByDoneStatus" resultType="com.dlink.model.Task">
select t.id as id, t.name as name
from dlink_task t
left join dlink_catalogue c on c.task_id = t.id
left join dlink_job_instance i on i.id = t.job_instance_id
where
c.parent_id in <foreach collection="parentIds" item="parentId" open="(" close=")" separator=","> #{parentId} </foreach>
and c.task_id is not null
and c.is_leaf = 1
and t.step in <foreach collection="stepIds" item="stepId" open="(" close=")" separator=","> #{stepId} </foreach>
and t.enabled = 1
c.parent_id in
<foreach collection="parentIds" item="parentId" open="(" close=")" separator=",">
#{parentId}
</foreach>
and c.task_id is not null
and c.is_leaf = 1
and t.step in
<foreach collection="stepIds" item="stepId" open="(" close=")" separator=",">
#{stepId}
</foreach>
and t.enabled = 1
<if test="includeNull == true">
and ((i.status is null) or (i.status in <foreach collection="jobStatuses" item="jobStatus" open="(" close=")" separator=","> #{jobStatus} </foreach>))
and ((i.status is null) or (i.status in <foreach collection="jobStatuses" item="jobStatus" open="("
close=")" separator=",">
#{jobStatus}
</foreach>))
</if>
<if test="includeNull != true">
and i.status in <foreach collection="jobStatuses" item="jobStatus" open="(" close=")" separator=","> #{jobStatus} </foreach>
and i.status in
<foreach collection="jobStatuses" item="jobStatus" open="(" close=")" separator=",">
#{jobStatus}
</foreach>
</if>
</select>
</mapper>
<?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.dlink.mapper.TenantMapper">
<sql id="baseSql">
id,tenant_code,is_delete,note,create_time,update_time
</sql>
<select id="selectForProTable" resultType="com.dlink.model.Tenant">
select
<include refid="baseSql"/>
from
dlink_tenant a
<where>
1=1
<if test='param.tenantCode!=null and param.tenantCode!=""'>
and tenant_code like "%${param.tenantCode}%"
</if>
<if test='param.createTime!=null and param.createTime!=""'>
and create_time <![CDATA[>=]]> str_to_date( #{param.createTime},'%Y-%m-%d %H:%i:%s')
</if>
<if test='param.updateTime!=null and param.updateTime!=""'>
and update_time <![CDATA[>=]]> str_to_date( #{param.updateTime},'%Y-%m-%d %H:%i:%s')
</if>
<if test='ew.sqlSegment!=null and ew.sqlSegment!="" and !ew.sqlSegment.startsWith(" ORDER BY")'>
and
</if>
<if test='ew.sqlSegment!=null and ew.sqlSegment!=""'>
${ew.sqlSegment}
</if>
</where>
</select>
<select id="getTenantByIds" resultType="com.dlink.model.Tenant">
select id
,tenant_code
,is_delete
,note
,create_time
,update_time
from dlink_tenant a
where 1=1
and id in
<foreach collection="tenantIds" item="id" separator="," open="(" close=")" index="">
#{id}
</foreach>
</select>
</mapper>
\ No newline at end of file
<?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.dlink.mapper.UserRoleMapper">
<sql id="baseSql">
id,user_id,role_id
</sql>
<select id="selectForProTable" resultType="com.dlink.model.UserRole">
select
<include refid="baseSql"/>
from
dlink_user_role
<where>
1=1
<if test='param.userId!=null and param.userId!=""'>
and user_id = #{param.userId}
</if>
<if test='param.roleId!=null and param.roleId!=""'>
and role_id = #{param.roleId}
</if>
<if test='ew.sqlSegment!=null and ew.sqlSegment!="" and !ew.sqlSegment.startsWith(" ORDER BY")'>
and
</if>
<if test='ew.sqlSegment!=null and ew.sqlSegment!=""'>
${ew.sqlSegment}
</if>
</where>
</select>
<select id="getUserRoleByUserId" resultType="com.dlink.model.UserRole">
select
<include refid="baseSql"/>
from
dlink_user_role
where user_id = (#{userId})
</select>
<delete id="deleteBathRelation" parameterType="java.util.List">
delete from dlink_user_role
where (user_id,role_id) in
<foreach item="item" index="index" collection="userRoleList" open="(" separator="," close=")">
(#{item.userId},#{item.roleId})
</foreach>
</delete>
<delete id="deleteByRoleIds" parameterType="java.util.List">
DELETE FROM dlink_user_role
WHERE role_id IN
<foreach collection="roleIds" item="item" open="(" separator="," close=")">
${item}
</foreach>
</delete>
</mapper>
\ No newline at end of file
<?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.dlink.mapper.UserTenantMapper">
<sql id="baseSql">
id
,user_id,tenant_id
</sql>
<select id="getUserTenantByUserId" resultType="com.dlink.model.UserTenant">
select
<include refid="baseSql"/>
from
dlink_user_tenant
where user_id = (#{userId})
</select>
</mapper>
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -462,7 +462,7 @@ public abstract class AbstractJdbcDriver extends AbstractDriver {
return sb.toString();
}
//todu impl by subclass
// todu impl by subclass
@Override
public String generateCreateTableSql(Table table) {
StringBuilder sb = new StringBuilder();
......@@ -473,7 +473,7 @@ public abstract class AbstractJdbcDriver extends AbstractDriver {
public boolean execute(String sql) throws Exception {
Asserts.checkNullString(sql, "Sql 语句为空");
try (Statement statement = conn.get().createStatement()) {
//logger.info("执行sql的连接id:" + ((DruidPooledConnection) conn).getTransactionInfo().getId());
// logger.info("执行sql的连接id:" + ((DruidPooledConnection) conn).getTransactionInfo().getId());
statement.execute(sql);
}
return true;
......@@ -503,10 +503,10 @@ public abstract class AbstractJdbcDriver extends AbstractDriver {
String limitEnd = queryData.getOption().getLimitEnd();
StringBuilder optionBuilder = new StringBuilder()
.append("select * from ")
.append(queryData.getSchemaName())
.append(".")
.append(queryData.getTableName());
.append("select * from ")
.append(queryData.getSchemaName())
.append(".")
.append(queryData.getTableName());
if (where != null && !where.equals("")) {
optionBuilder.append(" where ").append(where);
......@@ -522,9 +522,9 @@ public abstract class AbstractJdbcDriver extends AbstractDriver {
limitEnd = "100";
}
optionBuilder.append(" limit ")
.append(limitStart)
.append(",")
.append(limitEnd);
.append(limitStart)
.append(",")
.append(limitEnd);
return optionBuilder;
}
......
......@@ -17,7 +17,6 @@
*
*/
export default [
{
path: '/user',
......@@ -118,7 +117,7 @@ export default [
component: './AlertGroup',
},
],
},{
}, {
path: '/registration/document',
name: 'document',
icon: 'container',
......@@ -128,6 +127,37 @@ export default [
name: 'fragment',
icon: "cloud",
component: './FragmentVariable',
}
],
},
{
name: 'authenticationcenter',
icon: 'SafetyCertificateOutlined',
path: '/authenticationcenter',
routes: [
{
path: '/authenticationcenter/usermanager',
name: 'usermanager',
icon: 'UserOutlined',
component: './AuthenticationCenter/UserManager',
},
{
path: '/authenticationcenter/rolemanager',
name: 'rolemanager',
icon: 'TeamOutlined',
component: './AuthenticationCenter/RoleManager',
},
{
path: '/authenticationcenter/namespacemanager',
name: 'namespacemanager',
icon: 'BulbOutlined',
component: './AuthenticationCenter/NamespaceManager',
},
{
path: '/authenticationcenter/tenantmanager',
name: 'tenantmanager',
icon: 'SecurityScanOutlined',
component: './AuthenticationCenter/TenantManager',
},
],
},
......@@ -138,8 +168,15 @@ export default [
{
name: 'settings',
icon: 'setting',
path: '/settings',
component: './Settings',
path: '/settingcenter',
routes: [
{
path: '/settingcenter/flinksettings',
name: 'flinkConfig',
icon: 'setting',
component: './SettingCenter/FlinkSettings',
},
],
},
{
path: '/about',
......
......@@ -57,6 +57,7 @@
"@ant-design/charts": "^1.3.4",
"@ant-design/icons": "^4.5.0",
"@ant-design/plots": "^1.0.7",
"@ant-design/pro-components": "^1.1.23",
"@ant-design/pro-descriptions": "^1.6.8",
"@ant-design/pro-form": "^1.18.3",
"@ant-design/pro-layout": "^6.18.0",
......
......@@ -22,8 +22,8 @@
* @see https://umijs.org/zh-CN/plugins/plugin-access
* */
export default function access(initialState: { currentUser?: API.CurrentUser | undefined }) {
const { currentUser } = initialState || {};
const {currentUser} = initialState || {};
return {
canAdmin: currentUser && currentUser.access === 'admin',
canAdmin: currentUser && currentUser.isAdmin ? 'admin' : '',
};
}
......@@ -28,14 +28,13 @@ import Footer from '@/components/Footer';
import type {ResponseError} from 'umi-request';
import {currentUser as queryCurrentUser} from './services/ant-design-pro/api';
import {BookOutlined, LinkOutlined} from '@ant-design/icons';
import {useIntl} from "@@/plugin-locale/localeExports";
const isDev = process.env.NODE_ENV === 'development';
const loginPath = '/user/login';
/** 获取用户信息比较慢的时候会展示一个 loading */
export const initialStateConfig = {
loading: <PageLoading />,
loading: <PageLoading/>,
};
/**
......@@ -47,20 +46,24 @@ export async function getInitialState(): Promise<{
fetchUserInfo?: () => Promise<API.CurrentUser | undefined>;
}> {
const fetchUserInfo = async () => {
try {
const result = await queryCurrentUser();
const currentUser: API.CurrentUser = {
name: result.datas.nickname || result.datas.username,
avatar: result.datas.avatar?result.datas.avatar:'https://gw.alipayobjects.com/zos/antfincdn/XAosXuNZyF/BiazfanxmamNRoxxVxka.png',
userid: result.datas.username,
notifyCount: 0,
unreadCount: 0,
access: result.datas.isAdmin?'admin':'',
phone: result.datas.mobile,
isAdmin:result.datas.isAdmin,
worknum:result.datas.worknum,
id: result.datas.user.id,
username: result.datas.user.username,
password: result.datas.user.password,
nickname: result.datas.user.nickname,
worknum: result.datas.user.worknum,
avatar: result.datas.user.avatar ? result.datas.user.avatar : 'https://gw.alipayobjects.com/zos/antfincdn/XAosXuNZyF/BiazfanxmamNRoxxVxka.png',
mobile: result.datas.user.mobile,
enabled: result.datas.user.enabled,
isDelete: result.datas.user.isDelete,
createTime: result.datas.user.createTime,
updateTime: result.datas.user.updateTime,
isAdmin: result.datas.user.isAdmin,
roleList: result.datas.roleList,
tenantList: result.datas.tenantList,
currentTenant: result.datas.currentTenant,
};
return currentUser;
} catch (error) {
......@@ -107,48 +110,48 @@ export async function getInitialState(): Promise<{
*/
export const request: RequestConfig = {
errorHandler: (error: ResponseError) => {
const { messages } = getIntl(getLocale());
const { request,response } = error;
const {messages} = getIntl(getLocale());
const {request, response} = error;
const writeUrl = ['/api/current'];
if(writeUrl.indexOf(request.originUrl)>-1){
return;
}else {
if (response && response.status) {
const {status, statusText, url} = response;
const requestErrorMessage = messages['app.request.error'];
const errorMessage = `${requestErrorMessage} ${status}: ${url}`;
const errorDescription = messages[`app.request.${status}`] || statusText;
notification.error({
message: errorMessage,
description: errorDescription,
});
}
if (writeUrl.indexOf(request.originUrl) > -1) {
return;
} else {
if (response && response.status) {
const {status, statusText, url} = response;
const requestErrorMessage = messages['app.request.error'];
const errorMessage = `${requestErrorMessage} ${status}: ${url}`;
const errorDescription = messages[`app.request.${status}`] || statusText;
notification.error({
message: errorMessage,
description: errorDescription,
});
}
if (!response) {
notification.error({
description: '您的网络发生异常,无法连接服务器',
message: '网络异常',
});
if (!response) {
notification.error({
description: '您的网络发生异常,无法连接服务器',
message: '网络异常',
});
}
throw error;
}
throw error;
}
},
};
// ProLayout 支持的api https://procomponents.ant.design/components/layout
export const layout: RunTimeLayoutConfig = ({ initialState }) => {
export const layout: RunTimeLayoutConfig = ({initialState}) => {
return {
rightContentRender: () => <RightContent />,
rightContentRender: () => <RightContent/>,
disableContentMargin: false,
/*waterMarkProps: {
content: initialState?.currentUser?.name,
},*/
footerRender: () => <Footer />,
footerRender: () => <Footer/>,
onPageChange: () => {
const { location } = history;
const {location} = history;
// 如果没有登录,重定向到 login
if (!initialState?.currentUser && location.pathname !== loginPath) {
history.push(loginPath);
......@@ -156,15 +159,15 @@ export const layout: RunTimeLayoutConfig = ({ initialState }) => {
},
links: isDev
? [
<Link to="/umi/plugin/openapi" target="_blank">
<LinkOutlined />
<span>openAPI Document</span>
</Link>,
<Link to="/~docs">
<BookOutlined />
<span>Business Component Document</span>
</Link>,
]
<Link to="/umi/plugin/openapi" target="_blank">
<LinkOutlined/>
<span>openAPI Document</span>
</Link>,
<Link to="/~docs">
<BookOutlined/>
<span>Business Component Document</span>
</Link>,
]
: [],
menuHeaderRender: undefined,
// 自定义 403 页面
......
......@@ -18,9 +18,19 @@
*/
import request from "umi-request";
import {extend} from "umi-request";
import {TableListParams} from "@/components/Common/data";
import {message, Modal} from "antd";
import {message} from "antd";
export const request2 = extend(
{ headers: { tenantId: localStorage.getItem('dlink-tenantId') || ''} }
);
export const getStorageTenantId = () => {
return localStorage.getItem('dlink-tenantId') || '';
}
export const CODE = {
SUCCESS: 0,
......@@ -28,7 +38,7 @@ export const CODE = {
};
export async function queryData(url:string,params?: TableListParams) {
return request(url, {
return request2(url, {
method: 'POST',
data: {
...params,
......@@ -37,7 +47,7 @@ export async function queryData(url:string,params?: TableListParams) {
}
export async function getData(url:string,params?: any) {
return request(url, {
return request2(url, {
method: 'GET',
params: {
...params,
......@@ -46,7 +56,7 @@ export async function getData(url:string,params?: any) {
}
export async function removeData(url:string,params: any[]) {
return request(url, {
return request2(url, {
method: 'DELETE',
data: {
...params,
......@@ -55,7 +65,7 @@ export async function removeData(url:string,params: any[]) {
}
export async function addOrUpdateData(url:string,params: any) {
return request(url, {
return request2(url, {
method: 'PUT',
data: {
...params,
......@@ -64,7 +74,7 @@ export async function addOrUpdateData(url:string,params: any) {
}
export async function postDataArray(url:string,params: number[]) {
return request(url, {
return request2(url, {
method: 'POST',
data: {
...params,
......@@ -73,7 +83,7 @@ export async function postDataArray(url:string,params: number[]) {
}
export async function postAll(url:string,params?: any) {
return request(url, {
return request2(url, {
method: 'POST',
data: {
...params,
......@@ -82,7 +92,7 @@ export async function postAll(url:string,params?: any) {
}
export async function getInfoById(url:string,id:number) {
return request(url, {
return request2(url, {
method: 'GET',
params: {
id:id,
......
......@@ -18,14 +18,22 @@
*/
import React, {useCallback} from 'react';
import {LogoutOutlined, SettingOutlined, UserOutlined} from '@ant-design/icons';
import {Avatar, Menu, Spin} from 'antd';
import React, {useCallback, useRef} from 'react';
import {
LogoutOutlined,
SafetyOutlined,
SecurityScanOutlined,
SettingOutlined,
UserSwitchOutlined
} from '@ant-design/icons';
import {Avatar, Menu, Modal, Spin} from 'antd';
import {history, useModel} from 'umi';
import {stringify} from 'querystring';
import HeaderDropdown from '../HeaderDropdown';
import styles from './index.less';
import {outLogin} from '@/services/ant-design-pro/api';
import {ActionType} from "@ant-design/pro-table";
import {useIntl} from "@@/plugin-locale/localeExports";
export type GlobalHeaderRightProps = {
menu?: boolean;
......@@ -36,8 +44,8 @@ export type GlobalHeaderRightProps = {
*/
const loginOut = async () => {
await outLogin();
const { query = {}, pathname } = history.location;
const { redirect } = query;
const {query = {}, pathname} = history.location;
const {redirect} = query;
// Note: There may be security issues, please note
if (window.location.pathname !== '/user/login' && !redirect) {
history.replace({
......@@ -49,8 +57,14 @@ const loginOut = async () => {
}
};
const AvatarDropdown: React.FC<GlobalHeaderRightProps> = ({ menu }) => {
const { initialState, setInitialState } = useModel('@@initialState');
const requestUrl = '/api/tenant/switchTenant';
const AvatarDropdown: React.FC<GlobalHeaderRightProps> = ({menu}) => {
const {initialState, setInitialState} = useModel('@@initialState');
const actionRef = useRef<ActionType>();
const intl = useIntl();
const onMenuClick = useCallback(
(event: {
......@@ -59,9 +73,9 @@ const AvatarDropdown: React.FC<GlobalHeaderRightProps> = ({ menu }) => {
item: React.ReactInstance;
domEvent: React.MouseEvent<HTMLElement>;
}) => {
const { key } = event;
const {key} = event;
if (key === 'logout' && initialState) {
setInitialState({ ...initialState, currentUser: undefined });
setInitialState({...initialState, currentUser: undefined});
loginOut();
return;
}
......@@ -86,39 +100,97 @@ const AvatarDropdown: React.FC<GlobalHeaderRightProps> = ({ menu }) => {
return loading;
}
const { currentUser } = initialState;
const {currentUser} = initialState;
if (!currentUser || !currentUser.name) {
if (!currentUser || !currentUser.username) {
return loading;
}
const getChooseTenantListForm = () => {
let chooseTenantList: JSX.Element[] = [];
currentUser.tenantList?.map((item) => {
chooseTenantList.push(
<>
<Menu.Item
// If the current key (tenant id) is equal to the tenant the current user chooses to log in, this item is not optional
disabled={item.id === currentUser.currentTenant?.id}
key={item.id}
title={item.tenantCode}
icon={<SecurityScanOutlined/>}
onClick={(e) => {
console.log(e)
// get choose tenant title
let title = e.domEvent.target.textContent;
// get choose tenantId
let tenantInfoId = e.key;
Modal.confirm({
title: intl.formatMessage({id: 'menu.account.checkTenant'}),
content: '确定切换【' + title + '】租户吗?',
okText: intl.formatMessage({id: 'button.confirm'}),
cancelText: intl.formatMessage({id: 'button.cancel'}),
onOk: async () => {
// 目前先直接退出登录 重新选择租户登录
loginOut();
// todo 切换租户需要将租户id 传入后端 以及本地存储中
// const {code, msg} = await postAll(requestUrl, {tenantId: tenantInfoId});
// localStorage.clear() // clear local storage
// localStorage.setItem('dlink-tenantId',tenantInfoId) // set tenant to localStorage
// code == 0 ? message.success(msg) : message.error(msg);
// todo
// 1.切换租户后 需要重新调用 /api/current接口获取用户的信息 (目前此接口从cookie直接取数 ,达不到预期效果)
// 2.同步刷新所有页面 获取该租户id下的数据
//actionRef.current?.reload()
// actionRef.current?.reloadAndRest?.();
}
});
}}
>
{item.tenantCode}
</Menu.Item>
</>
)
})
return <>
<Menu.SubMenu
key="chooseTenantList"
title={intl.formatMessage({id: 'menu.account.checkTenant'})}
icon={<UserSwitchOutlined/>}
>
{chooseTenantList}
</Menu.SubMenu>
</>;
}
const menuHeaderDropdown = (
<Menu className={styles.menu} selectedKeys={[]} onClick={onMenuClick}>
{menu && (
<Menu.Item key="center">
<UserOutlined />
个人中心
getChooseTenantListForm()
)}
{menu && (
<Menu.Item key="personSettings" disabled>
<SettingOutlined/>
{intl.formatMessage({id: 'menu.account.settings'})}
</Menu.Item>
)}
{menu && (
<Menu.Item key="settings">
<SettingOutlined />
个人设置
<Menu.Item key="changePassWord" disabled>
<SafetyOutlined/>
{intl.formatMessage({id: 'menu.account.changePassword'})}
</Menu.Item>
)}
{menu && <Menu.Divider />}
{menu && <Menu.Divider/>}
<Menu.Item key="logout">
<LogoutOutlined />
退出登录
<LogoutOutlined/>
{intl.formatMessage({id: 'menu.account.logout'})}
</Menu.Item>
</Menu>
);
return (
<HeaderDropdown overlay={menuHeaderDropdown}>
<span className={`${styles.action} ${styles.account}`}>
<Avatar size="small" className={styles.avatar} src={currentUser.avatar} alt="avatar" />
<span className={`${styles.name} anticon`}>{currentUser.name}</span>
<Avatar size="small" className={styles.avatar} src={currentUser.avatar} alt="avatar"/>
<span className={`${styles.name} anticon`}>{currentUser.username}</span>
</span>
</HeaderDropdown>
);
......
......@@ -18,12 +18,11 @@
*/
import { Tag, Space } from 'antd';
import { QuestionCircleOutlined } from '@ant-design/icons';
import {GlobalOutlined} from '@ant-design/icons';
import {Space} from 'antd';
import React from 'react';
import { useModel, SelectLang } from 'umi';
import {SelectLang, useModel} from 'umi';
import Avatar from './AvatarDropdown';
import HeaderSearch from '../HeaderSearch';
import styles from './index.less';
export type SiderTheme = 'light' | 'dark';
......@@ -35,13 +34,13 @@ const ENVTagColor = {
};
const GlobalHeaderRight: React.FC = () => {
const { initialState } = useModel('@@initialState');
const {initialState} = useModel('@@initialState');
if (!initialState || !initialState.settings) {
return null;
}
const { navTheme, layout } = initialState.settings;
const {navTheme, layout} = initialState.settings;
let className = styles.right;
if ((navTheme === 'dark' && layout === 'top') || layout === 'mix') {
......@@ -49,44 +48,13 @@ const GlobalHeaderRight: React.FC = () => {
}
return (
<Space className={className}>
<HeaderSearch
className={`${styles.action} ${styles.search}`}
placeholder="站内搜索"
defaultValue="umi ui"
options={[
{ label: <a href="https://umijs.org/zh/guide/umi-ui.html">umi ui</a>, value: 'umi ui' },
{
label: <a href="next.ant.design">Ant Design</a>,
value: 'Ant Design',
},
{
label: <a href="https://protable.ant.design/">Pro Table</a>,
value: 'Pro Table',
},
{
label: <a href="https://prolayout.ant.design/">Pro Layout</a>,
value: 'Pro Layout',
},
]}
// onSearch={value => {
// console.log('input', value);
// }}
/>
<span
className={styles.action}
onClick={() => {
window.open('https://pro.ant.design/docs/getting-started');
}}
>
<QuestionCircleOutlined />
</span>
<Avatar />
{REACT_APP_ENV && (
<span>
<Tag color={ENVTagColor[REACT_APP_ENV]}>{REACT_APP_ENV}</Tag>
</span>
)}
<SelectLang className={styles.action} />
<Avatar menu={true}/>
{/*{REACT_APP_ENV && (*/}
{/* <span>*/}
{/* <Tag color={ENVTagColor[REACT_APP_ENV]}>{REACT_APP_ENV}</Tag>*/}
{/* </span>*/}
{/*)}*/}
<SelectLang icon={<GlobalOutlined/>} className={styles.action}/>
</Space>
);
};
......
......@@ -40,7 +40,7 @@ export function convertToTreeData(data:TreeDataNode[], pid:number,path?:string[]
!path&&(path=[]);
const result:TreeDataNode[] = [];
let temp:TreeDataNode[] = [];
for (let i = 0; i < data.length; i++) {
for (let i = 0; i < data?.length; i++) {
if (data[i].parentId === pid) {
let obj = data[i];
obj.title = obj.name;
......
......@@ -18,25 +18,31 @@
*/
import React, {useEffect, useRef, useState, useCallback} from "react";
import React, {useCallback, useEffect, useState} from "react";
import {connect} from "umi";
import styles from './index.less';
import {} from "@ant-design/icons";
import StudioMenu from "./StudioMenu";
import {Row, Col, Card, Form} from "antd";
import {Card, Col, Form, Row} from "antd";
import StudioTabs from "./StudioTabs";
import StudioHome from "./StudioHome";
import {StateType} from "@/pages/DataStudio/model";
import StudioConsole from "./StudioConsole";
import StudioLeftTool from "./StudioLeftTool";
import StudioRightTool from "./StudioRightTool";
import {
listSession, showCluster, showDataBase, getFillAllByVersion,
showClusterConfiguration, showSessionCluster, showJars, showEnv, showAlertInstance, showAlertGroup
getFillAllByVersion,
listSession,
showAlertGroup,
showAlertInstance,
showCluster,
showClusterConfiguration,
showDataBase,
showEnv,
showJars,
showSessionCluster
} from "@/components/Studio/StudioEvent/DDL";
import {loadSettings} from "@/pages/Settings/function";
import DraggleLayout from "@/components/DraggleLayout";
import DraggleVerticalLayout from "@/components/DraggleLayout/DraggleVerticalLayout";
import {loadSettings} from "@/pages/SettingCenter/FlinkSettings/function";
const Studio = (props: any) => {
......
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
import component from './en-US/component';
import globalHeader from './en-US/globalHeader';
import menu from './en-US/menu';
......@@ -6,6 +25,7 @@ import pwa from './en-US/pwa';
import request from './en-US/request';
import settingDrawer from './en-US/settingDrawer';
import settings from './en-US/settings';
import button from './en-US/button';
export default {
'navBar.lang': 'Languages',
......@@ -24,4 +44,5 @@ export default {
...component,
...pages,
...request,
...button,
};
......@@ -17,24 +17,9 @@
*
*/
export type UserTableListItem = {
id?: number;
enabled?: boolean;
isDelete?: string;
createTime?: Date;
updateTime?: Date;
username?: string;
nickname?: string;
password?: string;
avatar?: string;
worknum?: string;
mobile?: string;
};
export type PasswordItem = {
username: string;
password?: string;
newPassword?: string;
newPasswordCheck?: string;
export default {
'button.create': 'Create',
'button.close': 'Close',
'button.confirm': 'Confirm',
'button.cancel': 'Cancel',
};
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
export default {
'component.tagSelect.expand': 'Expand',
'component.tagSelect.collapse': 'Collapse',
......
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
export default {
'component.globalHeader.search': 'Search',
'component.globalHeader.search.example1': 'Search example 1',
......
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
export default {
'menu.welcome': 'Welcome',
'menu.more-blocks': 'More Blocks',
......@@ -45,25 +64,41 @@ export default {
'menu.account.settings': 'Account Settings',
'menu.account.trigger': 'Trigger Error',
'menu.account.logout': 'Logout',
'menu.account.checkTenant': 'Check Tenant',
'menu.account.changePassword': 'Change Password',
'menu.editor': 'Graphic Editor',
'menu.editor.flow': 'Flow Editor',
'menu.editor.mind': 'Mind Editor',
'menu.editor.koni': 'Koni Editor',
'menu.datastudio': 'Data Studio',
'menu.devops': 'Devops',
'menu.job': 'Job Instance',
'menu.datacenter': 'Mate Data Center',
'menu.datacenter.metadata': 'Mate Data',
'menu.registration': 'Regist Center',
'menu.registration.cluster': 'Cluster Management',
'menu.registration.cluster.clusterInstance': 'Cluster Instance',
'menu.registration.cluster.clusterConfiguration': 'Cluster Config',
'menu.registration.jar': 'Jar Management',
'menu.registration.database': 'Data Source Management',
'menu.registration.alert': 'Alarm Management',
'menu.registration.alert.alertInstance': 'Alarm Instance Management',
'menu.registration.alert.alertGroup': 'Alarm Group Management',
'menu.registration.jar': 'Jar Management',
'menu.registration.document': 'Document Management',
'menu.registration.fragment': 'Global Variable Management',
'menu.datastudio': 'Data Studio',
'menu.settings': 'System Setting',
'menu.devops': 'Devops',
'menu.authenticationcenter': 'Authentication Center',
'menu.authenticationcenter.usermanager': 'User Management',
'menu.authenticationcenter.namespacemanager': 'NameSpace Management',
'menu.authenticationcenter.rolemanager': 'Role Management',
'menu.authenticationcenter.tenantmanager': 'Tenant Management',
'menu.settings': 'Setting Center',
'menu.settings.flinkConfig': 'Flink Settings',
'menu.about': 'About',
};
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
export default {
'pages.layouts.userLayout.title': 'Dinky Real-time Computing Platform',
......@@ -5,6 +24,7 @@ export default {
'pages.login.accountLogin.errorMessage': 'Incorrect UserName/Password(admin/ant.design)',
'pages.login.failure': 'Login Failed, Please Try Again!',
'pages.login.success': 'Login Success!',
'pages.login.chooseTenant': 'Please Choose Tenant',
'pages.login.username.placeholder': 'Username: Admin Or User',
'pages.login.username.required': 'Please Input Your UserName!',
'pages.login.password.placeholder': 'Password: ant.design',
......@@ -68,83 +88,82 @@ export default {
'pages.searchTable.batchDeletion': 'Bacth Deletion',
'pages.searchTable.batchApproval': 'Batch Approval',
'pages.devops.jobstatus.CREATED' : 'Created',
'pages.devops.jobstatus.INITIALIZING' : 'Initialize',
'pages.devops.jobstatus.RUNNING' : 'Running',
'pages.devops.jobstatus.FINISHED' : 'Finished',
'pages.devops.jobstatus.FAILING' : 'Abnormal',
'pages.devops.jobstatus.FAILED' : 'Failed',
'pages.devops.jobstatus.SUSPENDED' : 'Paused',
'pages.devops.jobstatus.CANCELLING' : 'Canceling',
'pages.devops.jobstatus.CANCELED' : 'Canceled',
'pages.devops.jobstatus.RESTARTING' : 'Restarting',
'pages.devops.jobstatus.UNKNOWN' : 'Unknown',
'pages.devops.LastUpdateTime' : 'LastUpdateTime',
'pages.devops.jobstatus.CREATED': 'Created',
'pages.devops.jobstatus.INITIALIZING': 'Initialize',
'pages.devops.jobstatus.RUNNING': 'Running',
'pages.devops.jobstatus.FINISHED': 'Finished',
'pages.devops.jobstatus.FAILING': 'Abnormal',
'pages.devops.jobstatus.FAILED': 'Failed',
'pages.devops.jobstatus.SUSPENDED': 'Paused',
'pages.devops.jobstatus.CANCELLING': 'Canceling',
'pages.devops.jobstatus.CANCELED': 'Canceled',
'pages.devops.jobstatus.RESTARTING': 'Restarting',
'pages.devops.jobstatus.UNKNOWN': 'Unknown',
'pages.settings.UserManagement' : 'User Management',
'pages.settings.Flink' : 'Flink Setting',
'pages.settings.FlinkURL' : 'Submit the Jar file path to FlinkSQL',
'pages.devops.LastUpdateTime': 'LastUpdateTime',
'pages.settings.FlinkSQLJarMainParameter' : 'Submit The Main Class entry To the Jar For FlinkSQL',
'pages.settings.FlinkSQLJarMainClass' : 'The Main Class Of The Jar That Submitted FlinkSQL',
'pages.settings.FlinkRestAPI' : 'Using Rest API',
'pages.settings.FlinkURLSplit' : 'FlinkSQL Statement Separator',
'pages.settings.FlinkSQLLogic' : 'Calculate Consanguinity Using A Logical Plan',
'pages.settings.FlinkJobID' : 'Maximum Waiting Time For Getting A Job ID (seconds)',
'pages.settings.FlinkNoSetting' : 'Not Setting',
'pages.settings.FlinkNoUseSetting' : 'After The Flink Task Is Enabled, Operations Such As Savepoint And Stop Are Performed Through The RestAPI Of JobManager',
'pages.settings.FlinkLogic' : 'Whether The Calculation Of Field Consanguinity Analysis For Flink Tasks Is Based On A Logical Plan Is Supported Only In Version 1.14',
'pages.settings.UserManagement': 'User Management',
'pages.settings.Flink': 'Flink Setting',
'pages.settings.FlinkURL': 'Submit the Jar file path to FlinkSQL',
'pages.settings.FlinkUpdate' : 'Update',
'pages.settings.FlinkSave' : 'Save',
'pages.settings.FlinkCancel' : 'Cancel',
'pages.settings.FlinkUse' : 'In Use',
'pages.settings.FlinkNotUse' : 'Not Use',
'pages.settings.FlinkSQLJarMainParameter': 'Submit The Main Class entry To the Jar For FlinkSQL',
'pages.settings.FlinkSQLJarMainClass': 'The Main Class Of The Jar That Submitted FlinkSQL',
'pages.settings.FlinkRestAPI': 'Using Rest API',
'pages.settings.FlinkURLSplit': 'FlinkSQL Statement Separator',
'pages.settings.FlinkSQLLogic': 'Calculate Consanguinity Using A Logical Plan',
'pages.settings.FlinkJobID': 'Maximum Waiting Time For Getting A Job ID (seconds)',
'pages.settings.FlinkNoSetting': 'Not Setting',
'pages.settings.FlinkNoUseSetting': 'After The Flink Task Is Enabled, Operations Such As Savepoint And Stop Are Performed Through The RestAPI Of JobManager',
'pages.settings.FlinkLogic': 'Whether The Calculation Of Field Consanguinity Analysis For Flink Tasks Is Based On A Logical Plan Is Supported Only In Version 1.14',
'pages.user.UserEdit' : 'Edit',
'pages.user.UserDelete' : 'Delete',
'pages.user.UserChangePassword' : 'Update Password',
'pages.user.UserConfig' : 'Config',
'pages.user.UserMore' : 'More',
'pages.settings.FlinkUpdate': 'Update',
'pages.settings.FlinkSave': 'Save',
'pages.settings.FlinkCancel': 'Cancel',
'pages.settings.FlinkUse': 'In Use',
'pages.settings.FlinkNotUse': 'Not Use',
'pages.user.UserCreate' : 'Create',
'pages.user.UserManger' : 'User Management',
'pages.user.UserName' : 'User Name',//用户名
'pages.user.UserJobNumber' : 'Job Number',//工号
'pages.user.UserPhoneNumber' : 'Phone Number',//手机号
'pages.user.UserNickName' : 'Nick Name',//昵称
'pages.user.UserIsUse' : 'Is Use',//是否启用
'pages.user.UserUpdateTime' : 'Update Time',//最近更新时间
'pages.user.UserOperate' : 'Operate',//操作
'pages.user.UserInUse' : 'In Use',//已启用
'pages.user.UserNotUse' : 'Not Use',//已禁用
'pages.user.UserCreateTime' : 'Create Time',//创建时间
'pages.user.UserEdit': 'Edit',
'pages.user.UserDelete': 'Delete',
'pages.user.UserChangePassword': 'Update Password',
'pages.user.UserConfig': 'Config',
'pages.user.UserMore': 'More',
'pages.user.UserComplete' : 'Complete',
'pages.user.UserConfirm' : 'Confirm',
'pages.user.UserCancel' : 'Cancel',
'pages.user.UserDeleteUser' : 'Delete User',
'pages.user.UserCreateUser' : 'Create User',
'pages.user.UserUpdateUser' : 'Update User',
'pages.user.UserEnterUserName' : 'Please enter user name',
'pages.user.UserEnterUniqueUserName' : 'Please enter unique user name',
'pages.user.UserEnterJobNumber' : 'Please enter job number',
'pages.user.UserEnterNickName' : 'Please enter nickname',
'pages.user.UserEnterPhoneNumber' : 'Please enter phone number',
'pages.user.UserOldPassword' : 'Old Password',
'pages.user.UserNewPassword' : 'New Password',
'pages.user.UserRepeatNewPassword' : 'Repeat New Password',
'pages.user.UserEnterOldPassword' : 'Please enter old password',
'pages.user.UserEnterNewPassword' : 'Please enter new password',
'pages.user.UserEnterRepeatNewPassword' : 'Please enter repeat new password',
'pages.user.UserNewPasswordNotMatch' : 'The new passwords do not match',
'pages.user.UserUpdatePassword' : 'Update Password',
'pages.user.UserCreate': 'Create',
'pages.user.UserManger': 'User Management',
'pages.user.UserName': 'User Name',//用户名
'pages.user.UserJobNumber': 'Job Number',//工号
'pages.user.UserPhoneNumber': 'Phone Number',//手机号
'pages.user.UserNickName': 'Nick Name',//昵称
'pages.user.UserIsUse': 'Is Use',//是否启用
'pages.user.UserUpdateTime': 'Update Time',//最近更新时间
'pages.user.UserOperate': 'Operate',//操作
'pages.user.UserInUse': 'In Use',//已启用
'pages.user.UserNotUse': 'Not Use',//已禁用
'pages.user.UserCreateTime': 'Create Time',//创建时间
'pages.user.UserComplete': 'Complete',
'pages.user.UserConfirm': 'Confirm',
'pages.user.UserCancel': 'Cancel',
'pages.user.UserDeleteUser': 'Delete User',
'pages.user.UserCreateUser': 'Create User',
'pages.user.UserUpdateUser': 'Update User',
'pages.user.UserEnterUserName': 'Please enter user name',
'pages.user.UserEnterUniqueUserName': 'Please enter unique user name',
'pages.user.UserEnterJobNumber': 'Please enter job number',
'pages.user.UserEnterNickName': 'Please enter nickname',
'pages.user.UserEnterPhoneNumber': 'Please enter phone number',
'pages.user.UserOldPassword': 'Old Password',
'pages.user.UserNewPassword': 'New Password',
'pages.user.UserRepeatNewPassword': 'Repeat New Password',
'pages.user.UserEnterOldPassword': 'Please enter old password',
'pages.user.UserEnterNewPassword': 'Please enter new password',
'pages.user.UserEnterRepeatNewPassword': 'Please enter repeat new password',
'pages.user.UserNewPasswordNotMatch': 'The new passwords do not match',
'pages.user.UserUpdatePassword': 'Update Password',
'pages.regist.openAPI' : 'openAPI Document',
'pages.regist.BusinessComponent' : 'Business Component Document',
'pages.regist.openAPI': 'openAPI Document',
'pages.regist.BusinessComponent': 'Business Component Document',
};
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
export default {
'app.pwa.offline': 'You are offline now',
'app.pwa.serviceworker.updated': 'New content is available',
......
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
export default {
'app.request.error': 'Request error',
'app.request.200': 'The server successfully returned the requested data. ',
......
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
export default {
'app.setting.pagestyle': 'Page style setting',
'app.setting.pagestyle.dark': 'Dark style',
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment