Skip to content

Commit

Permalink
Some changes in the specification
Browse files Browse the repository at this point in the history
  • Loading branch information
周倬贤 committed Mar 7, 2024
1 parent 506023b commit 886c754
Show file tree
Hide file tree
Showing 12 changed files with 74 additions and 71 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,25 +34,25 @@
@Mapper
public interface ClusterMapper {

@Select("select * from cluster where is_delete=0")
@Select("SELECT * FROM cluster WHERE is_delete=0")
List<ClusterEntity> selectAllCluster();

@Select("select * from cluster where id=#{id} and is_delete=0")
@Select("SELECT * FROM cluster WHERE id=#{id} AND is_delete=0")
ClusterEntity selectClusterById(ClusterEntity cluster);

@Insert("insert into cluster (name, register_name_list, bootstrap_servers, eventmesh_version, client_properties, "
+ "jmx_properties, reg_properties, description, auth_type, run_state) values (#{name},#{registerNameList},"
@Insert("INSERT INTO cluster (name, register_name_list, bootstrap_servers, eventmesh_version, client_properties, "
+ "jmx_properties, reg_properties, description, auth_type, run_state) VALUES (#{name},#{registerNameList},"
+ "#{bootstrapServers},#{eventmeshVersion},#{clientProperties},#{jmxProperties},#{regProperties},#{description},#{authType},#{runState})")
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
void addCluster(ClusterEntity cluster);

@Update("update cluster set name =#{name},reg_properties=#{regProperties},bootstrap_servers=#{bootstrapServers},"
@Update("UPDATE cluster SET name =#{name},reg_properties=#{regProperties},bootstrap_servers=#{bootstrapServers},"
+ "eventmesh_version=#{eventmeshVersion},client_properties=#{clientProperties},jmx_properties=#{jmxProperties},"
+ "reg_properties=#{regProperties},description=#{description},auth_type=#{authType},run_state=#{runState} ,"
+ "register_name_list=#{registerNameList} where id=#{id}")
+ "register_name_list=#{registerNameList} WHERE id=#{id}")
void updateClusterById(ClusterEntity cluster);

@Delete("update cluster set is_delete=1 where id=#{id}")
@Delete("UPDATE cluster SET is_delete=1 WHERE id=#{id}")
void deleteClusterById(ClusterEntity clusterEntity);

}
Original file line number Diff line number Diff line change
Expand Up @@ -40,21 +40,21 @@ public interface ConfigMapper {
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
Integer addConfig(ConfigEntity configEntity);

@Update("update config set status=2 where id=#{id}")
@Update("UPDATE config SET status=2 WHERE id=#{id}")
Integer deleteConfig(ConfigEntity configEntity);

@Update("update config set config_value=#{configValue} where status=1 and edit=2")
@Update("UPDATE config SET config_value=#{configValue} WHERE status=1 AND edit=2")
void updateConfig(ConfigEntity configEntity);

@Select("select * from config where business_type=#{businessType} and instance_type=#{instanceType} "
+ "and instance_id=#{instanceId}")
@Select("SELECT * FROM config WHERE business_type=#{businessType} AND instance_type=#{instanceType} "
+ "AND instance_id=#{instanceId}")
List<ConfigEntity> selectByInstanceId(ConfigEntity configEntity);

@Select("select * from config where cluster_id=-1 and business_type=#{businessType} and instance_type=#{instanceType}")
@Select("SELECT * FROM config WHERE cluster_id=-1 AND business_type=#{businessType} AND instance_type=#{instanceType}")
List<ConfigEntity> selectDefaultConfig(ConfigEntity configEntity);


@Select("select * from config where cluster_id=#{clusterId} and instance_type=#{instanceType} "
+ "and instance_id=#{instanceId} and config_name=#{configName} and status=1")
@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);
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,36 +36,36 @@ public interface OprGroupMapper {

@Insert("INSERT INTO `group` (cluster_id, name, member_count, members, type, state)"
+ "VALUE (#{clusterId},#{name},#{memberCount},#{members},#{type},#{state}) "
+ "on duplicate key update is_delete=0")
+ "ON DUPLICATE KEY UPDATE is_delete=0")
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
void addGroup(GroupEntity groupEntity);

@Update("update `group`set member_count=#{memberCount},"
+ "members=#{members},type=#{type},state=#{state} where id=#{id}")
@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);

