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

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


The following commit(s) were added to refs/heads/ldap1 by this push:
     new 2e3fb6499 fix
2e3fb6499 is described below

commit 2e3fb6499754fa6925d3b0fed3d3bc12e0017245
Author: Monster <[email protected]>
AuthorDate: Mon Oct 17 16:17:17 2022 +0800

    fix
---
 .../console/base/domain/RestResponse.java          |  11 +-
 .../base/handler/GlobalExceptionHandler.java       |  23 ++--
 .../core/controller/VariableController.java        | 117 +++++++++++++++++++++
 .../entity/User.java => core/entity/Variable.java} |  80 ++++----------
 .../streampark/console/core/enums/Status.java      |  68 ------------
 .../mapper/VariableMapper.java}                    |  14 ++-
 .../service/VariableService.java}                  |  43 +++++---
 .../core/service/impl/ProjectServiceImpl.java      |  20 ++--
 .../core/service/impl/VariableServiceImpl.java     |  82 +++++++++++++++
 .../system/controller/PassportController.java      |  22 ++--
 .../console/system/controller/UserController.java  |  30 +++---
 .../streampark/console/system/entity/User.java     |  10 +-
 .../console/system/mapper/UserMapper.java          |   6 +-
 .../console/system/service/UserService.java        |   6 +-
 .../service/impl/AccessTokenServiceImpl.java       |  21 ++--
 .../system/service/impl/MenuServiceImpl.java       |  11 +-
 .../system/service/impl/UserServiceImpl.java       |  26 ++---
 .../main/resources/mapper/core/VariableMapper.xml  |  48 +++++++++
 .../main/resources/mapper/system/UserMapper.xml    |  16 +++
 19 files changed, 410 insertions(+), 244 deletions(-)

diff --git 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/base/domain/RestResponse.java
 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/base/domain/RestResponse.java
index 2d1ab9852..61d7b79b4 100644
--- 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/base/domain/RestResponse.java
+++ 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/base/domain/RestResponse.java
@@ -17,9 +17,6 @@
 
 package org.apache.streampark.console.base.domain;
 
-import org.apache.streampark.console.core.enums.Status;
-
-import java.text.MessageFormat;
 import java.util.HashMap;
 
 public class RestResponse extends HashMap<String, Object> {
@@ -44,11 +41,11 @@ public class RestResponse extends HashMap<String, Object> {
         return resp;
     }
 
-    public static RestResponse fail(Status status, Object... args) {
+    public static RestResponse fail(String message, Long code) {
         RestResponse resp = new RestResponse();
         resp.put("status", STATUS_FAIL);
-        resp.put("message", MessageFormat.format(status.getMsg(), args));
-        resp.put("code", status.getCode());
+        resp.put("message", message);
+        resp.put("code", code);
         resp.put("data", null);
         return resp;
     }
@@ -68,4 +65,4 @@ public class RestResponse extends HashMap<String, Object> {
         super.put(key, value);
         return this;
     }
-}
\ No newline at end of file
+}
diff --git 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/base/handler/GlobalExceptionHandler.java
 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/base/handler/GlobalExceptionHandler.java
index 84fd32f16..0fceb58f8 100644
--- 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/base/handler/GlobalExceptionHandler.java
+++ 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/base/handler/GlobalExceptionHandler.java
@@ -17,17 +17,13 @@
 
 package org.apache.streampark.console.base.handler;
 
-import static 
org.apache.streampark.console.core.enums.Status.INTERNAL_SERVER_ERROR_ARGS;
-import static 
org.apache.streampark.console.core.enums.Status.NOT_SUPPORTED_REQUEST_METHOD;
-import static 
org.apache.streampark.console.core.enums.Status.REQUEST_PARAMS_NOT_VALID_ERROR;
-
-import org.apache.streampark.console.base.domain.RestResponse;
-import org.apache.streampark.console.base.exception.AbstractApiException;
-
 import com.baomidou.mybatisplus.core.toolkit.StringPool;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.shiro.authz.UnauthorizedException;
+import org.apache.streampark.console.base.domain.ResponseCode;
+import org.apache.streampark.console.base.domain.RestResponse;
+import org.apache.streampark.console.base.exception.AbstractApiException;
 import org.springframework.core.Ordered;
 import org.springframework.core.annotation.Order;
 import org.springframework.http.HttpStatus;
