asset 模块添加操作日志.
This commit is contained in:
@@ -51,6 +51,8 @@ public interface ErrorMessage {
|
||||
|
||||
String USER_ABSENT = "用户不存在";
|
||||
|
||||
String HOST_ABSENT = "主机不存在";
|
||||
|
||||
String UNABLE_OPERATE_ADMIN_ROLE = "无法操作管理员账号";
|
||||
|
||||
String UNSUPPORTED_CHARSET = "不支持的编码 [{}]";
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.orion.ops.framework.common.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 启用状态
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023/10/12 16:02
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum EnableStatus {
|
||||
|
||||
/**
|
||||
* 停用
|
||||
*/
|
||||
DISABLED(0),
|
||||
|
||||
/**
|
||||
* 启用
|
||||
*/
|
||||
ENABLED(1),
|
||||
|
||||
;
|
||||
|
||||
private final Integer value;
|
||||
|
||||
public static EnableStatus of(Integer value) {
|
||||
if (value == null) {
|
||||
return null;
|
||||
}
|
||||
for (EnableStatus e : values()) {
|
||||
if (e.value.equals(value)) {
|
||||
return e;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -25,8 +25,12 @@ public interface OperatorLogKeys {
|
||||
|
||||
String LABEL = "label";
|
||||
|
||||
String TYPE = "type";
|
||||
|
||||
String STATUS = "status";
|
||||
|
||||
String STATUS_NAME = "statusName";
|
||||
|
||||
String REL_ID = "relId";
|
||||
|
||||
}
|
||||
|
||||
@@ -161,7 +161,7 @@ orion:
|
||||
# 下面引用了 需要注意
|
||||
field:
|
||||
ignore:
|
||||
- password,newPassword
|
||||
- password,newPassword,useNewPassword,publicKey,privateKey
|
||||
- metrics
|
||||
desensitize:
|
||||
storage:
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
package com.orion.ops.module.asset.controller;
|
||||
|
||||
import com.orion.lang.define.wrapper.DataGrid;
|
||||
import com.orion.ops.framework.biz.operator.log.core.annotation.OperatorLog;
|
||||
import com.orion.ops.framework.common.validator.group.Page;
|
||||
import com.orion.ops.framework.log.core.annotation.IgnoreLog;
|
||||
import com.orion.ops.framework.log.core.enums.IgnoreLogMode;
|
||||
import com.orion.ops.framework.web.core.annotation.RestWrapper;
|
||||
import com.orion.ops.module.asset.define.operator.HostOperatorType;
|
||||
import com.orion.ops.module.asset.entity.request.host.*;
|
||||
import com.orion.ops.module.asset.entity.vo.HostConfigVO;
|
||||
import com.orion.ops.module.asset.entity.vo.HostVO;
|
||||
@@ -43,6 +45,7 @@ public class HostController {
|
||||
@Resource
|
||||
private HostConfigService hostConfigService;
|
||||
|
||||
@OperatorLog(HostOperatorType.CREATE)
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建主机")
|
||||
@PreAuthorize("@ss.hasPermission('asset:host:create')")
|
||||
@@ -50,6 +53,7 @@ public class HostController {
|
||||
return hostService.createHost(request);
|
||||
}
|
||||
|
||||
@OperatorLog(HostOperatorType.UPDATE)
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "通过 id 更新主机")
|
||||
@PreAuthorize("@ss.hasPermission('asset:host:update')")
|
||||
@@ -90,6 +94,7 @@ public class HostController {
|
||||
return hostService.getHostPage(request);
|
||||
}
|
||||
|
||||
@OperatorLog(HostOperatorType.DELETE)
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "通过 id 删除主机")
|
||||
@Parameter(name = "id", description = "id", required = true)
|
||||
@@ -118,6 +123,7 @@ public class HostController {
|
||||
return hostConfigService.getHostConfig(hostId);
|
||||
}
|
||||
|
||||
@OperatorLog(HostOperatorType.UPDATE_CONFIG)
|
||||
@PutMapping("/update-config")
|
||||
@Operation(summary = "更新主机配置")
|
||||
@PreAuthorize("@ss.hasPermission('asset:host:update-config')")
|
||||
@@ -125,6 +131,7 @@ public class HostController {
|
||||
return hostConfigService.updateHostConfig(request);
|
||||
}
|
||||
|
||||
@OperatorLog(HostOperatorType.UPDATE_CONFIG_STATUS)
|
||||
@PutMapping("/update-config-status")
|
||||
@Operation(summary = "更新主机配置状态")
|
||||
@PreAuthorize("@ss.hasPermission('asset:host:update-config')")
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
package com.orion.ops.module.asset.controller;
|
||||
|
||||
import com.orion.lang.define.wrapper.DataGrid;
|
||||
import com.orion.ops.framework.biz.operator.log.core.annotation.OperatorLog;
|
||||
import com.orion.ops.framework.common.validator.group.Page;
|
||||
import com.orion.ops.framework.log.core.annotation.IgnoreLog;
|
||||
import com.orion.ops.framework.log.core.enums.IgnoreLogMode;
|
||||
import com.orion.ops.framework.web.core.annotation.RestWrapper;
|
||||
import com.orion.ops.module.asset.define.operator.HostIdentityOperatorType;
|
||||
import com.orion.ops.module.asset.entity.request.host.HostIdentityCreateRequest;
|
||||
import com.orion.ops.module.asset.entity.request.host.HostIdentityQueryRequest;
|
||||
import com.orion.ops.module.asset.entity.request.host.HostIdentityUpdateRequest;
|
||||
@@ -40,6 +42,7 @@ public class HostIdentityController {
|
||||
@Resource
|
||||
private HostIdentityService hostIdentityService;
|
||||
|
||||
@OperatorLog(HostIdentityOperatorType.CREATE)
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建主机身份")
|
||||
@PreAuthorize("@ss.hasPermission('asset:host-identity:create')")
|
||||
@@ -47,6 +50,7 @@ public class HostIdentityController {
|
||||
return hostIdentityService.createHostIdentity(request);
|
||||
}
|
||||
|
||||
@OperatorLog(HostIdentityOperatorType.UPDATE)
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "通过 id 更新主机身份")
|
||||
@PreAuthorize("@ss.hasPermission('asset:host-identity:update')")
|
||||
@@ -80,6 +84,7 @@ public class HostIdentityController {
|
||||
return hostIdentityService.getHostIdentityPage(request);
|
||||
}
|
||||
|
||||
@OperatorLog(HostIdentityOperatorType.DELETE)
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "通过 id 删除主机身份")
|
||||
@Parameter(name = "id", description = "id", required = true)
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
package com.orion.ops.module.asset.controller;
|
||||
|
||||
import com.orion.lang.define.wrapper.DataGrid;
|
||||
import com.orion.ops.framework.biz.operator.log.core.annotation.OperatorLog;
|
||||
import com.orion.ops.framework.common.validator.group.Page;
|
||||
import com.orion.ops.framework.log.core.annotation.IgnoreLog;
|
||||
import com.orion.ops.framework.log.core.enums.IgnoreLogMode;
|
||||
import com.orion.ops.framework.web.core.annotation.RestWrapper;
|
||||
import com.orion.ops.module.asset.define.operator.HostKeyOperatorType;
|
||||
import com.orion.ops.module.asset.entity.request.host.HostKeyCreateRequest;
|
||||
import com.orion.ops.module.asset.entity.request.host.HostKeyQueryRequest;
|
||||
import com.orion.ops.module.asset.entity.request.host.HostKeyUpdateRequest;
|
||||
@@ -40,6 +42,7 @@ public class HostKeyController {
|
||||
@Resource
|
||||
private HostKeyService hostKeyService;
|
||||
|
||||
@OperatorLog(HostKeyOperatorType.CREATE)
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建主机秘钥")
|
||||
@PreAuthorize("@ss.hasPermission('asset:host-key:create')")
|
||||
@@ -47,6 +50,7 @@ public class HostKeyController {
|
||||
return hostKeyService.createHostKey(request);
|
||||
}
|
||||
|
||||
@OperatorLog(HostKeyOperatorType.UPDATE)
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "通过 id 更新主机秘钥")
|
||||
@PreAuthorize("@ss.hasPermission('asset:host-key:update')")
|
||||
@@ -79,6 +83,7 @@ public class HostKeyController {
|
||||
return hostKeyService.getHostKeyPage(request);
|
||||
}
|
||||
|
||||
@OperatorLog(HostKeyOperatorType.DELETE)
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "通过 id 删除主机秘钥")
|
||||
@Parameter(name = "id", description = "id", required = true)
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.orion.ops.module.asset.define.operator;
|
||||
|
||||
import com.orion.ops.framework.biz.operator.log.core.model.OperatorType;
|
||||
|
||||
import static com.orion.ops.framework.biz.operator.log.core.enums.OperatorRiskLevel.H;
|
||||
import static com.orion.ops.framework.biz.operator.log.core.enums.OperatorRiskLevel.L;
|
||||
import static com.orion.ops.framework.biz.operator.log.core.holder.OperatorTypeHolder.set;
|
||||
|
||||
/**
|
||||
* 主机身份 操作日志类型
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023/10/10 17:30
|
||||
*/
|
||||
public class HostIdentityOperatorType {
|
||||
|
||||
private static final String MODULE = "asset:host-identity";
|
||||
|
||||
public static final String CREATE = "host-identity:create";
|
||||
|
||||
public static final String UPDATE = "host-identity:update";
|
||||
|
||||
public static final String DELETE = "host-identity:delete";
|
||||
|
||||
public static void init() {
|
||||
set(new OperatorType(L, MODULE, CREATE, "创建主机身份 <sb>${name}</sb>"));
|
||||
set(new OperatorType(L, MODULE, UPDATE, "修改主机身份 <sb>${name}</sb>"));
|
||||
set(new OperatorType(H, MODULE, DELETE, "删除主机身份 <sb>${name}</sb>"));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.orion.ops.module.asset.define.operator;
|
||||
|
||||
import com.orion.ops.framework.biz.operator.log.core.model.OperatorType;
|
||||
|
||||
import static com.orion.ops.framework.biz.operator.log.core.enums.OperatorRiskLevel.H;
|
||||
import static com.orion.ops.framework.biz.operator.log.core.enums.OperatorRiskLevel.L;
|
||||
import static com.orion.ops.framework.biz.operator.log.core.holder.OperatorTypeHolder.set;
|
||||
|
||||
/**
|
||||
* 主机秘钥 操作日志类型
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023/10/10 17:30
|
||||
*/
|
||||
public class HostKeyOperatorType {
|
||||
|
||||
private static final String MODULE = "asset:host-key";
|
||||
|
||||
public static final String CREATE = "host-key:create";
|
||||
|
||||
public static final String UPDATE = "host-key:update";
|
||||
|
||||
public static final String DELETE = "host-key:delete";
|
||||
|
||||
public static void init() {
|
||||
set(new OperatorType(L, MODULE, CREATE, "创建主机秘钥 <sb>${name}</sb>"));
|
||||
set(new OperatorType(L, MODULE, UPDATE, "修改主机秘钥 <sb>${name}</sb>"));
|
||||
set(new OperatorType(H, MODULE, DELETE, "删除主机秘钥 <sb>${name}</sb>"));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.orion.ops.module.asset.define.operator;
|
||||
|
||||
import com.orion.ops.framework.biz.operator.log.core.model.OperatorType;
|
||||
|
||||
import static com.orion.ops.framework.biz.operator.log.core.enums.OperatorRiskLevel.*;
|
||||
import static com.orion.ops.framework.biz.operator.log.core.holder.OperatorTypeHolder.set;
|
||||
|
||||
/**
|
||||
* 主机 操作日志类型
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023/10/10 17:30
|
||||
*/
|
||||
public class HostOperatorType {
|
||||
|
||||
private static final String MODULE = "asset:host";
|
||||
|
||||
public static final String CREATE = "host:create";
|
||||
|
||||
public static final String UPDATE = "host:update";
|
||||
|
||||
public static final String DELETE = "host:delete";
|
||||
|
||||
public static final String UPDATE_CONFIG = "host:update-config";
|
||||
|
||||
public static final String UPDATE_CONFIG_STATUS = "host:update-config-status";
|
||||
|
||||
public static void init() {
|
||||
set(new OperatorType(L, MODULE, CREATE, "创建主机 <sb>${name}</sb>"));
|
||||
set(new OperatorType(L, MODULE, UPDATE, "修改主机 <sb>${name}</sb>"));
|
||||
set(new OperatorType(H, MODULE, DELETE, "删除主机 <sb>${name}</sb>"));
|
||||
set(new OperatorType(M, MODULE, UPDATE_CONFIG, "修改主机配置 <sb>${name}</sb> | <sb>${type}</sb>"));
|
||||
set(new OperatorType(M, MODULE, UPDATE_CONFIG_STATUS, "修改主机配置状态 <sb>${name}</sb> | <sb>${type}</sb> - <sb>${statusName}</sb>"));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.orion.ops.module.asset.enums;
|
||||
|
||||
import com.orion.ops.framework.common.enums.BooleanBit;
|
||||
import com.orion.ops.framework.common.enums.EnableStatus;
|
||||
import com.orion.ops.module.asset.handler.host.config.model.HostConfigModel;
|
||||
import com.orion.ops.module.asset.handler.host.config.model.HostSshConfigModel;
|
||||
import com.orion.ops.module.asset.handler.host.config.strategy.HostConfigStrategy;
|
||||
@@ -21,7 +21,7 @@ public enum HostConfigTypeEnum {
|
||||
/**
|
||||
* SSH 配置
|
||||
*/
|
||||
SSH(HostSshConfigModel.class, HostSshConfigStrategy.class, BooleanBit.TRUE.getValue()),
|
||||
SSH(HostSshConfigModel.class, HostSshConfigStrategy.class, EnableStatus.ENABLED.getValue()),
|
||||
|
||||
;
|
||||
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.orion.ops.module.asset.runner;
|
||||
|
||||
import com.orion.ops.module.asset.define.operator.HostIdentityOperatorType;
|
||||
import com.orion.ops.module.asset.define.operator.HostKeyOperatorType;
|
||||
import com.orion.ops.module.asset.define.operator.HostOperatorType;
|
||||
import org.springframework.boot.CommandLineRunner;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 资产模块 操作类型初始化
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023/10/10 18:03
|
||||
*/
|
||||
@Component
|
||||
public class AssetOperatorTypeRunner implements CommandLineRunner {
|
||||
|
||||
@Override
|
||||
public void run(String... args) {
|
||||
HostOperatorType.init();
|
||||
HostKeyOperatorType.init();
|
||||
HostIdentityOperatorType.init();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,13 +1,16 @@
|
||||
package com.orion.ops.module.asset.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.orion.ops.framework.biz.operator.log.core.uitls.OperatorLogs;
|
||||
import com.orion.ops.framework.common.constant.Const;
|
||||
import com.orion.ops.framework.common.constant.ErrorMessage;
|
||||
import com.orion.ops.framework.common.enums.BooleanBit;
|
||||
import com.orion.ops.framework.common.enums.EnableStatus;
|
||||
import com.orion.ops.framework.common.utils.Valid;
|
||||
import com.orion.ops.module.asset.convert.HostConfigConvert;
|
||||
import com.orion.ops.module.asset.dao.HostConfigDAO;
|
||||
import com.orion.ops.module.asset.dao.HostDAO;
|
||||
import com.orion.ops.module.asset.entity.domain.HostConfigDO;
|
||||
import com.orion.ops.module.asset.entity.domain.HostDO;
|
||||
import com.orion.ops.module.asset.entity.request.host.HostConfigUpdateRequest;
|
||||
import com.orion.ops.module.asset.entity.request.host.HostConfigUpdateStatusRequest;
|
||||
import com.orion.ops.module.asset.entity.vo.HostConfigVO;
|
||||
@@ -35,6 +38,9 @@ import java.util.stream.Collectors;
|
||||
@Service
|
||||
public class HostConfigServiceImpl implements HostConfigService {
|
||||
|
||||
@Resource
|
||||
private HostDAO hostDAO;
|
||||
|
||||
@Resource
|
||||
private HostConfigDAO hostConfigDAO;
|
||||
|
||||
@@ -90,6 +96,13 @@ public class HostConfigServiceImpl implements HostConfigService {
|
||||
Valid.notNull(record, ErrorMessage.CONFIG_ABSENT);
|
||||
HostConfigTypeEnum type = Valid.valid(HostConfigTypeEnum::of, record.getType());
|
||||
HostConfigModel config = JSON.parseObject(request.getConfig(), type.getType());
|
||||
// 查询主机
|
||||
HostDO host = hostDAO.selectById(record.getHostId());
|
||||
Valid.notNull(host, ErrorMessage.HOST_ABSENT);
|
||||
// 添加日志参数
|
||||
OperatorLogs.add(OperatorLogs.REL_ID, host.getId());
|
||||
OperatorLogs.add(OperatorLogs.NAME, host.getName());
|
||||
OperatorLogs.add(OperatorLogs.TYPE, type.name());
|
||||
// 检查版本
|
||||
Valid.eq(record.getVersion(), request.getVersion(), ErrorMessage.DATA_MODIFIED);
|
||||
HostConfigStrategy<HostConfigModel> strategy = type.getStrategy();
|
||||
@@ -114,10 +127,18 @@ public class HostConfigServiceImpl implements HostConfigService {
|
||||
public Integer updateHostConfigStatus(HostConfigUpdateStatusRequest request) {
|
||||
Long id = request.getId();
|
||||
Integer status = request.getStatus();
|
||||
Valid.valid(BooleanBit::of, status);
|
||||
EnableStatus statusEnum = Valid.valid(EnableStatus::of, status);
|
||||
// 查询配置
|
||||
HostConfigDO record = hostConfigDAO.selectById(id);
|
||||
Valid.notNull(record, ErrorMessage.CONFIG_ABSENT);
|
||||
// 查询主机
|
||||
HostDO host = hostDAO.selectById(record.getHostId());
|
||||
Valid.notNull(host, ErrorMessage.HOST_ABSENT);
|
||||
// 添加日志参数
|
||||
OperatorLogs.add(OperatorLogs.REL_ID, host.getId());
|
||||
OperatorLogs.add(OperatorLogs.NAME, host.getName());
|
||||
OperatorLogs.add(OperatorLogs.TYPE, HostConfigTypeEnum.of(record.getType()).name());
|
||||
OperatorLogs.add(OperatorLogs.STATUS_NAME, statusEnum.name());
|
||||
// 修改状态
|
||||
HostConfigDO update = new HostConfigDO();
|
||||
update.setId(id);
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.orion.lang.define.wrapper.DataGrid;
|
||||
import com.orion.lang.utils.Strings;
|
||||
import com.orion.ops.framework.biz.operator.log.core.uitls.OperatorLogs;
|
||||
import com.orion.ops.framework.common.constant.Const;
|
||||
import com.orion.ops.framework.common.constant.ErrorMessage;
|
||||
import com.orion.ops.framework.common.security.PasswordModifier;
|
||||
@@ -171,6 +172,8 @@ public class HostIdentityServiceImpl implements HostIdentityService {
|
||||
// 检查数据是否存在
|
||||
HostIdentityDO record = hostIdentityDAO.selectById(id);
|
||||
Valid.notNull(record, ErrorMessage.DATA_ABSENT);
|
||||
// 添加日志参数
|
||||
OperatorLogs.add(OperatorLogs.NAME, record.getName());
|
||||
// 删除数据库
|
||||
int effect = hostIdentityDAO.deleteById(id);
|
||||
// 删除主机配置
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.orion.lang.define.wrapper.DataGrid;
|
||||
import com.orion.lang.utils.Strings;
|
||||
import com.orion.ops.framework.biz.operator.log.core.uitls.OperatorLogs;
|
||||
import com.orion.ops.framework.common.constant.Const;
|
||||
import com.orion.ops.framework.common.constant.ErrorMessage;
|
||||
import com.orion.ops.framework.common.security.PasswordModifier;
|
||||
@@ -166,6 +167,8 @@ public class HostKeyServiceImpl implements HostKeyService {
|
||||
// 检查数据是否存在
|
||||
HostKeyDO record = hostKeyDAO.selectById(id);
|
||||
Valid.notNull(record, ErrorMessage.DATA_ABSENT);
|
||||
// 添加日志参数
|
||||
OperatorLogs.add(OperatorLogs.NAME, record.getName());
|
||||
// 删除数据库
|
||||
int effect = hostKeyDAO.deleteById(id);
|
||||
// 删除关联
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.orion.lang.define.wrapper.DataGrid;
|
||||
import com.orion.lang.utils.Booleans;
|
||||
import com.orion.lang.utils.Strings;
|
||||
import com.orion.lang.utils.collect.Lists;
|
||||
import com.orion.ops.framework.biz.operator.log.core.uitls.OperatorLogs;
|
||||
import com.orion.ops.framework.common.constant.ErrorMessage;
|
||||
import com.orion.ops.framework.common.utils.Valid;
|
||||
import com.orion.ops.framework.security.core.utils.SecurityUtils;
|
||||
@@ -95,7 +96,7 @@ public class HostServiceImpl implements HostService {
|
||||
// 查询
|
||||
Long id = Valid.notNull(request.getId(), ErrorMessage.ID_MISSING);
|
||||
HostDO record = hostDAO.selectById(id);
|
||||
Valid.notNull(record, ErrorMessage.DATA_ABSENT);
|
||||
Valid.notNull(record, ErrorMessage.HOST_ABSENT);
|
||||
// 转换
|
||||
HostDO updateRecord = HostConvert.MAPPER.to(request);
|
||||
// 查询数据是否冲突
|
||||
@@ -113,7 +114,7 @@ public class HostServiceImpl implements HostService {
|
||||
public HostVO getHostById(HostQueryRequest request) {
|
||||
// 查询
|
||||
HostDO record = hostDAO.selectById(request.getId());
|
||||
Valid.notNull(record, ErrorMessage.DATA_ABSENT);
|
||||
Valid.notNull(record, ErrorMessage.HOST_ABSENT);
|
||||
// 转换
|
||||
HostVO vo = HostConvert.MAPPER.to(record);
|
||||
// 查询拓展信息
|
||||
@@ -162,6 +163,12 @@ public class HostServiceImpl implements HostService {
|
||||
@Override
|
||||
public Integer deleteHostById(Long id) {
|
||||
log.info("HostService-deleteHostById id: {}", id);
|
||||
// 查询
|
||||
HostDO record = hostDAO.selectById(id);
|
||||
Valid.notNull(record, ErrorMessage.HOST_ABSENT);
|
||||
// 添加日志参数
|
||||
OperatorLogs.add(OperatorLogs.NAME, record.getName());
|
||||
// 删除
|
||||
int effect = hostDAO.deleteById(id);
|
||||
log.info("HostService-deleteHostById effect: {}", effect);
|
||||
// 删除配置
|
||||
|
||||
@@ -8,7 +8,7 @@ import org.springframework.boot.CommandLineRunner;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 操作类型 初始化
|
||||
* 基建模块 操作类型初始化
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
|
||||
Reference in New Issue
Block a user