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; ...@@ -21,6 +21,7 @@ package org.dinky.service.impl;
import org.dinky.assertion.Asserts; import org.dinky.assertion.Asserts;
import org.dinky.data.model.AlertGroup; import org.dinky.data.model.AlertGroup;
import org.dinky.data.model.AlertHistory;
import org.dinky.data.model.AlertInstance; import org.dinky.data.model.AlertInstance;
import org.dinky.mapper.AlertGroupMapper; import org.dinky.mapper.AlertGroupMapper;
import org.dinky.mybatis.service.impl.SuperServiceImpl; import org.dinky.mybatis.service.impl.SuperServiceImpl;
...@@ -92,10 +93,9 @@ public class AlertGroupServiceImpl extends SuperServiceImpl<AlertGroupMapper, Al ...@@ -92,10 +93,9 @@ public class AlertGroupServiceImpl extends SuperServiceImpl<AlertGroupMapper, Al
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public Boolean deleteGroupById(Integer id) { public Boolean deleteGroupById(Integer id) {
if (removeById(id)) { alertHistoryService
alertHistoryService.deleteByAlertGroupId(id); .list(new LambdaQueryWrapper<AlertHistory>().eq(AlertHistory::getAlertGroupId, id))
return true; .forEach(alertHistory -> alertHistoryService.removeById(alertHistory.getId()));
} return removeById(id);
return false;
} }
} }
...@@ -155,7 +155,7 @@ const AlertGroupTableList: React.FC = (props: any) => { ...@@ -155,7 +155,7 @@ const AlertGroupTableList: React.FC = (props: any) => {
const editClick = (item: Alert.AlertGroup) => { const editClick = (item: Alert.AlertGroup) => {
setAlertGroupState((prevState) => ({ setAlertGroupState((prevState) => ({
...prevState, ...prevState,
editAlertGroupOpen: !prevState.editOpen, editOpen: !prevState.editOpen,
value: item 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