Skip to content

Commit

Permalink
fourth improve
Browse files Browse the repository at this point in the history
  • Loading branch information
zzxxiansheng committed Feb 1, 2024
1 parent edb4005 commit c030859
Show file tree
Hide file tree
Showing 15 changed files with 275 additions and 302 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@

package org.apache.eventmesh.dashboard.console.service.group;

import org.apache.eventmesh.dashboard.console.entity.GroupEntity;
import org.apache.eventmesh.dashboard.console.entity.GroupMemberEntity;
import org.apache.eventmesh.dashboard.console.entity.group.GroupEntity;
import org.apache.eventmesh.dashboard.console.entity.groupmember.GroupMemberEntity;


import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
package org.apache.eventmesh.dashboard.console.service.group;

import org.apache.eventmesh.dashboard.console.annotation.EmLog;
import org.apache.eventmesh.dashboard.console.entity.GroupEntity;
import org.apache.eventmesh.dashboard.console.entity.GroupMemberEntity;
import org.apache.eventmesh.dashboard.console.entity.group.GroupEntity;
import org.apache.eventmesh.dashboard.console.entity.groupmember.GroupMemberEntity;
import org.apache.eventmesh.dashboard.console.mapper.group.OprGroupMapper;
import org.apache.eventmesh.dashboard.console.service.groupmember.GroupMemberService;

Expand All @@ -45,6 +45,7 @@ public List<GroupEntity> getGroupByClusterId(GroupEntity groupEntity) {

}