@Delete("update `group` set is_delete=1 where id=#{id}")
@Delete("UPDATE `group` SET is_delete=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 is_delete=0")
@Select("SELECT * FROM `group` WHERE cluster_id=#{clusterId} AND name=#{name} AND is_delete=0")
GroupEntity selectGroupByUnique(GroupEntity groupEntity);

@Select("select * from `group` where id=#{id} and is_delete=0")
@Select("SELECT * FROM `group` WHERE id=#{id} AND is_delete=0")
GroupEntity selectGroupById(GroupEntity groupEntity);

@Select({
"<script>",
" select * from `group`",
" SELECT * FROM `group`",
" <where>",
" <if test='clusterId != null'>",
" cluster_id=#{clusterId}",
" </if>",
" <if test='name != null'>",
" and name like concat('%',#{name},'%')",
" AND name LIKE concat('%',#{name},'%')",
" </if>",
" and is_delete=0",
" AND is_delete=0",
" </where>",
"</script>"})
List<GroupEntity> selectGroup(GroupEntity groupEntity);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,47 +36,47 @@
@Mapper
public interface OprGroupMemberMapper {

@Select("select * from group_member where cluster_id=#{clusterId} and is_delete=0")
@Select("SELECT * FROM group_member WHERE cluster_id=#{clusterId} AND is_delete=0")
List<GroupMemberEntity> getGroupByClusterId(GroupMemberEntity groupMemberEntity);

@Insert("insert into group_member (cluster_id, topic_name, group_name, eventmesh_user,state)"
@Insert("INSERT INTO group_member (cluster_id, topic_name, group_name, eventmesh_user,state)"
+ " VALUE (#{clusterId},#{topicName},#{groupName},#{eventMeshUser},#{state})"
+ "on duplicate key update is_delete=0")
+ "ON DUPLICATE KEY UPDATE is_delete=0")
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
void addGroupMember(GroupMemberEntity groupMemberEntity);

@Update("update group_member set state=#{state} where id=#{id}")
@Update("UPDATE group_member SET state=#{state} WHERE id=#{id}")
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
void updateGroupMember(GroupMemberEntity groupMemberEntity);

@Delete("update group_member set is_delete=1 where id=#{id} ")
@Delete("UPDATE group_member SET is_delete=1 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 is_delete=0")
@Select("SELECT * FROM group_member WHERE cluster_id=#{clusterId} AND group_name=#{groupName} AND topic_name=#{topicName} AND is_delete=0")
GroupMemberEntity selectGroupMemberByUnique(GroupMemberEntity groupMemberEntity);

@Select("select * from group_member where id=#{id} and is_delete=0")
@Select("SELECT * FROM group_member WHERE id=#{id} AND is_delete=0")
GroupMemberEntity selectGroupMemberById(GroupMemberEntity groupMemberEntity);

@Select({
"<script>",
" select * from group_member",
" SELECT * FROM group_member",
" <where>",
" <if test='clusterId != null'>",
" cluster_id=#{clusterId}",
" </if>",
" <if test='groupName != null'>",
" and group_name=#{groupName}",
" AND group_name=#{groupName}",
" </if>",
" <if test='topicName != null'>",
" and topic_name=#{topicName}",
" AND topic_name=#{topicName}",
" </if>",
" </where>",
" and is_delete=0",
" AND is_delete=0",
"</script>"})
List<GroupMemberEntity> selectMember(GroupMemberEntity groupMemberEntity);

@Update("update group_member set state=#{state} where topic_name=#{topicName}")
@Update("UPDATE group_member SET state=#{state} WHERE topic_name=#{topicName}")
void updateMemberByTopic(GroupMemberEntity groupMemberEntity);
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,27 +35,27 @@ public interface OprLogMapper {

@Select({
"<script>",
" select * from operation_log",
" SELECT * FROM operation_log",
" <where>",
" <if test='targetType!=null'>",
" target_type=#{operationType}",
" </if>",
" <if test='operationUser!=null'>",
" and operation_user=#{operationUser}",
" AND operation_user=#{operationUser}",
" </if>",
" <if test='clusterId!=null'>",
" and cluster_id=#{clusterId} ",
" AND cluster_id=#{clusterId} ",
" </if>",
" and is_delete=0",
" AND is_delete=0",
" </where>",
"</script>"})
List<LogEntity> getLogList(LogEntity logEntity);

@Insert("insert into operation_log ( cluster_id, operation_type,target_Type, content,operation_user,result)"
@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 status=#{status} ,result=#{resultContent} where id=#{id}")
@Update("UPDATE operation_log SET status=#{status} ,result=#{resultContent} WHERE id=#{id}")
Integer updateLog(LogEntity logEntity);
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,18 @@
@Mapper
public interface RuntimeMapper {

@Insert("insert into runtime (cluster_id, host, storage_cluster_id, port, jmx_port, start_timestamp, rack, status, "
@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})")
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
void addRuntime(RuntimeEntity runtimeEntity);

@Select("select * from runtime where cluster_id=#{clusterId} and is_delete=0")
@Select("SELECT * FROM runtime WHERE cluster_id=#{clusterId} AND is_delete=0")
List<RuntimeEntity> selectRuntimeByCluster(RuntimeEntity runtimeEntity);

@Update("update runtime set port=#{port} ,jmx_port=#{jmxPort} ,status=#{status} where cluster_id=#{clusterId} and is_delete=0")
@Update("UPDATE runtime SET port=#{port} ,jmx_port=#{jmxPort} ,status=#{status} WHERE cluster_id=#{clusterId} AND is_delete=0")
void updateRuntimeByCluster(RuntimeEntity runtimeEntity);

@Delete("update runtime set is_delete=1 where cluster_id=#{clusterId}")
@Delete("UPDATE runtime SET is_delete=1 WHERE cluster_id=#{clusterId}")
void deleteRuntimeByCluster(RuntimeEntity runtimeEntity);

}
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,19 @@
@Mapper
public interface StoreMapper {

@Insert("insert into store (cluster_id, store_id, store_type, host, runtime_id, topic_list, diff_type"
@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 addStorage(StoreEntity storeEntity);

@Update("update store set is_delete=1 where cluster_id=#{clusterId} and store_id=#{storeId}")
@Update("UPDATE store SET is_delete=1 WHERE cluster_id=#{clusterId} AND store_id=#{storeId}")
void deleteStoreByUnique(StoreEntity storeEntity);

@Select("select * from store where cluster_id=#{clusterId} and is_delete=0")
@Select("SELECT * FROM store WHERE cluster_id=#{clusterId} AND is_delete=0")
List<StoreEntity> selectStoreByCluster(StoreEntity storeEntity);

@Update("update store set status=#{status} where cluster_id=#{clusterId} and store_id=#{storeId}")
@Update("UPDATE store SET status=#{status} WHERE cluster_id=#{clusterId} AND store_id=#{storeId}")
void updateStoreByUnique(StoreEntity storeEntity);
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,40 +35,43 @@
@Mapper
public interface TopicMapper {

@Select("SELECT count(*) FROM topic WHERE cluster_id=#{clusterId}")
Integer selectTopicNumByCluster(TopicEntity topicEntity);

@Select({
"<script>",
" select * from topic",
" SELECT * FROM topic",
" <where>",
" <if test='topicName!=null'>",
" and topic_name=#{topicName}",
" AND topic_name=#{topicName}",
" </if>",
" <if test='clusterId!=null'>",
" and cluster_id=#{clusterId} ",
" AND cluster_id=#{clusterId} ",
" </if>",
" and is_delete=0",
" AND is_delete=0",
" </where>",
"</script>"})
List<TopicEntity> getTopicList(TopicEntity topicEntity);

@Insert("INSERT INTO topic (cluster_id, topic_name, runtime_id, storage_id, retention_ms, type, description) "
+ "VALUE (#{clusterId},#{topicName},#{runtimeId},#{storageId},#{retentionMs},#{type},#{description})"
+ "on duplicate key update is_delete = 0")
+ "ON DUPLICATE KEY UPDATE is_delete = 0")
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
void addTopic(TopicEntity topicEntity);

@Update("update topic set type=#{type},description=#{description} where id=#{id}")
@Update("UPDATE topic SET type=#{type},description=#{description} WHERE id=#{id}")
void updateTopic(TopicEntity topicEntity);

@Delete("update `topic` set is_delete=1 where id=#{id}")
@Delete("UPDATE `topic` SET is_delete=1 WHERE id=#{id}")
void deleteTopic(TopicEntity topicEntity);

@Select("select * from topic where cluster_id=#{clusterId} and topic_name=#{topicName}")
@Select("SELECT * FROM topic WHERE cluster_id=#{clusterId} AND topic_name=#{topicName}")
TopicEntity selectTopicByUnique(TopicEntity topicEntity);

@Select("select * from topic where id=#{id}")
@Select("SELECT * FROM topic WHERE id=#{id}")
TopicEntity selectTopicById(TopicEntity topicEntity);

@Select("select * from topic where cluster_id=#{clusterId}")
@Select("SELECT * FROM topic WHERE cluster_id=#{clusterId}")
List<TopicEntity> selectTopicByCluster(TopicEntity topicEntity);

}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import org.springframework.stereotype.Service;

@Service
public class SynchronousConnectorConfigTask {
public class SynchronousConnectorConfigDBToInstanceTask {

@Autowired
private ConnectorDataService connectorDataService;
Expand Down Expand Up @@ -71,7 +71,7 @@ public void synchronousConnectorConfig(Long clusterId) {
}
}

public ConcurrentHashMap<String, String> configListToMap(List<ConfigEntity> configEntityList) {
private ConcurrentHashMap<String, String> configListToMap(List<ConfigEntity> configEntityList) {
ConcurrentHashMap<String, String> connectorConfigMap = new ConcurrentHashMap<>();
configEntityList.forEach(n -> {
connectorConfigMap.put(n.getConfigName(), n.getConfigValue());
Expand All @@ -81,7 +81,7 @@ public ConcurrentHashMap<String, String> configListToMap(List<ConfigEntity> conf
}


public ConfigEntity getConfigEntityBelongInstance(Long clusterId, Long id) {
private ConfigEntity getConfigEntityBelongInstance(Long clusterId, Long id) {
ConfigEntity configEntity = new ConfigEntity();
configEntity.setClusterId(clusterId);
configEntity.setInstanceId(id);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import org.springframework.stereotype.Service;

@Service
public class SynchronousRuntimeConfigTask {
public class SynchronousRuntimeConfigDBToInstanceTask {

@Autowired
private RuntimeService runtimeService;
Expand Down Expand Up @@ -73,7 +73,7 @@ public void synchronousRuntimeConfig(Long clusterId) {
}
}

public ConcurrentHashMap<String, String> configListToMap(List<ConfigEntity> configEntityList) {
private ConcurrentHashMap<String, String> configListToMap(List<ConfigEntity> configEntityList) {
ConcurrentHashMap<String, String> runtimeConfigMap = new ConcurrentHashMap<>();
configEntityList.forEach(n -> {
runtimeConfigMap.put(n.getConfigName(), n.getConfigValue());
Expand All @@ -83,7 +83,7 @@ public ConcurrentHashMap<String, String> configListToMap(List<ConfigEntity> conf
}


public ConfigEntity getConfigEntityBelongInstance(Long clusterId, Long id) {
private ConfigEntity getConfigEntityBelongInstance(Long clusterId, Long id) {
ConfigEntity configEntity = new ConfigEntity();
configEntity.setClusterId(clusterId);
configEntity.setInstanceId(id);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import org.springframework.stereotype.Service;

@Service
public class SynchronousStorageConfigTask {
public class SynchronousStorageConfigDBToInstanceTask {

@Autowired
private RuntimeService runtimeService;
Expand Down Expand Up @@ -72,7 +72,7 @@ public void synchronousRuntimeConfig(Long clusterId) {
}
}

public ConcurrentHashMap<String, String> configListToMap(List<ConfigEntity> configEntityList) {
private ConcurrentHashMap<String, String> configListToMap(List<ConfigEntity> configEntityList) {
ConcurrentHashMap<String, String> runtimeConfigMap = new ConcurrentHashMap<>();
configEntityList.forEach(n -> {
runtimeConfigMap.put(n.getConfigName(), n.getConfigValue());
Expand All @@ -82,7 +82,7 @@ public ConcurrentHashMap<String, String> configListToMap(List<ConfigEntity> conf
}


public ConfigEntity getConfigEntityBelongInstance(Long clusterId, Long id) {
private ConfigEntity getConfigEntityBelongInstance(Long clusterId, Long id) {
ConfigEntity configEntity = new ConfigEntity();
configEntity.setClusterId(clusterId);
configEntity.setInstanceId(id);
Expand Down
Loading

0 comments on commit 886c754

Please sign in to comment.