Skip to content

Commit

Permalink
Sync the modification of apache#85
Browse files Browse the repository at this point in the history
  • Loading branch information
周倬贤 committed Apr 7, 2024
1 parent f97576a commit 9c6ac39
Show file tree
Hide file tree
Showing 17 changed files with 24 additions and 56 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@ public interface ClusterMapper {
@Insert("INSERT INTO cluster (name, registry_name_list, bootstrap_servers, eventmesh_version, client_properties, "
+ "jmx_properties, reg_properties, description, auth_type, run_state,store_type) VALUES (#{name},#{registryNameList},"
+ "#{bootstrapServers},#{eventmeshVersion},#{clientProperties},#{jmxProperties},#{regProperties},#{description},#{authType},"
+ "#{runState},#{storeType})"
+ "ON DUPLICATE KEY UPDATE status = 1")
+ "#{runState},#{storeType})")
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
void addCluster(ClusterEntity cluster);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,6 @@ public interface ConfigMapper {
@Select("SELECT * FROM config WHERE status=1 AND is_default=0")
List<ConfigEntity> selectAll();

/**
* todo Insertion of supplemental version number values;
*
* @param configEntityList
*/
@Insert({
"<script>",
" INSERT INTO config (cluster_id, business_type, instance_type, instance_id, config_name, config_value, start_version,",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public List<ConnectionEntity> selectByClusterIdSinkTypeAndSinkIdAndCreateTimeRan
@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}, #{status}, #{topic}, #{groupId}, #{description})")
Long insert(ConnectionEntity connectionEntity);
void insert(ConnectionEntity connectionEntity);

@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
@Insert({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
@Mapper
public interface ConnectorMapper {


@Select("SELECT * FROM connector WHERE status=1")
ConnectorEntity selectAll();

Expand Down Expand Up @@ -76,7 +75,7 @@ public interface ConnectorMapper {
void updateConfigIds(ConnectorEntity connectorEntity);

@Update("UPDATE connector SET status = 0 WHERE cluster_id = #{clusterId}")
void deactivateById(ConnectorEntity connectorEntity);
void deactivateByClusterId(ConnectorEntity connectorEntity);

@Update({
"<script>",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,6 @@ public interface HealthCheckResultMapper {
@Select("SELECT * FROM health_check_result WHERE type_id = #{typeId} AND type=#{type} AND create_time>#{createTime}")
List<HealthCheckResultEntity> getInstanceLiveStatusHistory(HealthCheckResultEntity healthCheckResultEntity);

@Select("SELECT state FROM health_check_result WHERE type=#{type} AND type_id=#{typeId} AND create_time= (SELECT MAX(create_time) "
+ "FROM health_check_result WHERE type_id=#{typeId} AND type=#{type})")
Integer selectStateByTypeAndId(HealthCheckResultEntity healthCheckResultEntity);

@Select(
"SELECT count(*) FROM health_check_result WHERE type_id =#{typeId} AND type=#{type} AND state != 1 AND create_time= (SELECT MAX(create_time) "
+ "FROM health_check_result WHERE type_id=#{typeId} AND type=#{type} )")
Integer getAbnormalNumByClusterIdAndType(HealthCheckResultEntity healthCheckResultEntity);

@Select("SELECT * FROM health_check_result WHERE type_id =#{typeId} AND type=#{type} AND create_time= (SELECT MAX(create_time) "
+ "FROM health_check_result WHERE type_id=#{typeId} AND type=#{type})")
HealthCheckResultEntity getLatestByTypeAndId(HealthCheckResultEntity healthCheckResultEntity);

@Select("SELECT * FROM health_check_result")
List<HealthCheckResultEntity> selectAll();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public interface MetaMapper {
"</foreach>",
"</script>"})
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
List<Long> batchInsert(List<MetaEntity> metaEntities);
void batchInsert(List<MetaEntity> metaEntities);

@Select("SELECT * FROM meta WHERE id = #{id}")
MetaEntity selectById(MetaEntity metaEntity);
Expand All @@ -55,7 +55,7 @@ public interface MetaMapper {
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
@Insert("INSERT INTO meta (name, type, version, cluster_id, host, port, role, username, params, status)"
+ " VALUES ( #{name}, #{type}, #{version}, #{clusterId}, #{host}, #{port}, #{role}, #{username}, #{params}, #{status})")
Long insert(MetaEntity metaEntity);
void insert(MetaEntity metaEntity);

@Update("UPDATE meta SET status = 0 WHERE id = #{id}")
void deactivate(MetaEntity metaEntity);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ public interface RuntimeMapper {
void batchInsert(List<RuntimeEntity> 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},#{startTimestamp},#{rack},#{status},#{endpointMap})"
+ " ON DUPLICATE KEY UPDATE status=1,start_timestamp = now()")
+ "endpoint_map) VALUES(#{clusterId},#{host},#{storageClusterId},#{port},#{jmxPort},#{startTimestamp},#{rack},#{status},#{endpointMap})")
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
void addRuntime(RuntimeEntity runtimeEntity);

Expand All @@ -78,7 +77,7 @@ public interface RuntimeMapper {
@Update("UPDATE runtime SET port=#{port} ,jmx_port=#{jmxPort} ,status=#{status} WHERE cluster_id=#{clusterId} AND status=1")
void updateRuntimeByCluster(RuntimeEntity runtimeEntity);

@Delete("UPDATE runtime SET status=0 WHERE cluster_id=#{clusterId}")
@Update("UPDATE runtime SET status=0 WHERE cluster_id=#{clusterId}")
void deleteRuntimeByCluster(RuntimeEntity runtimeEntity);

@Update("UPDATE runtime SET status = 0 WHERE id = #{id}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ public interface ClusterService {

List<ClusterEntity> selectAllCluster();

ClusterEntity selectClusterById(Long cluster);
ClusterEntity selectClusterById(ClusterEntity cluster);

void updateClusterById(ClusterEntity cluster);

void deleteClusterById(ClusterEntity cluster);
void deactivate(ClusterEntity cluster);
}
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,8 @@ public List<ClusterEntity> selectAllCluster() {
}

@Override
public ClusterEntity selectClusterById(Long clusterId) {
ClusterEntity clusterEntity = new ClusterEntity();
clusterEntity.setId(clusterId);
return clusterMapper.selectClusterById(clusterEntity);
public ClusterEntity selectClusterById(ClusterEntity cluster) {
return clusterMapper.selectClusterById(cluster);
}

@Override
Expand All @@ -120,7 +118,7 @@ public void updateClusterById(ClusterEntity cluster) {
}

@Override
public void deleteClusterById(ClusterEntity cluster) {
public void deactivate(ClusterEntity cluster) {
clusterMapper.deactivate(cluster);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,5 @@ public interface ConnectionDataService {

List<ConfigEntity> getConnectorConfigsByClassAndVersion(String classType, String version);

Long insert(ConnectionEntity connectionEntity);
void insert(ConnectionEntity connectionEntity);
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ public List<ConnectionEntity> getAllConnectionsByClusterId(Long clusterId) {
}

@Override
public Long insert(ConnectionEntity connectionEntity) {
return connectionMapper.insert(connectionEntity);
public void insert(ConnectionEntity connectionEntity) {
connectionMapper.insert(connectionEntity);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@
*/
public interface RegistryDataService {

public List<MetaEntity> selectAll();
List<MetaEntity> selectAll();

public List<Long> batchInsert(List<MetaEntity> metaEntities);
void batchInsert(List<MetaEntity> metaEntities);

public Long insert(MetaEntity metaEntity);
void insert(MetaEntity metaEntity);

public void deactivate(MetaEntity metaEntity);
void deactivate(MetaEntity metaEntity);
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ public List<MetaEntity> selectAll() {
}

@Override
public List<Long> batchInsert(List<MetaEntity> metaEntities) {
return metaMapper.batchInsert(metaEntities);
public void batchInsert(List<MetaEntity> metaEntities) {
metaMapper.batchInsert(metaEntities);
}

@Override
public Long insert(MetaEntity metaEntity) {
return metaMapper.insert(metaEntity);
public void insert(MetaEntity metaEntity) {
metaMapper.insert(metaEntity);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,6 @@ public class StoreServiceImpl implements StoreService {
@Autowired
private StoreMapper storeMapper;

@Override
public void updateConfigById(Long storeId) {

}


@Override
public StoreEntity getStoreToFrontListByCluster(Long clusterId) {
StoreEntity storeEntity = new StoreEntity();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@
*/
public interface StoreService {

void updateConfigById(Long storeId);

StoreEntity getStoreToFrontListByCluster(Long clusterId);

List<StoreEntity> selectAll();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


@Service
public class TopicServiceImpl implements TopicService {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public void testUpdateConfigIds() {
public void testDeActiveById() {
ConnectorEntity connectorEntity = new ConnectorEntity();
connectorEntity.setId(1L);
connectorMapper.deactivateById(connectorEntity);
connectorMapper.deactivateByClusterId(connectorEntity);

connectorEntity = connectorMapper.selectById(connectorEntity);
assertEquals(1, connectorEntity.getStatus());
Expand Down

0 comments on commit 9c6ac39

Please sign in to comment.