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

casion pushed a commit to branch dev-1.3.1
in repository https://gitbox.apache.org/repos/asf/incubator-linkis.git


The following commit(s) were added to refs/heads/dev-1.3.1 by this push:
     new 768eb4ca4 feat(basedata-manager): add GatewayAuthToken manager restful 
api (#3171)
768eb4ca4 is described below

commit 768eb4ca4c47d7960ee5c2d85aa3fec452050b79
Author: jack tao <[email protected]>
AuthorDate: Fri Sep 2 14:35:44 2022 +0800

    feat(basedata-manager): add GatewayAuthToken manager restful api (#3171)
    
    * feat(basedata-manager):  add GatewayAuthToken manager restful api
    
    * feat(basedata-manager):  add swagger annotation
---
 .../server/dao/GatewayAuthTokenMapper.java         |  30 +++
 .../server/dao/mapper/GatewayAuthTokenMapper.xml   |  51 +++++
 .../server/domain/GatewayAuthTokenEntity.java      | 219 +++++++++++++++++++++
 .../server/restful/GatewayAuthTokenRestfulApi.java |  95 +++++++++
 .../server/service/GatewayAuthTokenService.java    |  30 +++
 .../service/impl/GatewayAuthTokenServiceImpl.java  |  42 ++++
 6 files changed, 467 insertions(+)

diff --git 
a/linkis-public-enhancements/linkis-publicservice/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/dao/GatewayAuthTokenMapper.java
 
b/linkis-public-enhancements/linkis-publicservice/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/dao/GatewayAuthTokenMapper.java
new file mode 100644
index 000000000..1b616f7c1
--- /dev/null
+++ 
b/linkis-public-enhancements/linkis-publicservice/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/dao/GatewayAuthTokenMapper.java
@@ -0,0 +1,30 @@
+/*
+ * 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.linkis.basedatamanager.server.dao;
+
+import org.apache.linkis.basedatamanager.server.domain.GatewayAuthTokenEntity;
+
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+import java.util.List;
+
+/** @TableName linkis_mg_gateway_auth_token */
+public interface GatewayAuthTokenMapper extends 
BaseMapper<GatewayAuthTokenEntity> {
+
+  List<GatewayAuthTokenEntity> getListByPage(String searchName);
+}
diff --git 
a/linkis-public-enhancements/linkis-publicservice/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/dao/mapper/GatewayAuthTokenMapper.xml
 
b/linkis-public-enhancements/linkis-publicservice/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/dao/mapper/GatewayAuthTokenMapper.xml
new file mode 100644
index 000000000..ea0ebcdc9
--- /dev/null
+++ 
b/linkis-public-enhancements/linkis-publicservice/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/dao/mapper/GatewayAuthTokenMapper.xml
@@ -0,0 +1,51 @@
+<?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="org.apache.linkis.basedatamanager.server.dao.GatewayAuthTokenMapper">
+
+    <resultMap id="BaseResultMap" 
type="org.apache.linkis.basedatamanager.server.domain.GatewayAuthTokenEntity">
+            <id property="id" column="id" jdbcType="INTEGER"/>
+            <result property="tokenName" column="token_name" 
jdbcType="VARCHAR"/>
+            <result property="legalUsers" column="legal_users" 
jdbcType="VARCHAR"/>
+            <result property="legalHosts" column="legal_hosts" 
jdbcType="VARCHAR"/>
+            <result property="businessOwner" column="business_owner" 
jdbcType="VARCHAR"/>
+            <result property="createTime" column="create_time" 
jdbcType="DATE"/>
+            <result property="updateTime" column="update_time" 
jdbcType="DATE"/>
+            <result property="elapseDay" column="elapse_day" 
jdbcType="BIGINT"/>
+            <result property="updateBy" column="update_by" jdbcType="VARCHAR"/>
+    </resultMap>
+
+    <sql id="Base_Column_List">
+        id,token_name,legal_users,
+        legal_hosts,business_owner,create_time,
+        update_time,elapse_day,update_by
+    </sql>
+
+    <select id="getListByPage" resultMap="BaseResultMap">
+        select
+        <include refid="Base_Column_List"></include>
+        from linkis_mg_gateway_auth_token
+        <if test="searchName != null and searchName!=''">
+            where token_name like concat('%',#{searchName},'%')
+            or legal_users like concat('%',#{searchName},'%')
+            or legal_hosts like concat('%',#{searchName},'%')
+        </if>
+    </select>
+</mapper>
diff --git 
a/linkis-public-enhancements/linkis-publicservice/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/domain/GatewayAuthTokenEntity.java
 
b/linkis-public-enhancements/linkis-publicservice/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/domain/GatewayAuthTokenEntity.java
new file mode 100644
index 000000000..9299df0dc
--- /dev/null
+++ 
b/linkis-public-enhancements/linkis-publicservice/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/domain/GatewayAuthTokenEntity.java
@@ -0,0 +1,219 @@
+/*
+ * 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.linkis.basedatamanager.server.domain;
+
+import java.io.Serializable;
+import java.util.Date;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+
+@TableName("linkis_mg_gateway_auth_token")
+public class GatewayAuthTokenEntity implements Serializable {
+  /** */
+  private Integer id;
+
+  /** */
+  private String tokenName;
+
+  /** */
+  private String legalUsers;
+
+  /** */
+  private String legalHosts;
+
+  /** */
+  private String businessOwner;
+
+  /** */
+  private Date createTime;
+
+  /** */
+  private Date updateTime;
+
+  /** */
+  private Long elapseDay;
+
+  /** */
+  private String updateBy;
+
+  private static final long serialVersionUID = 1L;
+
+  /** */
+  public Integer getId() {
+    return id;
+  }
+
+  /** */
+  public void setId(Integer id) {
+    this.id = id;
+  }
+
+  /** */
+  public String getTokenName() {
+    return tokenName;
+  }
+
+  /** */
+  public void setTokenName(String tokenName) {
+    this.tokenName = tokenName;
+  }
+
+  /** */
+  public String getLegalUsers() {
+    return legalUsers;
+  }
+
+  /** */
+  public void setLegalUsers(String legalUsers) {
+    this.legalUsers = legalUsers;
+  }
+
+  /** */
+  public String getLegalHosts() {
+    return legalHosts;
+  }
+
+  /** */
+  public void setLegalHosts(String legalHosts) {
+    this.legalHosts = legalHosts;
+  }
+
+  /** */
+  public String getBusinessOwner() {
+    return businessOwner;
+  }
+
+  /** */
+  public void setBusinessOwner(String businessOwner) {
+    this.businessOwner = businessOwner;
+  }
+
+  /** */
+  public Date getCreateTime() {
+    return createTime;
+  }
+
+  /** */
+  public void setCreateTime(Date createTime) {
+    this.createTime = createTime;
+  }
+
+  /** */
+  public Date getUpdateTime() {
+    return updateTime;
+  }
+
+  /** */
+  public void setUpdateTime(Date updateTime) {
+    this.updateTime = updateTime;
+  }
+
+  /** */
+  public Long getElapseDay() {
+    return elapseDay;
+  }
+
+  /** */
+  public void setElapseDay(Long elapseDay) {
+    this.elapseDay = elapseDay;
+  }
+
+  /** */
+  public String getUpdateBy() {
+    return updateBy;
+  }
+
+  /** */
+  public void setUpdateBy(String updateBy) {
+    this.updateBy = updateBy;
+  }
+
+  @Override
+  public boolean equals(Object that) {
+    if (this == that) {
+      return true;
+    }
+    if (that == null) {
+      return false;
+    }
+    if (getClass() != that.getClass()) {
+      return false;
+    }
+    GatewayAuthTokenEntity other = (GatewayAuthTokenEntity) that;
+    return (this.getId() == null ? other.getId() == null : 
this.getId().equals(other.getId()))
+        && (this.getTokenName() == null
+            ? other.getTokenName() == null
+            : this.getTokenName().equals(other.getTokenName()))
+        && (this.getLegalUsers() == null
+            ? other.getLegalUsers() == null
+            : this.getLegalUsers().equals(other.getLegalUsers()))
+        && (this.getLegalHosts() == null
+            ? other.getLegalHosts() == null
+            : this.getLegalHosts().equals(other.getLegalHosts()))
+        && (this.getBusinessOwner() == null
+            ? other.getBusinessOwner() == null
+            : this.getBusinessOwner().equals(other.getBusinessOwner()))
+        && (this.getCreateTime() == null
+            ? other.getCreateTime() == null
+            : this.getCreateTime().equals(other.getCreateTime()))
+        && (this.getUpdateTime() == null
+            ? other.getUpdateTime() == null
+            : this.getUpdateTime().equals(other.getUpdateTime()))
+        && (this.getElapseDay() == null
+            ? other.getElapseDay() == null
+            : this.getElapseDay().equals(other.getElapseDay()))
+        && (this.getUpdateBy() == null
+            ? other.getUpdateBy() == null
+            : this.getUpdateBy().equals(other.getUpdateBy()));
+  }
+
+  @Override
+  public int hashCode() {
+    final int prime = 31;
+    int result = 1;
+    result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
+    result = prime * result + ((getTokenName() == null) ? 0 : 
getTokenName().hashCode());
+    result = prime * result + ((getLegalUsers() == null) ? 0 : 
getLegalUsers().hashCode());
+    result = prime * result + ((getLegalHosts() == null) ? 0 : 
getLegalHosts().hashCode());
+    result = prime * result + ((getBusinessOwner() == null) ? 0 : 
getBusinessOwner().hashCode());
+    result = prime * result + ((getCreateTime() == null) ? 0 : 
getCreateTime().hashCode());
+    result = prime * result + ((getUpdateTime() == null) ? 0 : 
getUpdateTime().hashCode());
+    result = prime * result + ((getElapseDay() == null) ? 0 : 
getElapseDay().hashCode());
+    result = prime * result + ((getUpdateBy() == null) ? 0 : 
getUpdateBy().hashCode());
+    return result;
+  }
+
+  @Override
+  public String toString() {
+    StringBuilder sb = new StringBuilder();
+    sb.append(getClass().getSimpleName());
+    sb.append(" [");
+    sb.append("Hash = ").append(hashCode());
+    sb.append(", id=").append(id);
+    sb.append(", tokenName=").append(tokenName);
+    sb.append(", legalUsers=").append(legalUsers);
+    sb.append(", legalHosts=").append(legalHosts);
+    sb.append(", businessOwner=").append(businessOwner);
+    sb.append(", createTime=").append(createTime);
+    sb.append(", updateTime=").append(updateTime);
+    sb.append(", elapseDay=").append(elapseDay);
+    sb.append(", updateBy=").append(updateBy);
+    sb.append(", serialVersionUID=").append(serialVersionUID);
+    sb.append("]");
+    return sb.toString();
+  }
+}
diff --git 
a/linkis-public-enhancements/linkis-publicservice/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/restful/GatewayAuthTokenRestfulApi.java
 
b/linkis-public-enhancements/linkis-publicservice/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/restful/GatewayAuthTokenRestfulApi.java
new file mode 100644
index 000000000..d89ce71e9
--- /dev/null
+++ 
b/linkis-public-enhancements/linkis-publicservice/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/restful/GatewayAuthTokenRestfulApi.java
@@ -0,0 +1,95 @@
+/*
+ * 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.linkis.basedatamanager.server.restful;
+
+import com.github.pagehelper.PageInfo;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import org.apache.linkis.basedatamanager.server.domain.GatewayAuthTokenEntity;
+import 
org.apache.linkis.basedatamanager.server.service.GatewayAuthTokenService;
+import org.apache.linkis.server.Message;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.HashMap;
+
+
+@Api(tags = "GatewayAuthTokenRestfulApi")
+@RestController
+@RequestMapping(path = "/basedata_manager/gateway_auth_token")
+public class GatewayAuthTokenRestfulApi {
+    @Autowired
+    GatewayAuthTokenService gatewayAuthTokenService;
+
+    @ApiImplicitParams({
+            @ApiImplicitParam(paramType = "query", dataType = "string", name = 
"searchName", value = ""),
+            @ApiImplicitParam(paramType = "query", dataType = "int", name = 
"currentPage", value = ""),
+            @ApiImplicitParam(paramType = "query", dataType = "int", name = 
"pageSize", value = "")
+    })
+    @ApiOperation(value = "list", notes = "get list data", httpMethod = "GET")
+    @RequestMapping(path = "", method = RequestMethod.GET)
+    public Message list(String searchName,Integer currentPage,Integer 
pageSize) {
+        PageInfo pageList = 
gatewayAuthTokenService.getListByPage(searchName,currentPage,pageSize);
+        return Message.ok("").data("list", pageList);
+    }
+
+    @ApiImplicitParams({
+            @ApiImplicitParam(paramType = "path", dataType = "long", name = 
"id", value = "")
+    })
+    @ApiOperation(value = "get", notes = "get data by id", httpMethod = "GET")
+    @RequestMapping(path = "/{id}", method = RequestMethod.GET)
+    public Message get(@PathVariable("id") Long id) {
+        GatewayAuthTokenEntity gatewayAuthToken = 
gatewayAuthTokenService.getById(id);
+        return Message.ok("").data("item", gatewayAuthToken);
+    }
+
+    @ApiImplicitParams({
+            @ApiImplicitParam(paramType = "body", dataType = 
"GatewayAuthTokenEntity", name = "gatewayAuthToken", value = "")
+    })
+    @ApiOperation(value = "add", notes = "add data", httpMethod = "POST")
+    @RequestMapping(path = "", method = RequestMethod.POST)
+    public Message add(@RequestBody GatewayAuthTokenEntity gatewayAuthToken) {
+        boolean result = gatewayAuthTokenService.save(gatewayAuthToken);
+        return Message.ok("").data("result", result);
+    }
+
+    @ApiImplicitParams({
+            @ApiImplicitParam(paramType = "body", dataType = 
"GatewayAuthTokenEntity", name = "token", value = "")
+    })
+    @ApiOperation(value = "update", notes = "remove data by id", httpMethod = 
"PUT")
+    @RequestMapping(path = "", method = RequestMethod.PUT)
+    public Message update(@RequestBody GatewayAuthTokenEntity token) {
+        boolean result = gatewayAuthTokenService.updateById(token);
+        return Message.ok("").data("result", result);
+    }
+
+    @ApiImplicitParams({
+            @ApiImplicitParam(paramType = "query", dataType = "string", name = 
"tokenName", value = "")
+    })
+    @ApiOperation(value = "remove", notes = "update data", httpMethod = 
"DELETE")
+    @RequestMapping(path = "", method = RequestMethod.DELETE)
+    public Message remove(String tokenName) {
+        HashMap columnMap = new HashMap<String,Object>();
+        columnMap.put("token_name",tokenName);
+        boolean result = gatewayAuthTokenService.removeByMap(columnMap);
+        return Message.ok("").data("result", result);
+    }
+
+
+}
diff --git 
a/linkis-public-enhancements/linkis-publicservice/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/service/GatewayAuthTokenService.java
 
b/linkis-public-enhancements/linkis-publicservice/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/service/GatewayAuthTokenService.java
new file mode 100644
index 000000000..71944a6ce
--- /dev/null
+++ 
b/linkis-public-enhancements/linkis-publicservice/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/service/GatewayAuthTokenService.java
@@ -0,0 +1,30 @@
+/*
+ * 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.linkis.basedatamanager.server.service;
+
+import org.apache.linkis.basedatamanager.server.domain.GatewayAuthTokenEntity;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.github.pagehelper.PageInfo;
+
+/**
+ * @description Database operation Service for the 
[linkis_mg_gateway_auth_token] table
+ * @createDate 2022-07-13 10:42:13
+ */
+public interface GatewayAuthTokenService extends 
IService<GatewayAuthTokenEntity> {
+  PageInfo getListByPage(String searchName, Integer currentPage, Integer 
pageSize);
+}
diff --git 
a/linkis-public-enhancements/linkis-publicservice/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/service/impl/GatewayAuthTokenServiceImpl.java
 
b/linkis-public-enhancements/linkis-publicservice/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/service/impl/GatewayAuthTokenServiceImpl.java
new file mode 100644
index 000000000..a49f80aaf
--- /dev/null
+++ 
b/linkis-public-enhancements/linkis-publicservice/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/service/impl/GatewayAuthTokenServiceImpl.java
@@ -0,0 +1,42 @@
+/*
+ * 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.linkis.basedatamanager.server.service.impl;
+
+import org.apache.linkis.basedatamanager.server.dao.GatewayAuthTokenMapper;
+import org.apache.linkis.basedatamanager.server.domain.GatewayAuthTokenEntity;
+import 
org.apache.linkis.basedatamanager.server.service.GatewayAuthTokenService;
+
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+
+@Service
+public class GatewayAuthTokenServiceImpl
+    extends ServiceImpl<GatewayAuthTokenMapper, GatewayAuthTokenEntity>
+    implements GatewayAuthTokenService {
+  @Override
+  public PageInfo getListByPage(String searchName, Integer currentPage, 
Integer pageSize) {
+    PageHelper.startPage(currentPage, pageSize);
+    List<GatewayAuthTokenEntity> listByPage = 
this.getBaseMapper().getListByPage(searchName);
+    PageInfo pageInfo = new PageInfo(listByPage);
+    return pageInfo;
+  }
+}


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to