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:22:13 UTC
[incubator-linkis] branch dev-1.3.1 updated: feat(basedata-manager): add RmExternalResourcePrividerMapper manager restful api (#3175)
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 ff617ea18 feat(basedata-manager): add RmExternalResourcePrividerMapper manager restful api (#3175)
ff617ea18 is described below
commit ff617ea188347054d88756e724ea318744363c09
Author: jack tao <79...@qq.com>
AuthorDate: Fri Sep 2 14:22:08 2022 +0800
feat(basedata-manager): add RmExternalResourcePrividerMapper manager restful api (#3175)
---
.../dao/RmExternalResourceProviderMapper.java | 34 +++++
.../mapper/RmExternalResourceProviderMapper.xml | 47 +++++++
.../domain/RmExternalResourceProviderEntity.java | 148 +++++++++++++++++++++
.../RmExternalResourceProviderRestfulApi.java | 91 +++++++++++++
.../service/RmExternalResourceProviderService.java | 31 +++++
.../RmExternalResourceProviderServiceImpl.java | 43 ++++++
6 files changed, 394 insertions(+)
diff --git a/linkis-public-enhancements/linkis-publicservice/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/dao/RmExternalResourceProviderMapper.java b/linkis-public-enhancements/linkis-publicservice/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/dao/RmExternalResourceProviderMapper.java
new file mode 100644
index 000000000..28085575b
--- /dev/null
+++ b/linkis-public-enhancements/linkis-publicservice/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/dao/RmExternalResourceProviderMapper.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.RmExternalResourceProviderEntity;
+
+import java.util.List;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * @description Database operation Mapper for the linkis_mg_gateway_auth_token table
+ * @createDate 2022-07-13 10:42:13 @Entity
+ * org.apache.linkis.basedatamanager.server.domain.LinkisMgGatewayAuthToken
+ */
+public interface RmExternalResourceProviderMapper
+ extends BaseMapper<RmExternalResourceProviderEntity> {
+ List<RmExternalResourceProviderEntity> getListByPage(String searchName);
+}
diff --git a/linkis-public-enhancements/linkis-publicservice/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/dao/mapper/RmExternalResourceProviderMapper.xml b/linkis-public-enhancements/linkis-publicservice/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/dao/mapper/RmExternalResourceProviderMapper.xml
new file mode 100644
index 000000000..70f8f493a
--- /dev/null
+++ b/linkis-public-enhancements/linkis-publicservice/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/dao/mapper/RmExternalResourceProviderMapper.xml
@@ -0,0 +1,47 @@
+<?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.RmExternalResourceProviderMapper">
+
+ <resultMap id="BaseResultMap" type="org.apache.linkis.basedatamanager.server.domain.RmExternalResourceProviderEntity">
+ <id property="id" column="id" jdbcType="INTEGER"/>
+ <result property="resourceType" column="resource_type" jdbcType="VARCHAR"/>
+ <result property="name" column="name" jdbcType="VARCHAR"/>
+ <result property="labels" column="labels" jdbcType="VARCHAR"/>
+ <result property="config" column="config" jdbcType="VARCHAR"/>
+ </resultMap>
+
+ <sql id="Base_Column_List">
+ id,resource_type,name,
+ labels,config
+ </sql>
+
+ <select id="getListByPage" resultMap="BaseResultMap">
+ select
+ <include refid="Base_Column_List"></include>
+ from linkis_cg_rm_external_resource_provider
+ <if test="searchName != null and searchName!=''">
+ where resource_type like concat('%',#{searchName},'%')
+ or name like concat('%',#{searchName},'%')
+ or labels like concat('%',#{searchName},'%')
+ or config 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/RmExternalResourceProviderEntity.java b/linkis-public-enhancements/linkis-publicservice/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/domain/RmExternalResourceProviderEntity.java
new file mode 100644
index 000000000..d1a354aac
--- /dev/null
+++ b/linkis-public-enhancements/linkis-publicservice/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/domain/RmExternalResourceProviderEntity.java
@@ -0,0 +1,148 @@
+/*
+ * 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.TableName;
+
+/** @TableName linkis_mg_gateway_auth_token */
+@TableName("linkis_cg_rm_external_resource_provider")
+public class RmExternalResourceProviderEntity implements Serializable {
+ /** */
+ private Integer id;
+
+ /** */
+ private String resourceType;
+
+ /** */
+ private String name;
+
+ /** */
+ private String labels;
+
+ /** */
+ private String config;
+
+ private static final long serialVersionUID = 1L;
+
+ /** */
+ public Integer getId() {
+ return id;
+ }
+
+ /** */
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ /** */
+ public String getResourceType() {
+ return resourceType;
+ }
+
+ /** */
+ public void setResourceType(String resourceType) {
+ this.resourceType = resourceType;
+ }
+
+ /** */
+ public String getName() {
+ return name;
+ }
+
+ /** */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /** */
+ public String getLabels() {
+ return labels;
+ }
+
+ /** */
+ public void setLabels(String labels) {
+ this.labels = labels;
+ }
+
+ /** */
+ public String getConfig() {
+ return config;
+ }
+
+ /** */
+ public void setConfig(String config) {
+ this.config = config;
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (this == that) {
+ return true;
+ }
+ if (that == null) {
+ return false;
+ }
+ if (getClass() != that.getClass()) {
+ return false;
+ }
+ RmExternalResourceProviderEntity other = (RmExternalResourceProviderEntity) that;
+ return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
+ && (this.getResourceType() == null
+ ? other.getResourceType() == null
+ : this.getResourceType().equals(other.getResourceType()))
+ && (this.getName() == null
+ ? other.getName() == null
+ : this.getName().equals(other.getName()))
+ && (this.getLabels() == null
+ ? other.getLabels() == null
+ : this.getLabels().equals(other.getLabels()))
+ && (this.getConfig() == null
+ ? other.getConfig() == null
+ : this.getConfig().equals(other.getConfig()));
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
+ result = prime * result + ((getResourceType() == null) ? 0 : getResourceType().hashCode());
+ result = prime * result + ((getName() == null) ? 0 : getName().hashCode());
+ result = prime * result + ((getLabels() == null) ? 0 : getLabels().hashCode());
+ result = prime * result + ((getConfig() == null) ? 0 : getConfig().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(", resourceType=").append(resourceType);
+ sb.append(", name=").append(name);
+ sb.append(", labels=").append(labels);
+ sb.append(", config=").append(config);
+ 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/RmExternalResourceProviderRestfulApi.java b/linkis-public-enhancements/linkis-publicservice/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/restful/RmExternalResourceProviderRestfulApi.java
new file mode 100644
index 000000000..5f58c94c7
--- /dev/null
+++ b/linkis-public-enhancements/linkis-publicservice/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/restful/RmExternalResourceProviderRestfulApi.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.RmExternalResourceProviderEntity;
+import org.apache.linkis.basedatamanager.server.service.RmExternalResourceProviderService;
+import org.apache.linkis.server.Message;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+@Api(tags = "RmExternalResourceProviderRestfulApi")
+@RestController
+@RequestMapping(path = "/basedata_manager/rm_external_resource_provier")
+public class RmExternalResourceProviderRestfulApi {
+
+ @Autowired
+ RmExternalResourceProviderService rmExternalResourceProviderService;
+
+ @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 = rmExternalResourceProviderService.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) {
+ RmExternalResourceProviderEntity rmExternalResourceProvider = rmExternalResourceProviderService.getById(id);
+ return Message.ok("").data("dbs", rmExternalResourceProvider);
+ }
+
+ @ApiImplicitParams({
+ @ApiImplicitParam(paramType = "body", dataType = "RmExternalResourceProviderEntity", name = "rmExternalResourceProvider", value = "")
+ })
+ @ApiOperation(value = "add", notes = "add data", httpMethod = "POST")
+ @RequestMapping(path = "", method = RequestMethod.POST)
+ public Message add(@RequestBody RmExternalResourceProviderEntity rmExternalResourceProvider) {
+ boolean result = rmExternalResourceProviderService.save(rmExternalResourceProvider);
+ return Message.ok("").data("dbs", 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 = rmExternalResourceProviderService.removeById(id);
+ return Message.ok("").data("dbs", result);
+ }
+
+ @ApiImplicitParams({
+ @ApiImplicitParam(paramType = "body", dataType = "RmExternalResourceProviderEntity", name = "rmExternalResourceProvider", value = "")
+ })
+ @ApiOperation(value = "update", notes = "update data", httpMethod = "PUT")
+ @RequestMapping(path = "", method = RequestMethod.PUT)
+ public Message update(@RequestBody RmExternalResourceProviderEntity rmExternalResourceProvider) {
+ boolean result = rmExternalResourceProviderService.updateById(rmExternalResourceProvider);
+ return Message.ok("").data("dbs", result);
+ }
+
+
+}
diff --git a/linkis-public-enhancements/linkis-publicservice/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/service/RmExternalResourceProviderService.java b/linkis-public-enhancements/linkis-publicservice/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/service/RmExternalResourceProviderService.java
new file mode 100644
index 000000000..754e27146
--- /dev/null
+++ b/linkis-public-enhancements/linkis-publicservice/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/service/RmExternalResourceProviderService.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.RmExternalResourceProviderEntity;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.github.pagehelper.PageInfo;
+
+/**
+ * @description Database operation Service for the [linkis_CG_RM_external_resource_provider] table
+ * @createDate 2022-07-13 14:02:00
+ */
+public interface RmExternalResourceProviderService
+ extends IService<RmExternalResourceProviderEntity> {
+ 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/RmExternalResourceProviderServiceImpl.java b/linkis-public-enhancements/linkis-publicservice/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/service/impl/RmExternalResourceProviderServiceImpl.java
new file mode 100644
index 000000000..1bc711201
--- /dev/null
+++ b/linkis-public-enhancements/linkis-publicservice/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/service/impl/RmExternalResourceProviderServiceImpl.java
@@ -0,0 +1,43 @@
+/*
+ * 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.RmExternalResourceProviderMapper;
+import org.apache.linkis.basedatamanager.server.domain.RmExternalResourceProviderEntity;
+import org.apache.linkis.basedatamanager.server.service.RmExternalResourceProviderService;
+
+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 RmExternalResourceProviderServiceImpl
+ extends ServiceImpl<RmExternalResourceProviderMapper, RmExternalResourceProviderEntity>
+ implements RmExternalResourceProviderService {
+ @Override
+ public PageInfo getListByPage(String searchName, Integer currentPage, Integer pageSize) {
+ PageHelper.startPage(currentPage, pageSize);
+ List<RmExternalResourceProviderEntity> 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