This is an automated email from the ASF dual-hosted git repository.

achao pushed a commit to branch dev-2.1.3
in repository https://gitbox.apache.org/repos/asf/incubator-streampark.git


The following commit(s) were added to refs/heads/dev-2.1.3 by this push:
     new 05fcad527 [Imprpve] JDBC "like" syntax is compatible with mysql and 
pgsql (#3557)
05fcad527 is described below

commit 05fcad5275f2394f5bc70a78bcd8e50f6c8192ad
Author: benjobs <[email protected]>
AuthorDate: Sat Feb 17 00:28:32 2024 +0800

    [Imprpve] JDBC "like" syntax is compatible with mysql and pgsql (#3557)
    
    * [Imprpve] JDBC "like" syntax is compatible with mysql and pgsql
    
    * [Improve] checkstyle improvement
    
    * [Improve] dashboard page style improvement
    
    * [Improve] dashboard page style improvement
    
    * [Improve] FE i18n improvement
    
    ---------
    
    Co-authored-by: benjobs <[email protected]>
---
 .../console/base/config/MybatisConfig.java         | 16 ++++++++++
 .../resources/mapper/core/ApplicationMapper.xml    | 21 +++++++++++--
 .../main/resources/mapper/core/ProjectMapper.xml   |  7 ++++-
 .../main/resources/mapper/core/VariableMapper.xml  | 21 +++++++++++--
 .../main/resources/mapper/core/YarnQueueMapper.xml |  7 ++++-
 .../main/resources/mapper/system/MemberMapper.xml  |  7 ++++-
 .../main/resources/mapper/system/RoleMapper.xml    |  7 ++++-
 .../main/resources/mapper/system/TeamMapper.xml    |  7 ++++-
 .../main/resources/mapper/system/UserMapper.xml    |  7 ++++-
 .../src/locales/lang/en/flink/app.ts               | 34 +++++++++++-----------
 .../src/locales/lang/zh-CN/flink/app.ts            | 18 ++++++------
 .../src/views/flink/app/hooks/useAppTableAction.ts |  5 ++--
 12 files changed, 117 insertions(+), 40 deletions(-)

diff --git 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/base/config/MybatisConfig.java
 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/base/config/MybatisConfig.java
index 5be603899..4ac1921e7 100644
--- 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/base/config/MybatisConfig.java
+++ 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/base/config/MybatisConfig.java
@@ -20,6 +20,8 @@ package org.apache.streampark.console.base.config;
 import 
org.apache.streampark.console.base.mybatis.interceptor.PostgreSQLPrepareInterceptor;
 import 
org.apache.streampark.console.base.mybatis.interceptor.PostgreSQLQueryInterceptor;
 
+import org.apache.ibatis.mapping.DatabaseIdProvider;
+import org.apache.ibatis.mapping.VendorDatabaseIdProvider;
 import org.apache.ibatis.type.JdbcType;
 
 import com.baomidou.mybatisplus.annotation.IdType;
@@ -34,6 +36,8 @@ import 
org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 
+import java.util.Properties;
+
 /** for MyBatis Configure management. */
 @Configuration
 @MapperScan(value = {"org.apache.streampark.console.*.mapper"})
@@ -89,4 +93,16 @@ public class MybatisConfig {
       properties.setGlobalConfig(globalConfig);
     };
   }
+
+  @Bean
+  public DatabaseIdProvider databaseIdProvider() {
+    VendorDatabaseIdProvider databaseIdProvider = new 
VendorDatabaseIdProvider();
+    Properties properties = new Properties();
+    properties.put("MySQL", "mysql");
+    // h2 is also used as the processing strategy for MySQL
+    properties.setProperty("H2", "mysql");
+    properties.setProperty("PostgreSQL", "pgsql");
+    databaseIdProvider.setProperties(properties);
+    return databaseIdProvider;
+  }
 }