@EmLog(OprType = "add", OprTarget = "Group")
@Override
public GroupEntity addGroup(GroupEntity groupEntity) {
oprGroupMapper.addGroup(groupEntity);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@

package org.apache.eventmesh.dashboard.console.service.groupmember;

import org.apache.eventmesh.dashboard.console.entity.GroupEntity;
import org.apache.eventmesh.dashboard.console.entity.GroupMemberEntity;
import org.apache.eventmesh.dashboard.console.entity.group.GroupEntity;
import org.apache.eventmesh.dashboard.console.entity.groupmember.GroupMemberEntity;

import java.util.List;

Expand All @@ -29,9 +29,9 @@ public interface GroupMemberService {

List<GroupMemberEntity> getGroupMemberByClusterId(GroupMemberEntity groupMemberEntity);

GroupMemberEntity addGroupMember(GroupMemberEntity groupMemberEntity);
void addGroupMember(GroupMemberEntity groupMemberEntity);

GroupMemberEntity updateGroupMember(GroupMemberEntity groupMemberEntity);
void updateGroupMember(GroupMemberEntity groupMemberEntity);

GroupMemberEntity deleteGroupMember(GroupMemberEntity groupMemberEntity);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
package org.apache.eventmesh.dashboard.console.service.groupmember;

import org.apache.eventmesh.dashboard.console.annotation.EmLog;
import org.apache.eventmesh.dashboard.console.entity.GroupEntity;
import org.apache.eventmesh.dashboard.console.entity.GroupMemberEntity;
import org.apache.eventmesh.dashboard.console.entity.group.GroupEntity;
import org.apache.eventmesh.dashboard.console.entity.groupmember.GroupMemberEntity;
import org.apache.eventmesh.dashboard.console.mapper.groupmember.OprGroupMemberMapper;

import java.util.List;
Expand All @@ -41,13 +41,13 @@ public List<GroupMemberEntity> getGroupMemberByClusterId(GroupMemberEntity group

@Override
@EmLog(OprType = "add", OprTarget = "GroupMember")
public GroupMemberEntity addGroupMember(GroupMemberEntity groupMemberEntity) {
return oprGroupMemberMapper.addGroupMember(groupMemberEntity);
public void addGroupMember(GroupMemberEntity groupMemberEntity) {
oprGroupMemberMapper.addGroupMember(groupMemberEntity);
}

@Override
public GroupMemberEntity updateGroupMember(GroupMemberEntity groupMemberEntity) {
return oprGroupMemberMapper.updateGroupMember(groupMemberEntity);
public void updateGroupMember(GroupMemberEntity groupMemberEntity) {
oprGroupMemberMapper.updateGroupMember(groupMemberEntity);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

package org.apache.eventmesh.dashboard.console.service.log;

import org.apache.eventmesh.dashboard.console.entity.LogEntity;
import org.apache.eventmesh.dashboard.console.entity.log.LogEntity;

import java.util.List;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

package org.apache.eventmesh.dashboard.console.service.log;

import org.apache.eventmesh.dashboard.console.entity.LogEntity;
import org.apache.eventmesh.dashboard.console.entity.log.LogEntity;
import org.apache.eventmesh.dashboard.console.mapper.log.OprLogMapper;

import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

package org.apache.eventmesh.dashboard.console.service.topic;

import org.apache.eventmesh.dashboard.console.entity.TopicEntity;
import org.apache.eventmesh.dashboard.console.entity.topic.TopicEntity;

import java.util.List;

Expand All @@ -27,15 +27,15 @@
public interface TopicService {
List<TopicEntity> getTopicList(TopicEntity topicEntity);

TopicEntity addTopic_plus(TopicEntity topicEntity);
void addTopic_plus(TopicEntity topicEntity);

TopicEntity updateTopic(TopicEntity topicEntity);
void updateTopic(TopicEntity topicEntity);

TopicEntity deleteTopic(TopicEntity topicEntity);
void deleteTopic(TopicEntity topicEntity);

TopicEntity selectTopicById(TopicEntity topicEntity);

TopicEntity selectTopicByUnique(TopicEntity topicEntity);

TopicEntity deleteTopic_plus(TopicEntity topicEntity);
void deleteTopic_plus(TopicEntity topicEntity);
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@

package org.apache.eventmesh.dashboard.console.service.topic;

import org.apache.eventmesh.dashboard.console.entity.GroupMemberEntity;
import org.apache.eventmesh.dashboard.console.entity.TopicEntity;
import org.apache.eventmesh.dashboard.console.entity.groupmember.GroupMemberEntity;
import org.apache.eventmesh.dashboard.console.entity.topic.TopicEntity;
import org.apache.eventmesh.dashboard.console.mapper.groupmember.OprGroupMemberMapper;
import org.apache.eventmesh.dashboard.console.mapper.topic.TopicMapper;

Expand All @@ -39,26 +39,26 @@ public class TopicServiceImpl implements TopicService {

@Override
public List<TopicEntity> getTopicList(TopicEntity topicEntity) {
return topicMapper.getTopicListByClusterId(topicEntity);
return topicMapper.getTopicListByDynamic(topicEntity);
}

@Override
public TopicEntity addTopic_plus(TopicEntity topicEntity) {
public void addTopic_plus(TopicEntity topicEntity) {
GroupMemberEntity groupMemberEntity = new GroupMemberEntity();
groupMemberEntity.setTopicName(topicEntity.getTopicName());
groupMemberEntity.setState("active");
oprGroupMemberMapper.updateMemberByTopic(groupMemberEntity);
return topicMapper.addTopic(topicEntity);
topicMapper.addTopic(topicEntity);
}

@Override
public TopicEntity updateTopic(TopicEntity topicEntity) {
return topicMapper.updateTopic(topicEntity);
public void updateTopic(TopicEntity topicEntity) {
topicMapper.updateTopic(topicEntity);
}

@Override
public TopicEntity deleteTopic(TopicEntity topicEntity) {
return topicMapper.deleteTopic(topicEntity);
public void deleteTopic(TopicEntity topicEntity) {
topicMapper.deleteTopic(topicEntity);
}

@Override
Expand All @@ -72,11 +72,11 @@ public TopicEntity selectTopicByUnique(TopicEntity topicEntity) {
}

@Override
public TopicEntity deleteTopic_plus(TopicEntity topicEntity) {
public void deleteTopic_plus(TopicEntity topicEntity) {
GroupMemberEntity groupMemberEntity = new GroupMemberEntity();
groupMemberEntity.setTopicName(topicEntity.getTopicName());
groupMemberEntity.setState("empty");
oprGroupMemberMapper.updateMemberByTopic(groupMemberEntity);
return topicMapper.deleteTopic(topicEntity);
topicMapper.deleteTopic(topicEntity);
}
}
165 changes: 78 additions & 87 deletions eventmesh-dashboard-console/src/main/resources/eventmesh-dashboard.sql
Original file line number Diff line number Diff line change
Expand Up @@ -14,97 +14,88 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
create table `group`
CREATE TABLE `group`
(
id bigint unsigned auto_increment comment 'id'
primary key,
cluster_id bigint default -1 not null comment '集群id',
name varchar(192) collate utf8_bin default '' not null comment 'Group名称',
member_count int unsigned default '0' not null comment '成员数',
members text null comment 'group的member列表',
type tinyint not null comment 'group类型 0:consumer 1:producer',
state varchar(64) default '' not null comment '状态',
create_time timestamp default CURRENT_TIMESTAMP not null comment '创建时间',
update_time timestamp default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '修改时间',
is_delete int default 0 not null,
constraint uniq_cluster_phy_id_name
unique (cluster_id, name)
)
comment 'Group信息表' engine = InnoDB;

create index cluster_id
on `group` (cluster_id, name);



create table group_member
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
`cluster_id` bigint NOT NULL DEFAULT '-1' COMMENT '集群id',
`name` varchar(192) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT 'Group名称',
`member_count` int unsigned NOT NULL DEFAULT '0' COMMENT '成员数',
`members` text COMMENT 'group的member列表',
`type` tinyint NOT NULL COMMENT 'group类型 0:consumer 1:producer',
`state` varchar(64) NOT NULL DEFAULT '' COMMENT '状态',
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
`is_delete` int NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
UNIQUE KEY `uniq_cluster_phy_id_name` (`cluster_id`, `name`),
KEY `cluster_id` (`cluster_id`, `name`)
) ENGINE = InnoDB
AUTO_INCREMENT = 322
DEFAULT CHARSET = utf8mb3 COMMENT ='Group信息表'



CREATE TABLE `group_member`
(
id bigint unsigned auto_increment comment 'id'
primary key,
cluster_id bigint default -1 not null comment '集群ID',
topic_name varchar(192) default '' not null comment 'Topic名称',
group_name varchar(192) default '' not null comment 'Group名称',
eventmesh_user varchar(192) default '' not null comment 'EventMesh用户',
state varchar(64) default '' not null comment '状态',
create_time timestamp default CURRENT_TIMESTAMP not null comment '创建时间',
update_time timestamp default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '修改时间',
is_delete int default 0 not null,
constraint uniq_cluster_topic_group
unique (cluster_id, topic_name, group_name)
)
comment 'GroupMember信息表' engine = InnoDB;

create index cluster_id
on group_member (cluster_id, topic_name, group_name);



create table operation_log
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
`cluster_id` bigint NOT NULL DEFAULT '-1' COMMENT '集群ID',
`topic_name` varchar(192) NOT NULL DEFAULT '' COMMENT 'Topic名称',
`group_name` varchar(192) NOT NULL DEFAULT '' COMMENT 'Group名称',
`eventmesh_user` varchar(192) NOT NULL DEFAULT '' COMMENT 'EventMesh用户',
`state` varchar(64) NOT NULL DEFAULT '' COMMENT '状态',
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
`is_delete` int NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
UNIQUE KEY `uniq_cluster_topic_group` (`cluster_id`, `topic_name`, `group_name`),
KEY `cluster_id` (`cluster_id`, `topic_name`, `group_name`)
) ENGINE = InnoDB
AUTO_INCREMENT = 257
DEFAULT CHARSET = utf8mb3 COMMENT ='GroupMember信息表'



CREATE TABLE `operation_log`
(
id bigint unsigned auto_increment comment 'id'
primary key,
cluster_id bigint default -1 not null comment '物理集群ID',
operation_type varchar(192) default '' not null comment '操作类型,如:启动,停止,重启,添加,删除,修改',
status int default 0 not null comment '操作状态 0:未知,1:执行中,2:成功,3:失败',
description text null comment '备注信息',
create_time timestamp default CURRENT_TIMESTAMP not null comment '创建时间',
end_time timestamp default CURRENT_TIMESTAMP null comment '结束时间',
operation_user varchar(192) null,
result_content text null,
operation_target varchar(192) not null,
is_delete int not null
)
comment '操作记录信息表' engine = InnoDB;

create index idx_cluster_phy_id
on operation_log (cluster_id);

create index idx_status
on operation_log (status);



create table topic
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
`cluster_id` bigint NOT NULL DEFAULT '-1' COMMENT '物理集群ID',
`operation_type` varchar(192) NOT NULL DEFAULT '' COMMENT '操作类型,如:启动,停止,重启,添加,删除,修改',
`status` int NOT NULL DEFAULT '0' COMMENT '操作状态 0:未知,1:执行中,2:成功,3:失败',
`description` text COMMENT '备注信息',
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`end_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '结束时间',
`operation_user` varchar(192) DEFAULT NULL,
`result_content` text,
`target_type` varchar(192) NOT NULL,
`is_delete` int NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
KEY `idx_cluster_phy_id` (`cluster_id`),
KEY `idx_status` (`status`)
) ENGINE = InnoDB
AUTO_INCREMENT = 68
DEFAULT CHARSET = utf8mb3 COMMENT ='操作记录信息表'



CREATE TABLE `topic`
(
id bigint unsigned auto_increment comment 'id'
primary key,
cluster_id bigint default -1 not null comment '集群ID',
topic_name varchar(192) collate utf8_bin default '' not null comment 'Topic名称',
runtime_id varchar(2048) default '' not null comment 'RuntimeId',
storage_id varchar(2048) default '' not null comment 'StorageId',
retention_ms bigint default -2 not null comment '保存时间,-2:未知,-1:无限制,>=0对应时间,单位ms',
type tinyint default 0 not null comment 'Topic类型,默认0,0:普通,1:EventMesh内部',
description text null comment '备注信息',
create_time timestamp default CURRENT_TIMESTAMP not null comment '创建时间(尽量与Topic实际创建时间一致)',
update_time timestamp default CURRENT_TIMESTAMP not null comment '修改时间(尽量与Topic实际创建时间一致)',
is_delete int default 0 not null,
constraint uniq_cluster_phy_id_topic_name
unique (cluster_id, topic_name)
)
comment 'Topic信息表' engine = InnoDB;

create index cluster_id
on topic (cluster_id, topic_name);
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
`cluster_id` bigint NOT NULL DEFAULT '-1' COMMENT '集群ID',
`topic_name` varchar(192) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT 'Topic名称',
`runtime_id` varchar(2048) NOT NULL DEFAULT '' COMMENT 'RuntimeId',
`storage_id` varchar(2048) NOT NULL DEFAULT '' COMMENT 'StorageId',
`retention_ms` bigint NOT NULL DEFAULT '-2' COMMENT '保存时间,-2:未知,-1:无限制,>=0对应时间,单位ms',
`type` tinyint NOT NULL DEFAULT '0' COMMENT 'Topic类型,默认0,0:普通,1:EventMesh内部',
`description` text COMMENT '备注信息',
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间(尽量与Topic实际创建时间一致)',
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间(尽量与Topic实际创建时间一致)',
`is_delete` int NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
UNIQUE KEY `uniq_cluster_phy_id_topic_name` (`cluster_id`, `topic_name`),
KEY `cluster_id` (`cluster_id`, `topic_name`)
) ENGINE = InnoDB
AUTO_INCREMENT = 562
DEFAULT CHARSET = utf8mb3 COMMENT ='Topic信息表'



Expand Down
Loading

0 comments on commit c030859

Please sign in to comment.