-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Feature][scaleph-engine-doris] add doris instance service (#651)
* feature: add doris instance service * feature: add doris instance controller * feature: add doris instance controller * feature: add doris instance web * feature: add doris instance steps * feature: add doris instance steps * feature: add doris instance steps * fix: system nav bar error
- Loading branch information
Showing
27 changed files
with
1,401 additions
and
13 deletions.
There are no files selected for viewing
104 changes: 104 additions & 0 deletions
104
scaleph-api/src/main/java/cn/sliew/scaleph/api/controller/ws/WsDorisInstanceController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
/* | ||
* 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 cn.sliew.scaleph.api.controller.ws; | ||
|
||
import cn.sliew.scaleph.api.annotation.Logging; | ||
import cn.sliew.scaleph.engine.doris.operator.DorisCluster; | ||
import cn.sliew.scaleph.engine.doris.service.WsDorisInstanceService; | ||
import cn.sliew.scaleph.engine.doris.service.dto.WsDorisInstanceDTO; | ||
import cn.sliew.scaleph.engine.doris.service.param.WsDorisInstanceAddParam; | ||
import cn.sliew.scaleph.engine.doris.service.param.WsDorisInstanceListParam; | ||
import cn.sliew.scaleph.engine.doris.service.param.WsDorisInstanceUpdateParam; | ||
import cn.sliew.scaleph.system.model.ResponseVO; | ||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | ||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.*; | ||
|
||
import javax.validation.Valid; | ||
import java.util.List; | ||
|
||
@Tag(name = "Doris管理-实例管理") | ||
@RestController | ||
@RequestMapping(path = "/api/doris/instance") | ||
public class WsDorisInstanceController { | ||
|
||
@Autowired | ||
private WsDorisInstanceService wsDorisInstanceService; | ||
|
||
@Logging | ||
@GetMapping | ||
@Operation(summary = "查询实例列表", description = "分页查询实例列表") | ||
public ResponseEntity<Page<WsDorisInstanceDTO>> list(@Valid WsDorisInstanceListParam param) { | ||
Page<WsDorisInstanceDTO> page = wsDorisInstanceService.list(param); | ||
return new ResponseEntity<>(page, HttpStatus.OK); | ||
} | ||
|
||
@Logging | ||
@GetMapping("/{id}") | ||
@Operation(summary = "查询实例信息", description = "查询实例信息") | ||
public ResponseEntity<ResponseVO<WsDorisInstanceDTO>> selectOne(@PathVariable("id") Long id) { | ||
WsDorisInstanceDTO dto = wsDorisInstanceService.selectOne(id); | ||
return new ResponseEntity(ResponseVO.success(dto), HttpStatus.OK); | ||
} | ||
|
||
@Logging | ||
@PostMapping("asYaml") | ||
@Operation(summary = "转换实例信息", description = "转换实例信息") | ||
public ResponseEntity<ResponseVO<DorisCluster>> asYaml(@RequestBody WsDorisInstanceDTO dto) { | ||
DorisCluster cluster = wsDorisInstanceService.asYaml(dto); | ||
return new ResponseEntity(ResponseVO.success(cluster), HttpStatus.OK); | ||
} | ||
|
||
@Logging | ||
@PutMapping | ||
@Operation(summary = "新增实例", description = "新增实例") | ||
public ResponseEntity<ResponseVO> insert(@Valid @RequestBody WsDorisInstanceAddParam param) { | ||
wsDorisInstanceService.insert(param); | ||
return new ResponseEntity<>(ResponseVO.success(), HttpStatus.OK); | ||
} | ||
|
||
@Logging | ||
@PostMapping | ||
@Operation(summary = "修改实例", description = "修改实例") | ||
public ResponseEntity<ResponseVO> update(@Valid @RequestBody WsDorisInstanceUpdateParam param) { | ||
wsDorisInstanceService.update(param); | ||
return new ResponseEntity<>(ResponseVO.success(), HttpStatus.OK); | ||
} | ||
|
||
@Logging | ||
@DeleteMapping("/{id}") | ||
@Operation(summary = "删除实例", description = "删除实例") | ||
public ResponseEntity<ResponseVO> delete(@PathVariable("id") Long id) { | ||
wsDorisInstanceService.deleteById(id); | ||
return new ResponseEntity<>(ResponseVO.success(), HttpStatus.OK); | ||
} | ||
|
||
@Logging | ||
@DeleteMapping("/batch") | ||
@Operation(summary = "批量删除实例", description = "批量删除实例") | ||
public ResponseEntity<ResponseVO> deleteBatch(@RequestBody List<Long> ids) { | ||
wsDorisInstanceService.deleteBatch(ids); | ||
return new ResponseEntity<>(ResponseVO.success(), HttpStatus.OK); | ||
} | ||
|
||
} |
83 changes: 83 additions & 0 deletions
83
scaleph-dao/src/main/java/cn/sliew/scaleph/dao/entity/master/ws/WsDorisInstance.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
/* | ||
* 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 cn.sliew.scaleph.dao.entity.master.ws; | ||
|
||
import cn.sliew.scaleph.common.dict.common.YesOrNo; | ||
import cn.sliew.scaleph.dao.entity.BaseDO; | ||
import com.baomidou.mybatisplus.annotation.TableField; | ||
import com.baomidou.mybatisplus.annotation.TableName; | ||
import lombok.Data; | ||
|
||
/** | ||
* doris instance | ||
*/ | ||
@Data | ||
@TableName("ws_doris_instance") | ||
public class WsDorisInstance extends BaseDO { | ||
|
||
private static final long serialVersionUID = 1L; | ||
|
||
@TableField("project_id") | ||
private Long projectId; | ||
|
||
@TableField("cluster_credential_id") | ||
private Long clusterCredentialId; | ||
|
||
@TableField("`name`") | ||
private String name; | ||
|
||
@TableField("instance_id") | ||
private String instanceId; | ||
|
||
@TableField("namespace") | ||
private String namespace; | ||
|
||
@TableField("`admin`") | ||
private String admin; | ||
|
||
@TableField("fe_spec") | ||
private String feSpec; | ||
|
||
@TableField("be_spec") | ||
private String beSpec; | ||
|
||
@TableField("cn_spec") | ||
private String cnSpec; | ||
|
||
@TableField("broker_spec") | ||
private String brokerSpec; | ||
|
||
@TableField("deployed") | ||
private YesOrNo deployed; | ||
|
||
@TableField("fe_status") | ||
private String feStatus; | ||
|
||
@TableField("be_status") | ||
private String beStatus; | ||
|
||
@TableField("cn_status") | ||
private String cnStatus; | ||
|
||
@TableField("broker_status") | ||
private String brokerStatus; | ||
|
||
@TableField("remark") | ||
private String remark; | ||
} |
31 changes: 31 additions & 0 deletions
31
scaleph-dao/src/main/java/cn/sliew/scaleph/dao/mapper/master/ws/WsDorisInstanceMapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 cn.sliew.scaleph.dao.mapper.master.ws; | ||
|
||
import cn.sliew.scaleph.dao.entity.master.ws.WsDorisInstance; | ||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | ||
import org.springframework.stereotype.Repository; | ||
|
||
/** | ||
* doris instance Mapper 接口 | ||
*/ | ||
@Repository | ||
public interface WsDorisInstanceMapper extends BaseMapper<WsDorisInstance> { | ||
|
||
} |
57 changes: 57 additions & 0 deletions
57
...ph-dao/src/main/resources/cn/sliew/scaleph/dao/mapper/master/ws/WsDorisInstanceMapper.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<?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="cn.sliew.scaleph.dao.mapper.master.ws.WsDorisInstanceMapper"> | ||
|
||
<!-- 通用查询映射结果 --> | ||
<resultMap id="BaseResultMap" type="cn.sliew.scaleph.dao.entity.master.ws.WsDorisInstance"> | ||
<result column="id" property="id" /> | ||
<result column="creator" property="creator" /> | ||
<result column="create_time" property="createTime" /> | ||
<result column="editor" property="editor" /> | ||
<result column="update_time" property="updateTime" /> | ||
<result column="project_id" property="projectId" /> | ||
<result column="cluster_credential_id" property="clusterCredentialId" /> | ||
<result column="name" property="name" /> | ||
<result column="instance_id" property="instanceId" /> | ||
<result column="namespace" property="namespace" /> | ||
<result column="admin" property="admin" /> | ||
<result column="fe_spec" property="feSpec" /> | ||
<result column="be_spec" property="beSpec" /> | ||
<result column="cn_spec" property="cnSpec" /> | ||
<result column="broker_spec" property="brokerSpec" /> | ||
<result column="deployed" property="deployed" /> | ||
<result column="fe_status" property="feStatus" /> | ||
<result column="be_status" property="beStatus" /> | ||
<result column="cn_status" property="cnStatus" /> | ||
<result column="broker_status" property="brokerStatus" /> | ||
<result column="remark" property="remark" /> | ||
</resultMap> | ||
|
||
<!-- 通用查询结果列 --> | ||
<sql id="Base_Column_List"> | ||
id, | ||
creator, | ||
create_time, | ||
editor, | ||
update_time, | ||
project_id, cluster_credential_id, `name`, instance_id, namespace, `admin`, fe_spec, be_spec, cn_spec, broker_spec, deployed, fe_status, be_status, cn_status, broker_status, remark | ||
</sql> | ||
|
||
</mapper> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
...ine-doris/src/main/java/cn/sliew/scaleph/engine/doris/service/WsDorisInstanceService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* 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 cn.sliew.scaleph.engine.doris.service; | ||
|
||
import cn.sliew.scaleph.engine.doris.operator.DorisCluster; | ||
import cn.sliew.scaleph.engine.doris.service.dto.WsDorisInstanceDTO; | ||
import cn.sliew.scaleph.engine.doris.service.param.WsDorisInstanceAddParam; | ||
import cn.sliew.scaleph.engine.doris.service.param.WsDorisInstanceListParam; | ||
import cn.sliew.scaleph.engine.doris.service.param.WsDorisInstanceUpdateParam; | ||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | ||
|
||
import java.util.List; | ||
|
||
public interface WsDorisInstanceService { | ||
|
||
Page<WsDorisInstanceDTO> list(WsDorisInstanceListParam param); | ||
|
||
WsDorisInstanceDTO selectOne(Long id); | ||
|
||
WsDorisInstanceDTO fromTemplate(Long templateId); | ||
|
||
DorisCluster asYaml(WsDorisInstanceDTO dto); | ||
|
||
int insert(WsDorisInstanceAddParam param); | ||
|
||
int update(WsDorisInstanceUpdateParam param); | ||
|
||
int deleteById(Long id); | ||
|
||
int deleteBatch(List<Long> ids); | ||
} |
Oops, something went wrong.