-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: optimize query of monitorInstance
- Loading branch information
霄鸿
committed
Jun 3, 2024
1 parent
3272941
commit 03c255b
Showing
6 changed files
with
170 additions
and
8 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
.../main/java/io/holoinsight/server/common/dao/converter/MonitorInstanceConfigConverter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* | ||
* Copyright 2022 Holoinsight Project Authors. Licensed under Apache-2.0. | ||
*/ | ||
|
||
package io.holoinsight.server.common.dao.converter; | ||
|
||
import io.holoinsight.server.common.dao.entity.MonitorInstance; | ||
import io.holoinsight.server.common.dao.entity.dto.MonitorInstanceDTO; | ||
import io.holoinsight.server.common.dao.transformer.MonitorInstanceCfgMapper; | ||
import org.mapstruct.Mapper; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* @author jsy1001de | ||
* @version 1.0: MonitorInstanceConfigConverter.java, Date: 2024-06-03 Time: 11:05 | ||
*/ | ||
@Mapper(componentModel = "spring", uses = {MonitorInstanceCfgMapper.class}) | ||
public interface MonitorInstanceConfigConverter { | ||
MonitorInstanceDTO doToDTO(MonitorInstance monitorInstance); | ||
|
||
MonitorInstance dtoToDO(MonitorInstanceDTO monitorInstanceDTO); | ||
|
||
List<MonitorInstanceDTO> dosToDTOs(Iterable<MonitorInstance> monitorInstances); | ||
} |
84 changes: 84 additions & 0 deletions
84
...mon-dao/src/main/java/io/holoinsight/server/common/dao/entity/dto/MonitorInstanceDTO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
/* | ||
* Copyright 2022 Holoinsight Project Authors. Licensed under Apache-2.0. | ||
*/ | ||
|
||
package io.holoinsight.server.common.dao.entity.dto; | ||
|
||
import io.holoinsight.server.common.dao.entity.MonitorInstanceCfg; | ||
import lombok.Data; | ||
|
||
import java.util.Date; | ||
|
||
/** | ||
* @author jsy1001de | ||
* @version 1.0: MonitorInstanceDTO.java, Date: 2024-06-03 Time: 11:04 | ||
*/ | ||
@Data | ||
public class MonitorInstanceDTO { | ||
|
||
private Long id; | ||
|
||
/** | ||
* 创建时间 | ||
*/ | ||
private Date gmtCreate; | ||
|
||
/** | ||
* 修改时间 | ||
*/ | ||
private Date gmtModified; | ||
|
||
/** | ||
* 实例标识 | ||
*/ | ||
private String instance; | ||
|
||
private String instanceName; | ||
private String instanceType; | ||
private String instanceInfo; | ||
|
||
/** | ||
* 实例类型 | ||
*/ | ||
private String type; | ||
|
||
/** | ||
* 租户 | ||
*/ | ||
private String tenant; | ||
|
||
/** | ||
* 租户名称 | ||
*/ | ||
private String tenantName; | ||
|
||
/** | ||
* 工作空间 | ||
*/ | ||
private String workspace; | ||
|
||
/** | ||
* 工作空间名称 | ||
*/ | ||
private String workspaceName; | ||
|
||
/** | ||
* 计量状态 | ||
*/ | ||
private int meterState; | ||
|
||
/** | ||
* 计费状态 | ||
*/ | ||
private int billingState; | ||
|
||
/** | ||
* 扩展配置 | ||
*/ | ||
private MonitorInstanceCfg config; | ||
|
||
/** | ||
* 软删除标记 | ||
*/ | ||
private boolean deleted; | ||
} |
32 changes: 32 additions & 0 deletions
32
.../src/main/java/io/holoinsight/server/common/dao/transformer/MonitorInstanceCfgMapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* Copyright 2022 Holoinsight Project Authors. Licensed under Apache-2.0. | ||
*/ | ||
|
||
package io.holoinsight.server.common.dao.transformer; | ||
|
||
import com.google.gson.reflect.TypeToken; | ||
import io.holoinsight.server.common.J; | ||
import io.holoinsight.server.common.dao.entity.MonitorInstanceCfg; | ||
|
||
import java.lang.reflect.Type; | ||
|
||
/** | ||
* @author jsy1001de | ||
* @version 1.0: MonitorInstanceCfgMapper.java, Date: 2024-06-03 Time: 11:07 | ||
*/ | ||
public class MonitorInstanceCfgMapper { | ||
public static String asString(MonitorInstanceCfg map) { | ||
if (map != null) { | ||
return J.toJson(map); | ||
} | ||
return null; | ||
} | ||
|
||
public static MonitorInstanceCfg asObj(String map) { | ||
if (map != null) { | ||
Type t = new TypeToken<MonitorInstanceCfg>() {}.getType(); | ||
return J.fromJson(map, t); | ||
} | ||
return null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters