You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@linkis.apache.org by ca...@apache.org on 2022/09/02 06:31:27 UTC

[incubator-linkis] branch dev-1.3.1 updated: feat(basedata-manager): add UDF manager restful api (#3179)

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 16560254c feat(basedata-manager):  add UDF manager restful api (#3179)
16560254c is described below

commit 16560254c63a093cbe8c13996f753de2553ade85
Author: jack tao <79...@qq.com>
AuthorDate: Fri Sep 2 14:31:22 2022 +0800

    feat(basedata-manager):  add UDF manager restful api (#3179)
---
 .../server/dao/UdfManagerMapper.java               | 34 ++++++++
 .../server/dao/mapper/UdfManagerMapper.xml         | 40 +++++++++
 .../server/domain/UdfManagerEntity.java            | 99 ++++++++++++++++++++++
 .../server/restful/UdfManagerRestfulApi.java       | 91 ++++++++++++++++++++
 .../server/service/UdfManagerService.java          | 31 +++++++
 .../server/service/impl/UdfManagerServiceImpl.java | 46 ++++++++++
 6 files changed, 341 insertions(+)

diff --git a/linkis-public-enhancements/linkis-publicservice/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/dao/UdfManagerMapper.java b/linkis-public-enhancements/linkis-publicservice/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/dao/UdfManagerMapper.java
new file mode 100644
index 000000000..c542e22f1
--- /dev/null
+++ b/linkis-public-enhancements/linkis-publicservice/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/dao/UdfManagerMapper.java
@@ -0,0 +1,34 @@
+/*
+ * 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.UdfManagerEntity;
+
+import java.util.List;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * @author jack
+ * @description Database operation Mapper for the table [linKIS_PS_UDF_manager]
+ * @createDate 2022-08-13 15:14:10 @Entity
+ *     org.apache.linkis.basedatamanager.server.domain.LinkisPsUdfManager
+ */
+public interface UdfManagerMapper extends BaseMapper<UdfManagerEntity> {
+  List<UdfManagerEntity> getListByPage(String searchName);
+}
diff --git a/linkis-public-enhancements/linkis-publicservice/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/dao/mapper/UdfManagerMapper.xml b/linkis-public-enhancements/linkis-publicservice/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/dao/mapper/UdfManagerMapper.xml
new file mode 100644
index 000000000..84127f13e
--- /dev/null
+++ b/linkis-public-enhancements/linkis-publicservice/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/dao/mapper/UdfManagerMapper.xml
@@ -0,0 +1,40 @@
+<?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.UdfManagerMapper">
+
+    <resultMap id="BaseResultMap" type="org.apache.linkis.basedatamanager.server.domain.UdfManagerEntity">
+            <id property="id" column="id" jdbcType="BIGINT"/>
+            <result property="userName" column="user_name" jdbcType="VARCHAR"/>
+    </resultMap>
+
+    <sql id="Base_Column_List">
+        id,user_name
+    </sql>
+
+    <select id="getListByPage" resultMap="BaseResultMap">
+        select
+        <include refid="Base_Column_List"></include>
+        from linkis_ps_udf_manager
+        <if test="searchName != null and searchName!=''">
+            where user_name 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/UdfManagerEntity.java b/linkis-public-enhancements/linkis-publicservice/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/domain/UdfManagerEntity.java
new file mode 100644
index 000000000..7b9b202a9
--- /dev/null
+++ b/linkis-public-enhancements/linkis-publicservice/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/domain/UdfManagerEntity.java
@@ -0,0 +1,99 @@
+/*
+ * 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 com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+
+/** @TableName linkis_ps_udf_manager */
+@TableName(value = "linkis_ps_udf_manager")
+public class UdfManagerEntity implements Serializable {
+  /** */
+  @TableId(type = IdType.AUTO)
+  private Long id;
+
+  /** */
+  private String userName;
+
+  @TableField(exist = false)
+  private static final long serialVersionUID = 1L;
+
+  /** */
+  public Long getId() {
+    return id;
+  }
+
+  /** */
+  public void setId(Long id) {
+    this.id = id;
+  }
+
+  /** */
+  public String getUserName() {
+    return userName;
+  }
+
+  /** */
+  public void setUserName(String userName) {
+    this.userName = userName;
+  }
+
+  @Override
+  public boolean equals(Object that) {
+    if (this == that) {
+      return true;
+    }
+    if (that == null) {
+      return false;
+    }
+    if (getClass() != that.getClass()) {
+      return false;
+    }
+    UdfManagerEntity other = (UdfManagerEntity) that;
+    return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
+        && (this.getUserName() == null
+            ? other.getUserName() == null
+            : this.getUserName().equals(other.getUserName()));
+  }
+
+  @Override
+  public int hashCode() {
+    final int prime = 31;
+    int result = 1;
+    result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
+    result = prime * result + ((getUserName() == null) ? 0 : getUserName().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(", userName=").append(userName);
+    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/UdfManagerRestfulApi.java b/linkis-public-enhancements/linkis-publicservice/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/restful/UdfManagerRestfulApi.java
new file mode 100644
index 000000000..be541782e
--- /dev/null
+++ b/linkis-public-enhancements/linkis-publicservice/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/restful/UdfManagerRestfulApi.java
@@ -0,0 +1,91 @@
+/*
+ * 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.UdfManagerEntity;
+import org.apache.linkis.basedatamanager.server.service.UdfManagerService;
+import org.apache.linkis.server.Message;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+@Api(tags="UdfManagerRestfulApi")
+@RestController
+@RequestMapping(path = "/basedata_manager/udf_manager")
+public class UdfManagerRestfulApi {
+
+    @Autowired
+    UdfManagerService udfManagerService;
+
+    @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 = udfManagerService.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) {
+        UdfManagerEntity errorCode = udfManagerService.getById(id);
+        return Message.ok("").data("item", errorCode);
+    }
+
+    @ApiImplicitParams({
+            @ApiImplicitParam(paramType = "body", dataType = "UdfManagerEntity", name = "errorCode", value = "")
+    })
+    @ApiOperation(value = "add", notes = "add data", httpMethod = "POST")
+    @RequestMapping(path = "", method = RequestMethod.POST)
+    public Message add(@RequestBody UdfManagerEntity errorCode) {
+        boolean result = udfManagerService.save(errorCode);
+        return Message.ok("").data("result", result);
+    }
+
+    @ApiImplicitParams({
+            @ApiImplicitParam(paramType = "path", dataType = "long", name = "id", value = "")
+    })
+    @ApiOperation(value = "remove", notes = "remove data by id", httpMethod = "DELETE")
+    @RequestMapping(path = "/{id}", method = RequestMethod.DELETE)
+    public Message remove(@PathVariable("id") Long id) {
+        boolean result = udfManagerService.removeById(id);
+        return Message.ok("").data("result", result);
+    }
+
+    @ApiImplicitParams({
+            @ApiImplicitParam(paramType = "body", dataType = "UdfManagerEntity", name = "errorCode", value = "")
+    })
+    @ApiOperation(value = "update", notes = "update data", httpMethod = "PUT")
+    @RequestMapping(path = "", method = RequestMethod.PUT)
+    public Message update(@RequestBody UdfManagerEntity errorCode) {
+        boolean result = udfManagerService.updateById(errorCode);
+        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/UdfManagerService.java b/linkis-public-enhancements/linkis-publicservice/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/service/UdfManagerService.java
new file mode 100644
index 000000000..b17b42417
--- /dev/null
+++ b/linkis-public-enhancements/linkis-publicservice/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/service/UdfManagerService.java
@@ -0,0 +1,31 @@
+/*
+ * 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.UdfManagerEntity;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.github.pagehelper.PageInfo;
+
+/**
+ * @description Database operation Service for the table [linKIS_PS_UDF_manager]
+ * @createDate 2022-08-13 15:14:10
+ */
+public interface UdfManagerService extends IService<UdfManagerEntity> {
+  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/UdfManagerServiceImpl.java b/linkis-public-enhancements/linkis-publicservice/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/service/impl/UdfManagerServiceImpl.java
new file mode 100644
index 000000000..079051fa9
--- /dev/null
+++ b/linkis-public-enhancements/linkis-publicservice/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/service/impl/UdfManagerServiceImpl.java
@@ -0,0 +1,46 @@
+/*
+ * 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.UdfManagerMapper;
+import org.apache.linkis.basedatamanager.server.domain.UdfManagerEntity;
+import org.apache.linkis.basedatamanager.server.service.UdfManagerService;
+
+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;
+
+/**
+ * @description Database operation Service implementation for table [linKIS_PS_UDF_Manager]
+ * @createDate 2022-08-13 15:14:10
+ */
+@Service
+public class UdfManagerServiceImpl extends ServiceImpl<UdfManagerMapper, UdfManagerEntity>
+    implements UdfManagerService {
+  @Override
+  public PageInfo getListByPage(String searchName, Integer currentPage, Integer pageSize) {
+    PageHelper.startPage(currentPage, pageSize);
+    List<UdfManagerEntity> listByPage = this.getBaseMapper().getListByPage(searchName);
+    PageInfo pageInfo = new PageInfo(listByPage);
+    return pageInfo;
+  }
+}


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@linkis.apache.org
For additional commands, e-mail: commits-help@linkis.apache.org