@@ -54,21 +50,21 @@ public class GlobalExceptionHandler {
     @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
     public RestResponse handleException(Exception e) {
         log.info("Internal server error:", e);
-        return RestResponse.fail(INTERNAL_SERVER_ERROR_ARGS, e.getMessage());
+        return RestResponse.fail("internal server error: " + e.getMessage(), 
ResponseCode.CODE_FAIL);
     }
 
     @ExceptionHandler(value = HttpRequestMethodNotSupportedException.class)
     @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
     public RestResponse handleException(HttpRequestMethodNotSupportedException 
e) {
         log.info("not supported request method,exception:{}", e.getMessage());
-        return RestResponse.fail(NOT_SUPPORTED_REQUEST_METHOD, e.getMessage());
+        return RestResponse.fail("not supported request method,exception:" + 
e.getMessage(), ResponseCode.CODE_FAIL);
     }
 
     @ExceptionHandler(value = AbstractApiException.class)
     @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
     public RestResponse handleException(AbstractApiException e) {
         log.info("api exception:{}", e.getMessage());
-        return RestResponse.fail(INTERNAL_SERVER_ERROR_ARGS, e.getMessage());
+        return RestResponse.fail(e.getMessage(), e.getResponseCode());
     }
 
 
@@ -87,8 +83,7 @@ public class GlobalExceptionHandler {
             
message.append(error.getField()).append(error.getDefaultMessage()).append(StringPool.COMMA);
         }
         message = new StringBuilder(message.substring(0, message.length() - 
1));
-        return RestResponse.fail(REQUEST_PARAMS_NOT_VALID_ERROR, 
message.toString());
-
+        return RestResponse.fail(message.toString(), ResponseCode.CODE_FAIL);
     }
 
     /**
@@ -108,7 +103,7 @@ public class GlobalExceptionHandler {
             
message.append(pathArr[1]).append(violation.getMessage()).append(StringPool.COMMA);
         }
         message = new StringBuilder(message.substring(0, message.length() - 
1));
-        return RestResponse.fail(REQUEST_PARAMS_NOT_VALID_ERROR, 
message.toString());
+        return RestResponse.fail(message.toString(), ResponseCode.CODE_FAIL);
     }
 
     @ExceptionHandler(value = UnauthorizedException.class)
@@ -116,4 +111,4 @@ public class GlobalExceptionHandler {
     public void handleUnauthorizedException(Exception e) {
         log.info("Permission denied,{}", e.getMessage());
     }
-}
\ No newline at end of file
+}
diff --git 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/controller/VariableController.java
 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/controller/VariableController.java
new file mode 100644
index 000000000..3a647fef2
--- /dev/null
+++ 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/controller/VariableController.java
@@ -0,0 +1,117 @@
+/*
+ * 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 org.apache.streampark.console.core.controller;
+
+import org.apache.streampark.console.base.domain.ResponseCode;
+import org.apache.streampark.console.base.domain.RestRequest;
+import org.apache.streampark.console.base.domain.RestResponse;
+import org.apache.streampark.console.base.exception.ApiAlertException;
+import org.apache.streampark.console.core.entity.Variable;
+import org.apache.streampark.console.core.service.VariableService;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.annotation.Validated;
+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.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.validation.Valid;
+import javax.validation.constraints.NotBlank;
+
+import java.util.regex.Pattern;
+
+@Slf4j
+@Validated
+@RestController
+@RequestMapping("variable")
+public class VariableController {
+
+    private final String formatPattern = "^([A-Za-z])+([A-Za-z0-9._-])+$";
+
+    @Autowired
+    private VariableService variableService;
+
+    @PostMapping("list")
+    @RequiresPermissions("variable:view")
+    public RestResponse variableList(RestRequest restRequest, Variable 
variable) {
+        IPage<Variable> variableList = variableService.page(variable, 
restRequest);
+        return RestResponse.success(variableList);
+    }
+
+    @PostMapping("post")
+    @RequiresPermissions("variable:add")
+    public RestResponse addVariable(@Valid Variable variable) throws Exception 
{
+        this.variableService.createVariable(variable);
+        return RestResponse.success();
+    }
+
+    @PutMapping("update")
+    @RequiresPermissions("variable:update")
+    public RestResponse updateVariable(@Valid Variable variable) throws 
Exception {
+        if (variable.getId() == null) {
+            throw new ApiAlertException("Sorry, the variable id cannot be 
null.");
+        }
+        Variable findVariable = this.variableService.getById(variable.getId());
+        if (findVariable == null) {
+            throw new ApiAlertException("Sorry, the variable does not exist.");
+        }
+        if 
(!findVariable.getVariableCode().equals(variable.getVariableCode())) {
+            throw new ApiAlertException("Sorry, the variable code cannot be 
updated.");
+        }
+        this.variableService.updateById(variable);
+        return RestResponse.success();
+    }
+
+    @DeleteMapping("delete")
+    @RequiresPermissions("variable:delete")
+    public RestResponse deleteVariables(@Valid Variable variable) throws 
Exception {
+        this.variableService.removeById(variable);
+        return RestResponse.success();
+    }
+
+    @PostMapping("check/code")
+    public RestResponse checkVariableCode(@RequestParam Long teamId, 
@NotBlank(message = "{required}") String variableCode) {
+        try {
+            this.checkVariableCodeFormat(variableCode);
+        } catch (ApiAlertException e) {
+            return RestResponse.fail(e.getMessage(), 
ResponseCode.CODE_FAIL_ALERT);
+        }
+        boolean result = this.variableService.findByVariableCode(teamId, 
variableCode) == null;
+        return RestResponse.success(result);
+    }
+
+    @PostMapping("select")
+    public RestResponse selectVariables(@RequestParam Long teamId) {
+        return 
RestResponse.success().data(this.variableService.findByTeamId(teamId));
+    }
+
+    private void checkVariableCodeFormat(String variableCode) {
+        if (variableCode.length() < 3 || variableCode.length() > 50) {
+            throw new ApiAlertException("Sorry, variable code length should be 
no less than 3 and no more than 50 characters.");
+        }
+        if (!Pattern.matches(formatPattern, variableCode)) {
+            throw new ApiAlertException("Sorry, variable code can only contain 
letters, numbers, middle bars, bottom bars and dots, and the beginning can only 
be letters, For example, kafka_cluster.brokers-520");
+        }
+    }
+}
diff --git 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/entity/User.java
 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/entity/Variable.java
similarity index 53%
copy from 
streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/entity/User.java
copy to 
streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/entity/Variable.java
index 6f7f0769f..d78636d3a 100644
--- 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/entity/User.java
+++ 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/entity/Variable.java
@@ -15,91 +15,57 @@
  * limitations under the License.
  */
 
-package org.apache.streampark.console.system.entity;
-
-import org.apache.streampark.console.core.enums.UserType;
+package org.apache.streampark.console.core.entity;
 
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import lombok.Data;
 
-import javax.validation.constraints.Email;
 import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
 import javax.validation.constraints.Size;
 
 import java.io.Serializable;
 import java.util.Date;
 
 @Data
-@TableName("t_user")
-public class User implements Serializable {
-
-    private static final long serialVersionUID = -4852732617765810959L;
-    /**
-     * user status
-     */
-    public static final String STATUS_VALID = "1";
-
-    public static final String STATUS_LOCK = "0";
-
-    public static final String DEFAULT_AVATAR = "default.jpg";
-
-    public static final String SEX_MALE = "0";
-
-    public static final String SEX_FEMALE = "1";
+@TableName("t_variable")
+public class Variable implements Serializable {
 
-    public static final String SEX_UNKNOW = "2";
-
-    public static final String DEFAULT_PASSWORD = "streampark666";
+    private static final long serialVersionUID = -7720746591258904369L;
 
     @TableId(type = IdType.AUTO)
-    private Long userId;
-
-    @Size(min = 4, max = 20, message = "{range}")
-    private String username;
-
-    private String password;
-
-    @Size(max = 50, message = "{noMoreThan}")
-    @Email(message = "{email}")
-    private String email;
-
-    private UserType userType;
+    private Long id;
 
     @NotBlank(message = "{required}")
-    private String status;
-
-    private Date createTime;
-
-    private Date modifyTime;
-
-    private Date lastLoginTime;
+    private String variableCode;
 
     @NotBlank(message = "{required}")
-    private String sex;
+    @Size(max = 50, message = "{noMoreThan}")
+    private String variableValue;
 
     @Size(max = 100, message = "{noMoreThan}")
     private String description;
 
-    private String avatar;
-
-    private transient String sortField;
-
-    private transient String sortOrder;
+    /**
+     * user id of creator
+     */
+    private Long creatorId;
 
-    private transient String createTimeFrom;
-    private transient String createTimeTo;
+    /**
+     * user name of creator
+     */
+    private transient String creatorName;
 
-    private transient String id;
+    @NotNull(message = "{required}")
+    private Long teamId;
 
-    private String salt;
+    private transient Date createTime;
 
-    private String nickName;
+    private transient Date modifyTime;
 
-    /**
-     * The last set teamId
-     */
-    private Long teamId;
+    private transient String sortField;
 
+    private transient String sortOrder;
 }
diff --git 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/enums/Status.java
 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/enums/Status.java
deleted file mode 100644
index 9e893f5fa..000000000
--- 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/enums/Status.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * 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 org.apache.streampark.console.core.enums;
-
-import java.util.Optional;
-
-/**
- * status enum
- */
-public enum Status {
-
-    SUCCESS(0, "success"),
-
-    INTERNAL_SERVER_ERROR_ARGS(10000, "Internal Server Error: {0}"),
-    USER_CURRENTLY_LOCKED(10002, "user is currently locked"),
-    USER_NAME_EXIST(10003, "user name already exists"),
-    USER_NAME_NULL(10004, "user name is null"),
-    USER_NOT_EXIST(10005, "user {0} not exists"),
-    NOT_SUPPORTED_REQUEST_METHOD(10006, "not supported request method 
exception: {0}"),
-    API_FAIL(10007, "API Invoke exception:{0}"),
-    REQUEST_PARAMS_NOT_VALID_ERROR(10007, "request parameter {0} is not 
valid"),
-    READ_BUILD_LOG_EXECPTION(10008, "read build log exception: {0}"),
-    ACCESSTOKEN_COULD_NOT_FOUND(10009, "accesstoken_could_not_found"),
-    TEAMID_INVALID(10010, "teamId is invalid");
-
-    private final int code;
-    private final String enMsg;
-
-    Status(int code, String enMsg) {
-        this.code = code;
-        this.enMsg = enMsg;
-    }
-
-    public int getCode() {
-        return this.code;
-    }
-
-    public String getMsg() {
-        return this.enMsg;
-    }
-
-    /**
-     * Retrieve Status enum entity by status code.
-     */
-    public static Optional<Status> findStatusBy(int code) {
-        for (Status status : Status.values()) {
-            if (code == status.getCode()) {
-                return Optional.of(status);
-            }
-        }
-        return Optional.empty();
-    }
-}
\ No newline at end of file
diff --git 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/mapper/UserMapper.java
 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/mapper/VariableMapper.java
similarity index 73%
copy from 
streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/mapper/UserMapper.java
copy to 
streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/mapper/VariableMapper.java
index 38d1a2c03..1676a8eba 100644
--- 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/mapper/UserMapper.java
+++ 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/mapper/VariableMapper.java
@@ -15,9 +15,9 @@
  * limitations under the License.
  */
 
-package org.apache.streampark.console.system.mapper;
+package org.apache.streampark.console.core.mapper;
 
-import org.apache.streampark.console.system.entity.User;
+import org.apache.streampark.console.core.entity.Variable;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -27,11 +27,9 @@ import org.apache.ibatis.annotations.Select;
 
 import java.util.List;
 
-public interface UserMapper extends BaseMapper<User> {
-
-    IPage<User> findUserDetail(Page page, @Param("user") User user);
-
-    @Select("SELECT u.* FROM t_user u LEFT JOIN t_access_token t ON u.USER_ID 
= t.USER_ID WHERE t.USER_ID IS NULL")
-    List<User> getNoTokenUser();
+public interface VariableMapper extends BaseMapper<Variable> {
+    IPage<Variable> page(Page<Variable> page, @Param("variable") Variable 
variable);
 
+    @Select("select * from t_variable where team_id = #{teamId}")
+    List<Variable> selectByTeamId(@Param("teamId") Long teamId);
 }
diff --git 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/mapper/UserMapper.java
 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/VariableService.java
similarity index 51%
copy from 
streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/mapper/UserMapper.java
copy to 
streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/VariableService.java
index 38d1a2c03..292cfb3f0 100644
--- 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/mapper/UserMapper.java
+++ 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/VariableService.java
@@ -15,23 +15,40 @@
  * limitations under the License.
  */
 
-package org.apache.streampark.console.system.mapper;
+package org.apache.streampark.console.core.service;
 
-import org.apache.streampark.console.system.entity.User;
+import org.apache.streampark.console.base.domain.RestRequest;
+import org.apache.streampark.console.core.entity.Variable;
 
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import org.apache.ibatis.annotations.Param;
-import org.apache.ibatis.annotations.Select;
+import com.baomidou.mybatisplus.extension.service.IService;
 
 import java.util.List;
 
-public interface UserMapper extends BaseMapper<User> {
-
-    IPage<User> findUserDetail(Page page, @Param("user") User user);
-
-    @Select("SELECT u.* FROM t_user u LEFT JOIN t_access_token t ON u.USER_ID 
= t.USER_ID WHERE t.USER_ID IS NULL")
-    List<User> getNoTokenUser();
-
+public interface VariableService extends IService<Variable> {
+
+    /**
+     * find variable
+     *
+     * @param variable        variable
+     * @param restRequest queryRequest
+     * @return IPage
+     */
+    IPage<Variable> page(Variable variable, RestRequest restRequest);
+
+    /**
+     * get variables through team
+     * @param teamId
+     * @return
+     */
+    List<Variable> findByTeamId(Long teamId);
+
+    /**
+     * create variable
+     *
+     * @param variable variable
+     */
+    void createVariable(Variable variable) throws Exception;
+
+    Variable findByVariableCode(Long teamId, String variableCode);
 }
diff --git 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/ProjectServiceImpl.java
 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/ProjectServiceImpl.java
index e50fa9f40..c66d3770f 100644
--- 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/ProjectServiceImpl.java
+++ 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/ProjectServiceImpl.java
@@ -17,8 +17,11 @@
 
 package org.apache.streampark.console.core.service.impl;
 
-import static 
org.apache.streampark.console.core.enums.Status.READ_BUILD_LOG_EXECPTION;
-
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import lombok.extern.slf4j.Slf4j;
 import org.apache.streampark.common.conf.CommonConfig;
 import org.apache.streampark.common.conf.InternalConfigHolder;
 import org.apache.streampark.common.conf.Workspace;
@@ -26,6 +29,7 @@ import org.apache.streampark.common.domain.FlinkMemorySize;
 import org.apache.streampark.common.util.AssertUtils;
 import org.apache.streampark.common.util.CompletableFutureUtils;
 import org.apache.streampark.common.util.ThreadUtils;
+import org.apache.streampark.console.base.domain.ResponseCode;
 import org.apache.streampark.console.base.domain.RestRequest;
 import org.apache.streampark.console.base.domain.RestResponse;
 import org.apache.streampark.console.base.mybatis.pager.MybatisPager;
@@ -40,12 +44,6 @@ import 
org.apache.streampark.console.core.service.ApplicationService;
 import org.apache.streampark.console.core.service.ProjectService;
 import org.apache.streampark.console.core.task.FlinkTrackingTask;
 import org.apache.streampark.console.core.task.ProjectBuildTask;
-
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Propagation;
@@ -113,6 +111,8 @@ public class ProjectServiceImpl extends 
ServiceImpl<ProjectMapper, Project>
         try {
             Project project = getById(projectParam.getId());
             AssertUtils.state(project != null);
+            
AssertUtils.checkArgument(project.getTeamId().equals(projectParam.getTeamId()),
+                "TeamId cannot be changed.");
             project.setName(projectParam.getName());
             project.setUrl(projectParam.getUrl());
             project.setBranches(projectParam.getBranches());
@@ -311,7 +311,7 @@ public class ProjectServiceImpl extends 
ServiceImpl<ProjectMapper, Project>
         } catch (IOException e) {
             String error = String.format("Read build log file(fileName=%s) 
caused an exception: ", logFile);
             log.error(error, e);
-            return RestResponse.fail(READ_BUILD_LOG_EXECPTION, error + 
e.getMessage());
+            return RestResponse.fail(error + e.getMessage(), 
ResponseCode.CODE_FAIL);
         }
     }
 
@@ -319,4 +319,4 @@ public class ProjectServiceImpl extends 
ServiceImpl<ProjectMapper, Project>
         return String.format("%s/%s/build.log", 
Workspace.local().PROJECT_BUILD_LOG_DIR(), projectId);
     }
 
-}
\ No newline at end of file
+}
diff --git 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/VariableServiceImpl.java
 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/VariableServiceImpl.java
new file mode 100644
index 000000000..10cb6f15b
--- /dev/null
+++ 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/VariableServiceImpl.java
@@ -0,0 +1,82 @@
+/*
+ * 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 org.apache.streampark.console.core.service.impl;
+
+import org.apache.streampark.console.base.domain.RestRequest;
+import org.apache.streampark.console.base.exception.ApiAlertException;
+import org.apache.streampark.console.base.mybatis.pager.MybatisPager;
+import org.apache.streampark.console.core.entity.Variable;
+import org.apache.streampark.console.core.mapper.VariableMapper;
+import org.apache.streampark.console.core.service.ApplicationService;
+import org.apache.streampark.console.core.service.CommonService;
+import org.apache.streampark.console.core.service.VariableService;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Propagation;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+
+@Slf4j
+@Service
+@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, 
rollbackFor = Exception.class)
+public class VariableServiceImpl extends ServiceImpl<VariableMapper, Variable> 
implements VariableService {
+
+    @Autowired
+    private ApplicationService applicationService;
+
+    @Autowired
+    private CommonService commonService;
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void createVariable(Variable variable) throws Exception {
+        if (this.findByVariableCode(variable.getTeamId(), 
variable.getVariableCode()) != null) {
+            throw new ApiAlertException("Sorry, the variable code already 
exists.");
+        }
+        variable.setCreatorId(commonService.getUserId());
+        this.save(variable);
+    }
+
+    @Override
+    public IPage<Variable> page(Variable variable, RestRequest request) {
+        if (variable.getTeamId() == null) {
+            return null;
+        }
+        Page<Variable> page = new 
MybatisPager<Variable>().getDefaultPage(request);
+        return this.baseMapper.page(page, variable);
+    }
+
+    @Override
+    public Variable findByVariableCode(Long teamId, String variableCode) {
+        return baseMapper.selectOne(new LambdaQueryWrapper<Variable>()
+            .eq(Variable::getVariableCode, variableCode)
+            .eq(Variable::getTeamId, teamId));
+    }
+
+    @Override
+    public List<Variable> findByTeamId(Long teamId) {
+        return baseMapper.selectByTeamId(teamId);
+    }
+}
diff --git 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/controller/PassportController.java
 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/controller/PassportController.java
index b21baadf2..49df8aa27 100644
--- 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/controller/PassportController.java
+++ 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/controller/PassportController.java
@@ -17,10 +17,9 @@
 
 package org.apache.streampark.console.system.controller;
 
-import static 
org.apache.streampark.console.core.enums.Status.USER_CURRENTLY_LOCKED;
-import static org.apache.streampark.console.core.enums.Status.USER_NAME_NULL;
-import static org.apache.streampark.console.core.enums.Status.USER_NOT_EXIST;
-
+import org.apache.commons.lang3.RandomStringUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.shiro.SecurityUtils;
 import org.apache.streampark.common.util.DateUtils;
 import org.apache.streampark.console.base.domain.RestResponse;
 import org.apache.streampark.console.base.properties.ShiroProperties;
@@ -32,10 +31,6 @@ import org.apache.streampark.console.system.entity.User;
 import org.apache.streampark.console.system.security.Authenticator;
 import org.apache.streampark.console.system.service.RoleService;
 import org.apache.streampark.console.system.service.UserService;
-
-import org.apache.commons.lang3.RandomStringUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.shiro.SecurityUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.PostMapping;
@@ -71,7 +66,8 @@ public class PassportController {
         @NotBlank(message = "{required}") String username,
         @NotBlank(message = "{required}") String password) throws Exception {
         if (StringUtils.isEmpty(username)) {
-            return RestResponse.fail(USER_NAME_NULL);
+            return RestResponse.fail("User name cannot be empty", 1L);
+
         }
         User user = authenticator.authenticate(username, password);
         return login(username, password, user);
@@ -82,7 +78,8 @@ public class PassportController {
         @NotBlank(message = "{required}") String username,
         @NotBlank(message = "{required}") String password) throws Exception {
         if (StringUtils.isEmpty(username)) {
-            return RestResponse.fail(USER_NAME_NULL);
+            return RestResponse.fail("User name cannot be empty", 1L);
+
         }
         User user = authenticator.ldapAuthenticate(username, password);
         return login(username, password, user);
@@ -120,11 +117,12 @@ public class PassportController {
 
     private RestResponse login(String username, String password, User user) 
throws Exception {
         if (user == null) {
-            return RestResponse.fail(USER_NOT_EXIST, username);
+            return RestResponse.fail("User not exists", 1L);
         }
 
         if (User.STATUS_LOCK.equals(user.getStatus())) {
-            return RestResponse.fail(USER_CURRENTLY_LOCKED);
+            return RestResponse.fail("User is currently locked", 2L);
+
         }
 
         password = ShaHashUtils.encrypt(user.getSalt(), password);
diff --git 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/controller/UserController.java
 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/controller/UserController.java
index 7568b05df..f95b74f5f 100644
--- 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/controller/UserController.java
+++ 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/controller/UserController.java
@@ -17,8 +17,13 @@
 
 package org.apache.streampark.console.system.controller;
 
-import static org.apache.streampark.console.core.enums.Status.TEAMID_INVALID;
-
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.StringPool;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.shiro.authz.annotation.Logical;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.apache.streampark.console.base.domain.ResponseCode;
 import org.apache.streampark.console.base.domain.RestRequest;
 import org.apache.streampark.console.base.domain.RestResponse;
 import org.apache.streampark.console.base.util.ShaHashUtils;
@@ -29,13 +34,6 @@ import org.apache.streampark.console.system.entity.User;
 import org.apache.streampark.console.system.service.RoleService;
 import org.apache.streampark.console.system.service.TeamService;
 import org.apache.streampark.console.system.service.UserService;
-
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.core.toolkit.StringPool;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.shiro.authz.annotation.Logical;
-import org.apache.shiro.authz.annotation.RequiresPermissions;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.DeleteMapping;
@@ -171,7 +169,7 @@ public class UserController {
     public RestResponse initTeam(Long teamId, Long userId) {
         Team team = teamService.getById(teamId);
         if (team == null) {
-            return RestResponse.fail(TEAMID_INVALID);
+            return RestResponse.fail("teamId is invalid", 
ResponseCode.CODE_FAIL_ALERT);
         }
         userService.setLatestTeam(teamId, userId);
         return RestResponse.success();
@@ -181,7 +179,7 @@ public class UserController {
     public RestResponse setTeam(Long teamId) {
         Team team = teamService.getById(teamId);
         if (team == null) {
-            return RestResponse.fail(TEAMID_INVALID);
+            return RestResponse.fail("teamId is invalid", 
ResponseCode.CODE_FAIL_ALERT);
         }
 
         User user = commonService.getCurrentUser();
@@ -190,8 +188,7 @@ public class UserController {
         userService.setLatestTeam(teamId, user.getUserId());
 
         //2) get latest userInfo
-        user.setPassword("******");
-        user.setSalt("******");
+        user.dataMasking();
 
         Map<String, Object> infoMap = new HashMap<>(8);
         infoMap.put("user", user);
@@ -206,4 +203,11 @@ public class UserController {
         return new RestResponse().data(infoMap);
     }
 
+    @PostMapping("appOwners")
+    public RestResponse appOnwers(Long teamId) {
+        List<User> userList = userService.findByAppOwner(teamId);
+        userList.forEach((u) -> u.dataMasking());
+        return RestResponse.success(userList);
+    }
+
 }
diff --git 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/entity/User.java
 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/entity/User.java
index 6f7f0769f..57a3ba019 100644
--- 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/entity/User.java
+++ 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/entity/User.java
@@ -17,12 +17,12 @@
 
 package org.apache.streampark.console.system.entity;
 
-import org.apache.streampark.console.core.enums.UserType;
-
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import lombok.Data;
+import org.apache.streampark.common.conf.ConfigConst;
+import org.apache.streampark.console.core.enums.UserType;
 
 import javax.validation.constraints.Email;
 import javax.validation.constraints.NotBlank;
@@ -102,4 +102,10 @@ public class User implements Serializable {
      */
     private Long teamId;
 
+    public void dataMasking() {
+        String dataMask = ConfigConst.DEFAULT_DATAMASK_STRING();
+        this.setPassword(dataMask);
+        this.setSalt(dataMask);
+    }
+
 }
diff --git 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/mapper/UserMapper.java
 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/mapper/UserMapper.java
index 38d1a2c03..d81b3d1d8 100644
--- 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/mapper/UserMapper.java
+++ 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/mapper/UserMapper.java
@@ -17,13 +17,11 @@
 
 package org.apache.streampark.console.system.mapper;
 
-import org.apache.streampark.console.system.entity.User;
-
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import org.apache.ibatis.annotations.Param;
-import org.apache.ibatis.annotations.Select;
+import org.apache.streampark.console.system.entity.User;
 
 import java.util.List;
 
@@ -31,7 +29,7 @@ public interface UserMapper extends BaseMapper<User> {
 
     IPage<User> findUserDetail(Page page, @Param("user") User user);
 
-    @Select("SELECT u.* FROM t_user u LEFT JOIN t_access_token t ON u.USER_ID 
= t.USER_ID WHERE t.USER_ID IS NULL")
     List<User> getNoTokenUser();
 
+    List<User> findByAppOwner(@Param("teamId") Long teamId);
 }
diff --git 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/UserService.java
 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/UserService.java
index 100a47e20..ad4240254 100644
--- 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/UserService.java
+++ 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/UserService.java
@@ -17,11 +17,10 @@
 
 package org.apache.streampark.console.system.service;
 
-import org.apache.streampark.console.base.domain.RestRequest;
-import org.apache.streampark.console.system.entity.User;
-
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.IService;
+import org.apache.streampark.console.base.domain.RestRequest;
+import org.apache.streampark.console.system.entity.User;
 
 import java.util.List;
 import java.util.Set;
@@ -111,4 +110,5 @@ public interface UserService extends IService<User> {
 
     void fillInTeam(User user);
 
+    List<User> findByAppOwner(Long teamId);
 }
diff --git 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/impl/AccessTokenServiceImpl.java
 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/impl/AccessTokenServiceImpl.java
index c5ecd07f4..52d6818ec 100644
--- 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/impl/AccessTokenServiceImpl.java
+++ 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/impl/AccessTokenServiceImpl.java
@@ -17,10 +17,13 @@
 
 package org.apache.streampark.console.system.service.impl;
 
-import static 
org.apache.streampark.console.core.enums.Status.ACCESSTOKEN_COULD_NOT_FOUND;
-import static 
org.apache.streampark.console.core.enums.Status.USER_CURRENTLY_LOCKED;
-
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
 import org.apache.streampark.common.util.DateUtils;
+import org.apache.streampark.console.base.domain.ResponseCode;
 import org.apache.streampark.console.base.domain.RestRequest;
 import org.apache.streampark.console.base.domain.RestResponse;
 import org.apache.streampark.console.base.mybatis.pager.MybatisPager;
@@ -32,12 +35,6 @@ import org.apache.streampark.console.system.entity.User;
 import org.apache.streampark.console.system.mapper.AccessTokenMapper;
 import org.apache.streampark.console.system.service.AccessTokenService;
 import org.apache.streampark.console.system.service.UserService;
-
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Propagation;
@@ -108,11 +105,11 @@ public class AccessTokenServiceImpl extends 
ServiceImpl<AccessTokenMapper, Acces
     public RestResponse toggleToken(Long tokenId) {
         AccessToken tokenInfo = baseMapper.getById(tokenId);
         if (Objects.isNull(tokenInfo)) {
-            return RestResponse.fail(ACCESSTOKEN_COULD_NOT_FOUND);
+            return RestResponse.fail("accessToken could not be found!", 
ResponseCode.CODE_FAIL_ALERT);
         }
 
         if (User.STATUS_LOCK.equals(tokenInfo.getUserStatus())) {
-            return RestResponse.fail(USER_CURRENTLY_LOCKED, "could not operate 
this accessToken!");
+            return RestResponse.fail("user status is locked, could not operate 
this accessToken!", ResponseCode.CODE_FAIL_ALERT);
         }
 
         Integer status = 
tokenInfo.getStatus().equals(AccessToken.STATUS_ENABLE) ? 
AccessToken.STATUS_DISABLE : AccessToken.STATUS_ENABLE;
@@ -127,4 +124,4 @@ public class AccessTokenServiceImpl extends 
ServiceImpl<AccessTokenMapper, Acces
     public AccessToken getByUserId(Long userId) {
         return baseMapper.getByUserId(userId);
     }
-}
\ No newline at end of file
+}
diff --git 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/impl/MenuServiceImpl.java
 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/impl/MenuServiceImpl.java
index ac92129d5..a2e4c7449 100644
--- 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/impl/MenuServiceImpl.java
+++ 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/impl/MenuServiceImpl.java
@@ -17,6 +17,10 @@
 
 package org.apache.streampark.console.system.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
 import org.apache.streampark.console.base.domain.Constant;
 import org.apache.streampark.console.base.domain.router.RouterMeta;
 import org.apache.streampark.console.base.domain.router.RouterTree;
@@ -28,11 +32,6 @@ import org.apache.streampark.console.system.entity.User;
 import org.apache.streampark.console.system.mapper.MenuMapper;
 import org.apache.streampark.console.system.service.MenuService;
 import org.apache.streampark.console.system.service.UserService;
-
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Propagation;
@@ -70,7 +69,7 @@ public class MenuServiceImpl extends ServiceImpl<MenuMapper, 
Menu> implements Me
             .orElseThrow(() -> new IllegalArgumentException(String.format("The 
username [%s] not found", username)));
         // Admin has the permission for all menus.
         if (UserType.ADMIN.equals(user.getUserType())) {
-            return this.list(new LambdaQueryWrapper<Menu>().eq(Menu::getType, 
"0"));
+            return this.list(new LambdaQueryWrapper<Menu>().eq(Menu::getType, 
"0").orderByAsc(Menu::getOrderNum));
         }
         return this.baseMapper.findUserMenus(username);
     }
diff --git 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/impl/UserServiceImpl.java
 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/impl/UserServiceImpl.java
index 7a2613e69..2a106e63b 100644
--- 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/impl/UserServiceImpl.java
+++ 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/impl/UserServiceImpl.java
@@ -17,11 +17,16 @@
 
 package org.apache.streampark.console.system.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.collections.CollectionUtils;
 import org.apache.streampark.common.util.AssertUtils;
 import org.apache.streampark.console.base.domain.RestRequest;
 import org.apache.streampark.console.base.exception.ApiAlertException;
 import org.apache.streampark.console.base.util.ShaHashUtils;
-import org.apache.streampark.console.core.service.CommonService;
 import org.apache.streampark.console.system.entity.Member;
 import org.apache.streampark.console.system.entity.Menu;
 import org.apache.streampark.console.system.entity.Team;
@@ -29,15 +34,7 @@ import org.apache.streampark.console.system.entity.User;
 import org.apache.streampark.console.system.mapper.UserMapper;
 import org.apache.streampark.console.system.service.MemberService;
 import org.apache.streampark.console.system.service.MenuService;
-import org.apache.streampark.console.system.service.TeamService;
 import org.apache.streampark.console.system.service.UserService;
-
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.collections.CollectionUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Propagation;
@@ -61,12 +58,6 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, 
User> implements Us
     @Autowired
     private MenuService menuService;
 
-    @Autowired
-    private CommonService commonService;
-
-    @Autowired
-    private TeamService teamService;
-
     @Override
     public User findByName(String username) {
         return baseMapper.selectOne(new 
LambdaQueryWrapper<User>().eq(User::getUsername, username));
@@ -206,6 +197,11 @@ public class UserServiceImpl extends 
ServiceImpl<UserMapper, User> implements Us
         }
     }
 
+    @Override
+    public List<User> findByAppOwner(Long teamId) {
+        return baseMapper.findByAppOwner(teamId);
+    }
+
     private void setUserRoles(User user, String[] roles) {
         Arrays.stream(roles).forEach(roleId -> {
             Member ur = new Member();
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
new file mode 100644
index 000000000..397731bfb
--- /dev/null
+++ 
b/streampark-console/streampark-console-service/src/main/resources/mapper/core/VariableMapper.xml
@@ -0,0 +1,48 @@
+<?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
+
+       https://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="org.apache.streampark.console.core.mapper.VariableMapper">
+    <resultMap id="VariableMap" 
type="org.apache.streampark.console.core.entity.Variable">
+        <result column="id" jdbcType="BIGINT" property="id"/>
+        <result column="variable_code" jdbcType="VARCHAR" 
property="variableCode"/>
+        <result column="variable_value" jdbcType="VARCHAR" 
property="variableValue"/>
+        <result column="description" jdbcType="VARCHAR" 
property="description"/>
+        <result column="creator_id" jdbcType="BIGINT" property="creatorId"/>
+        <result column="team_id" jdbcType="BIGINT" property="teamId"/>
+        <result column="create_time" jdbcType="TIMESTAMP" 
property="createTime"/>
+        <result column="modify_time" jdbcType="TIMESTAMP" 
property="modifyTime"/>
+    </resultMap>
+
+    <select id="page" resultType="variable" parameterType="variable">
+        select v.*, u.username as creatorName
+        from t_variable v, t_user u
+        <where>
+            v.creator_id = u.user_id
+            and v.team_id = ${variable.teamId}
+            <if test="variable.description != null and variable.description != 
''">
+                and v.description like '%${variable.description}%'
+            </if>
+            <if test="variable.variableCode != null and variable.variableCode 
!= ''">
+                and v.variable_code like '%${variable.variableCode}%'
+            </if>
+        </where>
+    </select>
+
+</mapper>
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 85d3141a6..621676d37 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
@@ -59,4 +59,20 @@
             order by ${user.sortField} ${user.sortOrder}
         </if>
     </select>
+
+    <select id="getNoTokenUser" resultType="user" parameterType="user">
+        select u.* from t_user u left join t_access_token t
+        on u.user_id = t.user_id
+        where t.user_id is null
+    </select>
+
+    <select id="findByAppOwner" resultType="user" parameterType="user">
+        select u.* from t_user u inner join (
+            select distinct(user_id) as user_id
+            from t_flink_app
+            where team_id = #{teamId}
+        ) t
+        where u.user_id = t.user_id
+    </select>
+
 </mapper>

Reply via email to