package com.estate.expert.admin.domain.exam.task.pass; import lombok.Getter; import lombok.Setter; import org.hibernate.annotations.Type; import javax.persistence.*; import java.util.List; /** * 通过信息 * 用于处理检查通过,未发现问题的情况 */ @Getter @Setter @Entity public class ByPassInfo { @Id @Access(AccessType.PROPERTY) @GeneratedValue(strategy = GenerationType.IDENTITY) protected Integer id; @Type(type = "io.hypersistence.utils.hibernate.type.json.JsonType") @Column(columnDefinition = "json") List systemHierarchyPaths; // // 设备 // @Type(type = "io.hypersistence.utils.hibernate.type.json.JsonType") // @Column(columnDefinition = "json") // HashMap> deviceHierarchyPathMap; // 设备 @Type(type = "io.hypersistence.utils.hibernate.type.json.JsonType") @Column(columnDefinition = "json") List deviceHierarchyPaths; // 小结 String conclusion; // 建议 String advice; public List filterHierarchyPaths(Integer deviceId) { var header = deviceId.toString(); // 获取以id开头调路径 var paths = deviceHierarchyPaths.stream().filter( p -> p.startsWith(header)) .toList(); int headLen = header.length(); return paths.stream().map(p -> p.substring(headLen)).toList(); } }