⚡ 优化主机删除逻辑.
This commit is contained in:
@@ -31,7 +31,7 @@ public class HostOperatorType extends InitializingOperatorTypes {
|
|||||||
return new OperatorType[]{
|
return new OperatorType[]{
|
||||||
new OperatorType(L, CREATE, "创建主机 <sb>${name}</sb>"),
|
new OperatorType(L, CREATE, "创建主机 <sb>${name}</sb>"),
|
||||||
new OperatorType(L, UPDATE, "修改主机 <sb>${name}</sb>"),
|
new OperatorType(L, UPDATE, "修改主机 <sb>${name}</sb>"),
|
||||||
new OperatorType(H, DELETE, "删除主机 <sb>${name}</sb>"),
|
new OperatorType(H, DELETE, "删除主机 <sb>${count}</sb> 条"),
|
||||||
new OperatorType(M, UPDATE_STATUS, "修改主机状态 <sb>${name}</sb> - <sb>${status}</sb>"),
|
new OperatorType(M, UPDATE_STATUS, "修改主机状态 <sb>${name}</sb> - <sb>${status}</sb>"),
|
||||||
new OperatorType(M, UPDATE_CONFIG, "修改主机配置 <sb>${name}</sb>"),
|
new OperatorType(M, UPDATE_CONFIG, "修改主机配置 <sb>${name}</sb>"),
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -279,17 +279,10 @@ public class HostServiceImpl implements HostService {
|
|||||||
@Override
|
@Override
|
||||||
public Integer deleteHostByIdList(List<Long> idList) {
|
public Integer deleteHostByIdList(List<Long> idList) {
|
||||||
log.info("HostService-deleteHostByIdList idList: {}", idList);
|
log.info("HostService-deleteHostByIdList idList: {}", idList);
|
||||||
// 查询
|
|
||||||
List<HostDO> hosts = hostDAO.selectBaseByIdList(idList);
|
|
||||||
Valid.notEmpty(hosts, ErrorMessage.HOST_ABSENT);
|
|
||||||
// 添加日志参数
|
|
||||||
String name = hosts.stream()
|
|
||||||
.map(HostDO::getName)
|
|
||||||
.collect(Collectors.joining(Const.COMMA));
|
|
||||||
OperatorLogs.add(OperatorLogs.NAME, name);
|
|
||||||
OperatorLogs.add(OperatorLogs.COUNT, hosts.size());
|
|
||||||
// 删除
|
// 删除
|
||||||
int effect = hostDAO.deleteBatchIds(hosts);
|
int effect = hostDAO.deleteBatchIds(idList);
|
||||||
|
// 添加日志参数
|
||||||
|
OperatorLogs.add(OperatorLogs.COUNT, idList.size());
|
||||||
log.info("HostService-deleteHostByIdList effect: {}", effect);
|
log.info("HostService-deleteHostByIdList effect: {}", effect);
|
||||||
// 删除缓存
|
// 删除缓存
|
||||||
this.clearCache();
|
this.clearCache();
|
||||||
|
|||||||
Reference in New Issue
Block a user