From 2151639474b8abb2edf9ff4637de2af576abea27 Mon Sep 17 00:00:00 2001 From: dennyzhou-zdx Date: Wed, 26 Feb 2020 21:49:39 +0800 Subject: [PATCH] #Fixes #299 --- .../core/dao/DataSourceDao.java | 75 ++++++++ .../core/dao/DataSourceEnvDao.java | 67 +++++++ .../core/dao/DataSourceParamKeyDao.java | 42 +++++ .../core/dao/DataSourceTypeDao.java | 36 ++++ .../core/dao/DataSourceTypeEnvDao.java | 38 ++++ .../core/dao/mapper/DataSouceMapper.xml | 177 ++++++++++++++++++ .../core/dao/mapper/DataSourceEnvMapper.xml | 96 ++++++++++ .../dao/mapper/DataSourceParamKeyMapper.xml | 45 +++++ .../dao/mapper/DataSourceTypeEnvMapper.xml | 28 +++ .../core/dao/mapper/DataSourceTypeMapper.xml | 31 +++ 10 files changed, 635 insertions(+) create mode 100644 datasource/datasourcemanager/server/src/main/java/com/webank/wedatasphere/linkis/datasourcemanager/core/dao/DataSourceDao.java create mode 100644 datasource/datasourcemanager/server/src/main/java/com/webank/wedatasphere/linkis/datasourcemanager/core/dao/DataSourceEnvDao.java create mode 100644 datasource/datasourcemanager/server/src/main/java/com/webank/wedatasphere/linkis/datasourcemanager/core/dao/DataSourceParamKeyDao.java create mode 100644 datasource/datasourcemanager/server/src/main/java/com/webank/wedatasphere/linkis/datasourcemanager/core/dao/DataSourceTypeDao.java create mode 100644 datasource/datasourcemanager/server/src/main/java/com/webank/wedatasphere/linkis/datasourcemanager/core/dao/DataSourceTypeEnvDao.java create mode 100644 datasource/datasourcemanager/server/src/main/java/com/webank/wedatasphere/linkis/datasourcemanager/core/dao/mapper/DataSouceMapper.xml create mode 100644 datasource/datasourcemanager/server/src/main/java/com/webank/wedatasphere/linkis/datasourcemanager/core/dao/mapper/DataSourceEnvMapper.xml create mode 100644 datasource/datasourcemanager/server/src/main/java/com/webank/wedatasphere/linkis/datasourcemanager/core/dao/mapper/DataSourceParamKeyMapper.xml create mode 100644 datasource/datasourcemanager/server/src/main/java/com/webank/wedatasphere/linkis/datasourcemanager/core/dao/mapper/DataSourceTypeEnvMapper.xml create mode 100644 datasource/datasourcemanager/server/src/main/java/com/webank/wedatasphere/linkis/datasourcemanager/core/dao/mapper/DataSourceTypeMapper.xml diff --git a/datasource/datasourcemanager/server/src/main/java/com/webank/wedatasphere/linkis/datasourcemanager/core/dao/DataSourceDao.java b/datasource/datasourcemanager/server/src/main/java/com/webank/wedatasphere/linkis/datasourcemanager/core/dao/DataSourceDao.java new file mode 100644 index 0000000000..b14fa32b64 --- /dev/null +++ b/datasource/datasourcemanager/server/src/main/java/com/webank/wedatasphere/linkis/datasourcemanager/core/dao/DataSourceDao.java @@ -0,0 +1,75 @@ +/* + * Copyright 2019 WeBank + * Licensed 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 com.webank.wedatasphere.linkis.datasourcemanager.core.dao; + + +import com.webank.wedatasphere.linkis.datasourcemanager.common.domain.DataSource; +import com.webank.wedatasphere.linkis.datasourcemanager.core.vo.DataSourceVo; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * Data source dao + * @author dennyzhou-zdx + * 2020/02/14 + */ +public interface DataSourceDao { + + /** + * Insert + * @param dataSource data source + */ + void insertOne(DataSource dataSource); + + /** + * View detail + * @param dataSourceId data source id + * @param createSystem system name + * @return data source entity + */ + DataSource selectOneDetail(@Param("dataSourceId") Long dataSourceId, + @Param("createSystem") String createSystem); + + /** + * View normal + * @param dataSourceId data source id + * @param createSystem system name + * @return data source entity + */ + DataSource selectOne(@Param("dataSourceId") Long dataSourceId, + @Param("createSystem") String createSystem); + /** + * Delete One + * @param dataSourceId data source id + * @param createSystem create system + * @return affect row + */ + int removeOne(@Param("dataSourceId")Long dataSourceId, + @Param("createSystem")String createSystem); + + + /** + * Update one + * @param updatedOne updated one + */ + void updateOne(DataSource updatedOne); + + /** + * Page of query + * @param dataSourceVo data source view entity + * @return query list + */ + List selectByPageVo(DataSourceVo dataSourceVo); +} diff --git a/datasource/datasourcemanager/server/src/main/java/com/webank/wedatasphere/linkis/datasourcemanager/core/dao/DataSourceEnvDao.java b/datasource/datasourcemanager/server/src/main/java/com/webank/wedatasphere/linkis/datasourcemanager/core/dao/DataSourceEnvDao.java new file mode 100644 index 0000000000..247c419e71 --- /dev/null +++ b/datasource/datasourcemanager/server/src/main/java/com/webank/wedatasphere/linkis/datasourcemanager/core/dao/DataSourceEnvDao.java @@ -0,0 +1,67 @@ +/* + * Copyright 2019 WeBank + * Licensed 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 com.webank.wedatasphere.linkis.datasourcemanager.core.dao; + +import com.webank.wedatasphere.linkis.datasourcemanager.common.domain.DataSourceEnv; +import com.webank.wedatasphere.linkis.datasourcemanager.core.vo.DataSourceEnvVo; + +import java.util.List; + +/** + * Data source dao + * @author dennyzhou-zdx + * 2020/02/14 + */ +public interface DataSourceEnvDao { + + /** + * View details of data source environment information + * @param dataSourceEnvId env id + * @return + */ + DataSourceEnv selectOneDetail(Long dataSourceEnvId); + + /** + * Insert one + * @param dataSourceEnv environment + */ + void insertOne(DataSourceEnv dataSourceEnv); + + /** + * List all by type id + * @param dataSourceTypeId type id + * @return + */ + List listByTypeId(Long dataSourceTypeId); + + /** + * Remove one + * @param envId env id + * @return + */ + int removeOne(Long envId); + + /** + * Update one + * @param updatedOne + */ + void updateOne(DataSourceEnv updatedOne); + + /** + * Page query + * @param dataSourceEnvVo environment view entity + * @return + */ + List selectByPageVo(DataSourceEnvVo dataSourceEnvVo); +} diff --git a/datasource/datasourcemanager/server/src/main/java/com/webank/wedatasphere/linkis/datasourcemanager/core/dao/DataSourceParamKeyDao.java b/datasource/datasourcemanager/server/src/main/java/com/webank/wedatasphere/linkis/datasourcemanager/core/dao/DataSourceParamKeyDao.java new file mode 100644 index 0000000000..e6693fbb71 --- /dev/null +++ b/datasource/datasourcemanager/server/src/main/java/com/webank/wedatasphere/linkis/datasourcemanager/core/dao/DataSourceParamKeyDao.java @@ -0,0 +1,42 @@ +/* + * Copyright 2019 WeBank + * Licensed 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 com.webank.wedatasphere.linkis.datasourcemanager.core.dao; + +import com.webank.wedatasphere.linkis.datasourcemanager.common.domain.DataSourceParamKeyDefinition; +import org.apache.ibatis.annotations.Param; + +import java.util.List; +/** + * + * @author dennyzhou-zdx + * 2020/02/14 + */ +public interface DataSourceParamKeyDao { + + /** + * List by data source type id + * @param dataSourceTypeId type id + * @return + */ + List listByDataSourceType(Long dataSourceTypeId); + + /** + * List by data source type id and scope + * @param dataSourceTypeId type id + * @param scope scope + * @return + */ + List listByDataSourceTypeAndScope(@Param("dataSourceTypeId")Long dataSourceTypeId, + @Param("scope")DataSourceParamKeyDefinition.Scope scope); +} diff --git a/datasource/datasourcemanager/server/src/main/java/com/webank/wedatasphere/linkis/datasourcemanager/core/dao/DataSourceTypeDao.java b/datasource/datasourcemanager/server/src/main/java/com/webank/wedatasphere/linkis/datasourcemanager/core/dao/DataSourceTypeDao.java new file mode 100644 index 0000000000..94a7b6a56d --- /dev/null +++ b/datasource/datasourcemanager/server/src/main/java/com/webank/wedatasphere/linkis/datasourcemanager/core/dao/DataSourceTypeDao.java @@ -0,0 +1,36 @@ +/* + * Copyright 2019 WeBank + * Licensed 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 com.webank.wedatasphere.linkis.datasourcemanager.core.dao; + +import com.webank.wedatasphere.linkis.datasourcemanager.common.domain.DataSourceType; + +import java.util.List; +/** + * @author dennyzhou-zdx + * 2020/02/14 + */ +public interface DataSourceTypeDao { + /** + * Get all types + * @return type entity list + */ + List getAllTypes(); + + /** + * View + * @param typeId + * @return + */ + DataSourceType selectOne(Long typeId); +} diff --git a/datasource/datasourcemanager/server/src/main/java/com/webank/wedatasphere/linkis/datasourcemanager/core/dao/DataSourceTypeEnvDao.java b/datasource/datasourcemanager/server/src/main/java/com/webank/wedatasphere/linkis/datasourcemanager/core/dao/DataSourceTypeEnvDao.java new file mode 100644 index 0000000000..83e6ae469f --- /dev/null +++ b/datasource/datasourcemanager/server/src/main/java/com/webank/wedatasphere/linkis/datasourcemanager/core/dao/DataSourceTypeEnvDao.java @@ -0,0 +1,38 @@ +/* + * Copyright 2019 WeBank + * Licensed 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 com.webank.wedatasphere.linkis.datasourcemanager.core.dao; + +import org.apache.ibatis.annotations.Param; + +/** + * @author dennyzhu-zdx + * 2020/02/14 + */ +public interface DataSourceTypeEnvDao { + + /** + * Insert relation between type and environment + * @param dataSourceTypeId data source type + * @param dataSourceEnvId data source env + */ + void insertRelation(@Param("dataSourceTypeId") Long dataSourceTypeId, + @Param("dataSourceEnvId") Long dataSourceEnvId); + + /** + * Remove relations by environment id + * @param envId + * @return + */ + int removeRelationsByEnvId(Long envId); +} diff --git a/datasource/datasourcemanager/server/src/main/java/com/webank/wedatasphere/linkis/datasourcemanager/core/dao/mapper/DataSouceMapper.xml b/datasource/datasourcemanager/server/src/main/java/com/webank/wedatasphere/linkis/datasourcemanager/core/dao/mapper/DataSouceMapper.xml new file mode 100644 index 0000000000..541634b5bb --- /dev/null +++ b/datasource/datasourcemanager/server/src/main/java/com/webank/wedatasphere/linkis/datasourcemanager/core/dao/mapper/DataSouceMapper.xml @@ -0,0 +1,177 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + `datasource_name`, `datasource_type_id`, `datasource_desc`, + `create_identify`, `create_system`, `create_user`, `parameter`, `create_time`, + `modify_user`, `modify_time`, `datasource_env_id` + + + + `id`, `datasource_name`, `datasource_type_id`, `datasource_desc`, + `create_identify`, `create_system`, `create_user`, `parameter`, `create_time`, + `modify_user`, `modify_time`, `datasource_env_id` + + + + `id`, `datasource_name`, `datasource_type_id`, `datasource_desc`, + `create_identify`, `create_system`, `create_user`, `create_time`, + `modify_user`, `modify_time`, `datasource_env_id` + + + t.`name`, t.`icon`, + d.`id`, d.`datasource_name`, d.`datasource_type_id`, d.`datasource_desc`, + d.`create_identify`, d.`create_system`, d.`create_user`, d.`parameter`, d.`create_time`, + d.`modify_user`, d.`modify_time`, d.`datasource_env_id` + + + + + + + + + + + + + + + + + + `id` = #{dataSourceId} + + AND `create_system` = #{createSystem} + + + + + + + + + + + + + + + + + + + + + `id` = #{id} + + + + + \ No newline at end of file diff --git a/datasource/datasourcemanager/server/src/main/java/com/webank/wedatasphere/linkis/datasourcemanager/core/dao/mapper/DataSourceEnvMapper.xml b/datasource/datasourcemanager/server/src/main/java/com/webank/wedatasphere/linkis/datasourcemanager/core/dao/mapper/DataSourceEnvMapper.xml new file mode 100644 index 0000000000..a2f6eac0d8 --- /dev/null +++ b/datasource/datasourcemanager/server/src/main/java/com/webank/wedatasphere/linkis/datasourcemanager/core/dao/mapper/DataSourceEnvMapper.xml @@ -0,0 +1,96 @@ + + + + + + + + + + + + + + + + + + + + + + + `env_name`, `env_desc`, `parameter`, `create_time`, + `create_user`, `modify_time`, `modify_user` + + + + `id`, `env_name`, `env_desc`, `parameter`, `create_time`, + `create_user`, `modify_time`, `modify_user` + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + `id` = #{id} + + + \ No newline at end of file diff --git a/datasource/datasourcemanager/server/src/main/java/com/webank/wedatasphere/linkis/datasourcemanager/core/dao/mapper/DataSourceParamKeyMapper.xml b/datasource/datasourcemanager/server/src/main/java/com/webank/wedatasphere/linkis/datasourcemanager/core/dao/mapper/DataSourceParamKeyMapper.xml new file mode 100644 index 0000000000..1fcb42da4a --- /dev/null +++ b/datasource/datasourcemanager/server/src/main/java/com/webank/wedatasphere/linkis/datasourcemanager/core/dao/mapper/DataSourceParamKeyMapper.xml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + `id`, `key`, `description`, `name`, `require`, `scope`, + `default_value`, `value_type`, `value_regex`, `ref_id`, `ref_value` + + + + \ No newline at end of file diff --git a/datasource/datasourcemanager/server/src/main/java/com/webank/wedatasphere/linkis/datasourcemanager/core/dao/mapper/DataSourceTypeEnvMapper.xml b/datasource/datasourcemanager/server/src/main/java/com/webank/wedatasphere/linkis/datasourcemanager/core/dao/mapper/DataSourceTypeEnvMapper.xml new file mode 100644 index 0000000000..3a124012ab --- /dev/null +++ b/datasource/datasourcemanager/server/src/main/java/com/webank/wedatasphere/linkis/datasourcemanager/core/dao/mapper/DataSourceTypeEnvMapper.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/datasource/datasourcemanager/server/src/main/java/com/webank/wedatasphere/linkis/datasourcemanager/core/dao/mapper/DataSourceTypeMapper.xml b/datasource/datasourcemanager/server/src/main/java/com/webank/wedatasphere/linkis/datasourcemanager/core/dao/mapper/DataSourceTypeMapper.xml new file mode 100644 index 0000000000..f451e21791 --- /dev/null +++ b/datasource/datasourcemanager/server/src/main/java/com/webank/wedatasphere/linkis/datasourcemanager/core/dao/mapper/DataSourceTypeMapper.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + \ No newline at end of file