Unverified Commit 86a88dcc authored by zhu-mingye's avatar zhu-mingye Committed by GitHub

[fix]fix-alert-group-delete-bug (#2257)

* fix-alert-group-delete-bug * Spotless Apply * fix-alert-group-delete-bug --------- Co-authored-by: 's avatarzhu-mingye <zhu-mingye@users.noreply.github.com>
parent a6179b58
......@@ -21,6 +21,7 @@ package org.dinky.service.impl;
import org.dinky.assertion.Asserts;
import org.dinky.data.model.AlertGroup;
import org.dinky.data.model.AlertHistory;
import org.dinky.data.model.AlertInstance;
import org.dinky.mapper.AlertGroupMapper;
import org.dinky.mybatis.service.impl.SuperServiceImpl;
......@@ -92,10 +93,9 @@ public class AlertGroupServiceImpl extends SuperServiceImpl<AlertGroupMapper, Al
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean deleteGroupById(Integer id) {
if (removeById(id)) {
alertHistoryService.deleteByAlertGroupId(id);
return true;
}
return false;
alertHistoryService
.list(new LambdaQueryWrapper<AlertHistory>().eq(AlertHistory::getAlertGroupId, id))
.forEach(alertHistory -> alertHistoryService.removeById(alertHistory.getId()));
return removeById(id);
}
}
......@@ -155,7 +155,7 @@ const AlertGroupTableList: React.FC = (props: any) => {
const editClick = (item: Alert.AlertGroup) => {
setAlertGroupState((prevState) => ({
...prevState,
editAlertGroupOpen: !prevState.editOpen,
editOpen: !prevState.editOpen,
value: item
}));
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment