From 1bcb578febaa4a76db6c51c76fe0fd95ebe89a08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=91=A8=E5=80=AC=E8=B4=A4?= <14100340+zhou-zhuoxian@user.noreply.gitee.com> Date: Sat, 15 Jun 2024 00:21:29 +0800 Subject: [PATCH 1/4] Changes to code specifications --- .../controller/ConnectionController.java | 14 +++-- .../controller/cluster/ClusterController.java | 2 +- .../ClusterRelationshipController.java | 2 +- .../controller/cluster/RuntimeController.java | 2 +- .../controller/function/ConfigController.java | 6 +- .../controller/function/HealthController.java | 10 +-- .../controller/function/LogController.java | 8 ++- .../controller/message/GroupController.java | 2 +- .../controller/message/TopicController.java | 4 +- .../console/entity/DefaultConfigKey.java | 4 -- .../function/HealthCheckResultEntity.java | 6 -- .../console/entity/function/LogEntity.java | 4 -- .../db/RuntimeMetadataHandlerToDbImpl.java | 4 +- .../dashboard/console/log/OprLog.java | 2 +- .../console/mapper/cluster/AclMapper.java | 24 +++---- .../console/mapper/cluster/ClientMapper.java | 33 +++++----- .../console/mapper/cluster/ClusterMapper.java | 36 +++++------ .../cluster/ClusterRelationshipMapper.java | 23 +++---- .../mapper/cluster/ConnectionMapper.java | 29 ++++----- .../mapper/cluster/InstanceUserMapper.java | 22 +++---- .../mapper/cluster/NetConnectionMapper.java | 3 +- .../console/mapper/cluster/RuntimeMapper.java | 42 ++++++------- .../mapper/connector/ConnectorMapper.java | 49 ++++++++------- .../console/mapper/function/ConfigMapper.java | 46 +++++++------- .../function/HealthCheckResultMapper.java | 62 ++++++++++--------- .../console/mapper/function/OprLogMapper.java | 21 ++++--- .../mapper/message/OprGroupMapper.java | 24 +++---- .../mapper/message/OprGroupMemberMapper.java | 60 +++++++++--------- .../console/mapper/message/TopicMapper.java | 11 ++-- .../console/mapper/storage/StoreMapper.java | 27 ++++---- .../service/cluster/ClientDataService.java | 8 +-- .../cluster/ClusterRelationshipService.java | 2 +- .../service/cluster/ClusterService.java | 4 +- .../cluster/ConnectionDataService.java | 3 + .../service/cluster/RuntimeService.java | 10 +-- .../cluster/impl/ClientDataServiceImpl.java | 17 ++--- .../impl/ClusterRelationshipServiceImpl.java | 4 +- .../cluster/impl/ClusterServiceImpl.java | 8 +-- .../cluster/impl/RuntimeServiceImpl.java | 22 +++---- .../service/function/ConfigService.java | 4 +- .../service/function/HealthDataService.java | 10 +-- .../function/Impl/ConfigServiceImpl.java | 18 +++--- .../Impl/HealthDataServiceDatabaseImpl.java | 32 +++++----- .../service/function/Impl/LogServiceImpl.java | 8 +-- .../console/service/function/LogService.java | 4 +- .../service/message/GroupMemberService.java | 10 +-- .../console/service/message/GroupService.java | 6 +- .../console/service/message/TopicService.java | 8 +-- .../message/impl/GroupMemberServiceImp.java | 18 +++--- .../message/impl/GroupServiceImpl.java | 12 ++-- .../message/impl/TopicServiceImpl.java | 16 ++--- .../service/store/Impl/StoreServiceImpl.java | 18 +++--- .../console/service/store/StoreService.java | 10 +-- .../console/linkage/log/TestOprLog.java | 4 +- 54 files changed, 424 insertions(+), 414 deletions(-) diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/ConnectionController.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/ConnectionController.java index 2eca4804..1fd36661 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/ConnectionController.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/ConnectionController.java @@ -32,9 +32,11 @@ import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RestController +@RequestMapping("/cluster/connection") public class ConnectionController { @Autowired @@ -46,24 +48,24 @@ public class ConnectionController { * @param type * @return */ - @GetMapping("/cluster/connection/getConnectorBusinessType") + @GetMapping("/getConnectorBusinessType") public List getConnectorBusinessType(String type) { return connectionDataService.getConnectorBusinessType(type); } - @GetMapping("/cluster/connection/getConnectorConfigs") + @GetMapping("/getConnectorConfigs") public List getConnectorConfigsByClassAndVersion(String version, String classType) { return connectionDataService.getConnectorConfigsByClassAndVersion(classType, version); } - @GetMapping("/cluster/connection/showCreateConnectionMessage") + @GetMapping("/showCreateConnectionMessage") public AddConnectionDTO showCreateConnectionMessage() { return new AddConnectionDTO(); } - @PostMapping("/cluster/connection/createConnection") + @PostMapping("/createConnection") public String createConnection(@Validated @RequestBody CreateConnectionDTO createConnectionDTO) { try { connectionDataService.createConnection(createConnectionDTO); @@ -75,12 +77,12 @@ public String createConnection(@Validated @RequestBody CreateConnectionDTO creat } - @PostMapping("/cluster/connection/getConnectionList") + @PostMapping("/getConnectionList") public List getConnectionList(@Validated @RequestBody GetConnectionListDTO getConnectionListDTO) { return connectionDataService.getConnectionToFrontByCluster(getConnectionListDTO.getClusterId(), getConnectionListDTO); } - @GetMapping("/cluster/connection/getConnectorDetail") + @GetMapping("/getConnectorDetail") public ConnectorEntity getConnectorDetail(Long connectorId) { return connectionDataService.getConnectorById(connectorId); } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/cluster/ClusterController.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/cluster/ClusterController.java index 983d3372..35566305 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/cluster/ClusterController.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/cluster/ClusterController.java @@ -48,7 +48,7 @@ public class ClusterController { @GetMapping("queryHomeClusterData") public GetClusterBaseMessageVO queryHomeClusterData(@RequestBody @Validated ClusterIdDTO clusterIdDTO) { - return clusterService.getClusterBaseMessage(clusterIdDTO); + return clusterService.selectClusterBaseMessage(clusterIdDTO); } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/cluster/ClusterRelationshipController.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/cluster/ClusterRelationshipController.java index 1db255d6..9dba50f9 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/cluster/ClusterRelationshipController.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/cluster/ClusterRelationshipController.java @@ -40,7 +40,7 @@ public class ClusterRelationshipController { @PostMapping("addClusterRelationshipEntry") public void addClusterRelationshipEntry(@RequestBody ClusterRelationshipEntity clusterRelationshipEntity) { - this.clusterRelationshipService.addClusterRelationshipEntry(clusterRelationshipEntity); + this.clusterRelationshipService.insertClusterRelationshipEntry(clusterRelationshipEntity); } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/cluster/RuntimeController.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/cluster/RuntimeController.java index 3102a5a9..fe6647d6 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/cluster/RuntimeController.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/cluster/RuntimeController.java @@ -44,7 +44,7 @@ public class RuntimeController { @PostMapping("/queryRuntimeListByClusterId") public List queryRuntimeListByClusterId(@Validated @RequestBody ClusterIdDTO clusterIdDTO) { List runtimeEntityList = - runtimeService.getRuntimeToFrontByClusterId(RuntimeControllerMapper.INSTANCE.queryRuntimeListByClusterId(clusterIdDTO)); + runtimeService.selectRuntimeToFrontByClusterId(RuntimeControllerMapper.INSTANCE.queryRuntimeListByClusterId(clusterIdDTO)); runtimeEntityList.forEach(n -> { n.setStatus(CheckResultCache.getINSTANCE().getLastHealthyCheckResult("runtime", n.getId())); }); diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/function/ConfigController.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/function/ConfigController.java index 3dbb3ce8..c9ddb1d7 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/function/ConfigController.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/function/ConfigController.java @@ -31,15 +31,17 @@ import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RestController +@RequestMapping("/cluster/config") public class ConfigController { @Autowired private ConfigService configService; - @PostMapping("/cluster/config/updateConfigs") + @PostMapping("/updateConfigs") public String updateConfigsByTypeAndId(@Validated @RequestBody UpdateConfigDTO updateConfigDTO) { try { configService.updateConfigsByInstanceId(updateConfigDTO.getUsername(), updateConfigDTO.getClusterId(), updateConfigDTO.getInstanceType(), @@ -51,7 +53,7 @@ public String updateConfigsByTypeAndId(@Validated @RequestBody UpdateConfigDTO u } - @PostMapping("/cluster/config/getInstanceDetailConfigs") + @PostMapping("/getInstanceDetailConfigs") public List getInstanceDetailConfigs(@Validated @RequestBody GetConfigsListDTO getConfigsListDTO) { List configEntityList = configService.selectToFront(getConfigsListDTO.getInstanceId(), getConfigsListDTO.getInstanceType(), getConfigsListDTO); diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/function/HealthController.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/function/HealthController.java index b88906ae..4a969749 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/function/HealthController.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/function/HealthController.java @@ -26,21 +26,23 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RestController +@RequestMapping("/cluster/health") public class HealthController { @Autowired HealthDataService healthDataService; - @GetMapping("/cluster/health/getHistoryLiveStatus") + @GetMapping("/getHistoryLiveStatus") public List getHistoryLiveStatusById(Integer type, Long instanceId, String startTime) { - return healthDataService.getInstanceLiveStatusHistory(type, instanceId, LocalDateTime.parse(startTime)); + return healthDataService.selectInstanceLiveStatusHistory(type, instanceId, LocalDateTime.parse(startTime)); } - @GetMapping("/cluster/health/getInstanceLiveProportion") + @GetMapping("/getInstanceLiveProportion") public InstanceLiveProportionVo getInstanceLiveProportion(Integer instanceType, Long theClusterId) { - return healthDataService.getInstanceLiveProportion(theClusterId, instanceType); + return healthDataService.selectInstanceLiveProportion(theClusterId, instanceType); } } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/function/LogController.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/function/LogController.java index 1b048a26..6249e4ea 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/function/LogController.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/function/LogController.java @@ -27,17 +27,19 @@ import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RestController +@RequestMapping("/cluster/log") public class LogController { @Autowired private LogService logService; - @PostMapping("/cluster/log/getList") + @PostMapping("/getList") public List getLogLIstToFront(@Validated @RequestBody GetLogListDTO getLogListDTO) { - return logService.getLogListByCluster(getLogListDTO); + return logService.selectLogListByCluster(getLogListDTO); } -} \ No newline at end of file +} diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/message/GroupController.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/message/GroupController.java index 94c983c1..a2f8c7b0 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/message/GroupController.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/message/GroupController.java @@ -47,7 +47,7 @@ public class GroupController { @PostMapping("queryGroupListByClusterId") public List queryGroupListByClusterId(@RequestBody @Validated ClusterIdDTO clusterIdDTO) { - return groupService.getGroupByClusterId(GroupControllerMapper.INSTANCE.queryGroupListByClusterId(clusterIdDTO)); + return groupService.selectGroupByClusterId(GroupControllerMapper.INSTANCE.queryGroupListByClusterId(clusterIdDTO)); } @PostMapping("deleteGroupById") diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/message/TopicController.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/message/TopicController.java index a6d27096..25353a23 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/message/TopicController.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/message/TopicController.java @@ -46,7 +46,7 @@ public class TopicController { @PostMapping("/queryTopicListByClusterId") public List queryTopicListByClusterId(@Validated @RequestBody GetTopicListDTO getTopicListDTO) { - return topicService.getTopicListToFront(TopicControllerMapper.INSTANCE.queryTopicListByClusterId(getTopicListDTO)); + return topicService.selectTopicListToFront(TopicControllerMapper.INSTANCE.queryTopicListByClusterId(getTopicListDTO)); } @PostMapping("queryTopicListById ") @@ -72,7 +72,7 @@ public void createTopic(@Validated @RequestBody CreateTopicDTO createTopicDTO) { */ @GetMapping("/cluster/topic/getTopicDetailGroups") public List getTopicDetailGroups(Long topicId) { - return topicService.getTopicDetailGroups(topicId); + return topicService.selectTopicDetailGroups(topicId); } } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/DefaultConfigKey.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/DefaultConfigKey.java index 9efb4cfc..c4f2e8cd 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/DefaultConfigKey.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/DefaultConfigKey.java @@ -18,12 +18,8 @@ package org.apache.eventmesh.dashboard.console.entity; -import lombok.AllArgsConstructor; import lombok.Data; -import lombok.NoArgsConstructor; -@NoArgsConstructor -@AllArgsConstructor @Data public class DefaultConfigKey { diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/function/HealthCheckResultEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/function/HealthCheckResultEntity.java index b08053e9..657d217d 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/function/HealthCheckResultEntity.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/function/HealthCheckResultEntity.java @@ -22,18 +22,12 @@ import io.swagger.v3.oas.annotations.media.Schema; -import lombok.AllArgsConstructor; -import lombok.Builder; import lombok.Data; import lombok.EqualsAndHashCode; -import lombok.NoArgsConstructor; @Data @EqualsAndHashCode(callSuper = true, exclude = "resultDesc") -@Builder -@AllArgsConstructor -@NoArgsConstructor @Schema(name = "HealthCheckResultEntity", description = "Health check result entity") public class HealthCheckResultEntity extends BaseEntity { diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/function/LogEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/function/LogEntity.java index eb38abf9..7a07089f 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/function/LogEntity.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/function/LogEntity.java @@ -22,14 +22,10 @@ import java.sql.Timestamp; -import lombok.AllArgsConstructor; import lombok.Data; import lombok.EqualsAndHashCode; -import lombok.NoArgsConstructor; @Data -@NoArgsConstructor -@AllArgsConstructor @EqualsAndHashCode(callSuper = true, exclude = {"endTime", "operationUser", "result"}) public class LogEntity extends BaseEntity { diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/RuntimeMetadataHandlerToDbImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/RuntimeMetadataHandlerToDbImpl.java index 98c78cdb..c8c064e9 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/RuntimeMetadataHandlerToDbImpl.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/RuntimeMetadataHandlerToDbImpl.java @@ -59,10 +59,10 @@ public void addMetadata(RuntimeMetadata meta) { clusterEntity.setDescription(""); clusterEntity.setAuthType(0); clusterEntity.setRunState(0); - clusterService.addCluster(clusterEntity); + clusterService.insertCluster(clusterEntity); } else { cluster.setName(meta.getClusterName()); - clusterService.addCluster(cluster); + clusterService.insertCluster(cluster); } if (Objects.isNull(meta.getClusterId())) { //meta.setClusterId(ClusterCache.getINSTANCE().getClusterByName(meta.getClusterName()).getId()); diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/log/OprLog.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/log/OprLog.java index e1066b7f..bd61b8d1 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/log/OprLog.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/log/OprLog.java @@ -66,7 +66,7 @@ public Object logStart(ProceedingJoinPoint joinPoint) throws Throwable { return joinPoint.proceed(); } LogEntity logEntity = this.productLoEntity(declaredAnnotation, joinPoint); - logService.addLog(logEntity); + logService.insertLog(logEntity); logEntity.setEndTime(new Timestamp(System.currentTimeMillis())); Object proceed = null; try { diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/cluster/AclMapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/cluster/AclMapper.java index c69758cd..92332df7 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/cluster/AclMapper.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/cluster/AclMapper.java @@ -33,6 +33,18 @@ @Mapper public interface AclMapper { + @Select("SELECT * FROM acl WHERE id=#{id}") + AclEntity selectById(AclEntity aclEntity); + + @Select("SELECT * FROM acl") + List selectAll(); + + @Update("UPDATE acl SET resource_type=#{resourceType} WHERE id=#{id}") + void updateResourceTypeById(AclEntity aclEntity); + + @Update("UPDATE acl SET status=0 WHERE id=#{id}") + void deleteById(AclEntity aclEntity); + @Insert({ ""}) @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id") - void batchInsert(List aclEntities); + Integer batchInsert(List aclEntities); @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id") @Insert("INSERT INTO acl (cluster_id, pattern, operation, permission_type, host, resource_type, resource_name, pattern_type)" + "VALUE (#{clusterId}, #{pattern}, #{operation}, #{permissionType}, #{host}, #{resourceType}, #{resourceName}, #{patternType})") void insert(AclEntity aclEntity); - @Update("UPDATE acl SET status=0 WHERE id=#{id}") - void deleteById(AclEntity aclEntity); - - @Update("UPDATE acl SET resource_type=#{resourceType} WHERE id=#{id}") - void updateResourceTypeById(AclEntity aclEntity); - @Select("SELECT * FROM acl") - List selectAll(); - - @Select("SELECT * FROM acl WHERE id=#{id}") - AclEntity selectById(AclEntity aclEntity); } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/cluster/ClientMapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/cluster/ClientMapper.java index 1fa5a962..d75f78f0 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/cluster/ClientMapper.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/cluster/ClientMapper.java @@ -35,6 +35,21 @@ public interface ClientMapper { + @Select("SELECT * FROM `client` WHERE `host` = #{host} AND `port` = #{port} AND status = 1") + List selectByHostPort(ClientEntity clientEntity); + + @Select("SELECT * FROM `client` WHERE `id` = #{id}") + ClientEntity selectById(ClientEntity clientEntity); + + @Select("SELECT * FROM `client` WHERE `cluster_id` = #{clusterId}") + List selectByClusterId(ClientEntity clientEntity); + + @Update("UPDATE `client` SET status = 0, end_time = NOW() WHERE id = #{id}") + Integer deactivate(ClientEntity clientEntity); + + @Update("UPDATE `client` SET status = 0, end_time = NOW() WHERE `host` = #{host} AND `port` = #{port}") + Integer deActiveByHostPort(ClientEntity clientEntity); + @Select({ ""}) @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id") - void batchInsert(List clientEntityList); - - @Select("SELECT * FROM `client` WHERE `host` = #{host} AND `port` = #{port} AND status = 1") - List selectByHostPort(ClientEntity clientEntity); - - @Select("SELECT * FROM `client` WHERE `id` = #{id}") - ClientEntity selectById(ClientEntity clientEntity); - - @Select("SELECT * FROM `client` WHERE `cluster_id` = #{clusterId}") - List selectByClusterId(ClientEntity clientEntity); + Integer batchInsert(List clientEntityList); @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id") @Insert( @@ -65,12 +71,7 @@ public interface ClientMapper { + "#{language}, #{pid}, #{host}, #{port}, #{protocol}," + "#{status}, #{configIds}, #{description})" + "ON DUPLICATE KEY UPDATE `status` = 1, `pid` = #{pid}, `config_ids` = #{configIds}, `host` = #{host}, `port` = #{port}") - Long insert(ClientEntity clientEntity); + void insert(ClientEntity clientEntity); - @Update("UPDATE `client` SET status = 0, end_time = NOW() WHERE id = #{id}") - void deactivate(ClientEntity clientEntity); - - @Update("UPDATE `client` SET status = 0, end_time = NOW() WHERE `host` = #{host} AND `port` = #{port}") - void deActiveByHostPort(ClientEntity clientEntity); } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/cluster/ClusterMapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/cluster/ClusterMapper.java index d553204e..a59c1a74 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/cluster/ClusterMapper.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/cluster/ClusterMapper.java @@ -32,7 +32,9 @@ /** * cluster table operation + * */ + @Mapper public interface ClusterMapper { @@ -45,17 +47,6 @@ public interface ClusterMapper { @Select("SELECT * FROM cluster where update_time > #{updateTime}") List selectClusterByUpdate(@Param("updateTime") long updateTime); - @Insert({ - ""}) - @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id") - Integer batchInsert(List clusterEntities); - - @Select({ ""}) + @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id") + Integer batchInsert(List clusterEntities); + @Insert({ + "insert into cluster(name,trusteeship_type,cluster_type,version,jmx_properties,description,auth_type)values", + "(#{name},#{c.trusteeshipType},#{c.clusterType},#{c.version},#{jmxProperties},#{regProperties},#{description},#{authType})" + }) + @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id") + void insertCluster(ClusterEntity cluster); } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/cluster/ClusterRelationshipMapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/cluster/ClusterRelationshipMapper.java index f741ee8b..a0ea6c2e 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/cluster/ClusterRelationshipMapper.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/cluster/ClusterRelationshipMapper.java @@ -33,17 +33,6 @@ @Mapper public interface ClusterRelationshipMapper { - - @Insert({ - " insert into cluster_relationship (cluster_type,cluster_id,relationship_type,relationship_id)values( #{clusterType},#{clusterId},", - "#{relationshipType},#{relationshipId})" - }) - Integer addClusterRelationshipEntry(ClusterRelationshipEntity clusterRelationshipEntity); - - @Update("update cluster_relationship set status = 3 where id = #{id} ") - Integer relieveRelationship(ClusterRelationshipEntity clusterRelationshipEntity); - - @Select({ ""}) + Integer batchEndConnectionById(List connectionEntityList); + @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id") @Insert("INSERT INTO connection (cluster_id, source_type, source_id," + " sink_type, sink_id, runtime_id, status, topic, group_id, description)" + " VALUES ( #{clusterId}, #{sourceType}, #{sourceId}, " + " #{sinkType}, #{sinkId}, #{runtimeId}, 1, #{topic}, #{groupId}, #{description})" + "ON DUPLICATE KEY UPDATE status = 1") - Long insert(ConnectionEntity connectionEntity); + void insert(ConnectionEntity connectionEntity); @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id") @Insert({ @@ -92,18 +104,7 @@ public List selectByClusterIdSinkTypeAndSinkIdAndCreateTimeRan " ", "ON DUPLICATE KEY UPDATE status = 1", ""}) - void batchInsert(List connectionEntityList); + Integer batchInsert(List connectionEntityList); - @Update("UPDATE connection SET status = 1, end_time = NOW() WHERE id = #{id}") - void endConnectionById(ConnectionEntity connectionEntity); - - //batch end - @Update({ - ""}) - void batchEndConnectionById(List connectionEntityList); -} \ No newline at end of file +} diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/cluster/InstanceUserMapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/cluster/InstanceUserMapper.java index e5a838e6..f9d8ff85 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/cluster/InstanceUserMapper.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/cluster/InstanceUserMapper.java @@ -33,17 +33,6 @@ @Mapper public interface InstanceUserMapper { - @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id") - @Insert("INSERT INTO instance_user (id, instance_type, password, cluster_id, name, token, status) " - + "VALUES (#{id}, #{instanceType}, #{password}, #{clusterId}, #{name}, #{token},1)") - void insert(InstanceUserEntity instanceuserEntity); - - @Update("UPDATE instance_user SET status=0 WHERE id=#{clusterId}") - void deleteInstanceUserById(InstanceUserEntity instanceuserEntity); - - @Update("UPDATE instance_user SET password=#{password} WHERE id=#{id}") - void updatePasswordById(InstanceUserEntity instanceuserentity); - @Select("select * from instance_user where status=1") List selectAll(); @@ -53,4 +42,15 @@ public interface InstanceUserMapper { @Select("SELECT * FROM instance_user WHERE name=#{name} AND status=1") List selectByName(InstanceUserEntity instanceuserEntity); + @Update("UPDATE instance_user SET status=0 WHERE id=#{clusterId}") + Integer deleteInstanceUserById(InstanceUserEntity instanceuserEntity); + + @Update("UPDATE instance_user SET password=#{password} WHERE id=#{id}") + Integer updatePasswordById(InstanceUserEntity instanceuserentity); + + @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id") + @Insert("INSERT INTO instance_user (id, instance_type, password, cluster_id, name, token, status) " + + "VALUES (#{id}, #{instanceType}, #{password}, #{clusterId}, #{name}, #{token},1)") + void insert(InstanceUserEntity instanceuserEntity); + } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/cluster/NetConnectionMapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/cluster/NetConnectionMapper.java index e6fea127..865b8954 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/cluster/NetConnectionMapper.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/cluster/NetConnectionMapper.java @@ -28,13 +28,14 @@ * 1. 添加 and 修改。没有控制层接口 * 2. 按照 cluster or runtime id and client(host and port) 查询 * 3. 按照时间进行统计 + * */ @Mapper public interface NetConnectionMapper { + List queryNetConnectionEntityListByFrom(NetConnectionEntity netConnectionEntity); Integer batchInsert(List netConnectionEntityList); - List queryNetConnectionEntityListByFrom(NetConnectionEntity netConnectionEntity); } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/cluster/RuntimeMapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/cluster/RuntimeMapper.java index f27977d3..ed451265 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/cluster/RuntimeMapper.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/cluster/RuntimeMapper.java @@ -35,27 +35,11 @@ public interface RuntimeMapper { @Select("SELECT COUNT(*) FROM runtime WHERE cluster_id=#{clusterId} AND status=1") - Integer getRuntimeNumByCluster(RuntimeEntity runtimeEntity); + Integer selectRuntimeNumByCluster(RuntimeEntity runtimeEntity); @Select("SELECT * FROM runtime WHERE status=1") List selectAll(); - @Insert({ - ""}) - @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id") - void batchInsert(List runtimeEntities); - - @Insert("INSERT INTO runtime (cluster_id, host, storage_cluster_id, port, jmx_port, start_timestamp, rack, status, " - + "endpoint_map) VALUES(#{clusterId},#{host},#{storageClusterId},#{port},#{jmxPort},NOW(),#{rack},#{status},#{endpointMap})" - + " ON DUPLICATE KEY UPDATE status=1,start_timestamp = now()") - @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id") - void addRuntime(RuntimeEntity runtimeEntity); - @Select("select * from runtime where cluster_id=#{clusterid} and status=1") List selectRuntimeByCluster(RuntimeEntity runtimeEntity); @@ -73,18 +57,34 @@ public interface RuntimeMapper { "", "", ""}) - List getRuntimesToFrontByCluster(@Param("runtimeEntity") RuntimeEntity runtimeEntity); + List selectRuntimesToFrontByCluster(@Param("runtimeEntity") RuntimeEntity runtimeEntity); @Select("SELECT * FROM runtime WHERE host = #{host} and port = #{port} and status = 1") List selectByHostPort(RuntimeEntity runtimeEntity); @Update("UPDATE runtime SET port=#{port} ,jmx_port=#{jmxPort} ,status=#{status} WHERE cluster_id=#{clusterId} AND status=1") - void updateRuntimeByCluster(RuntimeEntity runtimeEntity); + Integer updateRuntimeByCluster(RuntimeEntity runtimeEntity); @Update("UPDATE runtime SET status=0 WHERE cluster_id=#{clusterId}") - void deleteRuntimeByCluster(RuntimeEntity runtimeEntity); + Integer deleteRuntimeByCluster(RuntimeEntity runtimeEntity); @Update("UPDATE runtime SET status = 0 WHERE id = #{id}") - void deactivate(RuntimeEntity runtimeEntity); + Integer deactivate(RuntimeEntity runtimeEntity); + + @Insert({ + ""}) + @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id") + Integer batchInsert(List runtimeEntities); + + @Insert("INSERT INTO runtime (cluster_id, host, storage_cluster_id, port, jmx_port, start_timestamp, rack, status, " + + "endpoint_map) VALUES(#{clusterId},#{host},#{storageClusterId},#{port},#{jmxPort},NOW(),#{rack},#{status},#{endpointMap})" + + " ON DUPLICATE KEY UPDATE status=1,start_timestamp = now()") + @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id") + void insertRuntime(RuntimeEntity runtimeEntity); } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/connector/ConnectorMapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/connector/ConnectorMapper.java index 910884fa..1c9d7be1 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/connector/ConnectorMapper.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/connector/ConnectorMapper.java @@ -45,38 +45,20 @@ public interface ConnectorMapper { @Select("SELECT * FROM connector WHERE host = #{host} AND port = #{port} AND status=1") List selectByHostAndPort(ConnectorEntity connectorEntity); - @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id") - @Insert("INSERT INTO connector (cluster_id,name, class_name, type, status, pod_state, config_ids, host, port) " - + "VALUES (#{clusterId}, #{name}, #{className}, #{type}, #{status}, #{podState}, #{configIds}, #{host}, #{port})" - + "ON DUPLICATE KEY UPDATE status = 1, pod_state = #{podState}, config_ids = #{configIds}, host = #{host}, port = #{port}") - Long insert(ConnectorEntity connectorEntity); - - @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id") - @Insert({ - ""}) - void batchInsert(List connectorEntityList); - @Update("UPDATE connector SET status = 1 WHERE id = #{id}") - void active(ConnectorEntity connectorEntity); + Integer active(ConnectorEntity connectorEntity); @Update("UPDATE connector SET status = 0 WHERE id = #{id}") - void deActive(ConnectorEntity connectorEntity); + Integer deActive(ConnectorEntity connectorEntity); @Update("UPDATE connector SET pod_state = #{podState} WHERE id = #{id}") - void updatePodState(ConnectorEntity connectorEntity); + Integer updatePodState(ConnectorEntity connectorEntity); @Update("UPDATE connector SET config_ids = #{configIds} WHERE id = #{id}") - void updateConfigIds(ConnectorEntity connectorEntity); + Integer updateConfigIds(ConnectorEntity connectorEntity); @Update("UPDATE connector SET status = 0 WHERE cluster_id = #{clusterId}") - void deactivateByClusterId(ConnectorEntity connectorEntity); + Integer deactivateByClusterId(ConnectorEntity connectorEntity); @Update({ "" }) - void batchDeactivate(List connectorEntities); + Integer batchDeactivate(List connectorEntities); + + @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id") + @Insert("INSERT INTO connector (cluster_id,name, class_name, type, status, pod_state, config_ids, host, port) " + + "VALUES (#{clusterId}, #{name}, #{className}, #{type}, #{status}, #{podState}, #{configIds}, #{host}, #{port})" + + "ON DUPLICATE KEY UPDATE status = 1, pod_state = #{podState}, config_ids = #{configIds}, host = #{host}, port = #{port}") + void insert(ConnectorEntity connectorEntity); + + @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id") + @Insert({ + ""}) + Integer batchInsert(List connectorEntityList); + } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/function/ConfigMapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/function/ConfigMapper.java index 85f6bcf2..119c5aea 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/function/ConfigMapper.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/function/ConfigMapper.java @@ -49,7 +49,7 @@ public interface ConfigMapper { "", "", ""}) - List getConfigsToFrontWithDynamic(ConfigEntity configEntity); + List selectConfigsToFrontWithDynamic(ConfigEntity configEntity); @Select("SELECT * FROM config WHERE business_type=#{businessType} AND is_default=1") List selectConnectorConfigsByBusinessType(ConfigEntity configEntity); @@ -57,13 +57,32 @@ public interface ConfigMapper { @Select("SELECT DISTINCT business_type FROM config WHERE instance_type=2 AND is_default=1 AND business_type LIKE CONCAT('%',#{businessType},'%')") List selectConnectorBusinessType(ConfigEntity configEntity); - @Select("SELECT * FROM config WHERE status=1 AND is_default=0") List selectAll(); @Select("SELECT * FROM config WHERE instance_type=#{instanceType} AND instance_id=#{instanceId}") List selectConfigsByInstance(ConfigEntity configEntity); + @Select("SELECT * FROM config WHERE instance_type=#{instanceType} AND instance_id=#{instanceId} AND is_default=0") + List selectByInstanceId(ConfigEntity configEntity); + + @Select("SELECT * FROM config WHERE cluster_id=-1 AND business_type=#{businessType} AND instance_type=#{instanceType} AND is_default=1") + List selectDefaultConfig(ConfigEntity configEntity); + + @Select("SELECT * FROM config WHERE is_default=1") + List selectAllDefaultConfig(); + + @Select("SELECT * FROM config WHERE cluster_id=#{clusterId} AND instance_type=#{instanceType} " + + "AND instance_id=#{instanceId} AND config_name=#{configName} AND status=1") + ConfigEntity selectByUnique(ConfigEntity configEntity); + + @Update("UPDATE config SET status=0 WHERE id=#{id}") + Integer deleteConfig(ConfigEntity configEntity); + + @Update("UPDATE config SET config_value=#{configValue} ,already_update=#{alreadyUpdate} WHERE instance_type=#{instanceType} AND" + + " instance_id=#{instanceId} AND config_name=#{configName} AND is_default=0") + Integer updateConfig(ConfigEntity configEntity); + @Insert({ ""}) @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id") - void batchInsert(List configEntityList); + Integer batchInsert(List configEntityList); @Insert("INSERT INTO config (cluster_id, business_type, instance_type, instance_id, config_name, config_value, " + "status, is_default, diff_type, description, edit, is_modify,start_version," @@ -84,25 +103,6 @@ public interface ConfigMapper { + "#{configValue},#{status},#{isDefault},#{diffType},#{description},#{edit},#{isModify}," + "#{startVersion},#{eventmeshVersion},#{endVersion})") @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id") - Integer addConfig(ConfigEntity configEntity); - - @Update("UPDATE config SET status=0 WHERE id=#{id}") - Integer deleteConfig(ConfigEntity configEntity); - - @Update("UPDATE config SET config_value=#{configValue} ,already_update=#{alreadyUpdate} WHERE instance_type=#{instanceType} AND" - + " instance_id=#{instanceId} AND config_name=#{configName} AND is_default=0") - void updateConfig(ConfigEntity configEntity); - - @Select("SELECT * FROM config WHERE instance_type=#{instanceType} AND instance_id=#{instanceId} AND is_default=0") - List selectByInstanceId(ConfigEntity configEntity); + void insertConfig(ConfigEntity configEntity); - @Select("SELECT * FROM config WHERE cluster_id=-1 AND business_type=#{businessType} AND instance_type=#{instanceType} AND is_default=1") - List selectDefaultConfig(ConfigEntity configEntity); - - @Select("SELECT * FROM config WHERE is_default=1") - List selectAllDefaultConfig(); - - @Select("SELECT * FROM config WHERE cluster_id=#{clusterId} AND instance_type=#{instanceType} " - + "AND instance_id=#{instanceId} AND config_name=#{configName} AND status=1") - ConfigEntity selectByUnique(ConfigEntity configEntity); } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/function/HealthCheckResultMapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/function/HealthCheckResultMapper.java index c5c80ff8..bdb15875 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/function/HealthCheckResultMapper.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/function/HealthCheckResultMapper.java @@ -54,6 +54,38 @@ public interface HealthCheckResultMapper { List selectByClusterIdAndCreateTimeRange(@Param("clusterId") Long clusterId, @Param("startTime") Timestamp startTime, @Param("endTime") Timestamp endTime); + @Select({ + "" + }) + List selectIdsNeedToBeUpdateByClusterIdAndTypeAndTypeId(List healthCheckResultEntityList); + + @Update("UPDATE health_check_result SET state = #{state}, result_desc = #{resultDesc} WHERE id = #{id}") + Integer update(HealthCheckResultEntity healthCheckResultEntity); + + @Update({ + ""}) + Integer batchUpdate(List healthCheckResultEntityList); + + /** + * TODO 未同步修改调用方法^ + * @param healthCheckResultEntity + */ + @Options(useGeneratedKeys = true, keyProperty = "id") @Insert("INSERT INTO health_check_result(type,type_id, cluster_id, state,result_desc)" + " VALUES( #{type}, #{typeId}, #{clusterId}, #{state}, #{resultDesc})") @@ -74,7 +106,7 @@ List selectByClusterIdAndCreateTimeRange(@Param("cluste " ", "" }) - void batchInsert(List healthCheckResultEntityList); + Integer batchInsert(List healthCheckResultEntityList); @Insert({ "" }) - void insertNewChecks(List healthCheckResultEntityList); - - @Update("UPDATE health_check_result SET state = #{state}, result_desc = #{resultDesc} WHERE id = #{id}") - void update(HealthCheckResultEntity healthCheckResultEntity); - - @Update({ - ""}) - void batchUpdate(List healthCheckResultEntityList); + Integer insertNewChecks(List healthCheckResultEntityList); - @Select({ - "" - }) - List getIdsNeedToBeUpdateByClusterIdAndTypeAndTypeId(List healthCheckResultEntityList); } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/function/OprLogMapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/function/OprLogMapper.java index bb784e75..6452a48b 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/function/OprLogMapper.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/function/OprLogMapper.java @@ -49,15 +49,7 @@ public interface OprLogMapper { " AND is_delete=0", " ", ""}) - List getLogList(LogEntity logEntity); - - @Insert("INSERT INTO operation_log ( cluster_id, operation_type,target_type, content,operation_user,result)" - + "VALUE (#{clusterId},#{operationType},#{targetType},#{content},#{operationUser},#{result})") - @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id") - Long addLog(LogEntity logEntity); - - @Update("UPDATE operation_log SET state=#{state} ,result=#{result} WHERE id=#{id}") - Integer updateLog(LogEntity logEntity); + List selectLogList(LogEntity logEntity); @Select({ "" }) - List getLogListToFront(LogEntity logEntity); + List selectLogListToFront(LogEntity logEntity); + + @Update("UPDATE operation_log SET state=#{state} ,result=#{result} WHERE id=#{id}") + Integer updateLog(LogEntity logEntity); + + @Insert("INSERT INTO operation_log ( cluster_id, operation_type,target_type, content,operation_user,result)" + + "VALUE (#{clusterId},#{operationType},#{targetType},#{content},#{operationUser},#{result})") + @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id") + void insertLog(LogEntity logEntity); + } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/message/OprGroupMapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/message/OprGroupMapper.java index f2eca1c3..ae196ecf 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/message/OprGroupMapper.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/message/OprGroupMapper.java @@ -38,21 +38,12 @@ public interface OprGroupMapper { @Select("SELECT COUNT(*) FROM `group` WHERE cluster_id=#{clusterId} AND type=0") - Integer getConsumerNumByCluster(GroupEntity groupEntity); + Integer selectConsumerNumByCluster(GroupEntity groupEntity); @Select("SELECT * FROM `group` WHERE status=1") List selectAll(); - @Update("UPDATE `group` SET member_count=#{memberCount}," - + "members=#{members},type=#{type},state=#{state} WHERE id=#{id}") - @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id") - Integer updateGroup(GroupEntity groupEntity); - - @Update("UPDATE `group` SET status=1 WHERE id=#{id}") - @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id") - Integer deleteGroup(GroupEntity groupEntity); - @Select("SELECT * FROM `group` WHERE cluster_id=#{clusterId} AND name=#{name} AND status=1") GroupEntity selectGroupByUnique(GroupEntity groupEntity); @@ -74,6 +65,15 @@ public interface OprGroupMapper { ""}) List selectGroup(GroupEntity groupEntity); + @Update("UPDATE `group` SET member_count=#{memberCount}," + + "members=#{members},type=#{type},state=#{state} WHERE id=#{id}") + @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id") + Integer updateGroup(GroupEntity groupEntity); + + @Update("UPDATE `group` SET status=1 WHERE id=#{id}") + @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id") + Integer deleteGroup(GroupEntity groupEntity); + @Insert({ ""}) @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id") - void batchInsert(List groupEntities); + Integer batchInsert(List groupEntities); @Insert("INSERT INTO `group` (cluster_id, name, member_count, members, type, state)" + "VALUE (#{clusterId},#{name},#{memberCount},#{members},#{type},#{state}) " + "ON DUPLICATE KEY UPDATE status=1") @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id") - void addGroup(GroupEntity groupEntity); + void insertGroup(GroupEntity groupEntity); } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/message/OprGroupMemberMapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/message/OprGroupMemberMapper.java index 0acba5dd..79f6b1a2 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/message/OprGroupMemberMapper.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/message/OprGroupMemberMapper.java @@ -44,33 +44,6 @@ public interface OprGroupMemberMapper { @Select("SELECT * FROM group_member WHERE status=1") List selectAll(); - @Insert({ - ""}) - @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id") - void batchInsert(List groupMemberEntities); - - @Select("SELECT * FROM group_member WHERE cluster_id=#{clusterId} AND status=1") - List getGroupByClusterId(GroupMemberEntity groupMemberEntity); - - @Insert("INSERT INTO group_member (cluster_id, topic_name, group_name, eventmesh_user,state)" - + " VALUE (#{clusterId},#{topicName},#{groupName},#{eventMeshUser},#{state})" - + "ON DUPLICATE KEY UPDATE status=0") - @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id") - void addGroupMember(GroupMemberEntity groupMemberEntity); - - @Update("UPDATE group_member SET state=#{state} WHERE id=#{id}") - @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id") - void updateGroupMember(GroupMemberEntity groupMemberEntity); - - @Update("UPDATE group_member SET status=0 WHERE id=#{id} ") - @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id") - GroupMemberEntity deleteGroupMember(GroupMemberEntity groupMemberEntity); - @Select("SELECT * FROM group_member WHERE cluster_id=#{clusterId} AND group_name=#{groupName} AND topic_name=#{topicName} AND status=1") GroupMemberEntity selectGroupMemberByUnique(GroupMemberEntity groupMemberEntity); @@ -95,6 +68,35 @@ public interface OprGroupMemberMapper { ""}) List selectMember(GroupMemberEntity groupMemberEntity); + @Select("SELECT * FROM group_member WHERE cluster_id=#{clusterId} AND status=1") + List selectGroupByClusterId(GroupMemberEntity groupMemberEntity); + + @Update("UPDATE group_member SET state=#{state} WHERE id=#{id}") + @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id") + Integer updateGroupMember(GroupMemberEntity groupMemberEntity); + + @Update("UPDATE group_member SET status=0 WHERE id=#{id} ") + @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id") + Integer deleteGroupMember(GroupMemberEntity groupMemberEntity); + @Update("UPDATE group_member SET state=#{state} WHERE topic_name=#{topicName}") - void updateMemberByTopic(GroupMemberEntity groupMemberEntity); -} \ No newline at end of file + Integer updateMemberByTopic(GroupMemberEntity groupMemberEntity); + + @Insert({ + ""}) + @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id") + Integer batchInsert(List groupMemberEntities); + + @Insert("INSERT INTO group_member (cluster_id, topic_name, group_name, eventmesh_user,state)" + + " VALUE (#{clusterId},#{topicName},#{groupName},#{eventMeshUser},#{state})" + + "ON DUPLICATE KEY UPDATE status=0") + @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id") + void insertGroupMember(GroupMemberEntity groupMemberEntity); + + +} diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/message/TopicMapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/message/TopicMapper.java index fd17db2c..5a98d9bc 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/message/TopicMapper.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/message/TopicMapper.java @@ -51,23 +51,20 @@ public interface TopicMapper { ""}) List queryTopicsToFrontByClusterId(@Param("topicEntity") TopicEntity topicEntity); - @Select("SELECT * FROM topic WHERE cluster_id=#{clusterId} and status = 1") List selectTopicByCluster(TopicEntity topicEntity); - @Select("SELECT * FROM topic WHERE status=1") List selectAll(); @Select("SELECT * FROM topic WHERE id=#{id}") TopicEntity selectTopicById(TopicEntity topicEntity); - @Update("UPDATE topic SET type=#{type},description=#{description} WHERE id=#{id}") - void updateTopic(TopicEntity topicEntity); + Integer updateTopic(TopicEntity topicEntity); @Update("UPDATE topic SET create_progress=#{createProgress} WHERE id=#{id}") - void updateTopicCreateProgress(TopicEntity topicEntity); + Integer updateTopicCreateProgress(TopicEntity topicEntity); @Update("UPDATE `topic` SET status=0 WHERE id=#{id}") Integer deleteTopic(TopicEntity topicEntity); @@ -86,6 +83,6 @@ public interface TopicMapper { + "VALUE (#{clusterId},#{topicName},#{storageId},#{retentionMs},#{type},#{description},#{createProgress})" + "ON DUPLICATE KEY UPDATE status = 1") @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id") - void addTopic(TopicEntity topicEntity); + void insertTopic(TopicEntity topicEntity); -} \ No newline at end of file +} diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/storage/StoreMapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/storage/StoreMapper.java index ede3d0d9..9aaa07c3 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/storage/StoreMapper.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/storage/StoreMapper.java @@ -42,6 +42,18 @@ public interface StoreMapper { @Select("SELECT * FROM store WHERE host=#{host} AND port=#{port} AND status=1 LIMIT 1") StoreEntity selectByHostPort(StoreEntity storeEntity); + @Select("SELECT * FROM store WHERE cluster_id=#{clusterId} AND status=1") + StoreEntity selectStoreByCluster(StoreEntity storeEntity); + + @Update("UPDATE store SET status=0 WHERE cluster_id=#{clusterId} AND store_id=#{storeId}") + Integer deleteStoreByUnique(StoreEntity storeEntity); + + @Update("UPDATE store SET status=#{status} WHERE cluster_id=#{clusterId} AND store_id=#{storeId}") + Integer updateStoreByUnique(StoreEntity storeEntity); + + @Update("UPDATE store SET topic_list=#{topicList} WHERE cluster_id=#{clusterId}") + Integer updateTopicListByCluster(StoreEntity storeEntity); + @Insert({ ""}) @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id") - void batchInsert(List storeEntities); + Integer batchInsert(List storeEntities); @Insert("INSERT INTO store (cluster_id, store_id, store_type, host, runtime_id, topic_list, diff_type" + ", port, jmx_port, start_timestamp, rack, status, endpoint_map ) VALUES (" + "#{clusterId},#{storeId},#{storeType},#{host},#{runtimeId},#{topicList},#{diffType},#{port},#{jmxPort}" + ",#{startTimestamp},#{rack},#{status},#{endpointMap})") @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id") - void addStore(StoreEntity storeEntity); + void insertStore(StoreEntity storeEntity); - @Update("UPDATE store SET status=0 WHERE cluster_id=#{clusterId} AND store_id=#{storeId}") - void deleteStoreByUnique(StoreEntity storeEntity); - - @Select("SELECT * FROM store WHERE cluster_id=#{clusterId} AND status=1") - StoreEntity selectStoreByCluster(StoreEntity storeEntity); - - @Update("UPDATE store SET status=#{status} WHERE cluster_id=#{clusterId} AND store_id=#{storeId}") - void updateStoreByUnique(StoreEntity storeEntity); - - @Update("UPDATE store SET topic_list=#{topicList} WHERE cluster_id=#{clusterId}") - void updateTopicListByCluster(StoreEntity storeEntity); } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/ClientDataService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/ClientDataService.java index e5739446..eb555456 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/ClientDataService.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/ClientDataService.java @@ -26,13 +26,13 @@ */ public interface ClientDataService { - void deActive(ClientEntity clientEntity); + Integer deActive(ClientEntity clientEntity); - void deActiveByHostPort(ClientEntity clientEntity); + Integer deActiveByHostPort(ClientEntity clientEntity); - Long addClient(ClientEntity clientEntity); + void insertClient(ClientEntity clientEntity); - void batchInsert(List clientEntityList); + Integer batchInsert(List clientEntityList); List selectByHostPort(ClientEntity clientEntity); diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/ClusterRelationshipService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/ClusterRelationshipService.java index 9f81f132..18c2cb2d 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/ClusterRelationshipService.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/ClusterRelationshipService.java @@ -28,7 +28,7 @@ public interface ClusterRelationshipService { - Integer addClusterRelationshipEntry(ClusterRelationshipEntity clusterRelationshipEntity); + void insertClusterRelationshipEntry(ClusterRelationshipEntity clusterRelationshipEntity); Integer relieveRelationship(ClusterRelationshipEntity clusterRelationshipEntity); diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/ClusterService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/ClusterService.java index a3e00b6b..0c5cf67e 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/ClusterService.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/ClusterService.java @@ -32,7 +32,7 @@ public interface ClusterService { void createCluster(ClusterEntity clusterEntity); - GetClusterBaseMessageVO getClusterBaseMessage(ClusterIdDTO clusterIdDTO); + GetClusterBaseMessageVO selectClusterBaseMessage(ClusterIdDTO clusterIdDTO); Map queryHomeClusterData(ClusterIdDTO clusterIdDTO); @@ -43,7 +43,7 @@ public interface ClusterService { List selectNewlyIncreased(ClusterEntity clusterEntity); - void addCluster(ClusterEntity cluster); + void insertCluster(ClusterEntity cluster); List selectAllCluster(); diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/ConnectionDataService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/ConnectionDataService.java index b1f159e6..5db26c96 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/ConnectionDataService.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/ConnectionDataService.java @@ -26,9 +26,12 @@ import java.util.List; +import org.springframework.stereotype.Service; + /** * Service providing ConnectionEntity data. */ +@Service public interface ConnectionDataService { ConnectorEntity getConnectorById(Long connectorId); diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/RuntimeService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/RuntimeService.java index ff7f4f62..d8011542 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/RuntimeService.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/RuntimeService.java @@ -29,9 +29,9 @@ public interface RuntimeService { RuntimeEntity queryRuntimeEntityById(RuntimeEntity runtimeEntity); - List getRuntimeToFrontByClusterId(RuntimeEntity runtimeEntity); + List selectRuntimeToFrontByClusterId(RuntimeEntity runtimeEntity); - void batchInsert(List runtimeEntities); + Integer batchInsert(List runtimeEntities); List selectAll(); @@ -39,9 +39,9 @@ public interface RuntimeService { void insertRuntime(RuntimeEntity runtimeEntity); - void updateRuntimeByCluster(RuntimeEntity runtimeEntity); + Integer updateRuntimeByCluster(RuntimeEntity runtimeEntity); - void deleteRuntimeByCluster(RuntimeEntity runtimeEntity); + Integer deleteRuntimeByCluster(RuntimeEntity runtimeEntity); - void deactivate(RuntimeEntity runtimeEntity); + Integer deactivate(RuntimeEntity runtimeEntity); } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/impl/ClientDataServiceImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/impl/ClientDataServiceImpl.java index 7e375ab2..c5f64fcc 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/impl/ClientDataServiceImpl.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/impl/ClientDataServiceImpl.java @@ -33,23 +33,24 @@ public class ClientDataServiceImpl implements ClientDataService { private ClientMapper clientMapper; @Override - public void deActive(ClientEntity clientEntity) { - clientMapper.deactivate(clientEntity); + public Integer deActive(ClientEntity clientEntity) { + return clientMapper.deactivate(clientEntity); } @Override - public void deActiveByHostPort(ClientEntity clientEntity) { - clientMapper.deActiveByHostPort(clientEntity); + public Integer deActiveByHostPort(ClientEntity clientEntity) { + return clientMapper.deActiveByHostPort(clientEntity); } + @SuppressWarnings("checkstyle:Indentation") @Override - public Long addClient(ClientEntity clientEntity) { - return clientMapper.insert(clientEntity); + public void insertClient(ClientEntity clientEntity) { + clientMapper.insert(clientEntity); } @Override - public void batchInsert(List clientEntityList) { - clientMapper.batchInsert(clientEntityList); + public Integer batchInsert(List clientEntityList) { + return clientMapper.batchInsert(clientEntityList); } @Override diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/impl/ClusterRelationshipServiceImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/impl/ClusterRelationshipServiceImpl.java index 44cb33d6..171cafea 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/impl/ClusterRelationshipServiceImpl.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/impl/ClusterRelationshipServiceImpl.java @@ -34,8 +34,8 @@ public class ClusterRelationshipServiceImpl implements ClusterRelationshipServic private ClusterRelationshipMapper clusterRelationshipMapper; @Override - public Integer addClusterRelationshipEntry(ClusterRelationshipEntity clusterRelationshipEntity) { - return this.clusterRelationshipMapper.addClusterRelationshipEntry(clusterRelationshipEntity); + public void insertClusterRelationshipEntry(ClusterRelationshipEntity clusterRelationshipEntity) { + this.clusterRelationshipMapper.insertClusterRelationshipEntry(clusterRelationshipEntity); } @Override diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/impl/ClusterServiceImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/impl/ClusterServiceImpl.java index abcc6d9b..5b4f8421 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/impl/ClusterServiceImpl.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/impl/ClusterServiceImpl.java @@ -65,7 +65,7 @@ public void createCluster(ClusterEntity clusterEntity) { } @Override - public GetClusterBaseMessageVO getClusterBaseMessage(ClusterIdDTO clusterIdDTO) { + public GetClusterBaseMessageVO selectClusterBaseMessage(ClusterIdDTO clusterIdDTO) { Long clusterId = clusterIdDTO.getClusterId(); GetClusterBaseMessageVO getClusterBaseMessageVO = new GetClusterBaseMessageVO(); TopicEntity topicEntity = new TopicEntity(); @@ -73,13 +73,13 @@ public GetClusterBaseMessageVO getClusterBaseMessage(ClusterIdDTO clusterIdDTO) getClusterBaseMessageVO.setTopicNum(topicMapper.selectTopicNumByCluster(topicEntity)); GroupEntity groupEntity = new GroupEntity(); groupEntity.setClusterId(clusterId); - getClusterBaseMessageVO.setConsumerGroupNum(oprGroupMapper.getConsumerNumByCluster(groupEntity)); + getClusterBaseMessageVO.setConsumerGroupNum(oprGroupMapper.selectConsumerNumByCluster(groupEntity)); ConnectionEntity connectionEntity = new ConnectionEntity(); connectionEntity.setClusterId(clusterId); getClusterBaseMessageVO.setConnectionNum(connectionMapper.selectConnectionNumByCluster(connectionEntity)); RuntimeEntity runtimeEntity = new RuntimeEntity(); runtimeEntity.setClusterId(clusterId); - getClusterBaseMessageVO.setRuntimeNum(runtimeMapper.getRuntimeNumByCluster(runtimeEntity)); + getClusterBaseMessageVO.setRuntimeNum(runtimeMapper.selectRuntimeNumByCluster(runtimeEntity)); return getClusterBaseMessageVO; } @@ -105,7 +105,7 @@ public List selectNewlyIncreased(ClusterEntity clusterEntity) { } @Override - public void addCluster(ClusterEntity cluster) { + public void insertCluster(ClusterEntity cluster) { clusterMapper.insertCluster(cluster); } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/impl/RuntimeServiceImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/impl/RuntimeServiceImpl.java index 68dc66a9..d414d137 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/impl/RuntimeServiceImpl.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/impl/RuntimeServiceImpl.java @@ -45,8 +45,8 @@ public RuntimeEntity queryRuntimeEntityById(RuntimeEntity runtimeEntity) { } @Override - public List getRuntimeToFrontByClusterId(RuntimeEntity runtimeEntity) { - List runtimeByClusterId = runtimeMapper.getRuntimesToFrontByCluster(runtimeEntity); + public List selectRuntimeToFrontByClusterId(RuntimeEntity runtimeEntity) { + List runtimeByClusterId = runtimeMapper.selectRuntimesToFrontByCluster(runtimeEntity); runtimeByClusterId.forEach(n -> { n.setStatus(CheckResultCache.getINSTANCE().getLastHealthyCheckResult("runtime", n.getId())); }); @@ -55,8 +55,8 @@ public List getRuntimeToFrontByClusterId(RuntimeEntity runtimeEnt @Override - public void batchInsert(List runtimeEntities) { - runtimeMapper.batchInsert(runtimeEntities); + public Integer batchInsert(List runtimeEntities) { + return runtimeMapper.batchInsert(runtimeEntities); } @Override @@ -71,21 +71,21 @@ public List selectByHostPort(RuntimeEntity runtimeEntity) { @Override public void insertRuntime(RuntimeEntity runtimeEntity) { - runtimeMapper.addRuntime(runtimeEntity); + runtimeMapper.insertRuntime(runtimeEntity); } @Override - public void updateRuntimeByCluster(RuntimeEntity runtimeEntity) { - runtimeMapper.updateRuntimeByCluster(runtimeEntity); + public Integer updateRuntimeByCluster(RuntimeEntity runtimeEntity) { + return runtimeMapper.updateRuntimeByCluster(runtimeEntity); } @Override - public void deleteRuntimeByCluster(RuntimeEntity runtimeEntity) { - runtimeMapper.deleteRuntimeByCluster(runtimeEntity); + public Integer deleteRuntimeByCluster(RuntimeEntity runtimeEntity) { + return runtimeMapper.deleteRuntimeByCluster(runtimeEntity); } @Override - public void deactivate(RuntimeEntity runtimeEntity) { - runtimeMapper.deactivate(runtimeEntity); + public Integer deactivate(RuntimeEntity runtimeEntity) { + return runtimeMapper.deactivate(runtimeEntity); } } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/ConfigService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/ConfigService.java index 9f9e126c..9f3ca75e 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/ConfigService.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/ConfigService.java @@ -37,11 +37,11 @@ public interface ConfigService { List selectAll(); - void batchInsert(List configEntityList); + Integer batchInsert(List configEntityList); String mapToYaml(Map stringMap); - Integer addConfig(ConfigEntity configEntity); + void insertConfig(ConfigEntity configEntity); Integer deleteConfig(ConfigEntity configEntity); diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/HealthDataService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/HealthDataService.java index 7469482c..2b7f370a 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/HealthDataService.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/HealthDataService.java @@ -29,24 +29,24 @@ */ public interface HealthDataService { - InstanceLiveProportionVo getInstanceLiveProportion(Long clusterId, Integer instanceType); + InstanceLiveProportionVo selectInstanceLiveProportion(Long clusterId, Integer instanceType); - List getInstanceLiveStatusHistory(Integer type, Long clusterId, LocalDateTime startTime); + List selectInstanceLiveStatusHistory(Integer type, Long clusterId, LocalDateTime startTime); HealthCheckResultEntity insertHealthCheckResult(HealthCheckResultEntity healthCheckResultEntity); - void batchInsertHealthCheckResult(List healthCheckResultEntityList); + Integer batchInsertHealthCheckResult(List healthCheckResultEntityList); /** * New check results have state 4: SDK client not created or connected */ - void batchInsertNewCheckResult(List healthCheckResultEntityList); + Integer batchInsertNewCheckResult(List healthCheckResultEntityList); List selectAll(); List queryHealthCheckResultByClusterIdAndTypeAndTypeId(HealthCheckResultEntity entity); - void batchUpdateCheckResult(List healthCheckResultEntityList); + Integer batchUpdateCheckResult(List healthCheckResultEntityList); void batchUpdateCheckResultByClusterIdAndTypeAndTypeId(List healthCheckResultEntityList); diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/Impl/ConfigServiceImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/Impl/ConfigServiceImpl.java index 90236d4a..d33af230 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/Impl/ConfigServiceImpl.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/Impl/ConfigServiceImpl.java @@ -131,8 +131,8 @@ public List selectAll() { } @Override - public void batchInsert(List configEntityList) { - configMapper.batchInsert(configEntityList); + public Integer batchInsert(List configEntityList) { + return configMapper.batchInsert(configEntityList); } @Override @@ -164,8 +164,8 @@ public Map propertiesToMap(String configProperties) { } @Override - public Integer addConfig(ConfigEntity configEntity) { - return configMapper.addConfig(configEntity); + public void insertConfig(ConfigEntity configEntity) { + configMapper.insertConfig(configEntity); } @Override @@ -181,7 +181,7 @@ public List selectByInstanceIdAndType(Long instanceId, Integer typ return configMapper.selectByInstanceId(config); } - public ConfigEntity setSearchCriteria(GetConfigsListDTO getConfigsListDTO, ConfigEntity configEntity) { + public ConfigEntity buildSearchCriteria(GetConfigsListDTO getConfigsListDTO, ConfigEntity configEntity) { if (getConfigsListDTO != null) { if (getConfigsListDTO.getConfigName() != null) { configEntity.setConfigName(getConfigsListDTO.getConfigName()); @@ -201,11 +201,11 @@ public List selectToFront(Long instanceId, Integer type, GetConfig ConfigEntity config = new ConfigEntity(); config.setInstanceId(instanceId); config.setInstanceType(type); - config = this.setSearchCriteria(getConfigsListDTO, config); - return configMapper.getConfigsToFrontWithDynamic(config); + config = this.buildSearchCriteria(getConfigsListDTO, config); + return configMapper.selectConfigsToFrontWithDynamic(config); } - public void addDefaultConfigToCache() { + public void insertDefaultConfigToCache() { List configEntityList = configMapper.selectAllDefaultConfig(); configEntityList.forEach(n -> { DefaultConfigKey defaultConfigKey = new DefaultConfigKey(n.getBusinessType(), n.getConfigName()); @@ -217,7 +217,7 @@ public void addDefaultConfigToCache() { @Override public Map selectDefaultConfig(String businessType, Long instanceId, Integer instanceType) { if (defaultConfigCache.size() == 0) { - this.addDefaultConfigToCache(); + this.insertDefaultConfigToCache(); } ConcurrentHashMap stringStringConcurrentHashMap = new ConcurrentHashMap<>(); defaultConfigCache.forEach((k, v) -> { diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/Impl/HealthDataServiceDatabaseImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/Impl/HealthDataServiceDatabaseImpl.java index 03a36cae..89d20f3d 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/Impl/HealthDataServiceDatabaseImpl.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/Impl/HealthDataServiceDatabaseImpl.java @@ -48,14 +48,14 @@ public class HealthDataServiceDatabaseImpl implements HealthDataService { @Override - public InstanceLiveProportionVo getInstanceLiveProportion(Long clusterId, Integer instanceType) { + public InstanceLiveProportionVo selectInstanceLiveProportion(Long clusterId, Integer instanceType) { InstanceLiveProportionVo instanceLiveProportionVo = new InstanceLiveProportionVo(); switch (instanceType) { case 2: - instanceLiveProportionVo = this.getRuntimeLiveProportion(clusterId); + instanceLiveProportionVo = this.selectRuntimeLiveProportion(clusterId); break; case 3: - instanceLiveProportionVo = this.getTopicLiveProportion(clusterId); + instanceLiveProportionVo = this.selectTopicLiveProportion(clusterId); break; default: break; @@ -63,7 +63,7 @@ public InstanceLiveProportionVo getInstanceLiveProportion(Long clusterId, Intege return instanceLiveProportionVo; } - public InstanceLiveProportionVo getTopicLiveProportion(Long clusterId) { + public InstanceLiveProportionVo selectTopicLiveProportion(Long clusterId) { TopicEntity topicEntity = new TopicEntity(); topicEntity.setClusterId(clusterId); Integer topicNum = topicMapper.selectTopicNumByCluster(topicEntity); @@ -78,10 +78,10 @@ public InstanceLiveProportionVo getTopicLiveProportion(Long clusterId) { } - public InstanceLiveProportionVo getRuntimeLiveProportion(Long clusterId) { + public InstanceLiveProportionVo selectRuntimeLiveProportion(Long clusterId) { RuntimeEntity runtimeEntity = new RuntimeEntity(); runtimeEntity.setClusterId(clusterId); - Integer topicNum = runtimeMapper.getRuntimeNumByCluster(runtimeEntity); + Integer topicNum = runtimeMapper.selectRuntimeNumByCluster(runtimeEntity); List runtimeEntities = runtimeMapper.selectRuntimeByCluster(runtimeEntity); int abnormalNum = 0; for (RuntimeEntity n : runtimeEntities) { @@ -94,7 +94,7 @@ public InstanceLiveProportionVo getRuntimeLiveProportion(Long clusterId) { @Override - public List getInstanceLiveStatusHistory(Integer type, Long instanceId, LocalDateTime startTime) { + public List selectInstanceLiveStatusHistory(Integer type, Long instanceId, LocalDateTime startTime) { HealthCheckResultEntity healthCheckResultEntity = new HealthCheckResultEntity(); healthCheckResultEntity.setType(type); healthCheckResultEntity.setTypeId(instanceId); @@ -109,19 +109,19 @@ public HealthCheckResultEntity insertHealthCheckResult(HealthCheckResultEntity h } @Override - public void batchInsertHealthCheckResult(List healthCheckResultEntityList) { + public Integer batchInsertHealthCheckResult(List healthCheckResultEntityList) { if (healthCheckResultEntityList.isEmpty()) { - return; + return 0; } - healthCheckResultMapper.batchInsert(healthCheckResultEntityList); + return healthCheckResultMapper.batchInsert(healthCheckResultEntityList); } @Override - public void batchInsertNewCheckResult(List healthCheckResultEntityList) { + public Integer batchInsertNewCheckResult(List healthCheckResultEntityList) { if (healthCheckResultEntityList.isEmpty()) { - return; + return 0; } - healthCheckResultMapper.insertNewChecks(healthCheckResultEntityList); + return healthCheckResultMapper.insertNewChecks(healthCheckResultEntityList); } @Override @@ -135,8 +135,8 @@ public List queryHealthCheckResultByClusterIdAndTypeAnd } @Override - public void batchUpdateCheckResult(List healthCheckResultEntityList) { - healthCheckResultMapper.batchUpdate(healthCheckResultEntityList); + public Integer batchUpdateCheckResult(List healthCheckResultEntityList) { + return healthCheckResultMapper.batchUpdate(healthCheckResultEntityList); } @Override @@ -144,7 +144,7 @@ public void batchUpdateCheckResultByClusterIdAndTypeAndTypeId(List entitiesNeedToBeUpdate = healthCheckResultMapper.getIdsNeedToBeUpdateByClusterIdAndTypeAndTypeId( + List entitiesNeedToBeUpdate = healthCheckResultMapper.selectIdsNeedToBeUpdateByClusterIdAndTypeAndTypeId( healthCheckResultEntityList); if (entitiesNeedToBeUpdate.isEmpty()) { return; diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/Impl/LogServiceImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/Impl/LogServiceImpl.java index 7e0f2cf1..14a87bee 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/Impl/LogServiceImpl.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/Impl/LogServiceImpl.java @@ -34,20 +34,20 @@ public class LogServiceImpl implements LogService { OprLogMapper oprLogMapper; @Override - public List getLogListByCluster(GetLogListDTO getLogListDTO) { + public List selectLogListByCluster(GetLogListDTO getLogListDTO) { LogEntity logEntity = new LogEntity(); logEntity.setClusterId(getLogListDTO.getClusterId()); logEntity.setTargetType(getLogListDTO.getTargetType()); logEntity.setOperationType(getLogListDTO.getOperationType()); logEntity.setState(getLogListDTO.getState()); logEntity.setOperationUser(getLogListDTO.getOperationUser()); - return oprLogMapper.getLogListToFront(logEntity); + return oprLogMapper.selectLogListToFront(logEntity); } @Override - public Long addLog(LogEntity logEntity) { + public void insertLog(LogEntity logEntity) { - return oprLogMapper.addLog(logEntity); + oprLogMapper.insertLog(logEntity); } @Override diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/LogService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/LogService.java index 88d4f1bd..0ed0d79e 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/LogService.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/LogService.java @@ -31,9 +31,9 @@ @Service public interface LogService { - List getLogListByCluster(GetLogListDTO getLogListDTO); + List selectLogListByCluster(GetLogListDTO getLogListDTO); - Long addLog(LogEntity logEntity); + void insertLog(LogEntity logEntity); Integer updateLog(LogEntity logEntity); diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/message/GroupMemberService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/message/GroupMemberService.java index f2a0aa87..a92cc34b 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/message/GroupMemberService.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/message/GroupMemberService.java @@ -29,15 +29,15 @@ public interface GroupMemberService { List selectAll(); - void batchInsert(List groupMemberEntities); + Integer batchInsert(List groupMemberEntities); - List getGroupMemberByClusterId(GroupMemberEntity groupMemberEntity); + List selectGroupMemberByClusterId(GroupMemberEntity groupMemberEntity); - void addGroupMember(GroupMemberEntity groupMemberEntity); + void insertGroupMember(GroupMemberEntity groupMemberEntity); - void updateGroupMember(GroupMemberEntity groupMemberEntity); + Integer updateGroupMember(GroupMemberEntity groupMemberEntity); - GroupMemberEntity deleteGroupMember(GroupMemberEntity groupMemberEntity); + Integer deleteGroupMember(GroupMemberEntity groupMemberEntity); GroupMemberEntity selectGroupMemberById(GroupMemberEntity groupMemberEntity); diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/message/GroupService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/message/GroupService.java index 4227d38e..a2bd08f6 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/message/GroupService.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/message/GroupService.java @@ -30,11 +30,11 @@ public interface GroupService { List selectAll(); - void batchInsert(List groupEntities); + Integer batchInsert(List groupEntities); - List getGroupByClusterId(GroupEntity groupEntity); + List selectGroupByClusterId(GroupEntity groupEntity); - void addGroup(GroupEntity groupEntity); + void insertGroup(GroupEntity groupEntity); void updateGroup(GroupEntity groupEntity); diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/message/TopicService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/message/TopicService.java index 796ee934..714be9d4 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/message/TopicService.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/message/TopicService.java @@ -27,7 +27,7 @@ */ public interface TopicService { - List getTopicDetailGroups(Long topicId); + List selectTopicDetailGroups(Long topicId); void createTopic(TopicEntity topicEntity); @@ -35,9 +35,9 @@ public interface TopicService { List selectAll(); - void addTopic(TopicEntity topicEntity); + void insertTopic(TopicEntity topicEntity); - void updateTopic(TopicEntity topicEntity); + Integer updateTopic(TopicEntity topicEntity); void deleteTopicById(TopicEntity topicEntity); @@ -47,5 +47,5 @@ public interface TopicService { List selectTopiByCluster(TopicEntity topicEntity); - List getTopicListToFront(TopicEntity topicEntity); + List selectTopicListToFront(TopicEntity topicEntity); } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/message/impl/GroupMemberServiceImp.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/message/impl/GroupMemberServiceImp.java index 9d85ac61..bbb46b3f 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/message/impl/GroupMemberServiceImp.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/message/impl/GroupMemberServiceImp.java @@ -40,29 +40,29 @@ public List selectAll() { } @Override - public void batchInsert(List groupMemberEntities) { - oprGroupMemberMapper.batchInsert(groupMemberEntities); + public Integer batchInsert(List groupMemberEntities) { + return oprGroupMemberMapper.batchInsert(groupMemberEntities); } @Override @EmLog(OprType = "View", OprTarget = "GroupMember") - public List getGroupMemberByClusterId(GroupMemberEntity groupMemberEntity) { - return oprGroupMemberMapper.getGroupByClusterId(groupMemberEntity); + public List selectGroupMemberByClusterId(GroupMemberEntity groupMemberEntity) { + return oprGroupMemberMapper.selectGroupByClusterId(groupMemberEntity); } @Override @EmLog(OprType = "add", OprTarget = "GroupMember") - public void addGroupMember(GroupMemberEntity groupMemberEntity) { - oprGroupMemberMapper.addGroupMember(groupMemberEntity); + public void insertGroupMember(GroupMemberEntity groupMemberEntity) { + oprGroupMemberMapper.insertGroupMember(groupMemberEntity); } @Override - public void updateGroupMember(GroupMemberEntity groupMemberEntity) { - oprGroupMemberMapper.updateGroupMember(groupMemberEntity); + public Integer updateGroupMember(GroupMemberEntity groupMemberEntity) { + return oprGroupMemberMapper.updateGroupMember(groupMemberEntity); } @Override - public GroupMemberEntity deleteGroupMember(GroupMemberEntity groupMemberEntity) { + public Integer deleteGroupMember(GroupMemberEntity groupMemberEntity) { return oprGroupMemberMapper.deleteGroupMember(groupMemberEntity); } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/message/impl/GroupServiceImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/message/impl/GroupServiceImpl.java index c3c1a40f..41997150 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/message/impl/GroupServiceImpl.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/message/impl/GroupServiceImpl.java @@ -45,21 +45,21 @@ public List selectAll() { } @Override - public void batchInsert(List groupEntities) { - oprGroupMapper.batchInsert(groupEntities); + public Integer batchInsert(List groupEntities) { + return oprGroupMapper.batchInsert(groupEntities); } @EmLog(OprType = "search", OprTarget = "Group") @Override - public List getGroupByClusterId(GroupEntity groupEntity) { + public List selectGroupByClusterId(GroupEntity groupEntity) { return oprGroupMapper.selectGroup(groupEntity); } @EmLog(OprType = "add", OprTarget = "Group") @Override - public void addGroup(GroupEntity groupEntity) { - oprGroupMapper.addGroup(groupEntity); + public void insertGroup(GroupEntity groupEntity) { + oprGroupMapper.insertGroup(groupEntity); } @Override @@ -79,7 +79,7 @@ public GroupEntity selectGroup(GroupEntity groupEntity) { @Override public Integer insertMemberToGroup(GroupMemberEntity groupMemberEntity) { - groupMemberService.addGroupMember(groupMemberEntity); + groupMemberService.insertGroupMember(groupMemberEntity); GroupEntity groupEntity = new GroupEntity(); groupEntity.setName(groupMemberEntity.getGroupName()); groupEntity.setClusterId(groupMemberEntity.getClusterId()); diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/message/impl/TopicServiceImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/message/impl/TopicServiceImpl.java index 47065762..0d3b0cb3 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/message/impl/TopicServiceImpl.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/message/impl/TopicServiceImpl.java @@ -66,7 +66,7 @@ public class TopicServiceImpl implements TopicService { @Override - public List getTopicDetailGroups(Long topicId) { + public List selectTopicDetailGroups(Long topicId) { TopicEntity topicEntity = new TopicEntity(); topicEntity.setId(topicId); topicEntity = this.selectTopicById(topicEntity); @@ -97,7 +97,7 @@ public List getTopicDetailGroups(Long topicId) { @Override public void createTopic(TopicEntity topicEntity) { topicEntity.setCreateProgress(1); - topicMapper.addTopic(topicEntity); + topicMapper.insertTopic(topicEntity); } @Override @@ -112,17 +112,17 @@ public List selectAll() { @Override - public void addTopic(TopicEntity topicEntity) { + public void insertTopic(TopicEntity topicEntity) { GroupMemberEntity groupMemberEntity = new GroupMemberEntity(); groupMemberEntity.setTopicName(topicEntity.getTopicName()); groupMemberEntity.setState("active"); oprGroupMemberMapper.updateMemberByTopic(groupMemberEntity); - topicMapper.addTopic(topicEntity); + topicMapper.insertTopic(topicEntity); } @Override - public void updateTopic(TopicEntity topicEntity) { - topicMapper.updateTopic(topicEntity); + public Integer updateTopic(TopicEntity topicEntity) { + return topicMapper.updateTopic(topicEntity); } @Override @@ -147,13 +147,13 @@ public List selectTopiByCluster(TopicEntity topicEntity) { } - public TopicEntity setSearchCriteria(GetTopicListDTO getTopicListDTO, TopicEntity topicEntity) { + public TopicEntity buildSearchCriteria(GetTopicListDTO getTopicListDTO, TopicEntity topicEntity) { topicEntity.setTopicName(getTopicListDTO.getTopicName()); return topicEntity; } @Override - public List getTopicListToFront(TopicEntity topicEntity) { + public List selectTopicListToFront(TopicEntity topicEntity) { List topicEntityList = topicMapper.queryTopicsToFrontByClusterId(topicEntity); topicEntityList.forEach(n -> { n.setStatus(CheckResultCache.getINSTANCE().getLastHealthyCheckResult("topic", n.getId())); diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/store/Impl/StoreServiceImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/store/Impl/StoreServiceImpl.java index 5fa6a87e..f95aed8a 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/store/Impl/StoreServiceImpl.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/store/Impl/StoreServiceImpl.java @@ -33,7 +33,7 @@ public class StoreServiceImpl implements StoreService { private StoreMapper storeMapper; @Override - public StoreEntity getStoreToFrontListByCluster(Long clusterId) { + public StoreEntity selectStoreToFrontListByCluster(Long clusterId) { StoreEntity storeEntity = new StoreEntity(); storeEntity.setClusterId(clusterId); return storeMapper.selectStoreByCluster(storeEntity); @@ -61,18 +61,18 @@ public StoreEntity selectByHostPort(String host, Integer port) { } @Override - public void batchInsert(List storeEntities) { - storeMapper.batchInsert(storeEntities); + public Integer batchInsert(List storeEntities) { + return storeMapper.batchInsert(storeEntities); } @Override - public void addStore(StoreEntity storeEntity) { - storeMapper.addStore(storeEntity); + public void insertStore(StoreEntity storeEntity) { + storeMapper.insertStore(storeEntity); } @Override - public void deleteStoreByUnique(StoreEntity storeEntity) { - storeMapper.deleteStoreByUnique(storeEntity); + public Integer deleteStoreByUnique(StoreEntity storeEntity) { + return storeMapper.deleteStoreByUnique(storeEntity); } @Override @@ -83,7 +83,7 @@ public StoreEntity selectStoreByCluster(Long clusterId) { } @Override - public void updateStoreByUnique(StoreEntity storeEntity) { - storeMapper.updateStoreByUnique(storeEntity); + public Integer updateStoreByUnique(StoreEntity storeEntity) { + return storeMapper.updateStoreByUnique(storeEntity); } } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/store/StoreService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/store/StoreService.java index 14f8c521..65282419 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/store/StoreService.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/store/StoreService.java @@ -26,7 +26,7 @@ */ public interface StoreService { - StoreEntity getStoreToFrontListByCluster(Long clusterId); + StoreEntity selectStoreToFrontListByCluster(Long clusterId); List selectAll(); @@ -34,13 +34,13 @@ public interface StoreService { StoreEntity selectByHostPort(String host, Integer port); - void batchInsert(List storeEntities); + Integer batchInsert(List storeEntities); - void addStore(StoreEntity storeEntity); + void insertStore(StoreEntity storeEntity); - void deleteStoreByUnique(StoreEntity storeEntity); + Integer deleteStoreByUnique(StoreEntity storeEntity); StoreEntity selectStoreByCluster(Long clusterId); - void updateStoreByUnique(StoreEntity storeEntity); + Integer updateStoreByUnique(StoreEntity storeEntity); } diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/linkage/log/TestOprLog.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/linkage/log/TestOprLog.java index ad7c44af..c52b31a5 100644 --- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/linkage/log/TestOprLog.java +++ b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/linkage/log/TestOprLog.java @@ -51,7 +51,7 @@ public void testGroupServiceOprLog() { groupEntity.setStatus(1); groupEntity.setType(0); groupEntity.setState("OS"); - groupService.addGroup(groupEntity); + groupService.insertGroup(groupEntity); LogEntity logEntity = new LogEntity(); logEntity.setClusterId(1L); logEntity.setOperationType("add"); @@ -59,7 +59,7 @@ public void testGroupServiceOprLog() { logEntity.setContent(groupEntity.toString()); logEntity.setResult(groupEntity.toString()); logEntity.setId(groupEntity.getId()); - List logListByCluster = logService.getLogListByCluster(new GetLogListDTO()); + List logListByCluster = logService.selectLogListByCluster(new GetLogListDTO()); logListByCluster.get(0).setId(null); logListByCluster.get(0).setCreateTime(null); logListByCluster.get(0).setEndTime(null); From 90959acb22ad7e156bea13a03376de261ef9ba48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=91=A8=E5=80=AC=E8=B4=A4?= <14100340+zhou-zhuoxian@user.noreply.gitee.com> Date: Sat, 15 Jun 2024 00:35:47 +0800 Subject: [PATCH 2/4] Resolve syntax errors --- .../console/function/health/HealthService.java | 14 +++++++------- .../service/connector/ConnectorDataService.java | 2 +- .../connector/Impl/ConnectorDataServiceImpl.java | 4 ++-- .../service/function/Impl/ConfigServiceImpl.java | 4 +++- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/HealthService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/HealthService.java index d8fa8392..a28b0e37 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/HealthService.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/HealthService.java @@ -273,13 +273,13 @@ public void updateHealthCheckConfigs(DataServiceWrapper dataServiceWrapper) { .host(store.getHost()) .port(store.getPort()) .build()); - checkResultEntities.add(HealthCheckResultEntity.builder() - .clusterId(store.getClusterId()) - .type(4) - .typeId(store.getId()) - .state(4) - .resultDesc("initializing check client") - .build()); + HealthCheckResultEntity healthCheckResultEntity = new HealthCheckResultEntity(); + healthCheckResultEntity.setClusterId(store.getClusterId()); + healthCheckResultEntity.setType(4); + healthCheckResultEntity.setTypeId(store.getId()); + healthCheckResultEntity.setState(4); + healthCheckResultEntity.setResultDesc("initializing check client"); + checkResultEntities.add(healthCheckResultEntity); } dataServiceWrapper.getHealthDataService().batchInsertNewCheckResult(checkResultEntities); diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/connector/ConnectorDataService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/connector/ConnectorDataService.java index f2b39bad..227f1e91 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/connector/ConnectorDataService.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/connector/ConnectorDataService.java @@ -26,7 +26,7 @@ */ public interface ConnectorDataService { - Long createConnector(ConnectorEntity connectorEntity); + void createConnector(ConnectorEntity connectorEntity); List selectAll(); diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/connector/Impl/ConnectorDataServiceImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/connector/Impl/ConnectorDataServiceImpl.java index 772270ba..12ac190e 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/connector/Impl/ConnectorDataServiceImpl.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/connector/Impl/ConnectorDataServiceImpl.java @@ -33,8 +33,8 @@ public class ConnectorDataServiceImpl implements ConnectorDataService { private ConnectorMapper connectorMapper; @Override - public Long createConnector(ConnectorEntity connectorEntity) { - return connectorMapper.insert(connectorEntity); + public void createConnector(ConnectorEntity connectorEntity) { + connectorMapper.insert(connectorEntity); } @Override diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/Impl/ConfigServiceImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/Impl/ConfigServiceImpl.java index d33af230..1c31b47b 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/Impl/ConfigServiceImpl.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/Impl/ConfigServiceImpl.java @@ -208,7 +208,9 @@ public List selectToFront(Long instanceId, Integer type, GetConfig public void insertDefaultConfigToCache() { List configEntityList = configMapper.selectAllDefaultConfig(); configEntityList.forEach(n -> { - DefaultConfigKey defaultConfigKey = new DefaultConfigKey(n.getBusinessType(), n.getConfigName()); + DefaultConfigKey defaultConfigKey = new DefaultConfigKey(); + defaultConfigKey.setConfigName(n.getConfigName()); + defaultConfigKey.setBusinessType(n.getBusinessType()); defaultConfigCache.putIfAbsent(defaultConfigKey, n.getConfigValue()); }); From 9b80552d547b12a597b8b54ec0fe9bf4d19e42d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=91=A8=E5=80=AC=E8=B4=A4?= <14100340+zhou-zhuoxian@user.noreply.gitee.com> Date: Sat, 15 Jun 2024 12:57:18 +0800 Subject: [PATCH 3/4] Code Specification --- .../controller/ConnectionController.java | 1 - .../controller/cluster/ClusterController.java | 5 +- .../controller/function/ConfigController.java | 9 ++- .../controller/function/LogController.java | 3 +- .../config/ConfigControllerMapper.java | 39 ++++++++++++ .../mapstruct/log/LogControllerMapper.java | 38 ++++++++++++ .../QueryRuntimeListByClusterIdDTO.java | 4 -- .../ChangeConfigEntity.java} | 8 +-- .../{dto => }/config/UpdateConfigsLog.java | 6 +- .../modle/dto/config/DetailConfigsVO.java | 4 -- .../modle/dto/config/GetConfigsListDTO.java | 4 -- .../modle/dto/config/UpdateConfigDTO.java | 8 +-- .../dto/connection/AddConnectionDTO.java | 4 -- .../dto/connection/AddConnectorConfigDTO.java | 2 - .../dto/connection/CreateConnectionDTO.java | 4 -- .../dto/connection/GetConnectionListDTO.java | 4 -- .../console/modle/dto/log/GetLogListDTO.java | 4 -- .../console/modle/dto/meta/NewMetaDTO.java | 4 -- .../modle/dto/topic/GetTopicListDTO.java | 4 -- .../vo/cluster/GetClusterBaseMessageVO.java | 4 -- .../modle/vo/cluster/ResourceNumVO.java | 4 -- .../modle/vo/connection/ConnectionListVO.java | 4 -- .../vo/health/InstanceLiveProportionVo.java | 4 -- .../modle/vo/topic/TopicDetailGroupVO.java | 4 -- .../console/service/OverviewService.java | 4 +- .../service/cluster/ClusterService.java | 5 +- .../cluster/impl/ClusterServiceImpl.java | 10 ++- .../service/function/ConfigService.java | 9 ++- .../function/Impl/ConfigServiceImpl.java | 62 +++++++------------ .../service/function/Impl/LogServiceImpl.java | 9 +-- .../console/service/function/LogService.java | 4 +- .../message/impl/TopicServiceImpl.java | 7 --- 32 files changed, 128 insertions(+), 157 deletions(-) create mode 100644 eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapstruct/config/ConfigControllerMapper.java create mode 100644 eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapstruct/log/LogControllerMapper.java rename eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/{dto/config/ChangeConfigDTO.java => config/ChangeConfigEntity.java} (82%) rename eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/{dto => }/config/UpdateConfigsLog.java (85%) diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/ConnectionController.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/ConnectionController.java index 1fd36661..f1f492f3 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/ConnectionController.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/ConnectionController.java @@ -69,7 +69,6 @@ public AddConnectionDTO showCreateConnectionMessage() { public String createConnection(@Validated @RequestBody CreateConnectionDTO createConnectionDTO) { try { connectionDataService.createConnection(createConnectionDTO); - } catch (Exception e) { return e.getMessage(); } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/cluster/ClusterController.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/cluster/ClusterController.java index 35566305..863655b0 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/cluster/ClusterController.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/cluster/ClusterController.java @@ -43,12 +43,9 @@ public class ClusterController { @Autowired ClusterService clusterService; - - - @GetMapping("queryHomeClusterData") public GetClusterBaseMessageVO queryHomeClusterData(@RequestBody @Validated ClusterIdDTO clusterIdDTO) { - return clusterService.selectClusterBaseMessage(clusterIdDTO); + return clusterService.selectClusterBaseMessage(clusterIdDTO.getClusterId()); } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/function/ConfigController.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/function/ConfigController.java index c9ddb1d7..31c36e33 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/function/ConfigController.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/function/ConfigController.java @@ -18,6 +18,7 @@ package org.apache.eventmesh.dashboard.console.controller.function; import org.apache.eventmesh.dashboard.console.entity.function.ConfigEntity; +import org.apache.eventmesh.dashboard.console.mapstruct.config.ConfigControllerMapper; import org.apache.eventmesh.dashboard.console.modle.dto.config.DetailConfigsVO; import org.apache.eventmesh.dashboard.console.modle.dto.config.GetConfigsListDTO; import org.apache.eventmesh.dashboard.console.modle.dto.config.UpdateConfigDTO; @@ -45,7 +46,7 @@ public class ConfigController { public String updateConfigsByTypeAndId(@Validated @RequestBody UpdateConfigDTO updateConfigDTO) { try { configService.updateConfigsByInstanceId(updateConfigDTO.getUsername(), updateConfigDTO.getClusterId(), updateConfigDTO.getInstanceType(), - updateConfigDTO.getInstanceId(), updateConfigDTO.getChangeConfigDTOS()); + updateConfigDTO.getInstanceId(), updateConfigDTO.getChangeConfigEntities()); } catch (Exception e) { return e.getMessage(); } @@ -55,10 +56,8 @@ public String updateConfigsByTypeAndId(@Validated @RequestBody UpdateConfigDTO u @PostMapping("/getInstanceDetailConfigs") public List getInstanceDetailConfigs(@Validated @RequestBody GetConfigsListDTO getConfigsListDTO) { - List configEntityList = configService.selectToFront(getConfigsListDTO.getInstanceId(), - getConfigsListDTO.getInstanceType(), getConfigsListDTO); - Map stringStringConcurrentHashMap = configService.selectDefaultConfig(getConfigsListDTO.getBusinessType(), - getConfigsListDTO.getInstanceId(), getConfigsListDTO.getInstanceType()); + List configEntityList = configService.selectToFront(ConfigControllerMapper.INSTANCE.queryEntityByConfig(getConfigsListDTO)); + Map stringStringConcurrentHashMap = configService.selectDefaultConfig(getConfigsListDTO.getBusinessType()); ArrayList showDetailConfigsVOS = new ArrayList<>(); configEntityList.forEach(n -> { DetailConfigsVO showDetailConfigsVO = new DetailConfigsVO(); diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/function/LogController.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/function/LogController.java index 6249e4ea..36ec3d09 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/function/LogController.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/function/LogController.java @@ -18,6 +18,7 @@ package org.apache.eventmesh.dashboard.console.controller.function; import org.apache.eventmesh.dashboard.console.entity.function.LogEntity; +import org.apache.eventmesh.dashboard.console.mapstruct.log.LogControllerMapper; import org.apache.eventmesh.dashboard.console.modle.dto.log.GetLogListDTO; import org.apache.eventmesh.dashboard.console.service.function.LogService; @@ -39,7 +40,7 @@ public class LogController { @PostMapping("/getList") public List getLogLIstToFront(@Validated @RequestBody GetLogListDTO getLogListDTO) { - return logService.selectLogListByCluster(getLogListDTO); + return logService.selectLogListByCluster(LogControllerMapper.INSTANCE.queryEntityByLog(getLogListDTO)); } } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapstruct/config/ConfigControllerMapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapstruct/config/ConfigControllerMapper.java new file mode 100644 index 00000000..d0f92828 --- /dev/null +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapstruct/config/ConfigControllerMapper.java @@ -0,0 +1,39 @@ +/* + * 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.eventmesh.dashboard.console.mapstruct.config; + + +import org.apache.eventmesh.dashboard.console.entity.function.ConfigEntity; +import org.apache.eventmesh.dashboard.console.entity.function.LogEntity; +import org.apache.eventmesh.dashboard.console.modle.dto.config.GetConfigsListDTO; +import org.apache.eventmesh.dashboard.console.modle.dto.log.GetLogListDTO; + +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +/** + * + */ + +@Mapper +public interface ConfigControllerMapper { + + ConfigControllerMapper INSTANCE = Mappers.getMapper(ConfigControllerMapper.class); + + public ConfigEntity queryEntityByConfig(GetConfigsListDTO getConfigsListDTO); +} diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapstruct/log/LogControllerMapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapstruct/log/LogControllerMapper.java new file mode 100644 index 00000000..03c5302a --- /dev/null +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapstruct/log/LogControllerMapper.java @@ -0,0 +1,38 @@ +/* + * 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.eventmesh.dashboard.console.mapstruct.log; + +import org.apache.eventmesh.dashboard.console.entity.function.LogEntity; +import org.apache.eventmesh.dashboard.console.modle.dto.log.GetLogListDTO; + + +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +/** + * + */ +@Mapper +public interface LogControllerMapper { + + LogControllerMapper INSTANCE = Mappers.getMapper(LogControllerMapper.class); + + + LogEntity queryEntityByLog(GetLogListDTO getLogListDTO); + +} diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/runtime/QueryRuntimeListByClusterIdDTO.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/runtime/QueryRuntimeListByClusterIdDTO.java index 0e6eab28..5cccc897 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/runtime/QueryRuntimeListByClusterIdDTO.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/runtime/QueryRuntimeListByClusterIdDTO.java @@ -19,12 +19,8 @@ import org.apache.eventmesh.dashboard.console.modle.ClusterIdDTO; -import lombok.AllArgsConstructor; import lombok.Data; -import lombok.NoArgsConstructor; -@NoArgsConstructor -@AllArgsConstructor @Data public class QueryRuntimeListByClusterIdDTO extends ClusterIdDTO { diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/config/ChangeConfigDTO.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/ChangeConfigEntity.java similarity index 82% rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/config/ChangeConfigDTO.java rename to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/ChangeConfigEntity.java index d0bdc23c..bf167b1e 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/config/ChangeConfigDTO.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/ChangeConfigEntity.java @@ -15,16 +15,12 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.modle.dto.config; +package org.apache.eventmesh.dashboard.console.modle.config; -import lombok.AllArgsConstructor; import lombok.Data; -import lombok.NoArgsConstructor; -@NoArgsConstructor -@AllArgsConstructor @Data -public class ChangeConfigDTO { +public class ChangeConfigEntity { private String configName; diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/config/UpdateConfigsLog.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/UpdateConfigsLog.java similarity index 85% rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/config/UpdateConfigsLog.java rename to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/UpdateConfigsLog.java index 9619c7f1..6dafeef6 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/config/UpdateConfigsLog.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/config/UpdateConfigsLog.java @@ -15,15 +15,11 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.modle.dto.config; +package org.apache.eventmesh.dashboard.console.modle.config; -import lombok.AllArgsConstructor; import lombok.Data; -import lombok.NoArgsConstructor; -@NoArgsConstructor -@AllArgsConstructor @Data public class UpdateConfigsLog { diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/config/DetailConfigsVO.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/config/DetailConfigsVO.java index bda02fa5..1796fa53 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/config/DetailConfigsVO.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/config/DetailConfigsVO.java @@ -17,12 +17,8 @@ package org.apache.eventmesh.dashboard.console.modle.dto.config; -import lombok.AllArgsConstructor; import lombok.Data; -import lombok.NoArgsConstructor; -@NoArgsConstructor -@AllArgsConstructor @Data public class DetailConfigsVO { diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/config/GetConfigsListDTO.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/config/GetConfigsListDTO.java index 478b1acf..e1420a24 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/config/GetConfigsListDTO.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/config/GetConfigsListDTO.java @@ -17,12 +17,8 @@ package org.apache.eventmesh.dashboard.console.modle.dto.config; -import lombok.AllArgsConstructor; import lombok.Data; -import lombok.NoArgsConstructor; -@NoArgsConstructor -@AllArgsConstructor @Data public class GetConfigsListDTO { diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/config/UpdateConfigDTO.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/config/UpdateConfigDTO.java index 8c273b81..69232c0f 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/config/UpdateConfigDTO.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/config/UpdateConfigDTO.java @@ -17,20 +17,18 @@ package org.apache.eventmesh.dashboard.console.modle.dto.config; +import org.apache.eventmesh.dashboard.console.modle.config.ChangeConfigEntity; + import java.util.List; -import lombok.AllArgsConstructor; import lombok.Data; -import lombok.NoArgsConstructor; -@NoArgsConstructor -@AllArgsConstructor @Data public class UpdateConfigDTO { private Long clusterId; - private List changeConfigDTOS; + private List changeConfigEntities; private String username; diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/connection/AddConnectionDTO.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/connection/AddConnectionDTO.java index 0a7c23e2..63438145 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/connection/AddConnectionDTO.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/connection/AddConnectionDTO.java @@ -17,12 +17,8 @@ package org.apache.eventmesh.dashboard.console.modle.dto.connection; -import lombok.AllArgsConstructor; import lombok.Data; -import lombok.NoArgsConstructor; -@NoArgsConstructor -@AllArgsConstructor @Data public class AddConnectionDTO { diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/connection/AddConnectorConfigDTO.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/connection/AddConnectorConfigDTO.java index 8ffc2cec..aa6801cf 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/connection/AddConnectorConfigDTO.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/connection/AddConnectorConfigDTO.java @@ -25,8 +25,6 @@ import lombok.Data; import lombok.NoArgsConstructor; -@NoArgsConstructor -@AllArgsConstructor @Data public class AddConnectorConfigDTO { diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/connection/CreateConnectionDTO.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/connection/CreateConnectionDTO.java index 1a63e0a7..6352038f 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/connection/CreateConnectionDTO.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/connection/CreateConnectionDTO.java @@ -17,12 +17,8 @@ package org.apache.eventmesh.dashboard.console.modle.dto.connection; -import lombok.AllArgsConstructor; import lombok.Data; -import lombok.NoArgsConstructor; -@NoArgsConstructor -@AllArgsConstructor @Data public class CreateConnectionDTO { diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/connection/GetConnectionListDTO.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/connection/GetConnectionListDTO.java index 63a97d27..ea5936d0 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/connection/GetConnectionListDTO.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/connection/GetConnectionListDTO.java @@ -17,12 +17,8 @@ package org.apache.eventmesh.dashboard.console.modle.dto.connection; -import lombok.AllArgsConstructor; import lombok.Data; -import lombok.NoArgsConstructor; -@NoArgsConstructor -@AllArgsConstructor @Data public class GetConnectionListDTO { diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/log/GetLogListDTO.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/log/GetLogListDTO.java index 63ae0f7a..cd086ba9 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/log/GetLogListDTO.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/log/GetLogListDTO.java @@ -17,12 +17,8 @@ package org.apache.eventmesh.dashboard.console.modle.dto.log; -import lombok.AllArgsConstructor; import lombok.Data; -import lombok.NoArgsConstructor; -@NoArgsConstructor -@AllArgsConstructor @Data public class GetLogListDTO { diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/meta/NewMetaDTO.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/meta/NewMetaDTO.java index 7ce8c37f..ff0888c2 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/meta/NewMetaDTO.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/meta/NewMetaDTO.java @@ -17,12 +17,8 @@ package org.apache.eventmesh.dashboard.console.modle.dto.meta; -import lombok.AllArgsConstructor; import lombok.Data; -import lombok.NoArgsConstructor; -@NoArgsConstructor -@AllArgsConstructor @Data public class NewMetaDTO { diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/topic/GetTopicListDTO.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/topic/GetTopicListDTO.java index 169b9bc9..b3652781 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/topic/GetTopicListDTO.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/topic/GetTopicListDTO.java @@ -18,12 +18,8 @@ package org.apache.eventmesh.dashboard.console.modle.dto.topic; -import lombok.AllArgsConstructor; import lombok.Data; -import lombok.NoArgsConstructor; -@NoArgsConstructor -@AllArgsConstructor @Data public class GetTopicListDTO { diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/vo/cluster/GetClusterBaseMessageVO.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/vo/cluster/GetClusterBaseMessageVO.java index 3c4c9f72..fde7d2ef 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/vo/cluster/GetClusterBaseMessageVO.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/vo/cluster/GetClusterBaseMessageVO.java @@ -17,12 +17,8 @@ package org.apache.eventmesh.dashboard.console.modle.vo.cluster; -import lombok.AllArgsConstructor; import lombok.Data; -import lombok.NoArgsConstructor; -@NoArgsConstructor -@AllArgsConstructor @Data public class GetClusterBaseMessageVO { diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/vo/cluster/ResourceNumVO.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/vo/cluster/ResourceNumVO.java index 13794078..95deb96e 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/vo/cluster/ResourceNumVO.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/vo/cluster/ResourceNumVO.java @@ -17,12 +17,8 @@ package org.apache.eventmesh.dashboard.console.modle.vo.cluster; -import lombok.AllArgsConstructor; import lombok.Data; -import lombok.NoArgsConstructor; -@NoArgsConstructor -@AllArgsConstructor @Data public class ResourceNumVO { diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/vo/connection/ConnectionListVO.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/vo/connection/ConnectionListVO.java index a9b40829..61846b9d 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/vo/connection/ConnectionListVO.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/vo/connection/ConnectionListVO.java @@ -17,13 +17,9 @@ package org.apache.eventmesh.dashboard.console.modle.vo.connection; -import lombok.AllArgsConstructor; import lombok.Data; -import lombok.NoArgsConstructor; @Data -@AllArgsConstructor -@NoArgsConstructor public class ConnectionListVO { private Long sinkConnectorId; diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/vo/health/InstanceLiveProportionVo.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/vo/health/InstanceLiveProportionVo.java index 2277c10c..9abd0d26 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/vo/health/InstanceLiveProportionVo.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/vo/health/InstanceLiveProportionVo.java @@ -17,12 +17,8 @@ package org.apache.eventmesh.dashboard.console.modle.vo.health; -import lombok.AllArgsConstructor; import lombok.Data; -import lombok.NoArgsConstructor; -@NoArgsConstructor -@AllArgsConstructor @Data public class InstanceLiveProportionVo { diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/vo/topic/TopicDetailGroupVO.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/vo/topic/TopicDetailGroupVO.java index aebeb7a4..10581e5e 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/vo/topic/TopicDetailGroupVO.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/vo/topic/TopicDetailGroupVO.java @@ -19,12 +19,8 @@ import java.util.List; -import lombok.AllArgsConstructor; import lombok.Data; -import lombok.NoArgsConstructor; -@NoArgsConstructor -@AllArgsConstructor @Data public class TopicDetailGroupVO { diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/OverviewService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/OverviewService.java index e966e280..cf919fd7 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/OverviewService.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/OverviewService.java @@ -17,7 +17,7 @@ package org.apache.eventmesh.dashboard.console.service; -import org.apache.eventmesh.dashboard.console.modle.function.OverviewDTO; +import org.apache.eventmesh.dashboard.console.modle.function.OverviewType; /** * @@ -25,5 +25,5 @@ public interface OverviewService { - Object overview(OverviewDTO overviewDTO); + Object overview(OverviewType overviewType); } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/ClusterService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/ClusterService.java index 0c5cf67e..66ecfb6e 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/ClusterService.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/ClusterService.java @@ -18,7 +18,6 @@ package org.apache.eventmesh.dashboard.console.service.cluster; import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterEntity; -import org.apache.eventmesh.dashboard.console.modle.ClusterIdDTO; import org.apache.eventmesh.dashboard.console.modle.vo.cluster.GetClusterBaseMessageVO; import java.util.List; @@ -32,10 +31,10 @@ public interface ClusterService { void createCluster(ClusterEntity clusterEntity); - GetClusterBaseMessageVO selectClusterBaseMessage(ClusterIdDTO clusterIdDTO); + GetClusterBaseMessageVO selectClusterBaseMessage(Long clusterId); - Map queryHomeClusterData(ClusterIdDTO clusterIdDTO); + Map queryHomeClusterData(Long clusterId); Integer batchInsert(List clusterEntities); diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/impl/ClusterServiceImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/impl/ClusterServiceImpl.java index 5b4f8421..3756faa4 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/impl/ClusterServiceImpl.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/impl/ClusterServiceImpl.java @@ -27,8 +27,7 @@ import org.apache.eventmesh.dashboard.console.mapper.cluster.RuntimeMapper; import org.apache.eventmesh.dashboard.console.mapper.message.OprGroupMapper; import org.apache.eventmesh.dashboard.console.mapper.message.TopicMapper; -import org.apache.eventmesh.dashboard.console.modle.ClusterIdDTO; -import org.apache.eventmesh.dashboard.console.modle.function.OverviewDTO; +import org.apache.eventmesh.dashboard.console.modle.function.OverviewType; import org.apache.eventmesh.dashboard.console.modle.vo.cluster.GetClusterBaseMessageVO; import org.apache.eventmesh.dashboard.console.service.OverviewService; import org.apache.eventmesh.dashboard.console.service.cluster.ClusterService; @@ -65,8 +64,7 @@ public void createCluster(ClusterEntity clusterEntity) { } @Override - public GetClusterBaseMessageVO selectClusterBaseMessage(ClusterIdDTO clusterIdDTO) { - Long clusterId = clusterIdDTO.getClusterId(); + public GetClusterBaseMessageVO selectClusterBaseMessage(Long clusterId) { GetClusterBaseMessageVO getClusterBaseMessageVO = new GetClusterBaseMessageVO(); TopicEntity topicEntity = new TopicEntity(); topicEntity.setClusterId(clusterId); @@ -84,7 +82,7 @@ public GetClusterBaseMessageVO selectClusterBaseMessage(ClusterIdDTO clusterIdDT } @Override - public Map queryHomeClusterData(ClusterIdDTO clusterIdDTO) { + public Map queryHomeClusterData(Long clusterId) { return null; } @@ -131,7 +129,7 @@ public Integer deactivate(ClusterEntity cluster) { } @Override - public Object overview(OverviewDTO overviewDTO) { + public Object overview(OverviewType overviewtype) { return null; } } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/ConfigService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/ConfigService.java index 9f3ca75e..7c53e34c 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/ConfigService.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/ConfigService.java @@ -19,8 +19,7 @@ import org.apache.eventmesh.dashboard.console.entity.function.ConfigEntity; -import org.apache.eventmesh.dashboard.console.modle.dto.config.ChangeConfigDTO; -import org.apache.eventmesh.dashboard.console.modle.dto.config.GetConfigsListDTO; +import org.apache.eventmesh.dashboard.console.modle.config.ChangeConfigEntity; import java.util.List; import java.util.Map; @@ -31,9 +30,9 @@ */ public interface ConfigService { - List selectToFront(Long instanceId, Integer type, GetConfigsListDTO getConfigsListDTO); + List selectToFront(ConfigEntity configEntity); - void updateConfigsByInstanceId(String name, Long clusterId, Integer instanceType, Long instanceId, List changeConfigDTOList); + void updateConfigsByInstanceId(String name, Long clusterId, Integer instanceType, Long instanceId, List changeConfigEntityList); List selectAll(); @@ -51,7 +50,7 @@ public interface ConfigService { List selectByInstanceIdAndType(Long instanceId, Integer type); - Map selectDefaultConfig(String version, Long instanceId, Integer instanceType); + Map selectDefaultConfig(String businessType); } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/Impl/ConfigServiceImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/Impl/ConfigServiceImpl.java index 1c31b47b..b6b42c1d 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/Impl/ConfigServiceImpl.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/Impl/ConfigServiceImpl.java @@ -21,9 +21,8 @@ import org.apache.eventmesh.dashboard.console.entity.DefaultConfigKey; import org.apache.eventmesh.dashboard.console.entity.function.ConfigEntity; import org.apache.eventmesh.dashboard.console.mapper.function.ConfigMapper; -import org.apache.eventmesh.dashboard.console.modle.dto.config.ChangeConfigDTO; -import org.apache.eventmesh.dashboard.console.modle.dto.config.GetConfigsListDTO; -import org.apache.eventmesh.dashboard.console.modle.dto.config.UpdateConfigsLog; +import org.apache.eventmesh.dashboard.console.modle.config.ChangeConfigEntity; +import org.apache.eventmesh.dashboard.console.modle.config.UpdateConfigsLog; import org.apache.eventmesh.dashboard.console.service.function.ConfigService; import java.util.Arrays; @@ -49,8 +48,8 @@ public class ConfigServiceImpl implements ConfigService { @EmLog(OprTarget = "Runtime", OprType = "UpdateConfigs") - public void logUpdateRuntimeConfigs(UpdateConfigsLog updateConfigsLog, List changeConfigDTOList) { - changeConfigDTOList.forEach(n -> { + public void logUpdateRuntimeConfigs(UpdateConfigsLog updateConfigsLog, List changeConfigEntityList) { + changeConfigEntityList.forEach(n -> { ConfigEntity config = new ConfigEntity(); config.setInstanceType(0); config.setInstanceId(updateConfigsLog.getInstanceId()); @@ -63,8 +62,8 @@ public void logUpdateRuntimeConfigs(UpdateConfigsLog updateConfigsLog, List changeConfigDTOList) { - changeConfigDTOList.forEach(n -> { + public void logUpdateStoreConfigs(UpdateConfigsLog updateConfigsLog, List changeConfigEntityList) { + changeConfigEntityList.forEach(n -> { ConfigEntity config = new ConfigEntity(); config.setInstanceType(1); config.setInstanceId(updateConfigsLog.getInstanceId()); @@ -77,8 +76,8 @@ public void logUpdateStoreConfigs(UpdateConfigsLog updateConfigsLog, List changeConfigDTOList) { - changeConfigDTOList.forEach(n -> { + public void logUpdateConnectorConfigs(UpdateConfigsLog updateConfigsLog, List changeConfigEntityList) { + changeConfigEntityList.forEach(n -> { ConfigEntity config = new ConfigEntity(); config.setInstanceType(2); config.setInstanceId(updateConfigsLog.getInstanceId()); @@ -91,8 +90,8 @@ public void logUpdateConnectorConfigs(UpdateConfigsLog updateConfigsLog, List changeConfigDTOList) { - changeConfigDTOList.forEach(n -> { + public void logUpdateTopicConfigs(UpdateConfigsLog updateConfigsLog, List changeConfigEntityList) { + changeConfigEntityList.forEach(n -> { ConfigEntity config = new ConfigEntity(); config.setInstanceType(3); config.setInstanceId(updateConfigsLog.getInstanceId()); @@ -105,22 +104,25 @@ public void logUpdateTopicConfigs(UpdateConfigsLog updateConfigsLog, List changeConfigDTOList) { + List changeConfigEntityList) { ConcurrentHashMap stringStringConcurrentHashMap = new ConcurrentHashMap<>(); - changeConfigDTOList.forEach(n -> { + changeConfigEntityList.forEach(n -> { stringStringConcurrentHashMap.put(n.getConfigName(), n.getConfigValue()); }); - UpdateConfigsLog updateConfigsLog = - new UpdateConfigsLog(instanceId, clusterId, name, this.mapToProperties(stringStringConcurrentHashMap)); + UpdateConfigsLog updateConfigsLog = new UpdateConfigsLog(); + updateConfigsLog.setInstanceId(instanceId); + updateConfigsLog.setClusterId(clusterId); + updateConfigsLog.setName(name); + updateConfigsLog.setConfigProperties(this.mapToProperties(stringStringConcurrentHashMap)); ConfigServiceImpl service = (ConfigServiceImpl) AopContext.currentProxy(); if (instanceType == 0) { - service.logUpdateRuntimeConfigs(updateConfigsLog, changeConfigDTOList); + service.logUpdateRuntimeConfigs(updateConfigsLog, changeConfigEntityList); } else if (instanceType == 1) { - service.logUpdateStoreConfigs(updateConfigsLog, changeConfigDTOList); + service.logUpdateStoreConfigs(updateConfigsLog, changeConfigEntityList); } else if (instanceType == 2) { - service.logUpdateConnectorConfigs(updateConfigsLog, changeConfigDTOList); + service.logUpdateConnectorConfigs(updateConfigsLog, changeConfigEntityList); } else if (instanceType == 3) { - service.logUpdateTopicConfigs(updateConfigsLog, changeConfigDTOList); + service.logUpdateTopicConfigs(updateConfigsLog, changeConfigEntityList); } } @@ -181,27 +183,9 @@ public List selectByInstanceIdAndType(Long instanceId, Integer typ return configMapper.selectByInstanceId(config); } - public ConfigEntity buildSearchCriteria(GetConfigsListDTO getConfigsListDTO, ConfigEntity configEntity) { - if (getConfigsListDTO != null) { - if (getConfigsListDTO.getConfigName() != null) { - configEntity.setConfigName(getConfigsListDTO.getConfigName()); - } - if (getConfigsListDTO.getIsModify() != null) { - configEntity.setIsModify(getConfigsListDTO.getIsModify()); - } - if (getConfigsListDTO.getAlreadyUpdate() != null) { - configEntity.setAlreadyUpdate(getConfigsListDTO.getAlreadyUpdate()); - } - } - return configEntity; - } @Override - public List selectToFront(Long instanceId, Integer type, GetConfigsListDTO getConfigsListDTO) { - ConfigEntity config = new ConfigEntity(); - config.setInstanceId(instanceId); - config.setInstanceType(type); - config = this.buildSearchCriteria(getConfigsListDTO, config); + public List selectToFront(ConfigEntity config) { return configMapper.selectConfigsToFrontWithDynamic(config); } @@ -217,7 +201,7 @@ public void insertDefaultConfigToCache() { } @Override - public Map selectDefaultConfig(String businessType, Long instanceId, Integer instanceType) { + public Map selectDefaultConfig(String businessType) { if (defaultConfigCache.size() == 0) { this.insertDefaultConfigToCache(); } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/Impl/LogServiceImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/Impl/LogServiceImpl.java index 14a87bee..cc4ea338 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/Impl/LogServiceImpl.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/Impl/LogServiceImpl.java @@ -19,7 +19,6 @@ import org.apache.eventmesh.dashboard.console.entity.function.LogEntity; import org.apache.eventmesh.dashboard.console.mapper.function.OprLogMapper; -import org.apache.eventmesh.dashboard.console.modle.dto.log.GetLogListDTO; import org.apache.eventmesh.dashboard.console.service.function.LogService; import java.util.List; @@ -34,13 +33,7 @@ public class LogServiceImpl implements LogService { OprLogMapper oprLogMapper; @Override - public List selectLogListByCluster(GetLogListDTO getLogListDTO) { - LogEntity logEntity = new LogEntity(); - logEntity.setClusterId(getLogListDTO.getClusterId()); - logEntity.setTargetType(getLogListDTO.getTargetType()); - logEntity.setOperationType(getLogListDTO.getOperationType()); - logEntity.setState(getLogListDTO.getState()); - logEntity.setOperationUser(getLogListDTO.getOperationUser()); + public List selectLogListByCluster(LogEntity logEntity) { return oprLogMapper.selectLogListToFront(logEntity); } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/LogService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/LogService.java index 0ed0d79e..dd9b993f 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/LogService.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/LogService.java @@ -18,7 +18,7 @@ package org.apache.eventmesh.dashboard.console.service.function; import org.apache.eventmesh.dashboard.console.entity.function.LogEntity; -import org.apache.eventmesh.dashboard.console.modle.dto.log.GetLogListDTO; + import java.util.List; @@ -31,7 +31,7 @@ @Service public interface LogService { - List selectLogListByCluster(GetLogListDTO getLogListDTO); + List selectLogListByCluster(LogEntity logEntity); void insertLog(LogEntity logEntity); diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/message/impl/TopicServiceImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/message/impl/TopicServiceImpl.java index 0d3b0cb3..45f5c4cc 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/message/impl/TopicServiceImpl.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/message/impl/TopicServiceImpl.java @@ -30,7 +30,6 @@ import org.apache.eventmesh.dashboard.console.mapper.message.OprGroupMemberMapper; import org.apache.eventmesh.dashboard.console.mapper.message.TopicMapper; import org.apache.eventmesh.dashboard.console.mapper.storage.StoreMapper; -import org.apache.eventmesh.dashboard.console.modle.dto.topic.GetTopicListDTO; import org.apache.eventmesh.dashboard.console.modle.vo.topic.TopicDetailGroupVO; import org.apache.eventmesh.dashboard.console.service.message.TopicService; @@ -146,12 +145,6 @@ public List selectTopiByCluster(TopicEntity topicEntity) { return topicMapper.selectTopicByCluster(topicEntity); } - - public TopicEntity buildSearchCriteria(GetTopicListDTO getTopicListDTO, TopicEntity topicEntity) { - topicEntity.setTopicName(getTopicListDTO.getTopicName()); - return topicEntity; - } - @Override public List selectTopicListToFront(TopicEntity topicEntity) { List topicEntityList = topicMapper.queryTopicsToFrontByClusterId(topicEntity); From 423da4bcc5f083c2ce30256b5677294bf16673a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=91=A8=E5=80=AC=E8=B4=A4?= <14100340+zhou-zhuoxian@user.noreply.gitee.com> Date: Sat, 15 Jun 2024 15:58:24 +0800 Subject: [PATCH 4/4] Code Specification --- .../controller/ConnectionController.java | 12 +- .../entity/CreateConnectionEntity.java | 33 +++ .../connection/AddConnectionEntity.java} | 4 +- .../connection/AddConnectorConfigEntity.java} | 6 +- .../config/ConfigControllerMapper.java | 2 - .../ConnectionControllerMapper.java | 37 +++ .../dto/connection/CreateConnectionDTO.java | 7 +- .../cluster/ConnectionDataService.java | 13 +- .../ConnectionDataServiceDatabaseImpl.java | 231 ++++++++++++++++++ .../service/function/ConfigService.java | 3 +- .../Impl/HealthDataServiceDatabaseImpl.java | 10 +- ...ConnectionDataServiceDatabaseImplTest.java | 3 +- 12 files changed, 337 insertions(+), 24 deletions(-) create mode 100644 eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/CreateConnectionEntity.java rename eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/{modle/dto/connection/AddConnectionDTO.java => entity/connection/AddConnectionEntity.java} (92%) rename eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/{modle/dto/connection/AddConnectorConfigDTO.java => entity/connection/AddConnectorConfigEntity.java} (85%) create mode 100644 eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapstruct/connection/ConnectionControllerMapper.java create mode 100644 eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/impl/ConnectionDataServiceDatabaseImpl.java diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/ConnectionController.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/ConnectionController.java index f1f492f3..6a4eee11 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/ConnectionController.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/ConnectionController.java @@ -17,9 +17,11 @@ package org.apache.eventmesh.dashboard.console.controller; + +import org.apache.eventmesh.dashboard.console.entity.connection.AddConnectionEntity; import org.apache.eventmesh.dashboard.console.entity.connector.ConnectorEntity; import org.apache.eventmesh.dashboard.console.entity.function.ConfigEntity; -import org.apache.eventmesh.dashboard.console.modle.dto.connection.AddConnectionDTO; +import org.apache.eventmesh.dashboard.console.mapstruct.connection.ConnectionControllerMapper; import org.apache.eventmesh.dashboard.console.modle.dto.connection.CreateConnectionDTO; import org.apache.eventmesh.dashboard.console.modle.dto.connection.GetConnectionListDTO; import org.apache.eventmesh.dashboard.console.modle.vo.connection.ConnectionListVO; @@ -60,15 +62,15 @@ public List getConnectorConfigsByClassAndVersion(String version, S @GetMapping("/showCreateConnectionMessage") - public AddConnectionDTO showCreateConnectionMessage() { - return new AddConnectionDTO(); + public AddConnectionEntity showCreateConnectionMessage() { + return new AddConnectionEntity(); } @PostMapping("/createConnection") public String createConnection(@Validated @RequestBody CreateConnectionDTO createConnectionDTO) { try { - connectionDataService.createConnection(createConnectionDTO); + connectionDataService.createConnection(ConnectionControllerMapper.INSTANCE.queryCreateEntityByConnection(createConnectionDTO)); } catch (Exception e) { return e.getMessage(); } @@ -78,7 +80,7 @@ public String createConnection(@Validated @RequestBody CreateConnectionDTO creat @PostMapping("/getConnectionList") public List getConnectionList(@Validated @RequestBody GetConnectionListDTO getConnectionListDTO) { - return connectionDataService.getConnectionToFrontByCluster(getConnectionListDTO.getClusterId(), getConnectionListDTO); + return connectionDataService.getConnectionToFrontByCluster(ConnectionControllerMapper.INSTANCE.queryEntityByConnection(getConnectionListDTO)); } @GetMapping("/getConnectorDetail") diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/CreateConnectionEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/CreateConnectionEntity.java new file mode 100644 index 00000000..1f453fea --- /dev/null +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/CreateConnectionEntity.java @@ -0,0 +1,33 @@ +/* + * 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.eventmesh.dashboard.console.entity; + +import org.apache.eventmesh.dashboard.console.entity.connection.AddConnectionEntity; +import org.apache.eventmesh.dashboard.console.entity.connection.AddConnectorConfigEntity; + +import lombok.Data; + +@Data +public class CreateConnectionEntity { + + private Long clusterId; + + private AddConnectionEntity addConnectionEntity; + + private AddConnectorConfigEntity addConnectorConfigEntity; +} diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/connection/AddConnectionDTO.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/connection/AddConnectionEntity.java similarity index 92% rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/connection/AddConnectionDTO.java rename to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/connection/AddConnectionEntity.java index 63438145..917462a7 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/connection/AddConnectionDTO.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/connection/AddConnectionEntity.java @@ -15,12 +15,12 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.modle.dto.connection; +package org.apache.eventmesh.dashboard.console.entity.connection; import lombok.Data; @Data -public class AddConnectionDTO { +public class AddConnectionEntity { private String sinkName; diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/connection/AddConnectorConfigDTO.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/connection/AddConnectorConfigEntity.java similarity index 85% rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/connection/AddConnectorConfigDTO.java rename to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/connection/AddConnectorConfigEntity.java index aa6801cf..291fe8cc 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/connection/AddConnectorConfigDTO.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/connection/AddConnectorConfigEntity.java @@ -15,18 +15,16 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.modle.dto.connection; +package org.apache.eventmesh.dashboard.console.entity.connection; import org.apache.eventmesh.dashboard.console.entity.function.ConfigEntity; import java.util.List; -import lombok.AllArgsConstructor; import lombok.Data; -import lombok.NoArgsConstructor; @Data -public class AddConnectorConfigDTO { +public class AddConnectorConfigEntity { private List sinkConnectorConfigs; diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapstruct/config/ConfigControllerMapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapstruct/config/ConfigControllerMapper.java index d0f92828..2afd16c0 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapstruct/config/ConfigControllerMapper.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapstruct/config/ConfigControllerMapper.java @@ -19,9 +19,7 @@ import org.apache.eventmesh.dashboard.console.entity.function.ConfigEntity; -import org.apache.eventmesh.dashboard.console.entity.function.LogEntity; import org.apache.eventmesh.dashboard.console.modle.dto.config.GetConfigsListDTO; -import org.apache.eventmesh.dashboard.console.modle.dto.log.GetLogListDTO; import org.mapstruct.Mapper; import org.mapstruct.factory.Mappers; diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapstruct/connection/ConnectionControllerMapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapstruct/connection/ConnectionControllerMapper.java new file mode 100644 index 00000000..a1c22646 --- /dev/null +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapstruct/connection/ConnectionControllerMapper.java @@ -0,0 +1,37 @@ +/* + * 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.eventmesh.dashboard.console.mapstruct.connection; + +import org.apache.eventmesh.dashboard.console.entity.CreateConnectionEntity; +import org.apache.eventmesh.dashboard.console.entity.cluster.ConnectionEntity; +import org.apache.eventmesh.dashboard.console.modle.dto.connection.CreateConnectionDTO; +import org.apache.eventmesh.dashboard.console.modle.dto.connection.GetConnectionListDTO; + +import org.mapstruct.factory.Mappers; + +/** + * + */ +public interface ConnectionControllerMapper { + + ConnectionControllerMapper INSTANCE = Mappers.getMapper(ConnectionControllerMapper.class); + + ConnectionEntity queryEntityByConnection(GetConnectionListDTO getConnectionListDTO); + + CreateConnectionEntity queryCreateEntityByConnection(CreateConnectionDTO createConnectionDTO); +} diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/connection/CreateConnectionDTO.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/connection/CreateConnectionDTO.java index 6352038f..f204296f 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/connection/CreateConnectionDTO.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/connection/CreateConnectionDTO.java @@ -17,6 +17,9 @@ package org.apache.eventmesh.dashboard.console.modle.dto.connection; +import org.apache.eventmesh.dashboard.console.entity.connection.AddConnectionEntity; +import org.apache.eventmesh.dashboard.console.entity.connection.AddConnectorConfigEntity; + import lombok.Data; @Data @@ -24,7 +27,7 @@ public class CreateConnectionDTO { private Long clusterId; - private AddConnectionDTO addConnectionDTO; + private AddConnectionEntity addConnectionEntity; - private AddConnectorConfigDTO addConnectorConfigDTO; + private AddConnectorConfigEntity addConnectorConfigEntity; } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/ConnectionDataService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/ConnectionDataService.java index 5db26c96..c1a6345f 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/ConnectionDataService.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/ConnectionDataService.java @@ -17,16 +17,16 @@ package org.apache.eventmesh.dashboard.console.service.cluster; +import org.apache.eventmesh.dashboard.console.entity.CreateConnectionEntity; import org.apache.eventmesh.dashboard.console.entity.cluster.ConnectionEntity; import org.apache.eventmesh.dashboard.console.entity.connector.ConnectorEntity; import org.apache.eventmesh.dashboard.console.entity.function.ConfigEntity; -import org.apache.eventmesh.dashboard.console.modle.dto.connection.CreateConnectionDTO; -import org.apache.eventmesh.dashboard.console.modle.dto.connection.GetConnectionListDTO; import org.apache.eventmesh.dashboard.console.modle.vo.connection.ConnectionListVO; import java.util.List; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; /** * Service providing ConnectionEntity data. @@ -40,13 +40,16 @@ public interface ConnectionDataService { List getAllConnectionsByClusterId(Long clusterId); - boolean createConnection(CreateConnectionDTO createConnectionDTO); + boolean createConnection(CreateConnectionEntity connectionEntity); List getAllConnections(); - List getConnectionToFrontByCluster(Long clusterId, GetConnectionListDTO getConnectionListDTO); + List getConnectionToFrontByCluster(ConnectionEntity connectionEntity); + + @Transactional + void replaceAllConnections(List connectionEntityList); List getConnectorConfigsByClassAndVersion(String classType, String version); - Long insert(ConnectionEntity connectionEntity); + void insert(ConnectionEntity connectionEntity); } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/impl/ConnectionDataServiceDatabaseImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/impl/ConnectionDataServiceDatabaseImpl.java new file mode 100644 index 00000000..2ba287a8 --- /dev/null +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/impl/ConnectionDataServiceDatabaseImpl.java @@ -0,0 +1,231 @@ +/* + * 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.eventmesh.dashboard.console.service.cluster.impl; + + + +import org.apache.eventmesh.dashboard.console.annotation.EmLog; +import org.apache.eventmesh.dashboard.console.entity.CreateConnectionEntity; +import org.apache.eventmesh.dashboard.console.entity.cluster.ConnectionEntity; +import org.apache.eventmesh.dashboard.console.entity.connection.AddConnectionEntity; +import org.apache.eventmesh.dashboard.console.entity.connector.ConnectorEntity; +import org.apache.eventmesh.dashboard.console.entity.function.ConfigEntity; +import org.apache.eventmesh.dashboard.console.mapper.cluster.ConnectionMapper; +import org.apache.eventmesh.dashboard.console.mapper.connector.ConnectorMapper; +import org.apache.eventmesh.dashboard.console.mapper.function.ConfigMapper; +import org.apache.eventmesh.dashboard.console.modle.vo.connection.ConnectionListVO; +import org.apache.eventmesh.dashboard.console.service.cluster.ConnectionDataService; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + + +@Service +public class ConnectionDataServiceDatabaseImpl implements ConnectionDataService { + + @Autowired + private ConnectionMapper connectionMapper; + + @Autowired + private ConnectorMapper connectorMapper; + + @Autowired + private ConfigMapper configMapper; + + + @Override + public ConnectorEntity getConnectorById(Long connectorId) { + ConnectorEntity connectorEntity = new ConnectorEntity(); + connectorEntity.setId(connectorId); + return connectorMapper.selectById(connectorEntity); + } + + @Override + public List getConnectorBusinessType(String type) { + ConfigEntity config = new ConfigEntity(); + config.setBusinessType(type); + return configMapper.selectConnectorBusinessType(config); + } + + @Override + public List getAllConnectionsByClusterId(Long clusterId) { + ConnectionEntity connectionEntity = new ConnectionEntity(); + connectionEntity.setClusterId(clusterId); + return connectionMapper.selectByClusterId(connectionEntity); + } + + @Override + public void insert(ConnectionEntity connectionEntity) { + connectionMapper.insert(connectionEntity); + } + + + @EmLog(OprType = "add", OprTarget = "Connection") + @Override + public boolean createConnection(CreateConnectionEntity createConnectionEntity) { + ConnectorEntity sinkConnector = this.createSinkConnector(createConnectionEntity.getClusterId(), + createConnectionEntity.getAddConnectionEntity()); + ConnectorEntity sourceConnector = this.createSourceConnector(createConnectionEntity.getClusterId(), + createConnectionEntity.getAddConnectionEntity()); + ConnectionEntity connectionEntity = this.setConnection(createConnectionEntity); + connectionEntity.setSinkId(sinkConnector.getId()); + connectionEntity.setSourceId(sourceConnector.getId()); + connectionMapper.insert(connectionEntity); + this.addConnectorConfigs(createConnectionEntity.getAddConnectorConfigEntity().getSinkConnectorConfigs(), sinkConnector); + this.addConnectorConfigs(createConnectionEntity.getAddConnectorConfigEntity().getSourceConnectorConfigs(), sourceConnector); + return false; + } + + private ConnectionEntity setConnection(CreateConnectionEntity createConnectionEntity) { + ConnectionEntity connectionEntity = new ConnectionEntity(); + connectionEntity.setClusterId(createConnectionEntity.getClusterId()); + connectionEntity.setSourceType("connector"); + connectionEntity.setSinkType("connector"); + connectionEntity.setRuntimeId(-1L); + connectionEntity.setGroupId(createConnectionEntity.getAddConnectionEntity().getGroupId()); + connectionEntity.setStatus(1); + connectionEntity.setDescription(createConnectionEntity.getAddConnectionEntity().getConnectionDescription()); + connectionEntity.setTopic(createConnectionEntity.getAddConnectionEntity().getTopicName()); + return connectionEntity; + } + + public void addConnectorConfigs(List configEntityList, ConnectorEntity connectorEntity) { + configEntityList.forEach(n -> { + n.setInstanceId(connectorEntity.getId()); + n.setIsDefault(0); + n.setClusterId(connectorEntity.getClusterId()); + }); + configMapper.batchInsert(configEntityList); + } + + public ConnectorEntity createSinkConnector(Long clusterId, AddConnectionEntity addConnectionEntity) { + ConnectorEntity connectorEntity = new ConnectorEntity(); + connectorEntity.setName(addConnectionEntity.getSinkName()); + connectorEntity.setHost(addConnectionEntity.getSinkHost()); + connectorEntity.setClusterId(clusterId); + connectorEntity.setClassName(addConnectionEntity.getSinkClass()); + connectorEntity.setType("Connector"); + connectorEntity.setStatus(1); + connectorEntity.setPodState(0); + connectorEntity.setPort(addConnectionEntity.getSinkPort()); + connectorMapper.insert(connectorEntity); + return connectorEntity; + } + + public ConnectorEntity createSourceConnector(Long clusterId, AddConnectionEntity addConnectionEntity) { + ConnectorEntity connectorEntity = new ConnectorEntity(); + connectorEntity.setName(addConnectionEntity.getSourceName()); + connectorEntity.setHost(addConnectionEntity.getSourceHost()); + connectorEntity.setClusterId(clusterId); + connectorEntity.setClassName(addConnectionEntity.getSourceClass()); + connectorEntity.setType("Connector"); + connectorEntity.setStatus(1); + connectorEntity.setPodState(0); + connectorEntity.setPort(addConnectionEntity.getSourcePort()); + connectorMapper.insert(connectorEntity); + return connectorEntity; + } + + + @Override + public List getAllConnections() { + return connectionMapper.selectAll(); + } + + @Override + public List getConnectionToFrontByCluster(ConnectionEntity connectionEntity) { + List allConnectionsByClusterId = connectionMapper.selectToFrontByClusterId(connectionEntity); + List connectionListVOs = new ArrayList<>(); + allConnectionsByClusterId.forEach(n -> { + connectionListVOs.add(this.setConnectionListVO(n)); + }); + return connectionListVOs; + } + + private ConnectionListVO setConnectionListVO(ConnectionEntity connectionEntity) { + ConnectionListVO connectionListVO = new ConnectionListVO(); + ConnectorEntity connectorEntity = new ConnectorEntity(); + connectorEntity.setId(connectionEntity.getSinkId()); + ConnectorEntity sinkConnector = connectorMapper.selectById(connectorEntity); + connectorEntity.setId(connectionEntity.getSourceId()); + ConnectorEntity sourceConnector = connectorMapper.selectById(connectorEntity); + connectionListVO.setSinkClass(sinkConnector.getClassName()); + connectionListVO.setSourceClass(sourceConnector.getClassName()); + connectionListVO.setSinkConnectorId(sinkConnector.getId()); + connectionListVO.setSourceConnectorId(sourceConnector.getId()); + connectionListVO.setSinkConnectorName(sinkConnector.getName()); + connectionListVO.setSourceConnectorName(sourceConnector.getName()); + connectionListVO.setTopicName(connectionEntity.getTopic()); + connectionListVO.setStatus(connectionEntity.getStatus()); + return connectionListVO; + } + + @Override + @Transactional + public void replaceAllConnections(List connectionEntityList) { + Map> connectionsGroupedByClusterId = connectionEntityList.stream() + .collect(Collectors.groupingBy(ConnectionEntity::getClusterId)); + + connectionsGroupedByClusterId.forEach((clusterId, newConnections) -> { + ConnectionEntity connectionEntity = new ConnectionEntity(); + connectionEntity.setClusterId(clusterId); + List existingConnections = connectionMapper.selectByClusterId(connectionEntity); + + // Collect connections that are not in the new list + List connectionsToInactive = existingConnections.stream() + .filter(existingConnection -> !newConnections.contains(existingConnection)) + .collect(Collectors.toList()); + + // Collect new connections that are not in the existing list + List connectionsToInsert = newConnections.stream() + .filter(connection -> !existingConnections.contains(connection)) + .collect(Collectors.toList()); + + // Delete connections in batch + if (!connectionsToInactive.isEmpty()) { + connectionMapper.batchEndConnectionById(connectionsToInactive); + } + + // Insert new connections in batch + if (!connectionsToInsert.isEmpty()) { + connectionMapper.batchInsert(connectionsToInsert); + } + }); + } + + + @Override + public List getConnectorConfigsByClassAndVersion(String classType, String version) { + ConfigEntity config = new ConfigEntity(); + config.setBusinessType(classType); + List configEntityList = configMapper.selectConnectorConfigsByBusinessType(config); + configEntityList.forEach(n -> { + if (!n.matchVersion(version)) { + configEntityList.remove(n); + } + }); + return configEntityList; + } +} + diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/ConfigService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/ConfigService.java index 7c53e34c..c619bd17 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/ConfigService.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/ConfigService.java @@ -32,7 +32,8 @@ public interface ConfigService { List selectToFront(ConfigEntity configEntity); - void updateConfigsByInstanceId(String name, Long clusterId, Integer instanceType, Long instanceId, List changeConfigEntityList); + void updateConfigsByInstanceId(String name, Long clusterId, Integer instanceType, Long instanceId, + List changeConfigEntityList); List selectAll(); diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/Impl/HealthDataServiceDatabaseImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/Impl/HealthDataServiceDatabaseImpl.java index 89d20f3d..2b315ae6 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/Impl/HealthDataServiceDatabaseImpl.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/Impl/HealthDataServiceDatabaseImpl.java @@ -74,7 +74,10 @@ public InstanceLiveProportionVo selectTopicLiveProportion(Long clusterId) { abnormalNum++; } } - return new InstanceLiveProportionVo(abnormalNum, topicNum); + InstanceLiveProportionVo instanceLiveProportionVo = new InstanceLiveProportionVo(); + instanceLiveProportionVo.setAbnormalNum(abnormalNum); + instanceLiveProportionVo.setAllNum(topicNum); + return instanceLiveProportionVo; } @@ -89,7 +92,10 @@ public InstanceLiveProportionVo selectRuntimeLiveProportion(Long clusterId) { abnormalNum++; } } - return new InstanceLiveProportionVo(abnormalNum, topicNum); + InstanceLiveProportionVo instanceLiveProportionVo = new InstanceLiveProportionVo(); + instanceLiveProportionVo.setAbnormalNum(abnormalNum); + instanceLiveProportionVo.setAllNum(topicNum); + return instanceLiveProportionVo; } diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/service/connection/impl/ConnectionDataServiceDatabaseImplTest.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/service/connection/impl/ConnectionDataServiceDatabaseImplTest.java index b01940a1..0884b5cf 100644 --- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/service/connection/impl/ConnectionDataServiceDatabaseImplTest.java +++ b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/service/connection/impl/ConnectionDataServiceDatabaseImplTest.java @@ -20,6 +20,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import org.apache.eventmesh.dashboard.console.entity.cluster.ConnectionEntity; +import org.apache.eventmesh.dashboard.console.service.cluster.impl.ConnectionDataServiceDatabaseImpl; import java.util.List; @@ -52,4 +53,4 @@ public void testGetAllConnections() { List connectionEntityList = connectionServiceDatabaseImpl.getAllConnections(); assertEquals(6, connectionEntityList.size()); } -} \ No newline at end of file +}