diff --git 
a/streampark-console/streampark-console-service/src/main/resources/mapper/core/ApplicationMapper.xml
 
b/streampark-console/streampark-console-service/src/main/resources/mapper/core/ApplicationMapper.xml
index ebc1a275e..b6f71849c 100644
--- 
a/streampark-console/streampark-console-service/src/main/resources/mapper/core/ApplicationMapper.xml
+++ 
b/streampark-console/streampark-console-service/src/main/resources/mapper/core/ApplicationMapper.xml
@@ -163,10 +163,20 @@
                 and t.execution_mode = #{application.executionMode}
             </if>
             <if test="application.jobName != null and application.jobName != 
''">
-                and t.job_name like concat('%','${application.jobName}','%')
+                <if test="_databaseId == 'mysql'">
+                    and t.job_name like concat('%', #{application.jobName},'%')
+                </if>
+                <if test="_databaseId == 'pgsql'">
+                    and t.job_name like '%' || #{application.jobName} || '%'
+                </if>
             </if>
             <if test="application.projectName != null and 
application.projectName != ''">
-                and p.name like concat('%','${application.projectName}','%')
+                <if test="_databaseId == 'mysql'">
+                    and p.name like concat('%', #{application.projectName},'%')
+                </if>
+                <if test="_databaseId == 'pgsql'">
+                    and p.name like '%' || #{application.projectName} || '%'
+                </if>
             </if>
             <if test="application.appId != null and application.appId != ''">
                 and t.app_id = #{application.appId}
@@ -185,7 +195,12 @@
                 </foreach>
             </if>
             <if test="application.tags != null and application.tags != ''">
-                and t.tags like concat('%','${application.tags}','%')
+                <if test="_databaseId == 'mysql'">
+                    and t.tags like concat('%', #{application.tags},'%')
+                </if>
+                <if test="_databaseId == 'pgsql'">
+                    and t.tags like '%' || #{application.tags} || '%'
+                </if>
             </if>
         </where>
     </select>
diff --git 
a/streampark-console/streampark-console-service/src/main/resources/mapper/core/ProjectMapper.xml
 
b/streampark-console/streampark-console-service/src/main/resources/mapper/core/ProjectMapper.xml
index a04ab7305..eb242ba38 100644
--- 
a/streampark-console/streampark-console-service/src/main/resources/mapper/core/ProjectMapper.xml
+++ 
b/streampark-console/streampark-console-service/src/main/resources/mapper/core/ProjectMapper.xml
@@ -72,7 +72,12 @@
         <where>
             t.team_id = #{project.teamId}
             <if test="project.name != null and project.name != ''">
-                and t.name like concat('%','${project.name}','%')
+                <if test="_databaseId == 'mysql'">
+                    and t.name like concat('%', #{project.name},'%')
+                </if>
+                <if test="_databaseId == 'pgsql'">
+                    and t.name like '%' || #{project.name} || '%'
+                </if>
             </if>
             <if test="project.buildState != null">
                 and t.build_state = #{project.buildState}
diff --git 
a/streampark-console/streampark-console-service/src/main/resources/mapper/core/VariableMapper.xml
 
b/streampark-console/streampark-console-service/src/main/resources/mapper/core/VariableMapper.xml
index 855ec164c..c55480aa6 100644
--- 
a/streampark-console/streampark-console-service/src/main/resources/mapper/core/VariableMapper.xml
+++ 
b/streampark-console/streampark-console-service/src/main/resources/mapper/core/VariableMapper.xml
@@ -38,10 +38,20 @@
         on v.creator_id = u.user_id
         and v.team_id = #{variable.teamId}
         <if test="variable.description != null and variable.description != ''">
-            and v.description like concat('%','${variable.description}','%')
+            <if test="_databaseId == 'mysql'">
+                and v.description like concat('%', #{variable.description},'%')
+            </if>
+            <if test="_databaseId == 'pgsql'">
+                and v.description like '%' || #{variable.description} || '%'
+            </if>
         </if>
         <if test="variable.variableCode != null and variable.variableCode != 
''">
-            and v.variable_code like concat('%','${variable.variableCode}','%')
+            <if test="_databaseId == 'mysql'">
+                and v.variable_code like concat('%', 
#{variable.variableCode},'%')
+            </if>
+            <if test="_databaseId == 'pgsql'">
+                and v.variable_code like '%' || #{variable.variableCode} || '%'
+            </if>
         </if>
     </select>
 
@@ -61,7 +71,12 @@
         <where>
             team_id = #{teamId}
             <if test="keyword != null and keyword != ''">
-                and variable_code like concat('%', '${keyword}', '%') or 
description like concat('%', '${keyword}', '%')
+                <if test="_databaseId == 'mysql'">
+                    and variable_code like concat('%', #{keyword}, '%') or 
description like concat('%', #{keyword}, '%')
+                </if>
+                <if test="_databaseId == 'pgsql'">
+                    and variable_code like '%' || #{keyword} || '%' or 
description like '%' || #{keyword} || '%'
+                </if>
             </if>
         </where>
     </select>
diff --git 
a/streampark-console/streampark-console-service/src/main/resources/mapper/core/YarnQueueMapper.xml
 
b/streampark-console/streampark-console-service/src/main/resources/mapper/core/YarnQueueMapper.xml
index a1f27f4a8..a49b439f0 100644
--- 
a/streampark-console/streampark-console-service/src/main/resources/mapper/core/YarnQueueMapper.xml
+++ 
b/streampark-console/streampark-console-service/src/main/resources/mapper/core/YarnQueueMapper.xml
@@ -33,7 +33,12 @@
                 team_id = #{yarnQueue.teamId}
             </if>
             <if test="yarnQueue.queueLabel != null and yarnQueue.queueLabel != 
''">
-                and queue_label like concat('%','${yarnQueue.queueLabel}','%')
+                <if test="_databaseId == 'mysql'">
+                    and queue_label like concat('%', 
#{yarnQueue.queueLabel},'%')
+                </if>
+                <if test="_databaseId == 'pgsql'">
+                    and queue_label like '%' || #{yarnQueue.queueLabel} || '%'
+                </if>
             </if>
             <if test="yarnQueue.createTimeFrom != null and 
yarnQueue.createTimeFrom !=''">
                 and create_time &gt; #{yarnQueue.createTimeFrom}
diff --git 
a/streampark-console/streampark-console-service/src/main/resources/mapper/system/MemberMapper.xml
 
b/streampark-console/streampark-console-service/src/main/resources/mapper/system/MemberMapper.xml
index 3d79db840..643ebc206 100644
--- 
a/streampark-console/streampark-console-service/src/main/resources/mapper/system/MemberMapper.xml
+++ 
b/streampark-console/streampark-console-service/src/main/resources/mapper/system/MemberMapper.xml
@@ -51,7 +51,12 @@
         <where>
             tur.team_id = #{member.teamId}
             <if test="member.userName != null and member.userName != ''">
-                and u.username like concat('%','${member.userName}','%')
+                <if test="_databaseId == 'mysql'">
+                    and u.username like concat('%', #{member.userName},'%')
+                </if>
+                <if test="_databaseId == 'pgsql'">
+                    and u.username like '%' || #{member.userName} || '%'
+                </if>
             </if>
             <if test="member.roleName != null and member.roleName != ''">
                 and r.role_name = #{member.roleName}
diff --git 
a/streampark-console/streampark-console-service/src/main/resources/mapper/system/RoleMapper.xml
 
b/streampark-console/streampark-console-service/src/main/resources/mapper/system/RoleMapper.xml
index c4c2bcaff..0904f6e47 100644
--- 
a/streampark-console/streampark-console-service/src/main/resources/mapper/system/RoleMapper.xml
+++ 
b/streampark-console/streampark-console-service/src/main/resources/mapper/system/RoleMapper.xml
@@ -29,7 +29,12 @@
         select * from t_role
         <where>
             <if test="role.roleName != null and role.roleName != ''">
-                and role_name like concat('%','${role.roleName}','%')
+                <if test="_databaseId == 'mysql'">
+                    and role_name like concat('%', #{role.roleName},'%')
+                </if>
+                <if test="_databaseId == 'pgsql'">
+                    and role_name like '%' || #{role.roleName} || '%'
+                </if>
             </if>
             <if test="role.createTimeFrom != null and role.createTimeFrom 
!=''">
                 and  create_time &gt; #{role.createTimeFrom}
diff --git 
a/streampark-console/streampark-console-service/src/main/resources/mapper/system/TeamMapper.xml
 
b/streampark-console/streampark-console-service/src/main/resources/mapper/system/TeamMapper.xml
index 328842435..b2b39d8e0 100644
--- 
a/streampark-console/streampark-console-service/src/main/resources/mapper/system/TeamMapper.xml
+++ 
b/streampark-console/streampark-console-service/src/main/resources/mapper/system/TeamMapper.xml
@@ -29,7 +29,12 @@
         select * from t_team
         <where>
             <if test="team.teamName != null and team.teamName != ''">
-                and team_name like concat('%','${team.teamName}','%')
+                <if test="_databaseId == 'mysql'">
+                    and team_name like concat('%', #{team.teamName},'%')
+                </if>
+                <if test="_databaseId == 'pgsql'">
+                    and team_name like '%' || #{team.teamName} || '%'
+                </if>
             </if>
             <if test="team.createTimeFrom != null and team.createTimeFrom 
!=''">
                 and create_time &gt; #{team.createTimeFrom}
diff --git 
a/streampark-console/streampark-console-service/src/main/resources/mapper/system/UserMapper.xml
 
b/streampark-console/streampark-console-service/src/main/resources/mapper/system/UserMapper.xml
index db459d626..e819aa114 100644
--- 
a/streampark-console/streampark-console-service/src/main/resources/mapper/system/UserMapper.xml
+++ 
b/streampark-console/streampark-console-service/src/main/resources/mapper/system/UserMapper.xml
@@ -38,7 +38,12 @@
         select * from t_user
         <where>
             <if test="user.username != null and user.username != ''">
-                and username like concat('%','${user.username}','%')
+                <if test="_databaseId == 'mysql'">
+                    and username like concat('%', #{user.username},'%')
+                </if>
+                <if test="_databaseId == 'pgsql'">
+                    and username like '%' || #{user.username} || '%'
+                </if>
             </if>
             <if test="user.createTimeFrom != null and user.createTimeFrom 
!=''">
                 and create_time &gt; #{user.createTimeFrom}
diff --git 
a/streampark-console/streampark-console-webapp/src/locales/lang/en/flink/app.ts 
b/streampark-console/streampark-console-webapp/src/locales/lang/en/flink/app.ts
index e96868b5e..c1dfd92e3 100644
--- 
a/streampark-console/streampark-console-webapp/src/locales/lang/en/flink/app.ts
+++ 
b/streampark-console/streampark-console-webapp/src/locales/lang/en/flink/app.ts
@@ -102,13 +102,13 @@ export default {
     lost: 'LOST',
   },
   release: {
-    releaseTitle: 'The current release of the application is in progress.',
+    releaseTitle: 'The current release of the job is in progress.',
     releaseDesc: 'are you sure you want to force another build',
-    releaseFail: 'release application failed,',
-    releasing: 'Current Application is releasing',
+    releaseFail: 'release job failed,',
+    releasing: 'Current job is releasing',
   },
   detail: {
-    detailTitle: 'Application Info',
+    detailTitle: 'Job Info',
     flinkWebUi: 'Flink Web UI',
     compareConfig: 'Compare Config',
     compareFlinkSql: 'Compare Flink SQL',
@@ -155,7 +155,7 @@ export default {
     },
   },
   view: {
-    buildTitle: 'Application releasing Progress',
+    buildTitle: 'Job releasing Progress',
     stepTitle: 'Steps Detail',
     errorLog: 'Error Log',
     errorSummary: 'Error Summary',
@@ -163,8 +163,8 @@ export default {
     logTitle: 'Start Log : Job Name [ {0} ]',
     refreshTime: 'last refresh time',
     refresh: 'refresh',
-    start: 'Start Application',
-    stop: 'Stop application',
+    start: 'Start Job',
+    stop: 'Stop Job',
     savepoint: 'Trigger Savepoint',
     fromSavepoint: 'From savepoint',
     savepointTip: 'Restore the job from savepoint or latest checkpoint',
@@ -174,8 +174,8 @@ export default {
     ignoreRestored: 'Ignore failed',
     ignoreRestoredTip:
       'ignore savepoint then cannot be restored, Same 
as:-allowNonRestoredState(-n)',
-    recheck: 'the associated project has changed and this job need to be 
rechecked',
-    changed: 'the application has changed.',
+    recheck: 'the associated project has changed and this job need to be 
release',
+    changed: 'the job has been updated',
   },
   pod: {
     choice: 'Choice',
@@ -203,17 +203,17 @@ export default {
     sqlCheck: 'SQL check error',
   },
   operation: {
-    edit: 'Edit Application',
-    release: 'Release Application',
+    edit: 'Edit Job',
+    release: 'Release Job',
     releaseDetail: 'Releasing Progress Detail',
-    start: 'Start Application',
-    cancel: 'Cancel Application',
+    start: 'Start Job',
+    cancel: 'Cancel Job',
     savepoint: 'Trigger Savepoint',
     detail: 'View Detail',
     startLog: 'See Flink Start log',
-    force: 'Forced Stop Application',
-    copy: 'Copy Application',
-    remapping: 'Remapping Application',
+    force: 'Forced Stop Job',
+    copy: 'Copy Job',
+    remapping: 'Remapping Job',
     deleteTip: 'Are you sure delete this job ?',
     triggerSavePoint: 'Trigger savepoint',
     enableSavePoint: 'Trigger savepoint before flink job cancel',
@@ -282,7 +282,7 @@ export default {
     totalMemoryOptionsPlaceholder: 'Please select the resource parameters to 
set',
     tmPlaceholder: 'Please select the resource parameters to set',
     yarnQueuePlaceholder: 'Please enter yarn queue label',
-    descriptionPlaceholder: 'Please enter description for this application',
+    descriptionPlaceholder: 'Please enter description for this job',
     serviceAccountPlaceholder: 'Please enter kubernetes service-account, e.g: 
default',
     kubernetesNamespacePlaceholder: 'Please enter kubernetes Namespace, e.g: 
default',
     kubernetesClusterIdPlaceholder: 'Please enter Kubernetes clusterId',
diff --git 
a/streampark-console/streampark-console-webapp/src/locales/lang/zh-CN/flink/app.ts
 
b/streampark-console/streampark-console-webapp/src/locales/lang/zh-CN/flink/app.ts
index cc710b017..5cb63a006 100644
--- 
a/streampark-console/streampark-console-webapp/src/locales/lang/zh-CN/flink/app.ts
+++ 
b/streampark-console/streampark-console-webapp/src/locales/lang/zh-CN/flink/app.ts
@@ -87,7 +87,7 @@ export default {
     terminated: '终止',
   },
   release: {
-    releaseTitle: '该应用程序的当前启动正在进行中.',
+    releaseTitle: '该作业正在启动中.',
     releaseDesc: '您确定要强制进行另一次构建吗',
     releaseFail: '发布作业失败',
     releasing: '当前作业正在发布中',
@@ -145,7 +145,7 @@ export default {
     },
   },
   view: {
-    buildTitle: '应用程序启动进度',
+    buildTitle: '作业启动进度',
     stepTitle: '步骤详情',
     errorLog: '错误日志',
     errorSummary: '错误摘要',
@@ -156,8 +156,8 @@ export default {
     start: '启动作业',
     stop: '停止应用',
     savepoint: '触发 Savepoint',
-    recheck: '关联的项目已更改,需要重新检查此作业',
-    changed: '应用程序已更改。',
+    recheck: '关联的项目已更新,需要重新发布此作业',
+    changed: '作业已更新',
     fromSavepoint: 'Savepoint 恢复',
     savepointTip: '作业从 savepoint 或 checkpoint 恢复状态',
     savepointInput: '指定 savepoint/checkpoint 路径',
@@ -262,10 +262,10 @@ export default {
     appNamePlaceholder: '请输入作业名称',
     appNameIsRequiredMessage: '作业名称必填',
     appNameNotUniqueMessage: '作业名称必须唯一, 输入的作业名称已经存在',
-    appNameExistsInYarnMessage: '应用程序名称已经在YARN集群中存在,不能重复。请检查',
-    appNameExistsInK8sMessage: '该应用程序名称已经在K8S集群中存在,不能重复。请检查',
-    appNameValid: '应用程序名称不合法',
-    appNameRole: '应用名称必须遵循以下规则:',
+    appNameExistsInYarnMessage: '该作业名称已经在YARN集群中存在,不能重复。请检查',
+    appNameExistsInK8sMessage: '该作业名称已经在K8S集群中存在,不能重复。请检查',
+    appNameValid: '作业名称不合法',
+    appNameRole: '作业必须遵循以下规则:',
     K8sSessionClusterIdRole: 'K8S集群ID必要遵循以下规则:',
     appNameK8sClusterIdRole:
       '当前部署模式是 K8s Application模式,会将作业名称作为k8s的 clusterId,因此作业名称要遵循以下规则:',
@@ -283,7 +283,7 @@ export default {
     totalMemoryOptionsPlaceholder: '请选择要设置的资源参数',
     tmPlaceholder: '请选择要设置的资源参数',
     yarnQueuePlaceholder: '请输入yarn队列标签名称',
-    descriptionPlaceholder: '请输入此应用程序的描述',
+    descriptionPlaceholder: '请输入此作业的描述',
     serviceAccountPlaceholder: '请输入K8S服务账号(service-account)',
     kubernetesNamespacePlaceholder: '请输入K8S命名空间, 如: default',
     kubernetesClusterIdPlaceholder: '请选择K8S ClusterId',
diff --git 
a/streampark-console/streampark-console-webapp/src/views/flink/app/hooks/useAppTableAction.ts
 
b/streampark-console/streampark-console-webapp/src/views/flink/app/hooks/useAppTableAction.ts
index 301be896d..b17acc940 100644
--- 
a/streampark-console/streampark-console-webapp/src/views/flink/app/hooks/useAppTableAction.ts
+++ 
b/streampark-console/streampark-console-webapp/src/views/flink/app/hooks/useAppTableAction.ts
@@ -264,8 +264,8 @@ export const useAppTableAction = (
 
   const formConfig = computed((): Partial<FormProps> => {
     const tableFormConfig: FormProps = {
-      baseColProps: { span: 5, style: { paddingRight: '20px' } },
-      actionColOptions: { span: 4 },
+      baseColProps: { span: 4, style: { paddingRight: '30px' } },
+      actionColOptions: { style: { paddingRight: '0px' } },
       showSubmitButton: false,
       showResetButton: false,
       async resetFunc() {
@@ -329,6 +329,7 @@ export const useAppTableAction = (
           text: t('common.add'),
           color: 'primary',
           preIcon: 'ant-design:plus-outlined',
+          style: { float: 'right' },
         },
       });
     }

Reply via email to