review code.
This commit is contained in:
@@ -114,7 +114,7 @@ public class HostController {
|
||||
|
||||
@IgnoreLog(IgnoreLogMode.RET)
|
||||
@GetMapping("/get-config-all")
|
||||
@Operation(summary = "查询主机配置-全部")
|
||||
@Operation(summary = "查询主机配置 - 全部")
|
||||
@Parameter(name = "hostId", description = "hostId", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('asset:host:query')")
|
||||
public List<HostConfigVO> getHostConfig(@RequestParam("hostId") Long hostId) {
|
||||
|
||||
@@ -40,6 +40,7 @@ public class HostCreateRequest implements Serializable {
|
||||
@Schema(description = "主机地址")
|
||||
private String address;
|
||||
|
||||
@Size(max = 5)
|
||||
@Schema(description = "tags")
|
||||
private List<Long> tags;
|
||||
|
||||
|
||||
@@ -45,6 +45,7 @@ public class HostUpdateRequest implements Serializable {
|
||||
@Schema(description = "主机地址")
|
||||
private String address;
|
||||
|
||||
@Size(max = 5)
|
||||
@Schema(description = "tags")
|
||||
private List<Long> tags;
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.orion.ops.module.asset.entity.vo;
|
||||
|
||||
import com.orion.ops.module.infra.entity.dto.tag.TagDTO;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
@@ -8,6 +9,7 @@ import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -54,7 +56,7 @@ public class HostVO implements Serializable {
|
||||
private Boolean favorite;
|
||||
|
||||
@Schema(description = "tags")
|
||||
private Map<Long, String> tags;
|
||||
private List<TagDTO> tags;
|
||||
|
||||
@Schema(description = "configs")
|
||||
private Map<String, HostConfigVO> configs;
|
||||
|
||||
@@ -31,7 +31,6 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
@@ -306,18 +305,7 @@ public class HostServiceImpl implements HostService {
|
||||
List<List<TagDTO>> tagList = null;
|
||||
if (tagsFuture != null && (tagList = tagsFuture.get()) != null) {
|
||||
for (int i = 0; i < hosts.size(); i++) {
|
||||
List<TagDTO> tags = tagList.get(i);
|
||||
if (Lists.isEmpty(tags)) {
|
||||
continue;
|
||||
}
|
||||
Map<Long, String> tagMap = tags.stream()
|
||||
.collect(Collectors.toMap(
|
||||
TagDTO::getId,
|
||||
TagDTO::getName,
|
||||
(v1, v2) -> v2,
|
||||
LinkedHashMap::new
|
||||
));
|
||||
hosts.get(i).setTags(tagMap);
|
||||
hosts.get(i).setTags(tagList.get(i));
|
||||
}
|
||||
}
|
||||
// 设置收藏信息
|
||||
|
||||
Reference in New Issue
Block a user