Skip to content

Commit

Permalink
Changes to code specifications
Browse files Browse the repository at this point in the history
  • Loading branch information
周倬贤 committed Jun 14, 2024
1 parent d3ffcb5 commit 1bcb578
Show file tree
Hide file tree
Showing 54 changed files with 424 additions and 414 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -46,24 +48,24 @@ public class ConnectionController {
* @param type
* @return
*/
@GetMapping("/cluster/connection/getConnectorBusinessType")
@GetMapping("/getConnectorBusinessType")
public List<String> getConnectorBusinessType(String type) {
return connectionDataService.getConnectorBusinessType(type);
}

@GetMapping("/cluster/connection/getConnectorConfigs")
@GetMapping("/getConnectorConfigs")
public List<ConfigEntity> 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);
Expand All @@ -75,12 +77,12 @@ public String createConnection(@Validated @RequestBody CreateConnectionDTO creat
}


@PostMapping("/cluster/connection/getConnectionList")
@PostMapping("/getConnectionList")
public List<ConnectionListVO> 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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public class ClusterController {

@GetMapping("queryHomeClusterData")
public GetClusterBaseMessageVO queryHomeClusterData(@RequestBody @Validated ClusterIdDTO clusterIdDTO) {
return clusterService.getClusterBaseMessage(clusterIdDTO);
return clusterService.selectClusterBaseMessage(clusterIdDTO);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public class ClusterRelationshipController {

@PostMapping("addClusterRelationshipEntry")
public void addClusterRelationshipEntry(@RequestBody ClusterRelationshipEntity clusterRelationshipEntity) {
this.clusterRelationshipService.addClusterRelationshipEntry(clusterRelationshipEntity);
this.clusterRelationshipService.insertClusterRelationshipEntry(clusterRelationshipEntity);

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public class RuntimeController {
@PostMapping("/queryRuntimeListByClusterId")
public List<RuntimeEntity> queryRuntimeListByClusterId(@Validated @RequestBody ClusterIdDTO clusterIdDTO) {
List<RuntimeEntity> runtimeEntityList =
runtimeService.getRuntimeToFrontByClusterId(RuntimeControllerMapper.INSTANCE.queryRuntimeListByClusterId(clusterIdDTO));
runtimeService.selectRuntimeToFrontByClusterId(RuntimeControllerMapper.INSTANCE.queryRuntimeListByClusterId(clusterIdDTO));
runtimeEntityList.forEach(n -> {
n.setStatus(CheckResultCache.getINSTANCE().getLastHealthyCheckResult("runtime", n.getId()));
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand All @@ -51,7 +53,7 @@ public String updateConfigsByTypeAndId(@Validated @RequestBody UpdateConfigDTO u
}


@PostMapping("/cluster/config/getInstanceDetailConfigs")
@PostMapping("/getInstanceDetailConfigs")
public List<DetailConfigsVO> getInstanceDetailConfigs(@Validated @RequestBody GetConfigsListDTO getConfigsListDTO) {
List<ConfigEntity> configEntityList = configService.selectToFront(getConfigsListDTO.getInstanceId(),
getConfigsListDTO.getInstanceType(), getConfigsListDTO);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<HealthCheckResultEntity> 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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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<LogEntity> getLogLIstToFront(@Validated @RequestBody GetLogListDTO getLogListDTO) {
return logService.getLogListByCluster(getLogListDTO);
return logService.selectLogListByCluster(getLogListDTO);
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public class GroupController {

@PostMapping("queryGroupListByClusterId")
public List<GroupEntity> queryGroupListByClusterId(@RequestBody @Validated ClusterIdDTO clusterIdDTO) {
return groupService.getGroupByClusterId(GroupControllerMapper.INSTANCE.queryGroupListByClusterId(clusterIdDTO));
return groupService.selectGroupByClusterId(GroupControllerMapper.INSTANCE.queryGroupListByClusterId(clusterIdDTO));
}

@PostMapping("deleteGroupById")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public class TopicController {

@PostMapping("/queryTopicListByClusterId")
public List<TopicEntity> queryTopicListByClusterId(@Validated @RequestBody GetTopicListDTO getTopicListDTO) {
return topicService.getTopicListToFront(TopicControllerMapper.INSTANCE.queryTopicListByClusterId(getTopicListDTO));
return topicService.selectTopicListToFront(TopicControllerMapper.INSTANCE.queryTopicListByClusterId(getTopicListDTO));
}

@PostMapping("queryTopicListById ")
Expand All @@ -72,7 +72,7 @@ public void createTopic(@Validated @RequestBody CreateTopicDTO createTopicDTO) {
*/
@GetMapping("/cluster/topic/getTopicDetailGroups")
public List<TopicDetailGroupVO> getTopicDetailGroups(Long topicId) {
return topicService.getTopicDetailGroups(topicId);
return topicService.selectTopicDetailGroups(topicId);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,18 @@
@Mapper
public interface AclMapper {

@Select("SELECT * FROM acl WHERE id=#{id}")
AclEntity selectById(AclEntity aclEntity);

@Select("SELECT * FROM acl")
List<AclEntity> 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({
"<script>",
" INSERT INTO acl (cluster_Id, pattern, operation, permission_Type, host, resource_Type, resource_Name, pattern_Type) VALUES ",
Expand All @@ -43,22 +55,12 @@ public interface AclMapper {
" </foreach>",
"</script>"})
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
void batchInsert(List<AclEntity> aclEntities);
Integer batchInsert(List<AclEntity> 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<AclEntity> selectAll();

@Select("SELECT * FROM acl WHERE id=#{id}")
AclEntity selectById(AclEntity aclEntity);
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,21 @@
public interface ClientMapper {


@Select("SELECT * FROM `client` WHERE `host` = #{host} AND `port` = #{port} AND status = 1")
List<ClientEntity> selectByHostPort(ClientEntity clientEntity);

@Select("SELECT * FROM `client` WHERE `id` = #{id}")
ClientEntity selectById(ClientEntity clientEntity);

@Select("SELECT * FROM `client` WHERE `cluster_id` = #{clusterId}")
List<ClientEntity> 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({
"<script>",
" INSERT INTO client (cluster_id, name, platform, language, pid, host, port, protocol, status,",
Expand All @@ -45,16 +60,7 @@ public interface ClientMapper {
" </foreach>",
"</script>"})
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
void batchInsert(List<ClientEntity> clientEntityList);

@Select("SELECT * FROM `client` WHERE `host` = #{host} AND `port` = #{port} AND status = 1")
List<ClientEntity> selectByHostPort(ClientEntity clientEntity);

@Select("SELECT * FROM `client` WHERE `id` = #{id}")
ClientEntity selectById(ClientEntity clientEntity);

@Select("SELECT * FROM `client` WHERE `cluster_id` = #{clusterId}")
List<ClientEntity> selectByClusterId(ClientEntity clientEntity);
Integer batchInsert(List<ClientEntity> clientEntityList);

@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
@Insert(
Expand All @@ -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);

}
Loading

0 comments on commit 1bcb578

Please sign in to comment.