mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-10 11:07:06 +00:00
(improvement)(headless) Remove materialization logic (#586)
Co-authored-by: kanedai <kanedai@tencent.com>
This commit is contained in:
@@ -1,8 +0,0 @@
|
|||||||
package com.tencent.supersonic.headless.common.materialization.enums;
|
|
||||||
|
|
||||||
public enum ElementFrequencyEnum {
|
|
||||||
|
|
||||||
UNKNOWN,
|
|
||||||
HIGH,
|
|
||||||
LOW
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
package com.tencent.supersonic.headless.common.materialization.enums;
|
|
||||||
|
|
||||||
public enum ElementTypeEnum {
|
|
||||||
|
|
||||||
VARCHAR,
|
|
||||||
DOUBLE,
|
|
||||||
BIGINT,
|
|
||||||
INT,
|
|
||||||
DATE,
|
|
||||||
ARRAY
|
|
||||||
}
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
package com.tencent.supersonic.headless.common.materialization.enums;
|
|
||||||
|
|
||||||
|
|
||||||
public enum UpdateCycleEnum {
|
|
||||||
DAY,
|
|
||||||
WEEK,
|
|
||||||
MONTH
|
|
||||||
}
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
package com.tencent.supersonic.headless.common.materialization.pojo;
|
|
||||||
|
|
||||||
import com.tencent.supersonic.common.pojo.enums.TypeEnums;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@NoArgsConstructor
|
|
||||||
public class MaterializationConfFilter extends MaterializationFilter {
|
|
||||||
|
|
||||||
private Long id;
|
|
||||||
private Boolean containElements = false;
|
|
||||||
|
|
||||||
private TypeEnums type;
|
|
||||||
private Long materializationId;
|
|
||||||
private Long elementId;
|
|
||||||
}
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
package com.tencent.supersonic.headless.common.materialization.pojo;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public class MaterializationDateFilter {
|
|
||||||
|
|
||||||
private Long modelId;
|
|
||||||
private List<String> dimensions;
|
|
||||||
private List<String> metrics;
|
|
||||||
private Date createdAt;
|
|
||||||
}
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
package com.tencent.supersonic.headless.common.materialization.pojo;
|
|
||||||
|
|
||||||
import com.tencent.supersonic.headless.common.model.enums.ModelSourceTypeEnum;
|
|
||||||
import com.tencent.supersonic.headless.common.materialization.enums.UpdateCycleEnum;
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Builder;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@Builder
|
|
||||||
@NoArgsConstructor
|
|
||||||
@AllArgsConstructor
|
|
||||||
public class MaterializationFilter {
|
|
||||||
|
|
||||||
private Long materializationId;
|
|
||||||
private String name;
|
|
||||||
private ModelSourceTypeEnum materializedType;
|
|
||||||
private UpdateCycleEnum updateCycle;
|
|
||||||
private Long modelId;
|
|
||||||
private Long databaseId;
|
|
||||||
private Integer level;
|
|
||||||
private String createdBy;
|
|
||||||
private String destinationTable;
|
|
||||||
}
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
package com.tencent.supersonic.headless.common.materialization.pojo;
|
|
||||||
|
|
||||||
|
|
||||||
import com.tencent.supersonic.common.pojo.enums.TaskStatusEnum;
|
|
||||||
import com.tencent.supersonic.common.pojo.enums.TypeEnums;
|
|
||||||
import java.util.List;
|
|
||||||
import lombok.Builder;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@Builder
|
|
||||||
public class MaterializationRecordFilter {
|
|
||||||
|
|
||||||
private Long id;
|
|
||||||
private Long materializationId;
|
|
||||||
private TypeEnums elementType;
|
|
||||||
private Long elementId;
|
|
||||||
private String elementName;
|
|
||||||
private List<TaskStatusEnum> taskStatus;
|
|
||||||
private String taskId;
|
|
||||||
private String createdBy;
|
|
||||||
private Date createdAt;
|
|
||||||
private String startDataTime;
|
|
||||||
private String endDataTime;
|
|
||||||
private List<Long> materializationIds;
|
|
||||||
}
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
package com.tencent.supersonic.headless.common.materialization.request;
|
|
||||||
|
|
||||||
|
|
||||||
import com.tencent.supersonic.common.pojo.RecordInfo;
|
|
||||||
import com.tencent.supersonic.common.pojo.enums.StatusEnum;
|
|
||||||
import com.tencent.supersonic.common.pojo.enums.TypeEnums;
|
|
||||||
import com.tencent.supersonic.headless.common.materialization.enums.ElementFrequencyEnum;
|
|
||||||
import com.tencent.supersonic.headless.common.materialization.enums.ElementTypeEnum;
|
|
||||||
import lombok.Builder;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@Builder
|
|
||||||
public class MaterializationElementReq extends RecordInfo {
|
|
||||||
private Long id;
|
|
||||||
private TypeEnums type;
|
|
||||||
private Long materializationId;
|
|
||||||
private String depends;
|
|
||||||
private ElementTypeEnum elementType;
|
|
||||||
private String defaultValue;
|
|
||||||
private String outlier;
|
|
||||||
private ElementFrequencyEnum frequency;
|
|
||||||
private String description;
|
|
||||||
private StatusEnum status;
|
|
||||||
}
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
package com.tencent.supersonic.headless.common.materialization.request;
|
|
||||||
|
|
||||||
|
|
||||||
import com.tencent.supersonic.common.pojo.RecordInfo;
|
|
||||||
import com.tencent.supersonic.common.pojo.enums.TaskStatusEnum;
|
|
||||||
import com.tencent.supersonic.common.pojo.enums.TypeEnums;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public class MaterializationRecordReq extends RecordInfo {
|
|
||||||
|
|
||||||
private Long id;
|
|
||||||
private Long materializationId;
|
|
||||||
private TypeEnums elementType;
|
|
||||||
private Long elementId;
|
|
||||||
private String elementName;
|
|
||||||
private String dataTime;
|
|
||||||
private TaskStatusEnum taskStatus;
|
|
||||||
private String taskId;
|
|
||||||
private Long retryCount;
|
|
||||||
private Long sourceCount;
|
|
||||||
private Long sinkCount;
|
|
||||||
private String message;
|
|
||||||
}
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
package com.tencent.supersonic.headless.common.materialization.request;
|
|
||||||
|
|
||||||
import com.tencent.supersonic.common.pojo.RecordInfo;
|
|
||||||
import com.tencent.supersonic.common.pojo.enums.StatusEnum;
|
|
||||||
import com.tencent.supersonic.headless.common.materialization.enums.UpdateCycleEnum;
|
|
||||||
import com.tencent.supersonic.headless.common.model.enums.ModelSourceTypeEnum;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public class MaterializationReq extends RecordInfo {
|
|
||||||
private Long id;
|
|
||||||
private String name;
|
|
||||||
private ModelSourceTypeEnum materializedType;
|
|
||||||
private UpdateCycleEnum updateCycle;
|
|
||||||
private Long modelId;
|
|
||||||
private Long databaseId;
|
|
||||||
private Integer level;
|
|
||||||
private String destinationTable;
|
|
||||||
private String dateInfo;
|
|
||||||
private String entities;
|
|
||||||
private List<String> principals;
|
|
||||||
private String description;
|
|
||||||
private StatusEnum status;
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
package com.tencent.supersonic.headless.common.materialization.request;
|
|
||||||
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public class MaterializationSourceReq {
|
|
||||||
|
|
||||||
private Long materializationId = 0L;
|
|
||||||
private Long dataSourceId = 0L;
|
|
||||||
private String dataTime;
|
|
||||||
}
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
package com.tencent.supersonic.headless.common.materialization.response;
|
|
||||||
|
|
||||||
import com.tencent.supersonic.common.pojo.enums.TypeEnums;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public class MaterializationDateResp {
|
|
||||||
|
|
||||||
private Long modelId;
|
|
||||||
private TypeEnums elementType;
|
|
||||||
private Long elementId;
|
|
||||||
private String elementName;
|
|
||||||
private String dateFormat;
|
|
||||||
private String startDate;
|
|
||||||
private String endDate;
|
|
||||||
private List<String> unavailableDateList = new ArrayList<>();
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
package com.tencent.supersonic.headless.common.materialization.response;
|
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import com.tencent.supersonic.common.pojo.enums.TypeEnums;
|
|
||||||
import com.tencent.supersonic.headless.common.model.pojo.Measure;
|
|
||||||
import java.util.List;
|
|
||||||
import lombok.Builder;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@Builder
|
|
||||||
public class MaterializationElementModelResp {
|
|
||||||
private Long id;
|
|
||||||
private TypeEnums type;
|
|
||||||
private String bizName;
|
|
||||||
private String expr;
|
|
||||||
private List<Measure> measures = Lists.newArrayList();
|
|
||||||
}
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
package com.tencent.supersonic.headless.common.materialization.response;
|
|
||||||
|
|
||||||
|
|
||||||
import com.tencent.supersonic.common.pojo.RecordInfo;
|
|
||||||
import com.tencent.supersonic.common.pojo.enums.TypeEnums;
|
|
||||||
import com.tencent.supersonic.headless.common.materialization.enums.ElementFrequencyEnum;
|
|
||||||
import com.tencent.supersonic.headless.common.materialization.enums.ElementTypeEnum;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public class MaterializationElementResp extends RecordInfo {
|
|
||||||
|
|
||||||
private Long id;
|
|
||||||
private TypeEnums type;
|
|
||||||
private Long materializationId;
|
|
||||||
private String depends;
|
|
||||||
private ElementTypeEnum elementType;
|
|
||||||
private String defaultValue;
|
|
||||||
private String outlier;
|
|
||||||
private ElementFrequencyEnum frequency;
|
|
||||||
private String description;
|
|
||||||
private String bizName;
|
|
||||||
}
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
package com.tencent.supersonic.headless.common.materialization.response;
|
|
||||||
|
|
||||||
|
|
||||||
import com.tencent.supersonic.common.pojo.RecordInfo;
|
|
||||||
import com.tencent.supersonic.common.pojo.enums.TaskStatusEnum;
|
|
||||||
import com.tencent.supersonic.common.pojo.enums.TypeEnums;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public class MaterializationRecordResp extends RecordInfo {
|
|
||||||
|
|
||||||
private Long id;
|
|
||||||
private Long materializationId;
|
|
||||||
private TypeEnums elementType;
|
|
||||||
private Long elementId;
|
|
||||||
private String elementName;
|
|
||||||
private String dataTime;
|
|
||||||
private TaskStatusEnum taskStatus;
|
|
||||||
private String taskId;
|
|
||||||
private Integer retryCount;
|
|
||||||
private Long sourceCount;
|
|
||||||
private Long sinkCount;
|
|
||||||
private String message;
|
|
||||||
}
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
package com.tencent.supersonic.headless.common.materialization.response;
|
|
||||||
|
|
||||||
import com.tencent.supersonic.common.pojo.RecordInfo;
|
|
||||||
import com.tencent.supersonic.headless.common.model.enums.ModelSourceTypeEnum;
|
|
||||||
import com.tencent.supersonic.headless.common.materialization.enums.UpdateCycleEnum;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public class MaterializationResp extends RecordInfo {
|
|
||||||
private Long id;
|
|
||||||
private String name;
|
|
||||||
private ModelSourceTypeEnum materializedType;
|
|
||||||
private UpdateCycleEnum updateCycle;
|
|
||||||
private Long modelId;
|
|
||||||
private Long databaseId;
|
|
||||||
private Integer level;
|
|
||||||
private String destinationTable;
|
|
||||||
private String dateInfo;
|
|
||||||
private String entities;
|
|
||||||
private List<String> principals;
|
|
||||||
private String description;
|
|
||||||
private List<MaterializationElementResp> materializationElementRespList;
|
|
||||||
}
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
package com.tencent.supersonic.headless.common.materialization.response;
|
|
||||||
|
|
||||||
import com.tencent.supersonic.headless.common.model.enums.ModelSourceTypeEnum;
|
|
||||||
import com.tencent.supersonic.headless.common.model.response.DatabaseResp;
|
|
||||||
import com.tencent.supersonic.headless.common.materialization.enums.UpdateCycleEnum;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Builder;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@NoArgsConstructor
|
|
||||||
@AllArgsConstructor
|
|
||||||
@Builder
|
|
||||||
public class MaterializationSourceResp {
|
|
||||||
|
|
||||||
private Long materializationId;
|
|
||||||
private Long dataSourceId;
|
|
||||||
private Long modelId;
|
|
||||||
private String sql;
|
|
||||||
private List<String> fields;
|
|
||||||
private String sourceDb;
|
|
||||||
private String sourceTable;
|
|
||||||
|
|
||||||
private String dateInfo;
|
|
||||||
private String entities;
|
|
||||||
private ModelSourceTypeEnum materializedType;
|
|
||||||
private UpdateCycleEnum updateCycle;
|
|
||||||
private DatabaseResp databaseResp;
|
|
||||||
private String depends;
|
|
||||||
private Map<Long, String> dimensions;
|
|
||||||
private Map<Long, String> metrics;
|
|
||||||
}
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
<parent>
|
|
||||||
<artifactId>headless</artifactId>
|
|
||||||
<groupId>com.tencent.supersonic</groupId>
|
|
||||||
<version>${revision}</version>
|
|
||||||
</parent>
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
|
|
||||||
<artifactId>headless-materialization</artifactId>
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.tencent.supersonic</groupId>
|
|
||||||
<artifactId>headless-common</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>commons-beanutils</groupId>
|
|
||||||
<artifactId>commons-beanutils</artifactId>
|
|
||||||
<version>1.9.4</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.tencent.supersonic</groupId>
|
|
||||||
<artifactId>headless-model</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
</dependencies>
|
|
||||||
|
|
||||||
|
|
||||||
</project>
|
|
||||||
@@ -1,485 +0,0 @@
|
|||||||
package com.tencent.supersonic.headless.materialization.application;
|
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import com.tencent.supersonic.auth.api.authentication.pojo.User;
|
|
||||||
import com.tencent.supersonic.common.pojo.RecordInfo;
|
|
||||||
import com.tencent.supersonic.common.pojo.enums.StatusEnum;
|
|
||||||
import com.tencent.supersonic.common.pojo.enums.TypeEnums;
|
|
||||||
import com.tencent.supersonic.common.util.JsonUtil;
|
|
||||||
import com.tencent.supersonic.common.util.jsqlparser.SqlParserSelectHelper;
|
|
||||||
import com.tencent.supersonic.headless.common.materialization.enums.ElementFrequencyEnum;
|
|
||||||
import com.tencent.supersonic.headless.common.materialization.enums.ElementTypeEnum;
|
|
||||||
import com.tencent.supersonic.headless.common.materialization.pojo.MaterializationConfFilter;
|
|
||||||
import com.tencent.supersonic.headless.common.materialization.pojo.MaterializationFilter;
|
|
||||||
import com.tencent.supersonic.headless.common.materialization.request.MaterializationElementReq;
|
|
||||||
import com.tencent.supersonic.headless.common.materialization.request.MaterializationReq;
|
|
||||||
import com.tencent.supersonic.headless.common.materialization.response.MaterializationElementModelResp;
|
|
||||||
import com.tencent.supersonic.headless.common.materialization.response.MaterializationElementResp;
|
|
||||||
import com.tencent.supersonic.headless.common.materialization.response.MaterializationResp;
|
|
||||||
import com.tencent.supersonic.headless.common.materialization.response.MaterializationSourceResp;
|
|
||||||
import com.tencent.supersonic.headless.common.model.pojo.Measure;
|
|
||||||
import com.tencent.supersonic.headless.common.model.pojo.SchemaItem;
|
|
||||||
import com.tencent.supersonic.headless.common.model.request.ModelSchemaFilterReq;
|
|
||||||
import com.tencent.supersonic.headless.common.model.response.DimSchemaResp;
|
|
||||||
import com.tencent.supersonic.headless.common.model.response.MeasureResp;
|
|
||||||
import com.tencent.supersonic.headless.common.model.response.MetricSchemaResp;
|
|
||||||
import com.tencent.supersonic.headless.common.model.response.ModelResp;
|
|
||||||
import com.tencent.supersonic.headless.common.model.response.ModelSchemaResp;
|
|
||||||
import com.tencent.supersonic.headless.materialization.domain.MaterializationConfService;
|
|
||||||
import com.tencent.supersonic.headless.materialization.domain.pojo.Materialization;
|
|
||||||
import com.tencent.supersonic.headless.materialization.domain.repository.MaterializationElementRepository;
|
|
||||||
import com.tencent.supersonic.headless.materialization.domain.repository.MaterializationRepository;
|
|
||||||
import com.tencent.supersonic.headless.materialization.domain.utils.MaterializationConverter;
|
|
||||||
import com.tencent.supersonic.headless.materialization.domain.utils.MaterializationZipperUtils;
|
|
||||||
import com.tencent.supersonic.headless.materialization.domain.pojo.MaterializationElement;
|
|
||||||
import com.tencent.supersonic.headless.model.domain.ModelService;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.beans.BeanUtils;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.util.CollectionUtils;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.Optional;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
@Service
|
|
||||||
public class MaterializationConfServiceImpl implements MaterializationConfService {
|
|
||||||
|
|
||||||
private final MaterializationRepository materializationRepository;
|
|
||||||
private final MaterializationElementRepository materializationElementRepository;
|
|
||||||
private final ModelService modelService;
|
|
||||||
private final MaterializationZipperUtils materializationZipperUtils;
|
|
||||||
private String typeAndIdSplit = "_";
|
|
||||||
|
|
||||||
public MaterializationConfServiceImpl(MaterializationRepository materializationRepository,
|
|
||||||
MaterializationElementRepository materializationElementRepository,
|
|
||||||
ModelService modelService,
|
|
||||||
MaterializationZipperUtils materializationZipperUtils) {
|
|
||||||
this.materializationRepository = materializationRepository;
|
|
||||||
this.materializationElementRepository = materializationElementRepository;
|
|
||||||
this.modelService = modelService;
|
|
||||||
this.materializationZipperUtils = materializationZipperUtils;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Boolean addMaterializationConf(MaterializationReq materializationReq, User user) {
|
|
||||||
log.info("materializationReq:{}, user:{}", JsonUtil.toString(materializationReq), JsonUtil.toString(user));
|
|
||||||
Materialization materialization = MaterializationConverter.materializationReq2Bean(materializationReq);
|
|
||||||
RecordInfo recordInfo = new RecordInfo().createdBy(user.getName());
|
|
||||||
BeanUtils.copyProperties(recordInfo, materialization);
|
|
||||||
return materializationRepository.insert(materialization);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Boolean updateMaterializationConf(MaterializationReq materializationReq, User user) {
|
|
||||||
Materialization materialization = MaterializationConverter.materializationReq2Bean(materializationReq);
|
|
||||||
RecordInfo recordInfo = new RecordInfo().updatedBy(user.getName());
|
|
||||||
BeanUtils.copyProperties(recordInfo, materialization);
|
|
||||||
return materializationRepository.update(materialization);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<MaterializationResp> getMaterializationResp(MaterializationFilter filter, User user) {
|
|
||||||
return materializationRepository.getMaterializationResp(filter);
|
|
||||||
}
|
|
||||||
|
|
||||||
public MaterializationResp getMaterializationRespById(Long materializationId, User user) {
|
|
||||||
MaterializationResp materializationResp = new MaterializationResp();
|
|
||||||
MaterializationConfFilter filter = new MaterializationConfFilter();
|
|
||||||
filter.setMaterializationId(materializationId);
|
|
||||||
filter.setContainElements(true);
|
|
||||||
List<MaterializationResp> materializationRespList = queryMaterializationConf(filter, user);
|
|
||||||
if (CollectionUtils.isEmpty(materializationRespList)) {
|
|
||||||
return materializationResp;
|
|
||||||
}
|
|
||||||
return materializationRespList.get(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Boolean addMaterializationElementConf(MaterializationElementReq materializationElementReq, User user) {
|
|
||||||
log.info("materializationElementReq:{}, user:{}", JsonUtil.toString(materializationElementReq),
|
|
||||||
JsonUtil.toString(user));
|
|
||||||
MaterializationElement materializationElement = MaterializationConverter
|
|
||||||
.materializationElementReq2Bean(materializationElementReq);
|
|
||||||
RecordInfo recordInfo = new RecordInfo().createdBy(user.getName());
|
|
||||||
BeanUtils.copyProperties(recordInfo, materializationElement);
|
|
||||||
return materializationElementRepository.insert(materializationElement);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Boolean updateMaterializationElementConf(MaterializationElementReq materializationElementReq, User user) {
|
|
||||||
MaterializationElement materializationElement = MaterializationConverter
|
|
||||||
.materializationElementReq2Bean(materializationElementReq);
|
|
||||||
RecordInfo recordInfo = new RecordInfo().updatedBy(user.getName());
|
|
||||||
BeanUtils.copyProperties(recordInfo, materializationElement);
|
|
||||||
return materializationElementRepository.update(materializationElement);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<MaterializationResp> queryMaterializationConf(MaterializationConfFilter filter, User user) {
|
|
||||||
MaterializationFilter materializationFilter = MaterializationFilter.builder().build();
|
|
||||||
BeanUtils.copyProperties(filter, materializationFilter);
|
|
||||||
List<MaterializationResp> materializationRespList = getMaterializationResp(materializationFilter, user);
|
|
||||||
if (!CollectionUtils.isEmpty(materializationRespList) && filter.getContainElements()) {
|
|
||||||
Map<String, SchemaItem> keyAndSchemaItemPair = generateSchemaItem(filter, user);
|
|
||||||
materializationRespList.stream().forEach(materializationResp -> {
|
|
||||||
filter.setMaterializationId(materializationResp.getId());
|
|
||||||
List<MaterializationElementResp> materializationElementRespList = materializationElementRepository
|
|
||||||
.getMaterializationElementResp(filter);
|
|
||||||
fillElementInfo(materializationElementRespList, keyAndSchemaItemPair);
|
|
||||||
materializationResp.setMaterializationElementRespList(materializationElementRespList);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return materializationRespList;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void fillElementInfo(List<MaterializationElementResp> materializationElementRespList,
|
|
||||||
Map<String, SchemaItem> keyAndSchemaItemPair) {
|
|
||||||
if (CollectionUtils.isEmpty(materializationElementRespList) || Objects.isNull(keyAndSchemaItemPair)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
materializationElementRespList.stream().forEach(materializationElementResp -> {
|
|
||||||
String key = materializationElementResp.getType() + typeAndIdSplit + materializationElementResp.getId();
|
|
||||||
SchemaItem schemaItem = keyAndSchemaItemPair.getOrDefault(key, null);
|
|
||||||
if (Objects.nonNull(schemaItem)) {
|
|
||||||
materializationElementResp.setBizName(schemaItem.getBizName());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private Map<String, SchemaItem> generateSchemaItem(MaterializationConfFilter filter, User user) {
|
|
||||||
return generateSchemaItem(filter);
|
|
||||||
}
|
|
||||||
|
|
||||||
private Map<String, SchemaItem> generateSchemaItem(MaterializationConfFilter filter) {
|
|
||||||
Map<String, SchemaItem> keyAndSchemaItemPair = new HashMap<>();
|
|
||||||
|
|
||||||
ModelSchemaFilterReq modelFilter = new ModelSchemaFilterReq();
|
|
||||||
List<Long> modelIds = new ArrayList<>();
|
|
||||||
if (Objects.nonNull(filter.getModelId())) {
|
|
||||||
modelIds.add(filter.getModelId());
|
|
||||||
}
|
|
||||||
List<ModelSchemaResp> modelSchemaRespList = modelService.fetchModelSchema(modelFilter);
|
|
||||||
if (!CollectionUtils.isEmpty(modelSchemaRespList)) {
|
|
||||||
modelSchemaRespList.stream().forEach(modelSchemaResp -> {
|
|
||||||
List<DimSchemaResp> dimensions = modelSchemaResp.getDimensions();
|
|
||||||
List<MetricSchemaResp> metrics = modelSchemaResp.getMetrics();
|
|
||||||
if (!CollectionUtils.isEmpty(dimensions)) {
|
|
||||||
dimensions.stream().forEach(dimSchemaResp -> {
|
|
||||||
SchemaItem schemaItem = new SchemaItem();
|
|
||||||
BeanUtils.copyProperties(dimSchemaResp, schemaItem);
|
|
||||||
String key = TypeEnums.DIMENSION.name() + typeAndIdSplit + dimSchemaResp.getId();
|
|
||||||
keyAndSchemaItemPair.put(key, schemaItem);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!CollectionUtils.isEmpty(metrics)) {
|
|
||||||
metrics.stream().forEach(metricSchemaResp -> {
|
|
||||||
SchemaItem schemaItem = new SchemaItem();
|
|
||||||
BeanUtils.copyProperties(metricSchemaResp, schemaItem);
|
|
||||||
String key = TypeEnums.METRIC.name() + typeAndIdSplit + metricSchemaResp.getId();
|
|
||||||
keyAndSchemaItemPair.put(key, schemaItem);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return keyAndSchemaItemPair;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<MaterializationResp> getMaterializationByModel(Long modelId) {
|
|
||||||
MaterializationFilter filter = new MaterializationConfFilter();
|
|
||||||
filter.setModelId(modelId);
|
|
||||||
List<MaterializationResp> materializationRespList = materializationRepository.getMaterializationResp(filter);
|
|
||||||
MaterializationConfFilter materializationConfFilter = new MaterializationConfFilter();
|
|
||||||
if (!CollectionUtils.isEmpty(materializationRespList)) {
|
|
||||||
materializationRespList.stream().forEach(materializationResp -> {
|
|
||||||
materializationConfFilter.setMaterializationId(materializationResp.getId());
|
|
||||||
List<MaterializationElementResp> materializationElementRespList = materializationElementRepository
|
|
||||||
.getMaterializationElementResp(materializationConfFilter);
|
|
||||||
materializationResp.setMaterializationElementRespList(materializationElementRespList);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return materializationRespList;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<Long> getMaterializationByTable(Long databaseId, String destinationTable) {
|
|
||||||
MaterializationFilter filter = new MaterializationConfFilter();
|
|
||||||
filter.setDestinationTable(destinationTable);
|
|
||||||
filter.setDatabaseId(databaseId);
|
|
||||||
List<MaterializationResp> materializationRespList = materializationRepository.getMaterializationResp(filter);
|
|
||||||
if (!CollectionUtils.isEmpty(materializationRespList)) {
|
|
||||||
return materializationRespList.stream().map(m -> m.getId()).collect(Collectors.toList());
|
|
||||||
}
|
|
||||||
return new ArrayList<>();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String generateCreateSql(Long materializationId, User user) {
|
|
||||||
MaterializationConfFilter filter = new MaterializationConfFilter();
|
|
||||||
filter.setMaterializationId(materializationId);
|
|
||||||
filter.setContainElements(true);
|
|
||||||
List<MaterializationResp> materializationRespList = queryMaterializationConf(filter, user);
|
|
||||||
if (CollectionUtils.isEmpty(materializationRespList)) {
|
|
||||||
log.warn("materializationRespList is empty, materializationId:{}", materializationId);
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
// 获取db 连接信息
|
|
||||||
MaterializationResp materializationResp = materializationRespList.get(0);
|
|
||||||
|
|
||||||
return generateCreateSql(materializationResp);
|
|
||||||
}
|
|
||||||
|
|
||||||
private String generateCreateSql(MaterializationResp materializationResp) {
|
|
||||||
return materializationZipperUtils.generateCreateSql(materializationResp);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Boolean initMaterializationElementConf(MaterializationConfFilter filter, User user) {
|
|
||||||
Long materializationId = filter.getMaterializationId();
|
|
||||||
MaterializationResp materializationResp = getMaterializationRespById(materializationId, user);
|
|
||||||
Long modelId = materializationResp.getModelId();
|
|
||||||
ModelSchemaResp modelSchemaResp = modelService.fetchSingleModelSchema(modelId);
|
|
||||||
|
|
||||||
doDimensionMaterializationLogic(modelSchemaResp.getDimensions(), materializationResp, user);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void doDimensionMaterializationLogic(List<DimSchemaResp> dimensions,
|
|
||||||
MaterializationResp materializationResp, User user) {
|
|
||||||
if (CollectionUtils.isEmpty(dimensions)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Long materializationId = materializationResp.getId();
|
|
||||||
cleanMaterializationElement(materializationId, user);
|
|
||||||
for (DimSchemaResp dimSchemaResp : dimensions) {
|
|
||||||
MaterializationElementReq materializationElementReq = MaterializationElementReq.builder()
|
|
||||||
.id(dimSchemaResp.getId())
|
|
||||||
.type(TypeEnums.DIMENSION)
|
|
||||||
.materializationId(materializationId)
|
|
||||||
.elementType(ElementTypeEnum.VARCHAR)
|
|
||||||
.frequency(ElementFrequencyEnum.LOW)
|
|
||||||
.status(StatusEnum.ONLINE)
|
|
||||||
.description(dimSchemaResp.getDescription())
|
|
||||||
.build();
|
|
||||||
|
|
||||||
addMaterializationElementConf(materializationElementReq, user);
|
|
||||||
}
|
|
||||||
MaterializationConfFilter filter = new MaterializationConfFilter();
|
|
||||||
filter.setMaterializationId(materializationId);
|
|
||||||
|
|
||||||
MaterializationResp materializationRespNew = getMaterializationRespById(materializationId, user);
|
|
||||||
String createSql = generateCreateSql(materializationRespNew);
|
|
||||||
log.info("createSql:{}", createSql);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private Boolean cleanMaterializationElement(Long materializationId, User user) {
|
|
||||||
log.info("cleanMaterializationElement materializationId:{}", materializationId);
|
|
||||||
return materializationElementRepository.cleanMaterializationElement(materializationId);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<MaterializationElementModelResp> getMaterializationElementModels(Long materializationId, User user) {
|
|
||||||
MaterializationResp materializationResp = materializationRepository.getMaterialization(materializationId);
|
|
||||||
MaterializationConfFilter filter = new MaterializationConfFilter();
|
|
||||||
filter.setMaterializationId(materializationId);
|
|
||||||
List<MaterializationElementResp> materializationElementRespList = materializationElementRepository
|
|
||||||
.getMaterializationElementResp(filter);
|
|
||||||
List<MaterializationElementModelResp> materializationElementModelRespList = new ArrayList<>();
|
|
||||||
if (!CollectionUtils.isEmpty(materializationElementRespList)) {
|
|
||||||
ModelSchemaFilterReq modelFilter = new ModelSchemaFilterReq();
|
|
||||||
modelFilter.setModelIds(Arrays.asList(materializationResp.getModelId()));
|
|
||||||
List<ModelSchemaResp> modelSchemaRespList = modelService.fetchModelSchema(modelFilter);
|
|
||||||
List<MeasureResp> measureRespList = modelService.getMeasureListOfModel(
|
|
||||||
Lists.newArrayList(materializationResp.getModelId()));
|
|
||||||
Map<String, DimSchemaResp> dimSchemaRespMap = new HashMap<>();
|
|
||||||
Map<String, MetricSchemaResp> metricSchemaRespHashMap = new HashMap<>();
|
|
||||||
if (!CollectionUtils.isEmpty(modelSchemaRespList)) {
|
|
||||||
modelSchemaRespList.stream().forEach(modelSchemaResp -> {
|
|
||||||
List<DimSchemaResp> dimensions = modelSchemaResp.getDimensions();
|
|
||||||
List<MetricSchemaResp> metrics = modelSchemaResp.getMetrics();
|
|
||||||
if (!CollectionUtils.isEmpty(dimensions)) {
|
|
||||||
dimensions.stream().forEach(dimSchemaResp -> {
|
|
||||||
String key = TypeEnums.DIMENSION.name() + typeAndIdSplit + dimSchemaResp.getId();
|
|
||||||
dimSchemaRespMap.put(key, dimSchemaResp);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (!CollectionUtils.isEmpty(metrics)) {
|
|
||||||
metrics.stream().forEach(metricSchemaResp -> {
|
|
||||||
String key = TypeEnums.METRIC.name() + typeAndIdSplit + metricSchemaResp.getId();
|
|
||||||
metricSchemaRespHashMap.put(key, metricSchemaResp);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
materializationElementRespList.stream().forEach(materializationElementResp -> {
|
|
||||||
String key = materializationElementResp.getType() + typeAndIdSplit + materializationElementResp.getId();
|
|
||||||
DimSchemaResp schemaItem = dimSchemaRespMap.getOrDefault(key, null);
|
|
||||||
MaterializationElementModelResp materializationElementModelResp = MaterializationElementModelResp
|
|
||||||
.builder()
|
|
||||||
.type(materializationElementResp.getType())
|
|
||||||
.id(materializationElementResp.getId())
|
|
||||||
.build();
|
|
||||||
if (Objects.nonNull(schemaItem)) {
|
|
||||||
materializationElementModelResp.setBizName(schemaItem.getBizName());
|
|
||||||
materializationElementModelResp.setExpr(schemaItem.getExpr());
|
|
||||||
materializationElementModelRespList.add(materializationElementModelResp);
|
|
||||||
} else {
|
|
||||||
MetricSchemaResp metricSchemaResp = metricSchemaRespHashMap.getOrDefault(key, null);
|
|
||||||
if (Objects.nonNull(metricSchemaResp)) {
|
|
||||||
materializationElementModelResp.setBizName(metricSchemaResp.getBizName());
|
|
||||||
materializationElementModelResp.setExpr(metricSchemaResp.getTypeParams().getExpr());
|
|
||||||
materializationElementModelResp.setMeasures(metricSchemaResp.getTypeParams().getMeasures());
|
|
||||||
materializationElementModelResp.getMeasures().forEach(m -> {
|
|
||||||
m.setExpr(getDataSourceMeasure(measureRespList, m.getBizName()));
|
|
||||||
});
|
|
||||||
materializationElementModelRespList.add(materializationElementModelResp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return materializationElementModelRespList;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<MaterializationSourceResp> getMaterializationSourceResp(
|
|
||||||
Long materializationId) {
|
|
||||||
MaterializationResp materializationResp = materializationRepository.getMaterialization(
|
|
||||||
materializationId);
|
|
||||||
Long modelId = materializationResp.getModelId();
|
|
||||||
|
|
||||||
Set<Long> modelIds = new HashSet<>();
|
|
||||||
Map<Long, Map<Long, String>> dataSourceDimensions = new HashMap<>();
|
|
||||||
Map<Long, Map<Long, String>> dataSourceMetrics = new HashMap<>();
|
|
||||||
MaterializationConfFilter materializationConfFilter = new MaterializationConfFilter();
|
|
||||||
materializationConfFilter.setMaterializationId(materializationId);
|
|
||||||
List<MaterializationElementResp> materializationElementRespList = materializationElementRepository
|
|
||||||
.getMaterializationElementResp(materializationConfFilter);
|
|
||||||
if (!CollectionUtils.isEmpty(materializationElementRespList)) {
|
|
||||||
ModelSchemaFilterReq modelSchemaFilterReq = new ModelSchemaFilterReq();
|
|
||||||
modelSchemaFilterReq.setModelIds(Arrays.asList(modelId));
|
|
||||||
List<ModelSchemaResp> modelSchemaRespList = modelService.fetchModelSchema(modelSchemaFilterReq);
|
|
||||||
List<MeasureResp> measureRespList = modelService.getMeasureListOfModel(Lists.newArrayList(modelId));
|
|
||||||
Set<Long> dimensionIds = new HashSet<>();
|
|
||||||
Set<Long> metricIds = new HashSet<>();
|
|
||||||
materializationElementRespList.stream().forEach(e -> {
|
|
||||||
if (e.getType().equals(TypeEnums.DIMENSION)) {
|
|
||||||
dimensionIds.add(e.getId());
|
|
||||||
}
|
|
||||||
if (e.getType().equals(TypeEnums.METRIC)) {
|
|
||||||
metricIds.add(e.getId());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
modelSchemaRespList.stream().forEach(m -> {
|
|
||||||
m.getDimensions().stream().filter(mm -> dimensionIds.contains(mm.getId())).forEach(mm -> {
|
|
||||||
if (!dataSourceDimensions.containsKey(mm.getModelId())) {
|
|
||||||
dataSourceDimensions.put(mm.getModelId(), new HashMap<>());
|
|
||||||
}
|
|
||||||
dataSourceDimensions.get(mm.getModelId()).put(mm.getId(), mm.getBizName());
|
|
||||||
modelIds.add(mm.getModelId());
|
|
||||||
});
|
|
||||||
m.getMetrics().stream().filter(mm -> metricIds.contains(mm.getId())).forEach(mm -> {
|
|
||||||
Long sourceId = 0L;
|
|
||||||
for (Measure measure : mm.getTypeParams().getMeasures()) {
|
|
||||||
sourceId = getSourceIdByMeasure(measureRespList, measure.getBizName());
|
|
||||||
if (sourceId > 0) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (sourceId > 0) {
|
|
||||||
if (!dataSourceMetrics.containsKey(sourceId)) {
|
|
||||||
dataSourceMetrics.put(sourceId, new HashMap<>());
|
|
||||||
}
|
|
||||||
dataSourceMetrics.get(sourceId).put(mm.getId(), mm.getBizName());
|
|
||||||
modelIds.add(sourceId);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
List<MaterializationSourceResp> materializationSourceResps = new ArrayList<>();
|
|
||||||
for (Long sourceId : modelIds) {
|
|
||||||
//todo
|
|
||||||
// Optional<ModelResp> modelResp = modelSchemaRespList.stream().filter(d -> d.getId().equals(sourceId))
|
|
||||||
// .findFirst();
|
|
||||||
Optional<ModelResp> modelResp = Optional.empty();
|
|
||||||
if (modelResp.isPresent()) {
|
|
||||||
MaterializationSourceResp materializationSourceResp = MaterializationSourceResp.builder()
|
|
||||||
.dataSourceId(sourceId)
|
|
||||||
.materializationId(materializationId)
|
|
||||||
.modelId(modelId)
|
|
||||||
.depends(modelResp.get().getDepends())
|
|
||||||
.materializedType(materializationResp.getMaterializedType())
|
|
||||||
.entities(materializationResp.getEntities())
|
|
||||||
.dateInfo(materializationResp.getDateInfo())
|
|
||||||
.updateCycle(materializationResp.getUpdateCycle())
|
|
||||||
.build();
|
|
||||||
setDataSourceDb(modelResp.get(), materializationSourceResp);
|
|
||||||
materializationSourceResp.setMetrics(
|
|
||||||
dataSourceMetrics.containsKey(sourceId) ? dataSourceMetrics.get(sourceId)
|
|
||||||
: new HashMap<>());
|
|
||||||
materializationSourceResp.setDimensions(
|
|
||||||
dataSourceDimensions.containsKey(sourceId) ? dataSourceDimensions.get(sourceId)
|
|
||||||
: new HashMap<>());
|
|
||||||
materializationSourceResps.add(materializationSourceResp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return materializationSourceResps;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getSourceIdByMeasure(List<MeasureResp> measureRespList, String bizName) {
|
|
||||||
if (!CollectionUtils.isEmpty(measureRespList)) {
|
|
||||||
Optional<MeasureResp> measure = measureRespList.stream()
|
|
||||||
.filter(m -> m.getBizName().equalsIgnoreCase(bizName)).findFirst();
|
|
||||||
if (measure.isPresent()) {
|
|
||||||
return measure.get().getDatasourceId();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0L;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setDataSourceDb(ModelResp datasourceResp, MaterializationSourceResp materializationSourceResp) {
|
|
||||||
if (Objects.nonNull(datasourceResp.getModelDetail())) {
|
|
||||||
String dbTable = "";
|
|
||||||
if (Objects.nonNull(datasourceResp.getModelDetail().getTableQuery())
|
|
||||||
&& !datasourceResp.getModelDetail().getTableQuery().isEmpty()) {
|
|
||||||
dbTable = datasourceResp.getModelDetail().getTableQuery();
|
|
||||||
}
|
|
||||||
if (Objects.nonNull(datasourceResp.getModelDetail().getSqlQuery())
|
|
||||||
&& !datasourceResp.getModelDetail().getSqlQuery().isEmpty()) {
|
|
||||||
dbTable = SqlParserSelectHelper.getDbTableName(datasourceResp.getModelDetail().getSqlQuery());
|
|
||||||
}
|
|
||||||
if (!dbTable.isEmpty()) {
|
|
||||||
String[] db = dbTable.split("\\.");
|
|
||||||
if (db.length > 1) {
|
|
||||||
materializationSourceResp.setSourceDb(db[0]);
|
|
||||||
materializationSourceResp.setSourceTable(db[1]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private String getDataSourceMeasure(List<MeasureResp> measureRespList, String bizName) {
|
|
||||||
if (!CollectionUtils.isEmpty(measureRespList)) {
|
|
||||||
Optional<MeasureResp> measure = measureRespList.stream()
|
|
||||||
.filter(m -> m.getBizName().equalsIgnoreCase(bizName)).findFirst();
|
|
||||||
if (measure.isPresent()) {
|
|
||||||
return measure.get().getExpr();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,80 +0,0 @@
|
|||||||
package com.tencent.supersonic.headless.materialization.application;
|
|
||||||
|
|
||||||
|
|
||||||
import com.tencent.supersonic.auth.api.authentication.pojo.User;
|
|
||||||
import com.tencent.supersonic.common.pojo.RecordInfo;
|
|
||||||
import com.tencent.supersonic.common.pojo.enums.TaskStatusEnum;
|
|
||||||
import com.tencent.supersonic.common.util.JsonUtil;
|
|
||||||
import com.tencent.supersonic.headless.common.materialization.pojo.MaterializationDateFilter;
|
|
||||||
import com.tencent.supersonic.headless.common.materialization.pojo.MaterializationRecordFilter;
|
|
||||||
import com.tencent.supersonic.headless.common.materialization.request.MaterializationRecordReq;
|
|
||||||
import com.tencent.supersonic.headless.common.materialization.response.MaterializationDateResp;
|
|
||||||
import com.tencent.supersonic.headless.common.materialization.response.MaterializationRecordResp;
|
|
||||||
import com.tencent.supersonic.headless.materialization.domain.MaterializationRecordService;
|
|
||||||
import com.tencent.supersonic.headless.materialization.domain.pojo.MaterializationRecord;
|
|
||||||
import com.tencent.supersonic.headless.materialization.domain.repository.MaterializationRecordRepository;
|
|
||||||
import com.tencent.supersonic.headless.materialization.domain.utils.MaterializationRecordConverter;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.beans.BeanUtils;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
@Service
|
|
||||||
public class MaterializationRecordServiceImpl implements MaterializationRecordService {
|
|
||||||
|
|
||||||
private final MaterializationRecordRepository repository;
|
|
||||||
|
|
||||||
public MaterializationRecordServiceImpl(MaterializationRecordRepository materializationRecordRepository) {
|
|
||||||
this.repository = materializationRecordRepository;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Boolean addMaterializationRecord(MaterializationRecordReq materializationRecordReq, User user) {
|
|
||||||
log.info("materializationRecordReq:{}, user:{}", JsonUtil.toString(materializationRecordReq),
|
|
||||||
JsonUtil.toString(user));
|
|
||||||
MaterializationRecord materializationRecord = MaterializationRecordConverter.req2Bean(materializationRecordReq);
|
|
||||||
RecordInfo recordInfo = new RecordInfo().createdBy(user.getName());
|
|
||||||
BeanUtils.copyProperties(recordInfo, materializationRecord);
|
|
||||||
return repository.insertMaterializationRecord(materializationRecord);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Boolean updateMaterializationRecord(MaterializationRecordReq materializationRecordReq, User user) {
|
|
||||||
log.info("materializationRecordReq:{}, user:{}", JsonUtil.toString(materializationRecordReq),
|
|
||||||
JsonUtil.toString(user));
|
|
||||||
MaterializationRecord materializationRecord = MaterializationRecordConverter.req2Bean(materializationRecordReq);
|
|
||||||
RecordInfo recordInfo = new RecordInfo().updatedBy(user.getName());
|
|
||||||
BeanUtils.copyProperties(recordInfo, materializationRecord);
|
|
||||||
return repository.updateMaterializationRecord(materializationRecord);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<MaterializationRecordResp> getMaterializationRecordList(MaterializationRecordFilter filter, User user) {
|
|
||||||
return repository.getMaterializationRecordList(filter);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Long getMaterializationRecordCount(MaterializationRecordFilter filter, User user) {
|
|
||||||
return repository.getCount(filter);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<MaterializationDateResp> fetchMaterializationDate(MaterializationDateFilter filter, User user) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<MaterializationRecordResp> fetchMaterializationDate(List<Long> materializationIds, String elementName,
|
|
||||||
String startTime, String endTime) {
|
|
||||||
MaterializationRecordFilter materializationRecordFilter = MaterializationRecordFilter.builder()
|
|
||||||
.taskStatus(Arrays.asList(TaskStatusEnum.SUCCESS))
|
|
||||||
.elementName(elementName)
|
|
||||||
.materializationIds(materializationIds)
|
|
||||||
.startDataTime(startTime)
|
|
||||||
.endDataTime(endTime).build();
|
|
||||||
return repository.getMaterializationRecordList(materializationRecordFilter);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
package com.tencent.supersonic.headless.materialization.domain;
|
|
||||||
|
|
||||||
import com.tencent.supersonic.auth.api.authentication.pojo.User;
|
|
||||||
import com.tencent.supersonic.headless.common.materialization.pojo.MaterializationConfFilter;
|
|
||||||
import com.tencent.supersonic.headless.common.materialization.pojo.MaterializationFilter;
|
|
||||||
import com.tencent.supersonic.headless.common.materialization.request.MaterializationElementReq;
|
|
||||||
import com.tencent.supersonic.headless.common.materialization.request.MaterializationReq;
|
|
||||||
import com.tencent.supersonic.headless.common.materialization.response.MaterializationElementModelResp;
|
|
||||||
import com.tencent.supersonic.headless.common.materialization.response.MaterializationResp;
|
|
||||||
import com.tencent.supersonic.headless.common.materialization.response.MaterializationSourceResp;
|
|
||||||
import com.tencent.supersonic.headless.common.model.response.MeasureResp;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public interface MaterializationConfService {
|
|
||||||
|
|
||||||
Boolean addMaterializationConf(MaterializationReq materializationReq, User user);
|
|
||||||
|
|
||||||
Boolean updateMaterializationConf(MaterializationReq materializationReq, User user);
|
|
||||||
|
|
||||||
List<MaterializationResp> getMaterializationResp(MaterializationFilter filter, User user);
|
|
||||||
|
|
||||||
Boolean addMaterializationElementConf(MaterializationElementReq materializationElementReq, User user);
|
|
||||||
|
|
||||||
Boolean updateMaterializationElementConf(MaterializationElementReq materializationElementReq, User user);
|
|
||||||
|
|
||||||
List<MaterializationResp> queryMaterializationConf(MaterializationConfFilter filter, User user);
|
|
||||||
|
|
||||||
List<MaterializationResp> getMaterializationByModel(Long modelId);
|
|
||||||
|
|
||||||
List<Long> getMaterializationByTable(Long databaseId, String destinationTable);
|
|
||||||
|
|
||||||
String generateCreateSql(Long materializationId, User user);
|
|
||||||
|
|
||||||
Boolean initMaterializationElementConf(MaterializationConfFilter filter, User user);
|
|
||||||
|
|
||||||
List<MaterializationElementModelResp> getMaterializationElementModels(Long materializationId, User user);
|
|
||||||
|
|
||||||
List<MaterializationSourceResp> getMaterializationSourceResp(Long materializationId);
|
|
||||||
|
|
||||||
Long getSourceIdByMeasure(List<MeasureResp> measureRespList, String bizName);
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
package com.tencent.supersonic.headless.materialization.domain;
|
|
||||||
|
|
||||||
import com.tencent.supersonic.auth.api.authentication.pojo.User;
|
|
||||||
import com.tencent.supersonic.headless.common.materialization.pojo.MaterializationDateFilter;
|
|
||||||
import com.tencent.supersonic.headless.common.materialization.pojo.MaterializationRecordFilter;
|
|
||||||
import com.tencent.supersonic.headless.common.materialization.request.MaterializationRecordReq;
|
|
||||||
import com.tencent.supersonic.headless.common.materialization.response.MaterializationDateResp;
|
|
||||||
import com.tencent.supersonic.headless.common.materialization.response.MaterializationRecordResp;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public interface MaterializationRecordService {
|
|
||||||
|
|
||||||
Boolean addMaterializationRecord(MaterializationRecordReq materializationRecord, User user);
|
|
||||||
|
|
||||||
Boolean updateMaterializationRecord(MaterializationRecordReq materializationRecord, User user);
|
|
||||||
|
|
||||||
List<MaterializationRecordResp> getMaterializationRecordList(MaterializationRecordFilter filter, User user);
|
|
||||||
|
|
||||||
Long getMaterializationRecordCount(MaterializationRecordFilter filter, User user);
|
|
||||||
|
|
||||||
List<MaterializationDateResp> fetchMaterializationDate(MaterializationDateFilter filter, User user);
|
|
||||||
|
|
||||||
List<MaterializationRecordResp> fetchMaterializationDate(List<Long> materializationIds, String elementName,
|
|
||||||
String startTime, String endTime);
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,145 +0,0 @@
|
|||||||
package com.tencent.supersonic.headless.materialization.domain.dataobject;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
public class MaterializationDO {
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
private String materializedType;
|
|
||||||
|
|
||||||
private String updateCycle;
|
|
||||||
|
|
||||||
private Long modelId;
|
|
||||||
|
|
||||||
private Long databaseId;
|
|
||||||
|
|
||||||
private Integer level;
|
|
||||||
|
|
||||||
private Integer status;
|
|
||||||
|
|
||||||
private String destinationTable;
|
|
||||||
|
|
||||||
private String principals;
|
|
||||||
|
|
||||||
private Date createdAt;
|
|
||||||
|
|
||||||
private String createdBy;
|
|
||||||
|
|
||||||
private Date updatedAt;
|
|
||||||
|
|
||||||
private String updatedBy;
|
|
||||||
|
|
||||||
public Long getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(Long id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name == null ? null : name.trim();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getMaterializedType() {
|
|
||||||
return materializedType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMaterializedType(String materializedType) {
|
|
||||||
this.materializedType = materializedType == null ? null : materializedType.trim();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUpdateCycle() {
|
|
||||||
return updateCycle;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUpdateCycle(String updateCycle) {
|
|
||||||
this.updateCycle = updateCycle == null ? null : updateCycle.trim();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getModelId() {
|
|
||||||
return modelId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setModelId(Long modelId) {
|
|
||||||
this.modelId = modelId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getDatabaseId() {
|
|
||||||
return databaseId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDatabaseId(Long databaseId) {
|
|
||||||
this.databaseId = databaseId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getLevel() {
|
|
||||||
return level;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLevel(Integer level) {
|
|
||||||
this.level = level;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getStatus() {
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setStatus(Integer status) {
|
|
||||||
this.status = status;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDestinationTable() {
|
|
||||||
return destinationTable;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDestinationTable(String destinationTable) {
|
|
||||||
this.destinationTable = destinationTable == null ? null : destinationTable.trim();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPrincipals() {
|
|
||||||
return principals;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPrincipals(String principals) {
|
|
||||||
this.principals = principals == null ? null : principals.trim();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Date getCreatedAt() {
|
|
||||||
return createdAt;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCreatedAt(Date createdAt) {
|
|
||||||
this.createdAt = createdAt;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCreatedBy() {
|
|
||||||
return createdBy;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCreatedBy(String createdBy) {
|
|
||||||
this.createdBy = createdBy == null ? null : createdBy.trim();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Date getUpdatedAt() {
|
|
||||||
return updatedAt;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUpdatedAt(Date updatedAt) {
|
|
||||||
this.updatedAt = updatedAt;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUpdatedBy() {
|
|
||||||
return updatedBy;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUpdatedBy(String updatedBy) {
|
|
||||||
this.updatedBy = updatedBy == null ? null : updatedBy.trim();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,33 +0,0 @@
|
|||||||
package com.tencent.supersonic.headless.materialization.domain.dataobject;
|
|
||||||
|
|
||||||
public class MaterializationDOWithBLOBs extends MaterializationDO {
|
|
||||||
private String dateInfo;
|
|
||||||
|
|
||||||
private String entities;
|
|
||||||
|
|
||||||
private String description;
|
|
||||||
|
|
||||||
public String getDateInfo() {
|
|
||||||
return dateInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDateInfo(String dateInfo) {
|
|
||||||
this.dateInfo = dateInfo == null ? null : dateInfo.trim();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getEntities() {
|
|
||||||
return entities;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setEntities(String entities) {
|
|
||||||
this.entities = entities == null ? null : entities.trim();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDescription() {
|
|
||||||
return description;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDescription(String description) {
|
|
||||||
this.description = description == null ? null : description.trim();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,95 +0,0 @@
|
|||||||
package com.tencent.supersonic.headless.materialization.domain.dataobject;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
public class MaterializationElementDO extends MaterializationElementDOKey {
|
|
||||||
private String elementType;
|
|
||||||
|
|
||||||
private String defaultValue;
|
|
||||||
|
|
||||||
private String outlier;
|
|
||||||
|
|
||||||
private String frequency;
|
|
||||||
|
|
||||||
private Date createdAt;
|
|
||||||
|
|
||||||
private String createdBy;
|
|
||||||
|
|
||||||
private Date updatedAt;
|
|
||||||
|
|
||||||
private String updatedBy;
|
|
||||||
|
|
||||||
private Integer status;
|
|
||||||
|
|
||||||
public String getElementType() {
|
|
||||||
return elementType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setElementType(String elementType) {
|
|
||||||
this.elementType = elementType == null ? null : elementType.trim();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDefaultValue() {
|
|
||||||
return defaultValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDefaultValue(String defaultValue) {
|
|
||||||
this.defaultValue = defaultValue == null ? null : defaultValue.trim();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getOutlier() {
|
|
||||||
return outlier;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOutlier(String outlier) {
|
|
||||||
this.outlier = outlier == null ? null : outlier.trim();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getFrequency() {
|
|
||||||
return frequency;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFrequency(String frequency) {
|
|
||||||
this.frequency = frequency == null ? null : frequency.trim();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Date getCreatedAt() {
|
|
||||||
return createdAt;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCreatedAt(Date createdAt) {
|
|
||||||
this.createdAt = createdAt;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCreatedBy() {
|
|
||||||
return createdBy;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCreatedBy(String createdBy) {
|
|
||||||
this.createdBy = createdBy == null ? null : createdBy.trim();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Date getUpdatedAt() {
|
|
||||||
return updatedAt;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUpdatedAt(Date updatedAt) {
|
|
||||||
this.updatedAt = updatedAt;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUpdatedBy() {
|
|
||||||
return updatedBy;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUpdatedBy(String updatedBy) {
|
|
||||||
this.updatedBy = updatedBy == null ? null : updatedBy.trim();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getStatus() {
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setStatus(Integer status) {
|
|
||||||
this.status = status;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,992 +0,0 @@
|
|||||||
package com.tencent.supersonic.headless.materialization.domain.dataobject;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class MaterializationElementDOExample {
|
|
||||||
protected String orderByClause;
|
|
||||||
|
|
||||||
protected boolean distinct;
|
|
||||||
|
|
||||||
protected List<Criteria> oredCriteria;
|
|
||||||
|
|
||||||
public MaterializationElementDOExample() {
|
|
||||||
oredCriteria = new ArrayList<>();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOrderByClause(String orderByClause) {
|
|
||||||
this.orderByClause = orderByClause;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getOrderByClause() {
|
|
||||||
return orderByClause;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDistinct(boolean distinct) {
|
|
||||||
this.distinct = distinct;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isDistinct() {
|
|
||||||
return distinct;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Criteria> getOredCriteria() {
|
|
||||||
return oredCriteria;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void or(Criteria criteria) {
|
|
||||||
oredCriteria.add(criteria);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria or() {
|
|
||||||
Criteria criteria = createCriteriaInternal();
|
|
||||||
oredCriteria.add(criteria);
|
|
||||||
return criteria;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria createCriteria() {
|
|
||||||
Criteria criteria = createCriteriaInternal();
|
|
||||||
if (oredCriteria.size() == 0) {
|
|
||||||
oredCriteria.add(criteria);
|
|
||||||
}
|
|
||||||
return criteria;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected Criteria createCriteriaInternal() {
|
|
||||||
Criteria criteria = new Criteria();
|
|
||||||
return criteria;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void clear() {
|
|
||||||
oredCriteria.clear();
|
|
||||||
orderByClause = null;
|
|
||||||
distinct = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected abstract static class GeneratedCriteria {
|
|
||||||
protected List<Criterion> criteria;
|
|
||||||
|
|
||||||
protected GeneratedCriteria() {
|
|
||||||
super();
|
|
||||||
criteria = new ArrayList<>();
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isValid() {
|
|
||||||
return criteria.size() > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Criterion> getAllCriteria() {
|
|
||||||
return criteria;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Criterion> getCriteria() {
|
|
||||||
return criteria;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void addCriterion(String condition) {
|
|
||||||
if (condition == null) {
|
|
||||||
throw new RuntimeException("Value for condition cannot be null");
|
|
||||||
}
|
|
||||||
criteria.add(new Criterion(condition));
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void addCriterion(String condition, Object value, String property) {
|
|
||||||
if (value == null) {
|
|
||||||
throw new RuntimeException("Value for " + property + " cannot be null");
|
|
||||||
}
|
|
||||||
criteria.add(new Criterion(condition, value));
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void addCriterion(String condition, Object value1, Object value2, String property) {
|
|
||||||
if (value1 == null || value2 == null) {
|
|
||||||
throw new RuntimeException("Between values for " + property + " cannot be null");
|
|
||||||
}
|
|
||||||
criteria.add(new Criterion(condition, value1, value2));
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andIdIsNull() {
|
|
||||||
addCriterion("id is null");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andIdIsNotNull() {
|
|
||||||
addCriterion("id is not null");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andIdEqualTo(Long value) {
|
|
||||||
addCriterion("id =", value, "id");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andIdNotEqualTo(Long value) {
|
|
||||||
addCriterion("id <>", value, "id");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andIdGreaterThan(Long value) {
|
|
||||||
addCriterion("id >", value, "id");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andIdGreaterThanOrEqualTo(Long value) {
|
|
||||||
addCriterion("id >=", value, "id");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andIdLessThan(Long value) {
|
|
||||||
addCriterion("id <", value, "id");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andIdLessThanOrEqualTo(Long value) {
|
|
||||||
addCriterion("id <=", value, "id");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andIdIn(List<Long> values) {
|
|
||||||
addCriterion("id in", values, "id");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andIdNotIn(List<Long> values) {
|
|
||||||
addCriterion("id not in", values, "id");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andIdBetween(Long value1, Long value2) {
|
|
||||||
addCriterion("id between", value1, value2, "id");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andIdNotBetween(Long value1, Long value2) {
|
|
||||||
addCriterion("id not between", value1, value2, "id");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andTypeIsNull() {
|
|
||||||
addCriterion("type is null");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andTypeIsNotNull() {
|
|
||||||
addCriterion("type is not null");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andTypeEqualTo(String value) {
|
|
||||||
addCriterion("type =", value, "type");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andTypeNotEqualTo(String value) {
|
|
||||||
addCriterion("type <>", value, "type");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andTypeGreaterThan(String value) {
|
|
||||||
addCriterion("type >", value, "type");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andTypeGreaterThanOrEqualTo(String value) {
|
|
||||||
addCriterion("type >=", value, "type");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andTypeLessThan(String value) {
|
|
||||||
addCriterion("type <", value, "type");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andTypeLessThanOrEqualTo(String value) {
|
|
||||||
addCriterion("type <=", value, "type");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andTypeLike(String value) {
|
|
||||||
addCriterion("type like", value, "type");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andTypeNotLike(String value) {
|
|
||||||
addCriterion("type not like", value, "type");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andTypeIn(List<String> values) {
|
|
||||||
addCriterion("type in", values, "type");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andTypeNotIn(List<String> values) {
|
|
||||||
addCriterion("type not in", values, "type");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andTypeBetween(String value1, String value2) {
|
|
||||||
addCriterion("type between", value1, value2, "type");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andTypeNotBetween(String value1, String value2) {
|
|
||||||
addCriterion("type not between", value1, value2, "type");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andMaterializationIdIsNull() {
|
|
||||||
addCriterion("materialization_id is null");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andMaterializationIdIsNotNull() {
|
|
||||||
addCriterion("materialization_id is not null");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andMaterializationIdEqualTo(Long value) {
|
|
||||||
addCriterion("materialization_id =", value, "materializationId");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andMaterializationIdNotEqualTo(Long value) {
|
|
||||||
addCriterion("materialization_id <>", value, "materializationId");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andMaterializationIdGreaterThan(Long value) {
|
|
||||||
addCriterion("materialization_id >", value, "materializationId");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andMaterializationIdGreaterThanOrEqualTo(Long value) {
|
|
||||||
addCriterion("materialization_id >=", value, "materializationId");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andMaterializationIdLessThan(Long value) {
|
|
||||||
addCriterion("materialization_id <", value, "materializationId");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andMaterializationIdLessThanOrEqualTo(Long value) {
|
|
||||||
addCriterion("materialization_id <=", value, "materializationId");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andMaterializationIdIn(List<Long> values) {
|
|
||||||
addCriterion("materialization_id in", values, "materializationId");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andMaterializationIdNotIn(List<Long> values) {
|
|
||||||
addCriterion("materialization_id not in", values, "materializationId");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andMaterializationIdBetween(Long value1, Long value2) {
|
|
||||||
addCriterion("materialization_id between", value1, value2, "materializationId");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andMaterializationIdNotBetween(Long value1, Long value2) {
|
|
||||||
addCriterion("materialization_id not between", value1, value2, "materializationId");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andElementTypeIsNull() {
|
|
||||||
addCriterion("element_type is null");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andElementTypeIsNotNull() {
|
|
||||||
addCriterion("element_type is not null");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andElementTypeEqualTo(String value) {
|
|
||||||
addCriterion("element_type =", value, "elementType");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andElementTypeNotEqualTo(String value) {
|
|
||||||
addCriterion("element_type <>", value, "elementType");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andElementTypeGreaterThan(String value) {
|
|
||||||
addCriterion("element_type >", value, "elementType");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andElementTypeGreaterThanOrEqualTo(String value) {
|
|
||||||
addCriterion("element_type >=", value, "elementType");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andElementTypeLessThan(String value) {
|
|
||||||
addCriterion("element_type <", value, "elementType");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andElementTypeLessThanOrEqualTo(String value) {
|
|
||||||
addCriterion("element_type <=", value, "elementType");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andElementTypeLike(String value) {
|
|
||||||
addCriterion("element_type like", value, "elementType");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andElementTypeNotLike(String value) {
|
|
||||||
addCriterion("element_type not like", value, "elementType");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andElementTypeIn(List<String> values) {
|
|
||||||
addCriterion("element_type in", values, "elementType");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andElementTypeNotIn(List<String> values) {
|
|
||||||
addCriterion("element_type not in", values, "elementType");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andElementTypeBetween(String value1, String value2) {
|
|
||||||
addCriterion("element_type between", value1, value2, "elementType");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andElementTypeNotBetween(String value1, String value2) {
|
|
||||||
addCriterion("element_type not between", value1, value2, "elementType");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andDefaultValueIsNull() {
|
|
||||||
addCriterion("default_value is null");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andDefaultValueIsNotNull() {
|
|
||||||
addCriterion("default_value is not null");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andDefaultValueEqualTo(String value) {
|
|
||||||
addCriterion("default_value =", value, "defaultValue");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andDefaultValueNotEqualTo(String value) {
|
|
||||||
addCriterion("default_value <>", value, "defaultValue");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andDefaultValueGreaterThan(String value) {
|
|
||||||
addCriterion("default_value >", value, "defaultValue");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andDefaultValueGreaterThanOrEqualTo(String value) {
|
|
||||||
addCriterion("default_value >=", value, "defaultValue");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andDefaultValueLessThan(String value) {
|
|
||||||
addCriterion("default_value <", value, "defaultValue");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andDefaultValueLessThanOrEqualTo(String value) {
|
|
||||||
addCriterion("default_value <=", value, "defaultValue");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andDefaultValueLike(String value) {
|
|
||||||
addCriterion("default_value like", value, "defaultValue");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andDefaultValueNotLike(String value) {
|
|
||||||
addCriterion("default_value not like", value, "defaultValue");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andDefaultValueIn(List<String> values) {
|
|
||||||
addCriterion("default_value in", values, "defaultValue");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andDefaultValueNotIn(List<String> values) {
|
|
||||||
addCriterion("default_value not in", values, "defaultValue");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andDefaultValueBetween(String value1, String value2) {
|
|
||||||
addCriterion("default_value between", value1, value2, "defaultValue");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andDefaultValueNotBetween(String value1, String value2) {
|
|
||||||
addCriterion("default_value not between", value1, value2, "defaultValue");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andOutlierIsNull() {
|
|
||||||
addCriterion("outlier is null");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andOutlierIsNotNull() {
|
|
||||||
addCriterion("outlier is not null");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andOutlierEqualTo(String value) {
|
|
||||||
addCriterion("outlier =", value, "outlier");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andOutlierNotEqualTo(String value) {
|
|
||||||
addCriterion("outlier <>", value, "outlier");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andOutlierGreaterThan(String value) {
|
|
||||||
addCriterion("outlier >", value, "outlier");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andOutlierGreaterThanOrEqualTo(String value) {
|
|
||||||
addCriterion("outlier >=", value, "outlier");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andOutlierLessThan(String value) {
|
|
||||||
addCriterion("outlier <", value, "outlier");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andOutlierLessThanOrEqualTo(String value) {
|
|
||||||
addCriterion("outlier <=", value, "outlier");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andOutlierLike(String value) {
|
|
||||||
addCriterion("outlier like", value, "outlier");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andOutlierNotLike(String value) {
|
|
||||||
addCriterion("outlier not like", value, "outlier");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andOutlierIn(List<String> values) {
|
|
||||||
addCriterion("outlier in", values, "outlier");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andOutlierNotIn(List<String> values) {
|
|
||||||
addCriterion("outlier not in", values, "outlier");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andOutlierBetween(String value1, String value2) {
|
|
||||||
addCriterion("outlier between", value1, value2, "outlier");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andOutlierNotBetween(String value1, String value2) {
|
|
||||||
addCriterion("outlier not between", value1, value2, "outlier");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andFrequencyIsNull() {
|
|
||||||
addCriterion("frequency is null");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andFrequencyIsNotNull() {
|
|
||||||
addCriterion("frequency is not null");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andFrequencyEqualTo(String value) {
|
|
||||||
addCriterion("frequency =", value, "frequency");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andFrequencyNotEqualTo(String value) {
|
|
||||||
addCriterion("frequency <>", value, "frequency");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andFrequencyGreaterThan(String value) {
|
|
||||||
addCriterion("frequency >", value, "frequency");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andFrequencyGreaterThanOrEqualTo(String value) {
|
|
||||||
addCriterion("frequency >=", value, "frequency");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andFrequencyLessThan(String value) {
|
|
||||||
addCriterion("frequency <", value, "frequency");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andFrequencyLessThanOrEqualTo(String value) {
|
|
||||||
addCriterion("frequency <=", value, "frequency");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andFrequencyLike(String value) {
|
|
||||||
addCriterion("frequency like", value, "frequency");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andFrequencyNotLike(String value) {
|
|
||||||
addCriterion("frequency not like", value, "frequency");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andFrequencyIn(List<String> values) {
|
|
||||||
addCriterion("frequency in", values, "frequency");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andFrequencyNotIn(List<String> values) {
|
|
||||||
addCriterion("frequency not in", values, "frequency");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andFrequencyBetween(String value1, String value2) {
|
|
||||||
addCriterion("frequency between", value1, value2, "frequency");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andFrequencyNotBetween(String value1, String value2) {
|
|
||||||
addCriterion("frequency not between", value1, value2, "frequency");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andCreatedAtIsNull() {
|
|
||||||
addCriterion("created_at is null");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andCreatedAtIsNotNull() {
|
|
||||||
addCriterion("created_at is not null");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andCreatedAtEqualTo(Date value) {
|
|
||||||
addCriterion("created_at =", value, "createdAt");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andCreatedAtNotEqualTo(Date value) {
|
|
||||||
addCriterion("created_at <>", value, "createdAt");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andCreatedAtGreaterThan(Date value) {
|
|
||||||
addCriterion("created_at >", value, "createdAt");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andCreatedAtGreaterThanOrEqualTo(Date value) {
|
|
||||||
addCriterion("created_at >=", value, "createdAt");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andCreatedAtLessThan(Date value) {
|
|
||||||
addCriterion("created_at <", value, "createdAt");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andCreatedAtLessThanOrEqualTo(Date value) {
|
|
||||||
addCriterion("created_at <=", value, "createdAt");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andCreatedAtIn(List<Date> values) {
|
|
||||||
addCriterion("created_at in", values, "createdAt");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andCreatedAtNotIn(List<Date> values) {
|
|
||||||
addCriterion("created_at not in", values, "createdAt");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andCreatedAtBetween(Date value1, Date value2) {
|
|
||||||
addCriterion("created_at between", value1, value2, "createdAt");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andCreatedAtNotBetween(Date value1, Date value2) {
|
|
||||||
addCriterion("created_at not between", value1, value2, "createdAt");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andCreatedByIsNull() {
|
|
||||||
addCriterion("created_by is null");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andCreatedByIsNotNull() {
|
|
||||||
addCriterion("created_by is not null");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andCreatedByEqualTo(String value) {
|
|
||||||
addCriterion("created_by =", value, "createdBy");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andCreatedByNotEqualTo(String value) {
|
|
||||||
addCriterion("created_by <>", value, "createdBy");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andCreatedByGreaterThan(String value) {
|
|
||||||
addCriterion("created_by >", value, "createdBy");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andCreatedByGreaterThanOrEqualTo(String value) {
|
|
||||||
addCriterion("created_by >=", value, "createdBy");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andCreatedByLessThan(String value) {
|
|
||||||
addCriterion("created_by <", value, "createdBy");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andCreatedByLessThanOrEqualTo(String value) {
|
|
||||||
addCriterion("created_by <=", value, "createdBy");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andCreatedByLike(String value) {
|
|
||||||
addCriterion("created_by like", value, "createdBy");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andCreatedByNotLike(String value) {
|
|
||||||
addCriterion("created_by not like", value, "createdBy");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andCreatedByIn(List<String> values) {
|
|
||||||
addCriterion("created_by in", values, "createdBy");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andCreatedByNotIn(List<String> values) {
|
|
||||||
addCriterion("created_by not in", values, "createdBy");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andCreatedByBetween(String value1, String value2) {
|
|
||||||
addCriterion("created_by between", value1, value2, "createdBy");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andCreatedByNotBetween(String value1, String value2) {
|
|
||||||
addCriterion("created_by not between", value1, value2, "createdBy");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andUpdatedAtIsNull() {
|
|
||||||
addCriterion("updated_at is null");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andUpdatedAtIsNotNull() {
|
|
||||||
addCriterion("updated_at is not null");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andUpdatedAtEqualTo(Date value) {
|
|
||||||
addCriterion("updated_at =", value, "updatedAt");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andUpdatedAtNotEqualTo(Date value) {
|
|
||||||
addCriterion("updated_at <>", value, "updatedAt");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andUpdatedAtGreaterThan(Date value) {
|
|
||||||
addCriterion("updated_at >", value, "updatedAt");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andUpdatedAtGreaterThanOrEqualTo(Date value) {
|
|
||||||
addCriterion("updated_at >=", value, "updatedAt");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andUpdatedAtLessThan(Date value) {
|
|
||||||
addCriterion("updated_at <", value, "updatedAt");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andUpdatedAtLessThanOrEqualTo(Date value) {
|
|
||||||
addCriterion("updated_at <=", value, "updatedAt");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andUpdatedAtIn(List<Date> values) {
|
|
||||||
addCriterion("updated_at in", values, "updatedAt");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andUpdatedAtNotIn(List<Date> values) {
|
|
||||||
addCriterion("updated_at not in", values, "updatedAt");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andUpdatedAtBetween(Date value1, Date value2) {
|
|
||||||
addCriterion("updated_at between", value1, value2, "updatedAt");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andUpdatedAtNotBetween(Date value1, Date value2) {
|
|
||||||
addCriterion("updated_at not between", value1, value2, "updatedAt");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andUpdatedByIsNull() {
|
|
||||||
addCriterion("updated_by is null");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andUpdatedByIsNotNull() {
|
|
||||||
addCriterion("updated_by is not null");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andUpdatedByEqualTo(String value) {
|
|
||||||
addCriterion("updated_by =", value, "updatedBy");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andUpdatedByNotEqualTo(String value) {
|
|
||||||
addCriterion("updated_by <>", value, "updatedBy");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andUpdatedByGreaterThan(String value) {
|
|
||||||
addCriterion("updated_by >", value, "updatedBy");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andUpdatedByGreaterThanOrEqualTo(String value) {
|
|
||||||
addCriterion("updated_by >=", value, "updatedBy");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andUpdatedByLessThan(String value) {
|
|
||||||
addCriterion("updated_by <", value, "updatedBy");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andUpdatedByLessThanOrEqualTo(String value) {
|
|
||||||
addCriterion("updated_by <=", value, "updatedBy");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andUpdatedByLike(String value) {
|
|
||||||
addCriterion("updated_by like", value, "updatedBy");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andUpdatedByNotLike(String value) {
|
|
||||||
addCriterion("updated_by not like", value, "updatedBy");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andUpdatedByIn(List<String> values) {
|
|
||||||
addCriterion("updated_by in", values, "updatedBy");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andUpdatedByNotIn(List<String> values) {
|
|
||||||
addCriterion("updated_by not in", values, "updatedBy");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andUpdatedByBetween(String value1, String value2) {
|
|
||||||
addCriterion("updated_by between", value1, value2, "updatedBy");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andUpdatedByNotBetween(String value1, String value2) {
|
|
||||||
addCriterion("updated_by not between", value1, value2, "updatedBy");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andStatusIsNull() {
|
|
||||||
addCriterion("status is null");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andStatusIsNotNull() {
|
|
||||||
addCriterion("status is not null");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andStatusEqualTo(Integer value) {
|
|
||||||
addCriterion("status =", value, "status");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andStatusNotEqualTo(Integer value) {
|
|
||||||
addCriterion("status <>", value, "status");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andStatusGreaterThan(Integer value) {
|
|
||||||
addCriterion("status >", value, "status");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andStatusGreaterThanOrEqualTo(Integer value) {
|
|
||||||
addCriterion("status >=", value, "status");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andStatusLessThan(Integer value) {
|
|
||||||
addCriterion("status <", value, "status");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andStatusLessThanOrEqualTo(Integer value) {
|
|
||||||
addCriterion("status <=", value, "status");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andStatusIn(List<Integer> values) {
|
|
||||||
addCriterion("status in", values, "status");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andStatusNotIn(List<Integer> values) {
|
|
||||||
addCriterion("status not in", values, "status");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andStatusBetween(Integer value1, Integer value2) {
|
|
||||||
addCriterion("status between", value1, value2, "status");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andStatusNotBetween(Integer value1, Integer value2) {
|
|
||||||
addCriterion("status not between", value1, value2, "status");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class Criteria extends GeneratedCriteria {
|
|
||||||
protected Criteria() {
|
|
||||||
super();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class Criterion {
|
|
||||||
private String condition;
|
|
||||||
|
|
||||||
private Object value;
|
|
||||||
|
|
||||||
private Object secondValue;
|
|
||||||
|
|
||||||
private boolean noValue;
|
|
||||||
|
|
||||||
private boolean singleValue;
|
|
||||||
|
|
||||||
private boolean betweenValue;
|
|
||||||
|
|
||||||
private boolean listValue;
|
|
||||||
|
|
||||||
private String typeHandler;
|
|
||||||
|
|
||||||
protected Criterion(String condition) {
|
|
||||||
super();
|
|
||||||
this.condition = condition;
|
|
||||||
this.typeHandler = null;
|
|
||||||
this.noValue = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected Criterion(String condition, Object value, String typeHandler) {
|
|
||||||
super();
|
|
||||||
this.condition = condition;
|
|
||||||
this.value = value;
|
|
||||||
this.typeHandler = typeHandler;
|
|
||||||
if (value instanceof List<?>) {
|
|
||||||
this.listValue = true;
|
|
||||||
} else {
|
|
||||||
this.singleValue = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected Criterion(String condition, Object value) {
|
|
||||||
this(condition, value, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
|
|
||||||
super();
|
|
||||||
this.condition = condition;
|
|
||||||
this.value = value;
|
|
||||||
this.secondValue = secondValue;
|
|
||||||
this.typeHandler = typeHandler;
|
|
||||||
this.betweenValue = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected Criterion(String condition, Object value, Object secondValue) {
|
|
||||||
this(condition, value, secondValue, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCondition() {
|
|
||||||
return condition;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Object getValue() {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Object getSecondValue() {
|
|
||||||
return secondValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isNoValue() {
|
|
||||||
return noValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isSingleValue() {
|
|
||||||
return singleValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isBetweenValue() {
|
|
||||||
return betweenValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isListValue() {
|
|
||||||
return listValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTypeHandler() {
|
|
||||||
return typeHandler;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
package com.tencent.supersonic.headless.materialization.domain.dataobject;
|
|
||||||
|
|
||||||
public class MaterializationElementDOKey {
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
private String type;
|
|
||||||
|
|
||||||
private Long materializationId;
|
|
||||||
|
|
||||||
public Long getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(Long id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getType() {
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setType(String type) {
|
|
||||||
this.type = type == null ? null : type.trim();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getMaterializationId() {
|
|
||||||
return materializationId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMaterializationId(Long materializationId) {
|
|
||||||
this.materializationId = materializationId;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
package com.tencent.supersonic.headless.materialization.domain.dataobject;
|
|
||||||
|
|
||||||
public class MaterializationElementDOWithBLOBs extends MaterializationElementDO {
|
|
||||||
private String depends;
|
|
||||||
|
|
||||||
private String description;
|
|
||||||
|
|
||||||
public String getDepends() {
|
|
||||||
return depends;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDepends(String depends) {
|
|
||||||
this.depends = depends == null ? null : depends.trim();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDescription() {
|
|
||||||
return description;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDescription(String description) {
|
|
||||||
this.description = description == null ? null : description.trim();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,168 +0,0 @@
|
|||||||
package com.tencent.supersonic.headless.materialization.domain.dataobject;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public class MaterializationRecordDO {
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
private Long materializationId;
|
|
||||||
|
|
||||||
private String elementType;
|
|
||||||
|
|
||||||
private Long elementId;
|
|
||||||
|
|
||||||
private String elementName;
|
|
||||||
|
|
||||||
private String dataTime;
|
|
||||||
|
|
||||||
private String state;
|
|
||||||
|
|
||||||
private String taskId;
|
|
||||||
|
|
||||||
private Date createdAt;
|
|
||||||
|
|
||||||
private Date updatedAt;
|
|
||||||
|
|
||||||
private String createdBy;
|
|
||||||
|
|
||||||
private String updatedBy;
|
|
||||||
|
|
||||||
private Long retryCount;
|
|
||||||
|
|
||||||
private Long sourceCount;
|
|
||||||
|
|
||||||
private Long sinkCount;
|
|
||||||
|
|
||||||
private String message;
|
|
||||||
|
|
||||||
public Long getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(Long id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getMaterializationId() {
|
|
||||||
return materializationId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMaterializationId(Long materializationId) {
|
|
||||||
this.materializationId = materializationId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getElementType() {
|
|
||||||
return elementType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setElementType(String elementType) {
|
|
||||||
this.elementType = elementType == null ? null : elementType.trim();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getElementId() {
|
|
||||||
return elementId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setElementId(Long elementId) {
|
|
||||||
this.elementId = elementId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getElementName() {
|
|
||||||
return elementName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setElementName(String elementName) {
|
|
||||||
this.elementName = elementName == null ? null : elementName.trim();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDataTime() {
|
|
||||||
return dataTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDataTime(String dataTime) {
|
|
||||||
this.dataTime = dataTime == null ? null : dataTime.trim();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getState() {
|
|
||||||
return state;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setState(String state) {
|
|
||||||
this.state = state == null ? null : state.trim();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTaskId() {
|
|
||||||
return taskId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTaskId(String taskId) {
|
|
||||||
this.taskId = taskId == null ? null : taskId.trim();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Date getCreatedAt() {
|
|
||||||
return createdAt;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCreatedAt(Date createdAt) {
|
|
||||||
this.createdAt = createdAt;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Date getUpdatedAt() {
|
|
||||||
return updatedAt;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUpdatedAt(Date updatedAt) {
|
|
||||||
this.updatedAt = updatedAt;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCreatedBy() {
|
|
||||||
return createdBy;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCreatedBy(String createdBy) {
|
|
||||||
this.createdBy = createdBy == null ? null : createdBy.trim();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUpdatedBy() {
|
|
||||||
return updatedBy;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUpdatedBy(String updatedBy) {
|
|
||||||
this.updatedBy = updatedBy == null ? null : updatedBy.trim();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getRetryCount() {
|
|
||||||
return retryCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRetryCount(Long retryCount) {
|
|
||||||
this.retryCount = retryCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getSourceCount() {
|
|
||||||
return sourceCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSourceCount(Long sourceCount) {
|
|
||||||
this.sourceCount = sourceCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getSinkCount() {
|
|
||||||
return sinkCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSinkCount(Long sinkCount) {
|
|
||||||
this.sinkCount = sinkCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getMessage() {
|
|
||||||
return message;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMessage(String message) {
|
|
||||||
this.message = message == null ? null : message.trim();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,28 +0,0 @@
|
|||||||
package com.tencent.supersonic.headless.materialization.domain.pojo;
|
|
||||||
|
|
||||||
|
|
||||||
import com.tencent.supersonic.common.pojo.RecordInfo;
|
|
||||||
import com.tencent.supersonic.common.pojo.enums.StatusEnum;
|
|
||||||
import com.tencent.supersonic.headless.common.model.enums.ModelSourceTypeEnum;
|
|
||||||
import com.tencent.supersonic.headless.common.materialization.enums.UpdateCycleEnum;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public class Materialization extends RecordInfo {
|
|
||||||
|
|
||||||
private Long id;
|
|
||||||
private String name;
|
|
||||||
private ModelSourceTypeEnum materializedType;
|
|
||||||
private UpdateCycleEnum updateCycle;
|
|
||||||
private Long modelId;
|
|
||||||
private Long databaseId;
|
|
||||||
private Integer level;
|
|
||||||
private String destinationTable;
|
|
||||||
private String dateInfo;
|
|
||||||
private String entities;
|
|
||||||
private List<String> principals;
|
|
||||||
private String description;
|
|
||||||
private StatusEnum status = StatusEnum.ONLINE;
|
|
||||||
}
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
package com.tencent.supersonic.headless.materialization.domain.pojo;
|
|
||||||
|
|
||||||
|
|
||||||
import com.tencent.supersonic.common.pojo.RecordInfo;
|
|
||||||
import com.tencent.supersonic.common.pojo.enums.StatusEnum;
|
|
||||||
import com.tencent.supersonic.common.pojo.enums.TypeEnums;
|
|
||||||
import com.tencent.supersonic.headless.common.materialization.enums.ElementFrequencyEnum;
|
|
||||||
import com.tencent.supersonic.headless.common.materialization.enums.ElementTypeEnum;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public class MaterializationElement extends RecordInfo {
|
|
||||||
private Long id;
|
|
||||||
private TypeEnums type;
|
|
||||||
private Long materializationId;
|
|
||||||
private String depends;
|
|
||||||
private ElementTypeEnum elementType;
|
|
||||||
private String defaultValue;
|
|
||||||
private String outlier;
|
|
||||||
private ElementFrequencyEnum frequency;
|
|
||||||
private String description;
|
|
||||||
private StatusEnum status;
|
|
||||||
}
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
package com.tencent.supersonic.headless.materialization.domain.pojo;
|
|
||||||
|
|
||||||
import com.tencent.supersonic.common.pojo.RecordInfo;
|
|
||||||
import com.tencent.supersonic.common.pojo.enums.TaskStatusEnum;
|
|
||||||
import com.tencent.supersonic.common.pojo.enums.TypeEnums;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public class MaterializationRecord extends RecordInfo {
|
|
||||||
|
|
||||||
private Long id;
|
|
||||||
private Long materializationId;
|
|
||||||
private TypeEnums elementType;
|
|
||||||
private Long elementId;
|
|
||||||
private String elementName;
|
|
||||||
private String dataTime;
|
|
||||||
private TaskStatusEnum taskStatus;
|
|
||||||
private String taskId;
|
|
||||||
private Long retryCount;
|
|
||||||
private Long sourceCount;
|
|
||||||
private Long sinkCount;
|
|
||||||
private String message;
|
|
||||||
}
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
package com.tencent.supersonic.headless.materialization.domain.repository;
|
|
||||||
|
|
||||||
import com.tencent.supersonic.headless.common.materialization.pojo.MaterializationConfFilter;
|
|
||||||
import com.tencent.supersonic.headless.common.materialization.response.MaterializationElementResp;
|
|
||||||
import com.tencent.supersonic.headless.materialization.domain.pojo.MaterializationElement;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public interface MaterializationElementRepository {
|
|
||||||
Boolean insert(MaterializationElement materializationElement);
|
|
||||||
|
|
||||||
Boolean update(MaterializationElement materializationElement);
|
|
||||||
|
|
||||||
List<MaterializationElementResp> getMaterializationElementResp(MaterializationConfFilter filter);
|
|
||||||
|
|
||||||
Boolean cleanMaterializationElement(Long materializationId);
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
package com.tencent.supersonic.headless.materialization.domain.repository;
|
|
||||||
|
|
||||||
import com.tencent.supersonic.headless.common.materialization.pojo.MaterializationRecordFilter;
|
|
||||||
import com.tencent.supersonic.headless.common.materialization.response.MaterializationRecordResp;
|
|
||||||
import com.tencent.supersonic.headless.materialization.domain.pojo.MaterializationRecord;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public interface MaterializationRecordRepository {
|
|
||||||
|
|
||||||
Boolean insertMaterializationRecord(MaterializationRecord materializationRecord);
|
|
||||||
|
|
||||||
Boolean updateMaterializationRecord(MaterializationRecord materializationRecord);
|
|
||||||
|
|
||||||
List<MaterializationRecordResp> getMaterializationRecordList(MaterializationRecordFilter filter);
|
|
||||||
|
|
||||||
long getCount(MaterializationRecordFilter filter);
|
|
||||||
}
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
package com.tencent.supersonic.headless.materialization.domain.repository;
|
|
||||||
|
|
||||||
import com.tencent.supersonic.headless.common.materialization.pojo.MaterializationFilter;
|
|
||||||
import com.tencent.supersonic.headless.common.materialization.response.MaterializationResp;
|
|
||||||
import com.tencent.supersonic.headless.materialization.domain.pojo.Materialization;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public interface MaterializationRepository {
|
|
||||||
Boolean insert(Materialization materialization);
|
|
||||||
|
|
||||||
Boolean update(Materialization materialization);
|
|
||||||
|
|
||||||
List<MaterializationResp> getMaterializationResp(MaterializationFilter filter);
|
|
||||||
|
|
||||||
MaterializationResp getMaterialization(Long id);
|
|
||||||
}
|
|
||||||
@@ -1,146 +0,0 @@
|
|||||||
package com.tencent.supersonic.headless.materialization.domain.utils;
|
|
||||||
|
|
||||||
import com.tencent.supersonic.common.pojo.enums.TypeEnums;
|
|
||||||
import com.tencent.supersonic.common.util.BeanMapper;
|
|
||||||
import com.tencent.supersonic.common.util.JsonUtil;
|
|
||||||
import com.tencent.supersonic.headless.common.materialization.enums.ElementFrequencyEnum;
|
|
||||||
import com.tencent.supersonic.headless.common.materialization.enums.ElementTypeEnum;
|
|
||||||
import com.tencent.supersonic.headless.common.model.enums.ModelSourceTypeEnum;
|
|
||||||
import com.tencent.supersonic.headless.common.materialization.enums.UpdateCycleEnum;
|
|
||||||
import com.tencent.supersonic.headless.common.materialization.request.MaterializationElementReq;
|
|
||||||
import com.tencent.supersonic.headless.common.materialization.request.MaterializationReq;
|
|
||||||
import com.tencent.supersonic.headless.common.materialization.response.MaterializationElementResp;
|
|
||||||
import com.tencent.supersonic.headless.common.materialization.response.MaterializationResp;
|
|
||||||
import com.tencent.supersonic.headless.materialization.domain.pojo.Materialization;
|
|
||||||
import com.tencent.supersonic.headless.materialization.domain.dataobject.MaterializationDOWithBLOBs;
|
|
||||||
import com.tencent.supersonic.headless.materialization.domain.dataobject.MaterializationElementDOWithBLOBs;
|
|
||||||
import com.tencent.supersonic.headless.materialization.domain.pojo.MaterializationElement;
|
|
||||||
import org.apache.logging.log4j.util.Strings;
|
|
||||||
import org.springframework.beans.BeanUtils;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
import org.springframework.util.CollectionUtils;
|
|
||||||
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
@Component
|
|
||||||
public class MaterializationConverter {
|
|
||||||
|
|
||||||
public static Materialization materializationReq2Bean(MaterializationReq materializationReq) {
|
|
||||||
Materialization materialization = new Materialization();
|
|
||||||
BeanUtils.copyProperties(materializationReq, materialization);
|
|
||||||
return materialization;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static MaterializationDOWithBLOBs materialization2DO(Materialization materialization) {
|
|
||||||
MaterializationDOWithBLOBs materializationDOWithBLOBs = new MaterializationDOWithBLOBs();
|
|
||||||
BeanUtils.copyProperties(materialization, materializationDOWithBLOBs);
|
|
||||||
if (Objects.nonNull(materialization.getMaterializedType())) {
|
|
||||||
materializationDOWithBLOBs.setMaterializedType(materialization.getMaterializedType().name());
|
|
||||||
}
|
|
||||||
if (Objects.nonNull(materialization.getUpdateCycle())) {
|
|
||||||
materializationDOWithBLOBs.setUpdateCycle(materialization.getUpdateCycle().name());
|
|
||||||
}
|
|
||||||
if (Objects.nonNull(materialization.getStatus())) {
|
|
||||||
materializationDOWithBLOBs.setStatus(materialization.getStatus().getCode());
|
|
||||||
}
|
|
||||||
if (!CollectionUtils.isEmpty(materialization.getPrincipals())) {
|
|
||||||
materializationDOWithBLOBs.setPrincipals(JsonUtil.toString(materialization.getPrincipals()));
|
|
||||||
}
|
|
||||||
return materializationDOWithBLOBs;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static MaterializationElementDOWithBLOBs materialization2DO(MaterializationElement materializationElement) {
|
|
||||||
MaterializationElementDOWithBLOBs materializationElementDO = new MaterializationElementDOWithBLOBs();
|
|
||||||
BeanUtils.copyProperties(materializationElement, materializationElementDO);
|
|
||||||
if (Objects.nonNull(materializationElement.getElementType())) {
|
|
||||||
materializationElementDO.setElementType(materializationElement.getElementType().name());
|
|
||||||
}
|
|
||||||
if (Objects.nonNull(materializationElement.getType())) {
|
|
||||||
materializationElementDO.setType(materializationElement.getType().getName());
|
|
||||||
}
|
|
||||||
if (Objects.nonNull(materializationElement.getStatus())) {
|
|
||||||
materializationElementDO.setStatus(materializationElement.getStatus().getCode());
|
|
||||||
}
|
|
||||||
if (Objects.nonNull(materializationElement.getFrequency())) {
|
|
||||||
materializationElementDO.setFrequency(materializationElement.getFrequency().name());
|
|
||||||
}
|
|
||||||
|
|
||||||
return materializationElementDO;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static MaterializationDOWithBLOBs convert(MaterializationDOWithBLOBs materializationDO,
|
|
||||||
Materialization materialization) {
|
|
||||||
BeanMapper.mapper(materialization, materializationDO);
|
|
||||||
if (Objects.nonNull(materialization.getMaterializedType())) {
|
|
||||||
materializationDO.setMaterializedType(materialization.getMaterializedType().name());
|
|
||||||
}
|
|
||||||
if (Objects.nonNull(materialization.getUpdateCycle())) {
|
|
||||||
materializationDO.setUpdateCycle(materialization.getUpdateCycle().name());
|
|
||||||
}
|
|
||||||
if (Objects.nonNull(materialization.getStatus())) {
|
|
||||||
materializationDO.setStatus(materialization.getStatus().getCode());
|
|
||||||
}
|
|
||||||
if (!CollectionUtils.isEmpty(materialization.getPrincipals())) {
|
|
||||||
materializationDO.setPrincipals(JsonUtil.toString(materialization.getPrincipals()));
|
|
||||||
}
|
|
||||||
return materializationDO;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static MaterializationElementDOWithBLOBs convert(MaterializationElementDOWithBLOBs materializationElementDO,
|
|
||||||
MaterializationElement materializationElement) {
|
|
||||||
BeanMapper.mapper(materializationElement, materializationElementDO);
|
|
||||||
if (Objects.nonNull(materializationElement.getType())) {
|
|
||||||
materializationElementDO.setType(materializationElement.getType().name());
|
|
||||||
}
|
|
||||||
if (Objects.nonNull(materializationElement.getElementType())) {
|
|
||||||
materializationElementDO.setElementType(materializationElement.getElementType().name());
|
|
||||||
}
|
|
||||||
if (Objects.nonNull(materializationElement.getFrequency())) {
|
|
||||||
materializationElementDO.setFrequency(materializationElement.getFrequency().name());
|
|
||||||
}
|
|
||||||
if (Objects.nonNull(materializationElement.getStatus())) {
|
|
||||||
materializationElementDO.setStatus(materializationElement.getStatus().getCode());
|
|
||||||
}
|
|
||||||
|
|
||||||
return materializationElementDO;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static MaterializationElement materializationElementReq2Bean(MaterializationElementReq elementReq) {
|
|
||||||
MaterializationElement materializationElement = new MaterializationElement();
|
|
||||||
BeanUtils.copyProperties(elementReq, materializationElement);
|
|
||||||
return materializationElement;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static MaterializationResp convert2Resp(MaterializationDOWithBLOBs materializationDO) {
|
|
||||||
MaterializationResp materializationResp = new MaterializationResp();
|
|
||||||
BeanUtils.copyProperties(materializationDO, materializationResp);
|
|
||||||
if (Strings.isNotEmpty(materializationDO.getMaterializedType())) {
|
|
||||||
materializationResp.setMaterializedType(Enum.valueOf(ModelSourceTypeEnum.class,
|
|
||||||
materializationDO.getMaterializedType()));
|
|
||||||
}
|
|
||||||
if (Strings.isNotEmpty(materializationDO.getUpdateCycle())) {
|
|
||||||
materializationResp.setUpdateCycle(Enum.valueOf(UpdateCycleEnum.class, materializationDO.getUpdateCycle()));
|
|
||||||
}
|
|
||||||
if (Strings.isNotEmpty(materializationDO.getPrincipals())) {
|
|
||||||
materializationResp.setPrincipals(JsonUtil.toList(materializationDO.getPrincipals(), String.class));
|
|
||||||
}
|
|
||||||
return materializationResp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static MaterializationElementResp elementDO2Resp(MaterializationElementDOWithBLOBs elementDO) {
|
|
||||||
MaterializationElementResp materializationElementResp = new MaterializationElementResp();
|
|
||||||
BeanUtils.copyProperties(elementDO, materializationElementResp);
|
|
||||||
if (Strings.isNotEmpty(elementDO.getType())) {
|
|
||||||
materializationElementResp.setType(TypeEnums.of(elementDO.getType()));
|
|
||||||
}
|
|
||||||
if (Strings.isNotEmpty(elementDO.getElementType())) {
|
|
||||||
materializationElementResp.setElementType(Enum.valueOf(ElementTypeEnum.class,
|
|
||||||
elementDO.getElementType()));
|
|
||||||
}
|
|
||||||
if (Strings.isNotEmpty(elementDO.getFrequency())) {
|
|
||||||
materializationElementResp.setFrequency(Enum.valueOf(ElementFrequencyEnum.class,
|
|
||||||
elementDO.getFrequency()));
|
|
||||||
}
|
|
||||||
return materializationElementResp;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,78 +0,0 @@
|
|||||||
package com.tencent.supersonic.headless.materialization.domain.utils;
|
|
||||||
|
|
||||||
|
|
||||||
import com.tencent.supersonic.common.pojo.enums.TypeEnums;
|
|
||||||
import com.tencent.supersonic.headless.common.materialization.enums.ElementFrequencyEnum;
|
|
||||||
import com.tencent.supersonic.headless.common.materialization.response.MaterializationElementResp;
|
|
||||||
import com.tencent.supersonic.headless.common.materialization.response.MaterializationResp;
|
|
||||||
import org.apache.logging.log4j.util.Strings;
|
|
||||||
import org.springframework.util.CollectionUtils;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.StringJoiner;
|
|
||||||
|
|
||||||
public class MaterializationPartitionHelper implements MaterializationUtils {
|
|
||||||
private String split = "_";
|
|
||||||
private String createPatter = "CREATE TABLE `#{tableName}` (\n"
|
|
||||||
+ " `dayno` date NOT NULL COMMENT '日期',\n"
|
|
||||||
+ " `id` int(11) NOT NULL COMMENT 'id',\n"
|
|
||||||
+ " #{columnInfo}\n"
|
|
||||||
+ " ) ENGINE=OLAP\n"
|
|
||||||
+ "UNIQUE KEY(`dayno`, `id`)\n"
|
|
||||||
+ "COMMENT 'OLAP'\n"
|
|
||||||
+ "PARTITION BY RANGE(`dayno`)\n"
|
|
||||||
+ "(PARTITION p20230820 VALUES [('2023-08-20'), ('2023-08-21')),\n"
|
|
||||||
+ "PARTITION p20230821 VALUES [('2023-08-21'), ('2023-08-22')),\n"
|
|
||||||
+ "PARTITION p20230827 VALUES [('2023-08-27'), ('2023-08-28')))\n"
|
|
||||||
+ "DISTRIBUTED BY HASH(`id`) BUCKETS 36\n"
|
|
||||||
+ "PROPERTIES (\n"
|
|
||||||
+ "\"replication_allocation\" = \"tag.location.default: 1\",\n"
|
|
||||||
+ "\"is_being_synced\" = \"false\",\n"
|
|
||||||
+ "\"colocate_with\" = \"#{colocateGroup}\",\n"
|
|
||||||
+ "\"storage_format\" = \"V2\",\n"
|
|
||||||
+ "\"enable_unique_key_merge_on_write\" = \"true\",\n"
|
|
||||||
+ "\"light_schema_change\" = \"true\",\n"
|
|
||||||
+ "\"disable_auto_compaction\" = \"false\",\n"
|
|
||||||
+ "\"enable_single_replica_compaction\" = \"false\"\n"
|
|
||||||
+ ")";
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String generateCreateSql(MaterializationResp materializationResp) {
|
|
||||||
List<MaterializationElementResp> materializationElementRespList = materializationResp
|
|
||||||
.getMaterializationElementRespList();
|
|
||||||
if (CollectionUtils.isEmpty(materializationElementRespList)) {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
StringJoiner joiner = new StringJoiner(",");
|
|
||||||
materializationElementRespList.stream()
|
|
||||||
.filter(element -> !ElementFrequencyEnum.LOW.equals(element.getFrequency()))
|
|
||||||
.forEach(element -> {
|
|
||||||
String type = "double";
|
|
||||||
if (TypeEnums.DIMENSION.equals(element.getType())) {
|
|
||||||
type = "varchar(10000)";
|
|
||||||
}
|
|
||||||
String description = element.getDescription().replace("'", "").replace("\"", "");
|
|
||||||
joiner.add(
|
|
||||||
String.format(" %s %s COMMENT '%s'", element.getBizName(), type, description));
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
if (Strings.isEmpty(joiner.toString())) {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
String colocateGroup = generateColocateGroup(materializationResp);
|
|
||||||
|
|
||||||
return createPatter.replace("#{tableName}", materializationResp.getDestinationTable())
|
|
||||||
.replace("#{columnInfo}", joiner.toString())
|
|
||||||
.replace("#{colocateGroup}", colocateGroup);
|
|
||||||
}
|
|
||||||
|
|
||||||
private String generateColocateGroup(MaterializationResp materializationResp) {
|
|
||||||
String name = materializationResp.getName();
|
|
||||||
if (Strings.isNotEmpty(name) && name.contains(split)) {
|
|
||||||
return name.split(split)[0];
|
|
||||||
}
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,57 +0,0 @@
|
|||||||
package com.tencent.supersonic.headless.materialization.domain.utils;
|
|
||||||
|
|
||||||
import com.tencent.supersonic.common.pojo.enums.TaskStatusEnum;
|
|
||||||
import com.tencent.supersonic.common.pojo.enums.TypeEnums;
|
|
||||||
import com.tencent.supersonic.common.util.BeanMapper;
|
|
||||||
import com.tencent.supersonic.headless.common.materialization.request.MaterializationRecordReq;
|
|
||||||
import com.tencent.supersonic.headless.common.materialization.response.MaterializationRecordResp;
|
|
||||||
import com.tencent.supersonic.headless.materialization.domain.pojo.MaterializationRecord;
|
|
||||||
import com.tencent.supersonic.headless.materialization.domain.dataobject.MaterializationRecordDO;
|
|
||||||
import org.apache.logging.log4j.util.Strings;
|
|
||||||
import org.springframework.beans.BeanUtils;
|
|
||||||
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
public class MaterializationRecordConverter {
|
|
||||||
public static MaterializationRecord req2Bean(MaterializationRecordReq materializationRecordReq) {
|
|
||||||
MaterializationRecord materializationRecord = new MaterializationRecord();
|
|
||||||
BeanUtils.copyProperties(materializationRecordReq, materializationRecord);
|
|
||||||
return materializationRecord;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static MaterializationRecordDO materializationRecord2DO(MaterializationRecord materializationRecord) {
|
|
||||||
MaterializationRecordDO materializationRecordDO = new MaterializationRecordDO();
|
|
||||||
BeanUtils.copyProperties(materializationRecord, materializationRecordDO);
|
|
||||||
if (Objects.nonNull(materializationRecord.getElementType())) {
|
|
||||||
materializationRecordDO.setElementType(materializationRecord.getElementType().name());
|
|
||||||
}
|
|
||||||
if (Objects.nonNull(materializationRecord.getTaskStatus())) {
|
|
||||||
materializationRecordDO.setState(materializationRecord.getTaskStatus().name());
|
|
||||||
}
|
|
||||||
return materializationRecordDO;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static MaterializationRecordDO convert(MaterializationRecordDO materializationRecordDO,
|
|
||||||
MaterializationRecord materializationRecord) {
|
|
||||||
BeanMapper.mapper(materializationRecord, materializationRecordDO);
|
|
||||||
if (Objects.nonNull(materializationRecord.getElementType())) {
|
|
||||||
materializationRecordDO.setElementType(materializationRecord.getElementType().name());
|
|
||||||
}
|
|
||||||
if (Objects.nonNull(materializationRecord.getTaskStatus())) {
|
|
||||||
materializationRecordDO.setState(materializationRecord.getTaskStatus().name());
|
|
||||||
}
|
|
||||||
return materializationRecordDO;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static MaterializationRecordResp materializationRecordDO2Resp(MaterializationRecordDO recordDO) {
|
|
||||||
MaterializationRecordResp materializationRecordResp = new MaterializationRecordResp();
|
|
||||||
BeanUtils.copyProperties(recordDO, materializationRecordResp);
|
|
||||||
if (Strings.isNotEmpty(recordDO.getElementType())) {
|
|
||||||
materializationRecordResp.setElementType(TypeEnums.of(recordDO.getElementType()));
|
|
||||||
}
|
|
||||||
if (Strings.isNotEmpty(recordDO.getState())) {
|
|
||||||
materializationRecordResp.setTaskStatus(TaskStatusEnum.of(recordDO.getState()));
|
|
||||||
}
|
|
||||||
return materializationRecordResp;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
package com.tencent.supersonic.headless.materialization.domain.utils;
|
|
||||||
|
|
||||||
import com.tencent.supersonic.headless.common.materialization.response.MaterializationResp;
|
|
||||||
|
|
||||||
public interface MaterializationUtils {
|
|
||||||
|
|
||||||
String generateCreateSql(MaterializationResp materializationResp);
|
|
||||||
}
|
|
||||||
@@ -1,110 +0,0 @@
|
|||||||
package com.tencent.supersonic.headless.materialization.domain.utils;
|
|
||||||
|
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import com.tencent.supersonic.common.pojo.enums.DataTypeEnums;
|
|
||||||
import com.tencent.supersonic.common.pojo.enums.TypeEnums;
|
|
||||||
import com.tencent.supersonic.headless.common.materialization.enums.ElementFrequencyEnum;
|
|
||||||
import com.tencent.supersonic.headless.common.materialization.enums.ElementTypeEnum;
|
|
||||||
import com.tencent.supersonic.headless.common.materialization.response.MaterializationElementResp;
|
|
||||||
import com.tencent.supersonic.headless.common.materialization.response.MaterializationResp;
|
|
||||||
import com.tencent.supersonic.headless.common.model.response.DimensionResp;
|
|
||||||
import com.tencent.supersonic.headless.model.domain.DimensionService;
|
|
||||||
import com.tencent.supersonic.headless.model.domain.pojo.DimensionFilter;
|
|
||||||
import org.apache.logging.log4j.util.Strings;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
import org.springframework.util.CollectionUtils;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.StringJoiner;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
@Component
|
|
||||||
public class MaterializationZipperUtils implements MaterializationUtils {
|
|
||||||
|
|
||||||
private String split = "_";
|
|
||||||
private String createPatter = "CREATE TABLE IF NOT EXISTS `#{tableName}` (\n"
|
|
||||||
+ " `end_sys_imp_date` date NOT NULL COMMENT '日期',\n"
|
|
||||||
+ " `id` int(11) NOT NULL COMMENT 'id',\n"
|
|
||||||
+ " `start_sys_imp_date` date NULL,\n"
|
|
||||||
+ " #{columnInfo}\n"
|
|
||||||
+ " ) ENGINE=OLAP\n"
|
|
||||||
+ "UNIQUE KEY(`end_sys_imp_date`, `id`)\n"
|
|
||||||
+ "COMMENT 'OLAP'\n"
|
|
||||||
+ "PARTITION BY RANGE(`end_sys_imp_date`)\n"
|
|
||||||
+ "(PARTITION p99991230 VALUES [('9999-12-30'), ('9999-12-31')))\n"
|
|
||||||
+ "DISTRIBUTED BY HASH(`id`) BUCKETS 9\n"
|
|
||||||
+ "PROPERTIES (\n"
|
|
||||||
+ "\"replication_allocation\" = \"tag.location.default: 1\",\n"
|
|
||||||
+ "\"is_being_synced\" = \"false\",\n"
|
|
||||||
+ "\"colocate_with\" = \"#{colocateGroup}\",\n"
|
|
||||||
+ "\"storage_format\" = \"V2\",\n"
|
|
||||||
+ "\"enable_unique_key_merge_on_write\" = \"true\",\n"
|
|
||||||
+ "\"light_schema_change\" = \"true\",\n"
|
|
||||||
+ "\"disable_auto_compaction\" = \"false\",\n"
|
|
||||||
+ "\"enable_single_replica_compaction\" = \"false\"\n"
|
|
||||||
+ ");";
|
|
||||||
|
|
||||||
|
|
||||||
private final DimensionService dimensionService;
|
|
||||||
|
|
||||||
public MaterializationZipperUtils(DimensionService dimensionService) {
|
|
||||||
this.dimensionService = dimensionService;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String generateCreateSql(MaterializationResp materializationResp) {
|
|
||||||
List<MaterializationElementResp> materializationElementRespList = materializationResp
|
|
||||||
.getMaterializationElementRespList();
|
|
||||||
if (CollectionUtils.isEmpty(materializationElementRespList)) {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
StringJoiner joiner = new StringJoiner(",");
|
|
||||||
DimensionFilter dimensionFilter = new DimensionFilter();
|
|
||||||
dimensionFilter.setModelIds(Lists.newArrayList(materializationResp.getModelId()));
|
|
||||||
Map<Long, DimensionResp> dimIdAndDim = dimensionService.getDimensions(dimensionFilter)
|
|
||||||
.stream().collect(Collectors.toMap(DimensionResp::getId, value -> value, (v1, v2) -> v2));
|
|
||||||
materializationElementRespList.stream()
|
|
||||||
.filter(element -> TypeEnums.DIMENSION.equals(element.getType()) && ElementFrequencyEnum.LOW.equals(
|
|
||||||
element.getFrequency()))
|
|
||||||
.forEach(element -> {
|
|
||||||
String type = "varchar(10000)";
|
|
||||||
if (Objects.nonNull(element.getElementType()) && ElementTypeEnum.DATE.equals(
|
|
||||||
element.getElementType())) {
|
|
||||||
type = "date";
|
|
||||||
}
|
|
||||||
if (dimIdAndDim.containsKey(element.getId())) {
|
|
||||||
if (DataTypeEnums.ARRAY.equals(dimIdAndDim.get(element.getId()).getDataType())) {
|
|
||||||
type = "array<varchar(10000)>";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
String description = element.getDescription().replace("'", "")
|
|
||||||
.replace("\"", "");
|
|
||||||
joiner.add(
|
|
||||||
String.format(" `%s` %s COMMENT '%s'",
|
|
||||||
element.getBizName(), type, description));
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
if (Strings.isEmpty(joiner.toString())) {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
String colocateGroup = generateColocateGroup(materializationResp);
|
|
||||||
|
|
||||||
return createPatter.replace("#{tableName}", materializationResp.getDestinationTable())
|
|
||||||
.replace("#{columnInfo}", joiner.toString())
|
|
||||||
.replace("#{colocateGroup}", colocateGroup);
|
|
||||||
}
|
|
||||||
|
|
||||||
private String generateColocateGroup(MaterializationResp materializationResp) {
|
|
||||||
String name = materializationResp.getName();
|
|
||||||
if (Strings.isNotEmpty(name) && name.contains(split)) {
|
|
||||||
return name.split(split)[0];
|
|
||||||
}
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
package com.tencent.supersonic.headless.materialization.infrastructure.mapper;
|
|
||||||
|
|
||||||
import com.tencent.supersonic.headless.common.materialization.pojo.MaterializationFilter;
|
|
||||||
import com.tencent.supersonic.headless.materialization.domain.dataobject.MaterializationDOWithBLOBs;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Mapper
|
|
||||||
public interface MaterializationDOCustomMapper {
|
|
||||||
|
|
||||||
List<MaterializationDOWithBLOBs> getMaterializationResp(MaterializationFilter filter);
|
|
||||||
}
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
package com.tencent.supersonic.headless.materialization.infrastructure.mapper;
|
|
||||||
|
|
||||||
import com.tencent.supersonic.headless.materialization.domain.dataobject.MaterializationDO;
|
|
||||||
import com.tencent.supersonic.headless.materialization.domain.dataobject.MaterializationDOExample;
|
|
||||||
import com.tencent.supersonic.headless.materialization.domain.dataobject.MaterializationDOWithBLOBs;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Mapper
|
|
||||||
public interface MaterializationDOMapper {
|
|
||||||
long countByExample(MaterializationDOExample example);
|
|
||||||
|
|
||||||
int deleteByPrimaryKey(Long id);
|
|
||||||
|
|
||||||
int insert(MaterializationDOWithBLOBs record);
|
|
||||||
|
|
||||||
int insertSelective(MaterializationDOWithBLOBs record);
|
|
||||||
|
|
||||||
List<MaterializationDOWithBLOBs> selectByExampleWithBLOBs(MaterializationDOExample example);
|
|
||||||
|
|
||||||
List<MaterializationDO> selectByExample(MaterializationDOExample example);
|
|
||||||
|
|
||||||
MaterializationDOWithBLOBs selectByPrimaryKey(Long id);
|
|
||||||
|
|
||||||
int updateByPrimaryKeySelective(MaterializationDOWithBLOBs record);
|
|
||||||
|
|
||||||
int updateByPrimaryKeyWithBLOBs(MaterializationDOWithBLOBs record);
|
|
||||||
|
|
||||||
int updateByPrimaryKey(MaterializationDO record);
|
|
||||||
}
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
package com.tencent.supersonic.headless.materialization.infrastructure.mapper;
|
|
||||||
|
|
||||||
import com.tencent.supersonic.headless.materialization.domain.dataobject.MaterializationElementDO;
|
|
||||||
import com.tencent.supersonic.headless.materialization.domain.dataobject.MaterializationElementDOExample;
|
|
||||||
import com.tencent.supersonic.headless.materialization.domain.dataobject.MaterializationElementDOKey;
|
|
||||||
import com.tencent.supersonic.headless.materialization.domain.dataobject.MaterializationElementDOWithBLOBs;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
|
|
||||||
@Mapper
|
|
||||||
public interface MaterializationElementDOMapper {
|
|
||||||
long countByExample(MaterializationElementDOExample example);
|
|
||||||
|
|
||||||
int deleteByPrimaryKey(MaterializationElementDOKey key);
|
|
||||||
|
|
||||||
int insert(MaterializationElementDOWithBLOBs record);
|
|
||||||
|
|
||||||
int insertSelective(MaterializationElementDOWithBLOBs record);
|
|
||||||
|
|
||||||
List<MaterializationElementDOWithBLOBs> selectByExampleWithBLOBs(MaterializationElementDOExample example);
|
|
||||||
|
|
||||||
List<MaterializationElementDO> selectByExample(MaterializationElementDOExample example);
|
|
||||||
|
|
||||||
MaterializationElementDOWithBLOBs selectByPrimaryKey(MaterializationElementDOKey key);
|
|
||||||
|
|
||||||
int updateByPrimaryKeySelective(MaterializationElementDOWithBLOBs record);
|
|
||||||
|
|
||||||
int updateByPrimaryKeyWithBLOBs(MaterializationElementDOWithBLOBs record);
|
|
||||||
|
|
||||||
int updateByPrimaryKey(MaterializationElementDO record);
|
|
||||||
|
|
||||||
Boolean cleanMaterializationElement(Long materializationId);
|
|
||||||
}
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
package com.tencent.supersonic.headless.materialization.infrastructure.mapper;
|
|
||||||
|
|
||||||
import com.tencent.supersonic.headless.materialization.domain.dataobject.MaterializationRecordDO;
|
|
||||||
import com.tencent.supersonic.headless.materialization.domain.dataobject.MaterializationRecordDOExample;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
|
|
||||||
@Mapper
|
|
||||||
public interface MaterializationRecordDOMapper {
|
|
||||||
long countByExample(MaterializationRecordDOExample example);
|
|
||||||
|
|
||||||
int deleteByPrimaryKey(Long id);
|
|
||||||
|
|
||||||
int insert(MaterializationRecordDO record);
|
|
||||||
|
|
||||||
int insertSelective(MaterializationRecordDO record);
|
|
||||||
|
|
||||||
List<MaterializationRecordDO> selectByExampleWithBLOBs(MaterializationRecordDOExample example);
|
|
||||||
|
|
||||||
List<MaterializationRecordDO> selectByExample(MaterializationRecordDOExample example);
|
|
||||||
|
|
||||||
MaterializationRecordDO selectByPrimaryKey(Long id);
|
|
||||||
|
|
||||||
int updateByPrimaryKeySelective(MaterializationRecordDO record);
|
|
||||||
|
|
||||||
int updateByPrimaryKeyWithBLOBs(MaterializationRecordDO record);
|
|
||||||
|
|
||||||
int updateByBizName(MaterializationRecordDO record);
|
|
||||||
|
|
||||||
int updateByPrimaryKey(MaterializationRecordDO record);
|
|
||||||
}
|
|
||||||
@@ -1,82 +0,0 @@
|
|||||||
package com.tencent.supersonic.headless.materialization.infrastructure.repository;
|
|
||||||
|
|
||||||
import com.tencent.supersonic.headless.common.materialization.pojo.MaterializationConfFilter;
|
|
||||||
import com.tencent.supersonic.headless.common.materialization.response.MaterializationElementResp;
|
|
||||||
import com.tencent.supersonic.headless.materialization.infrastructure.mapper.MaterializationElementDOMapper;
|
|
||||||
import com.tencent.supersonic.headless.materialization.domain.dataobject.MaterializationElementDOExample;
|
|
||||||
import com.tencent.supersonic.headless.materialization.domain.dataobject.MaterializationElementDOKey;
|
|
||||||
import com.tencent.supersonic.headless.materialization.domain.dataobject.MaterializationElementDOWithBLOBs;
|
|
||||||
import com.tencent.supersonic.headless.materialization.domain.pojo.MaterializationElement;
|
|
||||||
import com.tencent.supersonic.headless.materialization.domain.repository.MaterializationElementRepository;
|
|
||||||
import com.tencent.supersonic.headless.materialization.domain.utils.MaterializationConverter;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
import org.springframework.util.CollectionUtils;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
@Component
|
|
||||||
public class MaterializationElementRepositoryImpl implements MaterializationElementRepository {
|
|
||||||
|
|
||||||
private final MaterializationElementDOMapper materializationElementDOMapper;
|
|
||||||
|
|
||||||
public MaterializationElementRepositoryImpl(MaterializationElementDOMapper materializationElementDOMapper) {
|
|
||||||
this.materializationElementDOMapper = materializationElementDOMapper;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Boolean insert(MaterializationElement materializationElement) {
|
|
||||||
MaterializationElementDOWithBLOBs materializationElementDOWithBLOBs = MaterializationConverter
|
|
||||||
.materialization2DO(materializationElement);
|
|
||||||
materializationElementDOMapper.insert(materializationElementDOWithBLOBs);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Boolean update(MaterializationElement materializationElement) {
|
|
||||||
MaterializationElementDOKey key = new MaterializationElementDOKey();
|
|
||||||
key.setId(materializationElement.getId());
|
|
||||||
if (Objects.nonNull(materializationElement.getType())) {
|
|
||||||
key.setType(materializationElement.getType().getName());
|
|
||||||
}
|
|
||||||
if (Objects.nonNull(materializationElement.getMaterializationId())) {
|
|
||||||
key.setMaterializationId(materializationElement.getMaterializationId());
|
|
||||||
}
|
|
||||||
MaterializationElementDOWithBLOBs materializationElementDO = materializationElementDOMapper
|
|
||||||
.selectByPrimaryKey(key);
|
|
||||||
MaterializationConverter.convert(materializationElementDO, materializationElement);
|
|
||||||
materializationElementDOMapper.updateByPrimaryKeyWithBLOBs(MaterializationConverter
|
|
||||||
.convert(materializationElementDO, materializationElement));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<MaterializationElementResp> getMaterializationElementResp(MaterializationConfFilter filter) {
|
|
||||||
List<MaterializationElementResp> materializationElementRespList = new ArrayList<>();
|
|
||||||
MaterializationElementDOExample example = new MaterializationElementDOExample();
|
|
||||||
MaterializationElementDOExample.Criteria criteria = example.createCriteria();
|
|
||||||
if (Objects.nonNull(filter.getType())) {
|
|
||||||
criteria.andTypeEqualTo(filter.getType().getName());
|
|
||||||
}
|
|
||||||
if (Objects.nonNull(filter.getMaterializationId())) {
|
|
||||||
criteria.andMaterializationIdEqualTo(filter.getMaterializationId());
|
|
||||||
}
|
|
||||||
if (Objects.nonNull(filter.getElementId())) {
|
|
||||||
criteria.andIdEqualTo(filter.getElementId());
|
|
||||||
}
|
|
||||||
List<MaterializationElementDOWithBLOBs> materializationElementDOs = materializationElementDOMapper
|
|
||||||
.selectByExampleWithBLOBs(example);
|
|
||||||
if (!CollectionUtils.isEmpty(materializationElementDOs)) {
|
|
||||||
materializationElementDOs.stream().forEach(materializationElementDO -> {
|
|
||||||
materializationElementRespList.add(MaterializationConverter.elementDO2Resp(materializationElementDO));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return materializationElementRespList;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Boolean cleanMaterializationElement(Long materializationId) {
|
|
||||||
return materializationElementDOMapper.cleanMaterializationElement(materializationId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,113 +0,0 @@
|
|||||||
package com.tencent.supersonic.headless.materialization.infrastructure.repository;
|
|
||||||
|
|
||||||
|
|
||||||
import com.tencent.supersonic.headless.common.materialization.pojo.MaterializationRecordFilter;
|
|
||||||
import com.tencent.supersonic.headless.common.materialization.response.MaterializationRecordResp;
|
|
||||||
import com.tencent.supersonic.headless.materialization.domain.dataobject.MaterializationRecordDO;
|
|
||||||
import com.tencent.supersonic.headless.materialization.domain.pojo.MaterializationRecord;
|
|
||||||
import com.tencent.supersonic.headless.materialization.domain.repository.MaterializationRecordRepository;
|
|
||||||
import com.tencent.supersonic.headless.materialization.domain.utils.MaterializationRecordConverter;
|
|
||||||
import com.tencent.supersonic.headless.materialization.infrastructure.mapper.MaterializationRecordDOMapper;
|
|
||||||
import com.tencent.supersonic.headless.materialization.domain.dataobject.MaterializationRecordDOExample;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
import org.springframework.util.CollectionUtils;
|
|
||||||
|
|
||||||
@Component
|
|
||||||
public class MaterializationRecordRepositoryImpl implements MaterializationRecordRepository {
|
|
||||||
|
|
||||||
private final MaterializationRecordDOMapper mapper;
|
|
||||||
|
|
||||||
public MaterializationRecordRepositoryImpl(MaterializationRecordDOMapper mapper) {
|
|
||||||
this.mapper = mapper;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Boolean insertMaterializationRecord(MaterializationRecord materializationRecord) {
|
|
||||||
MaterializationRecordDO materializationRecordDO = MaterializationRecordConverter
|
|
||||||
.materializationRecord2DO(materializationRecord);
|
|
||||||
mapper.insert(materializationRecordDO);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Boolean updateMaterializationRecord(MaterializationRecord materializationRecord) {
|
|
||||||
MaterializationRecordDO materializationRecordDO = mapper.selectByPrimaryKey(materializationRecord.getId());
|
|
||||||
if (Objects.nonNull(materializationRecordDO)) {
|
|
||||||
MaterializationRecordConverter.convert(materializationRecordDO, materializationRecord);
|
|
||||||
} else {
|
|
||||||
materializationRecordDO = MaterializationRecordConverter.materializationRecord2DO(materializationRecord);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Objects.isNull(materializationRecord.getId())) {
|
|
||||||
mapper.updateByBizName(materializationRecordDO);
|
|
||||||
} else {
|
|
||||||
mapper.updateByPrimaryKey(materializationRecordDO);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<MaterializationRecordResp> getMaterializationRecordList(MaterializationRecordFilter filter) {
|
|
||||||
List<MaterializationRecordResp> materializationRecordRespList = new ArrayList<>();
|
|
||||||
MaterializationRecordDOExample example = getExample(filter);
|
|
||||||
|
|
||||||
List<MaterializationRecordDO> materializationRecordDOS = mapper.selectByExampleWithBLOBs(example);
|
|
||||||
if (!CollectionUtils.isEmpty(materializationRecordDOS)) {
|
|
||||||
materializationRecordDOS.stream().forEach(recordDO -> materializationRecordRespList.add(
|
|
||||||
MaterializationRecordConverter.materializationRecordDO2Resp(recordDO)));
|
|
||||||
}
|
|
||||||
return materializationRecordRespList;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getCount(MaterializationRecordFilter filter) {
|
|
||||||
MaterializationRecordDOExample example = getExample(filter);
|
|
||||||
return mapper.countByExample(example);
|
|
||||||
}
|
|
||||||
|
|
||||||
private MaterializationRecordDOExample getExample(MaterializationRecordFilter filter) {
|
|
||||||
MaterializationRecordDOExample example = new MaterializationRecordDOExample();
|
|
||||||
MaterializationRecordDOExample.Criteria criteria = example.createCriteria();
|
|
||||||
if (Objects.nonNull(filter.getId())) {
|
|
||||||
criteria.andIdEqualTo(filter.getId());
|
|
||||||
}
|
|
||||||
if (Objects.nonNull(filter.getMaterializationId())) {
|
|
||||||
criteria.andMaterializationIdEqualTo(filter.getMaterializationId());
|
|
||||||
}
|
|
||||||
if (!CollectionUtils.isEmpty(filter.getMaterializationIds())) {
|
|
||||||
criteria.andMaterializationIdIn(filter.getMaterializationIds());
|
|
||||||
}
|
|
||||||
if (Objects.nonNull(filter.getElementType())) {
|
|
||||||
criteria.andElementTypeEqualTo(filter.getElementType().getName());
|
|
||||||
}
|
|
||||||
if (Objects.nonNull(filter.getElementId())) {
|
|
||||||
criteria.andElementIdEqualTo(filter.getElementId());
|
|
||||||
}
|
|
||||||
if (Objects.nonNull(filter.getElementName())) {
|
|
||||||
criteria.andElementNameEqualTo(filter.getElementName());
|
|
||||||
}
|
|
||||||
if (Objects.nonNull(filter.getTaskStatus())) {
|
|
||||||
criteria.andStateIn(filter.getTaskStatus().stream().map(s -> s.getStatus()).collect(Collectors.toList()));
|
|
||||||
}
|
|
||||||
if (Objects.nonNull(filter.getTaskId())) {
|
|
||||||
criteria.andTaskIdEqualTo(filter.getTaskId());
|
|
||||||
}
|
|
||||||
if (Objects.nonNull(filter.getCreatedBy())) {
|
|
||||||
criteria.andCreatedByEqualTo(filter.getCreatedBy());
|
|
||||||
}
|
|
||||||
if (Objects.nonNull(filter.getCreatedAt())) {
|
|
||||||
criteria.andCreatedAtGreaterThanOrEqualTo(filter.getCreatedAt());
|
|
||||||
}
|
|
||||||
if (Objects.nonNull(filter.getStartDataTime())) {
|
|
||||||
criteria.andDataTimeGreaterThanOrEqualTo(filter.getStartDataTime());
|
|
||||||
}
|
|
||||||
if (Objects.nonNull(filter.getEndDataTime())) {
|
|
||||||
criteria.andDataTimeLessThanOrEqualTo(filter.getEndDataTime());
|
|
||||||
}
|
|
||||||
return example;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,63 +0,0 @@
|
|||||||
package com.tencent.supersonic.headless.materialization.infrastructure.repository;
|
|
||||||
|
|
||||||
import com.tencent.supersonic.headless.common.materialization.pojo.MaterializationFilter;
|
|
||||||
import com.tencent.supersonic.headless.common.materialization.response.MaterializationResp;
|
|
||||||
import com.tencent.supersonic.headless.materialization.domain.pojo.Materialization;
|
|
||||||
import com.tencent.supersonic.headless.materialization.domain.repository.MaterializationRepository;
|
|
||||||
import com.tencent.supersonic.headless.materialization.domain.utils.MaterializationConverter;
|
|
||||||
import com.tencent.supersonic.headless.materialization.infrastructure.mapper.MaterializationDOCustomMapper;
|
|
||||||
import com.tencent.supersonic.headless.materialization.infrastructure.mapper.MaterializationDOMapper;
|
|
||||||
import com.tencent.supersonic.headless.materialization.domain.dataobject.MaterializationDOWithBLOBs;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
import org.springframework.util.CollectionUtils;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Component
|
|
||||||
public class MaterializationRepositoryImpl implements MaterializationRepository {
|
|
||||||
|
|
||||||
private final MaterializationDOMapper materializationDOMapper;
|
|
||||||
private final MaterializationDOCustomMapper materializationDOCustomMapper;
|
|
||||||
|
|
||||||
public MaterializationRepositoryImpl(MaterializationDOMapper materializationDOMapper,
|
|
||||||
MaterializationDOCustomMapper materializationDOCustomMapper) {
|
|
||||||
this.materializationDOMapper = materializationDOMapper;
|
|
||||||
this.materializationDOCustomMapper = materializationDOCustomMapper;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Boolean insert(Materialization materialization) {
|
|
||||||
MaterializationDOWithBLOBs materializationDOWithBLOBs = MaterializationConverter
|
|
||||||
.materialization2DO(materialization);
|
|
||||||
materializationDOMapper.insert(materializationDOWithBLOBs);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Boolean update(Materialization materialization) {
|
|
||||||
MaterializationDOWithBLOBs materializationDOWithBLOBs = materializationDOMapper
|
|
||||||
.selectByPrimaryKey(materialization.getId());
|
|
||||||
materializationDOMapper.updateByPrimaryKeyWithBLOBs(MaterializationConverter
|
|
||||||
.convert(materializationDOWithBLOBs, materialization));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<MaterializationResp> getMaterializationResp(MaterializationFilter filter) {
|
|
||||||
List<MaterializationResp> materializationRespList = new ArrayList<>();
|
|
||||||
List<MaterializationDOWithBLOBs> materializationDOWithBLOBsList = materializationDOCustomMapper
|
|
||||||
.getMaterializationResp(filter);
|
|
||||||
if (!CollectionUtils.isEmpty(materializationDOWithBLOBsList)) {
|
|
||||||
materializationDOWithBLOBsList.stream().forEach(materializationDO -> {
|
|
||||||
materializationRespList.add(MaterializationConverter.convert2Resp(materializationDO));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return materializationRespList;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public MaterializationResp getMaterialization(Long id) {
|
|
||||||
return MaterializationConverter.convert2Resp(materializationDOMapper.selectByPrimaryKey(id));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,109 +0,0 @@
|
|||||||
package com.tencent.supersonic.headless.materialization.rest;
|
|
||||||
|
|
||||||
import com.tencent.supersonic.auth.api.authentication.pojo.User;
|
|
||||||
import com.tencent.supersonic.auth.api.authentication.utils.UserHolder;
|
|
||||||
import com.tencent.supersonic.headless.common.materialization.pojo.MaterializationConfFilter;
|
|
||||||
import com.tencent.supersonic.headless.common.materialization.pojo.MaterializationFilter;
|
|
||||||
import com.tencent.supersonic.headless.common.materialization.request.MaterializationElementReq;
|
|
||||||
import com.tencent.supersonic.headless.common.materialization.request.MaterializationReq;
|
|
||||||
import com.tencent.supersonic.headless.common.materialization.response.MaterializationResp;
|
|
||||||
import com.tencent.supersonic.headless.common.materialization.response.MaterializationSourceResp;
|
|
||||||
import com.tencent.supersonic.headless.materialization.domain.MaterializationConfService;
|
|
||||||
import java.util.List;
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PutMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/api/semantic/materialization/conf")
|
|
||||||
public class MaterializationConfController {
|
|
||||||
|
|
||||||
private final MaterializationConfService confService;
|
|
||||||
|
|
||||||
public MaterializationConfController(MaterializationConfService confService) {
|
|
||||||
this.confService = confService;
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping
|
|
||||||
public Boolean addMaterializationConf(@RequestBody MaterializationReq materializationReq,
|
|
||||||
HttpServletRequest request,
|
|
||||||
HttpServletResponse response) {
|
|
||||||
User user = UserHolder.findUser(request, response);
|
|
||||||
return confService.addMaterializationConf(materializationReq, user);
|
|
||||||
}
|
|
||||||
|
|
||||||
@PutMapping
|
|
||||||
public Boolean updateMaterializationConf(@RequestBody MaterializationReq materializationReq,
|
|
||||||
HttpServletRequest request,
|
|
||||||
HttpServletResponse response) {
|
|
||||||
User user = UserHolder.findUser(request, response);
|
|
||||||
return confService.updateMaterializationConf(materializationReq, user);
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping("/info")
|
|
||||||
List<MaterializationResp> getMaterializationResp(@RequestBody MaterializationFilter filter,
|
|
||||||
HttpServletRequest request,
|
|
||||||
HttpServletResponse response) {
|
|
||||||
|
|
||||||
User user = UserHolder.findUser(request, response);
|
|
||||||
return confService.getMaterializationResp(filter, user);
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping("/element")
|
|
||||||
public Boolean addMaterializationElementConf(@RequestBody MaterializationElementReq materializationElementReq,
|
|
||||||
HttpServletRequest request,
|
|
||||||
HttpServletResponse response) {
|
|
||||||
User user = UserHolder.findUser(request, response);
|
|
||||||
return confService.addMaterializationElementConf(materializationElementReq, user);
|
|
||||||
}
|
|
||||||
|
|
||||||
@PutMapping("/element")
|
|
||||||
public Boolean updateMaterializationElementConf(@RequestBody MaterializationElementReq materializationElementReq,
|
|
||||||
HttpServletRequest request,
|
|
||||||
HttpServletResponse response) {
|
|
||||||
User user = UserHolder.findUser(request, response);
|
|
||||||
return confService.updateMaterializationElementConf(materializationElementReq, user);
|
|
||||||
}
|
|
||||||
|
|
||||||
@PutMapping("/element/init")
|
|
||||||
public Boolean initMaterializationElementConf(@RequestBody MaterializationConfFilter filter,
|
|
||||||
HttpServletRequest request,
|
|
||||||
HttpServletResponse response) {
|
|
||||||
User user = UserHolder.findUser(request, response);
|
|
||||||
return confService.initMaterializationElementConf(filter, user);
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping("/element/info")
|
|
||||||
List<MaterializationResp> queryMaterializationConf(@RequestBody MaterializationConfFilter filter,
|
|
||||||
HttpServletRequest request,
|
|
||||||
HttpServletResponse response) {
|
|
||||||
|
|
||||||
User user = UserHolder.findUser(request, response);
|
|
||||||
return confService.queryMaterializationConf(filter, user);
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/table/sql")
|
|
||||||
String generateCreateSql(@RequestParam(value = "materializationId") Long materializationId,
|
|
||||||
HttpServletRequest request,
|
|
||||||
HttpServletResponse response) {
|
|
||||||
|
|
||||||
User user = UserHolder.findUser(request, response);
|
|
||||||
return confService.generateCreateSql(materializationId, user);
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping("/source")
|
|
||||||
List<MaterializationSourceResp> queryElementModel(@RequestBody MaterializationFilter filter,
|
|
||||||
HttpServletRequest request,
|
|
||||||
HttpServletResponse response) {
|
|
||||||
|
|
||||||
//User user = UserHolder.findUser(request, response);
|
|
||||||
return confService.getMaterializationSourceResp(filter.getMaterializationId());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,75 +0,0 @@
|
|||||||
package com.tencent.supersonic.headless.materialization.rest;
|
|
||||||
|
|
||||||
import com.tencent.supersonic.auth.api.authentication.pojo.User;
|
|
||||||
import com.tencent.supersonic.auth.api.authentication.utils.UserHolder;
|
|
||||||
import com.tencent.supersonic.headless.common.materialization.pojo.MaterializationDateFilter;
|
|
||||||
import com.tencent.supersonic.headless.common.materialization.pojo.MaterializationRecordFilter;
|
|
||||||
import com.tencent.supersonic.headless.common.materialization.request.MaterializationRecordReq;
|
|
||||||
import com.tencent.supersonic.headless.common.materialization.response.MaterializationDateResp;
|
|
||||||
import com.tencent.supersonic.headless.common.materialization.response.MaterializationRecordResp;
|
|
||||||
import com.tencent.supersonic.headless.materialization.domain.MaterializationRecordService;
|
|
||||||
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.PutMapping;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/api/semantic/materialization/record")
|
|
||||||
public class MaterializationRecordController {
|
|
||||||
|
|
||||||
private final MaterializationRecordService recordService;
|
|
||||||
|
|
||||||
public MaterializationRecordController(MaterializationRecordService recordService) {
|
|
||||||
this.recordService = recordService;
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping
|
|
||||||
public Boolean addMaterializationRecord(@RequestBody MaterializationRecordReq materializationRecord,
|
|
||||||
HttpServletRequest request,
|
|
||||||
HttpServletResponse response) {
|
|
||||||
User user = UserHolder.findUser(request, response);
|
|
||||||
return recordService.addMaterializationRecord(materializationRecord, user);
|
|
||||||
}
|
|
||||||
|
|
||||||
@PutMapping
|
|
||||||
public Boolean updateMaterializationRecord(@RequestBody MaterializationRecordReq materializationRecord,
|
|
||||||
HttpServletRequest request,
|
|
||||||
HttpServletResponse response) {
|
|
||||||
User user = UserHolder.findUser(request, response);
|
|
||||||
return recordService.updateMaterializationRecord(materializationRecord, user);
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping("/info")
|
|
||||||
List<MaterializationRecordResp> getMaterializationRecordList(@RequestBody MaterializationRecordFilter filter,
|
|
||||||
HttpServletRequest request,
|
|
||||||
HttpServletResponse response) {
|
|
||||||
|
|
||||||
User user = UserHolder.findUser(request, response);
|
|
||||||
return recordService.getMaterializationRecordList(filter, user);
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping("/count")
|
|
||||||
Long getMaterializationRecordCount(@RequestBody MaterializationRecordFilter filter,
|
|
||||||
HttpServletRequest request,
|
|
||||||
HttpServletResponse response) {
|
|
||||||
|
|
||||||
User user = UserHolder.findUser(request, response);
|
|
||||||
return recordService.getMaterializationRecordCount(filter, user);
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping("/info/date")
|
|
||||||
List<MaterializationDateResp> fetchMaterializationDate(@RequestBody MaterializationDateFilter filter,
|
|
||||||
HttpServletRequest request,
|
|
||||||
HttpServletResponse response) {
|
|
||||||
|
|
||||||
User user = UserHolder.findUser(request, response);
|
|
||||||
return recordService.fetchMaterializationDate(filter, user);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,95 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
||||||
<mapper namespace="com.tencent.supersonic.headless.materialization.infrastructure.mapper.MaterializationDOCustomMapper">
|
|
||||||
<resultMap id="BaseResultMap" type="com.tencent.supersonic.headless.materialization.domain.dataobject.MaterializationDO">
|
|
||||||
<id column="id" jdbcType="BIGINT" property="id" />
|
|
||||||
<result column="name" jdbcType="VARCHAR" property="name" />
|
|
||||||
<result column="materialized_type" jdbcType="VARCHAR" property="materializedType" />
|
|
||||||
<result column="update_cycle" jdbcType="VARCHAR" property="updateCycle" />
|
|
||||||
<result column="model_id" jdbcType="BIGINT" property="modelId" />
|
|
||||||
<result column="database_id" jdbcType="BIGINT" property="databaseId" />
|
|
||||||
<result column="level" jdbcType="INTEGER" property="level" />
|
|
||||||
<result column="status" jdbcType="INTEGER" property="status" />
|
|
||||||
<result column="destination_table" jdbcType="VARCHAR" property="destinationTable" />
|
|
||||||
<result column="principals" jdbcType="VARCHAR" property="principals" />
|
|
||||||
<result column="created_at" jdbcType="TIMESTAMP" property="createdAt" />
|
|
||||||
<result column="created_by" jdbcType="VARCHAR" property="createdBy" />
|
|
||||||
<result column="updated_at" jdbcType="TIMESTAMP" property="updatedAt" />
|
|
||||||
<result column="updated_by" jdbcType="VARCHAR" property="updatedBy" />
|
|
||||||
</resultMap>
|
|
||||||
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.tencent.supersonic.headless.materialization.domain.dataobject.MaterializationDOWithBLOBs">
|
|
||||||
<result column="date_info" jdbcType="LONGVARCHAR" property="dateInfo" />
|
|
||||||
<result column="entities" jdbcType="LONGVARCHAR" property="entities" />
|
|
||||||
<result column="description" jdbcType="LONGVARCHAR" property="description" />
|
|
||||||
</resultMap>
|
|
||||||
<sql id="Example_Where_Clause">
|
|
||||||
<where>
|
|
||||||
<foreach collection="oredCriteria" item="criteria" separator="or">
|
|
||||||
<if test="criteria.valid">
|
|
||||||
<trim prefix="(" prefixOverrides="and" suffix=")">
|
|
||||||
<foreach collection="criteria.criteria" item="criterion">
|
|
||||||
<choose>
|
|
||||||
<when test="criterion.noValue">
|
|
||||||
and ${criterion.condition}
|
|
||||||
</when>
|
|
||||||
<when test="criterion.singleValue">
|
|
||||||
and ${criterion.condition} #{criterion.value}
|
|
||||||
</when>
|
|
||||||
<when test="criterion.betweenValue">
|
|
||||||
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
|
|
||||||
</when>
|
|
||||||
<when test="criterion.listValue">
|
|
||||||
and ${criterion.condition}
|
|
||||||
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
|
|
||||||
#{listItem}
|
|
||||||
</foreach>
|
|
||||||
</when>
|
|
||||||
</choose>
|
|
||||||
</foreach>
|
|
||||||
</trim>
|
|
||||||
</if>
|
|
||||||
</foreach>
|
|
||||||
</where>
|
|
||||||
</sql>
|
|
||||||
<sql id="Base_Column_List">
|
|
||||||
id, name, materialized_type, update_cycle, model_id, database_id, level, status,
|
|
||||||
destination_table, principals, created_at, created_by, updated_at, updated_by
|
|
||||||
</sql>
|
|
||||||
<sql id="Blob_Column_List">
|
|
||||||
date_info, entities, description
|
|
||||||
</sql>
|
|
||||||
|
|
||||||
<select id="getMaterializationResp" parameterType="com.tencent.supersonic.headless.common.materialization.pojo.MaterializationFilter" resultMap="ResultMapWithBLOBs">
|
|
||||||
select *
|
|
||||||
from s2_materialization
|
|
||||||
<where>
|
|
||||||
<if test="materializationId != null">
|
|
||||||
and `id` = #{materializationId}
|
|
||||||
</if>
|
|
||||||
<if test="name != null and name != ''">
|
|
||||||
and `name` = #{name}
|
|
||||||
</if>
|
|
||||||
<if test="materializedType != null">
|
|
||||||
and `materialized_type` = #{materializedType.name()}
|
|
||||||
</if>
|
|
||||||
<if test="updateCycle != null">
|
|
||||||
and update_cycle = #{updateCycle.name()}
|
|
||||||
</if>
|
|
||||||
<if test="modelId != null and modelId !=''">
|
|
||||||
and model_id = #{modelId}
|
|
||||||
</if>
|
|
||||||
<if test="databaseId != null and databaseId !=''">
|
|
||||||
and database_id= #{databaseId}
|
|
||||||
</if>
|
|
||||||
<if test="level != null and level !=''">
|
|
||||||
and level= #{level}
|
|
||||||
</if>
|
|
||||||
<if test="createdBy != null and createdBy !=''">
|
|
||||||
and created_by = #{createdBy}
|
|
||||||
</if>
|
|
||||||
<if test="destinationTable != null and destinationTable !=''">
|
|
||||||
and destination_table = #{destinationTable}
|
|
||||||
</if>
|
|
||||||
</where>
|
|
||||||
</select>
|
|
||||||
</mapper>
|
|
||||||
@@ -1,324 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
||||||
<mapper namespace="com.tencent.supersonic.headless.materialization.infrastructure.mapper.MaterializationDOMapper">
|
|
||||||
<resultMap id="BaseResultMap" type="com.tencent.supersonic.headless.materialization.domain.dataobject.MaterializationDO">
|
|
||||||
<id column="id" jdbcType="BIGINT" property="id" />
|
|
||||||
<result column="name" jdbcType="VARCHAR" property="name" />
|
|
||||||
<result column="materialized_type" jdbcType="VARCHAR" property="materializedType" />
|
|
||||||
<result column="update_cycle" jdbcType="VARCHAR" property="updateCycle" />
|
|
||||||
<result column="model_id" jdbcType="BIGINT" property="modelId" />
|
|
||||||
<result column="database_id" jdbcType="BIGINT" property="databaseId" />
|
|
||||||
<result column="level" jdbcType="INTEGER" property="level" />
|
|
||||||
<result column="status" jdbcType="INTEGER" property="status" />
|
|
||||||
<result column="destination_table" jdbcType="VARCHAR" property="destinationTable" />
|
|
||||||
<result column="principals" jdbcType="VARCHAR" property="principals" />
|
|
||||||
<result column="created_at" jdbcType="TIMESTAMP" property="createdAt" />
|
|
||||||
<result column="created_by" jdbcType="VARCHAR" property="createdBy" />
|
|
||||||
<result column="updated_at" jdbcType="TIMESTAMP" property="updatedAt" />
|
|
||||||
<result column="updated_by" jdbcType="VARCHAR" property="updatedBy" />
|
|
||||||
</resultMap>
|
|
||||||
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.tencent.supersonic.headless.materialization.domain.dataobject.MaterializationDOWithBLOBs">
|
|
||||||
<result column="date_info" jdbcType="LONGVARCHAR" property="dateInfo" />
|
|
||||||
<result column="entities" jdbcType="LONGVARCHAR" property="entities" />
|
|
||||||
<result column="description" jdbcType="LONGVARCHAR" property="description" />
|
|
||||||
</resultMap>
|
|
||||||
<sql id="Example_Where_Clause">
|
|
||||||
<where>
|
|
||||||
<foreach collection="oredCriteria" item="criteria" separator="or">
|
|
||||||
<if test="criteria.valid">
|
|
||||||
<trim prefix="(" prefixOverrides="and" suffix=")">
|
|
||||||
<foreach collection="criteria.criteria" item="criterion">
|
|
||||||
<choose>
|
|
||||||
<when test="criterion.noValue">
|
|
||||||
and ${criterion.condition}
|
|
||||||
</when>
|
|
||||||
<when test="criterion.singleValue">
|
|
||||||
and ${criterion.condition} #{criterion.value}
|
|
||||||
</when>
|
|
||||||
<when test="criterion.betweenValue">
|
|
||||||
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
|
|
||||||
</when>
|
|
||||||
<when test="criterion.listValue">
|
|
||||||
and ${criterion.condition}
|
|
||||||
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
|
|
||||||
#{listItem}
|
|
||||||
</foreach>
|
|
||||||
</when>
|
|
||||||
</choose>
|
|
||||||
</foreach>
|
|
||||||
</trim>
|
|
||||||
</if>
|
|
||||||
</foreach>
|
|
||||||
</where>
|
|
||||||
</sql>
|
|
||||||
<sql id="Base_Column_List">
|
|
||||||
id, name, materialized_type, update_cycle, model_id, database_id, level, status,
|
|
||||||
destination_table, principals, created_at, created_by, updated_at, updated_by
|
|
||||||
</sql>
|
|
||||||
<sql id="Blob_Column_List">
|
|
||||||
date_info, entities, description
|
|
||||||
</sql>
|
|
||||||
<select id="selectByExampleWithBLOBs" parameterType="com.tencent.supersonic.headless.materialization.domain.dataobject.MaterializationDOExample" resultMap="ResultMapWithBLOBs">
|
|
||||||
select
|
|
||||||
<if test="distinct">
|
|
||||||
distinct
|
|
||||||
</if>
|
|
||||||
<include refid="Base_Column_List" />
|
|
||||||
,
|
|
||||||
<include refid="Blob_Column_List" />
|
|
||||||
from s2_materialization
|
|
||||||
<if test="_parameter != null">
|
|
||||||
<include refid="Example_Where_Clause" />
|
|
||||||
</if>
|
|
||||||
<if test="orderByClause != null">
|
|
||||||
order by ${orderByClause}
|
|
||||||
</if>
|
|
||||||
</select>
|
|
||||||
<select id="selectByExample" parameterType="com.tencent.supersonic.headless.materialization.domain.dataobject.MaterializationDOExample" resultMap="BaseResultMap">
|
|
||||||
select
|
|
||||||
<if test="distinct">
|
|
||||||
distinct
|
|
||||||
</if>
|
|
||||||
<include refid="Base_Column_List" />
|
|
||||||
from s2_materialization
|
|
||||||
<if test="_parameter != null">
|
|
||||||
<include refid="Example_Where_Clause" />
|
|
||||||
</if>
|
|
||||||
<if test="orderByClause != null">
|
|
||||||
order by ${orderByClause}
|
|
||||||
</if>
|
|
||||||
</select>
|
|
||||||
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="ResultMapWithBLOBs">
|
|
||||||
select
|
|
||||||
<include refid="Base_Column_List" />
|
|
||||||
,
|
|
||||||
<include refid="Blob_Column_List" />
|
|
||||||
from s2_materialization
|
|
||||||
where id = #{id,jdbcType=BIGINT}
|
|
||||||
</select>
|
|
||||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
|
|
||||||
delete from s2_materialization
|
|
||||||
where id = #{id,jdbcType=BIGINT}
|
|
||||||
</delete>
|
|
||||||
<insert id="insert" parameterType="com.tencent.supersonic.headless.materialization.domain.dataobject.MaterializationDOWithBLOBs">
|
|
||||||
insert into s2_materialization (id, name, materialized_type,
|
|
||||||
update_cycle, model_id, database_id,
|
|
||||||
level, status, destination_table,
|
|
||||||
principals, created_at, created_by,
|
|
||||||
updated_at, updated_by, date_info,
|
|
||||||
entities, description)
|
|
||||||
values (#{id,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{materializedType,jdbcType=VARCHAR},
|
|
||||||
#{updateCycle,jdbcType=VARCHAR}, #{modelId,jdbcType=BIGINT}, #{databaseId,jdbcType=BIGINT},
|
|
||||||
#{level,jdbcType=INTEGER}, #{status,jdbcType=INTEGER}, #{destinationTable,jdbcType=VARCHAR},
|
|
||||||
#{principals,jdbcType=VARCHAR}, #{createdAt,jdbcType=TIMESTAMP}, #{createdBy,jdbcType=VARCHAR},
|
|
||||||
#{updatedAt,jdbcType=TIMESTAMP}, #{updatedBy,jdbcType=VARCHAR}, #{dateInfo,jdbcType=LONGVARCHAR},
|
|
||||||
#{entities,jdbcType=LONGVARCHAR}, #{description,jdbcType=LONGVARCHAR})
|
|
||||||
</insert>
|
|
||||||
|
|
||||||
<insert id="insertSelective" parameterType="com.tencent.supersonic.headless.materialization.domain.dataobject.MaterializationDOWithBLOBs">
|
|
||||||
insert into s2_materialization
|
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
||||||
<if test="id != null">
|
|
||||||
id,
|
|
||||||
</if>
|
|
||||||
<if test="name != null">
|
|
||||||
name,
|
|
||||||
</if>
|
|
||||||
<if test="materializedType != null">
|
|
||||||
materialized_type,
|
|
||||||
</if>
|
|
||||||
<if test="updateCycle != null">
|
|
||||||
update_cycle,
|
|
||||||
</if>
|
|
||||||
<if test="modelId != null">
|
|
||||||
model_id,
|
|
||||||
</if>
|
|
||||||
<if test="databaseId != null">
|
|
||||||
database_id,
|
|
||||||
</if>
|
|
||||||
<if test="level != null">
|
|
||||||
level,
|
|
||||||
</if>
|
|
||||||
<if test="status != null">
|
|
||||||
status,
|
|
||||||
</if>
|
|
||||||
<if test="destinationTable != null">
|
|
||||||
destination_table,
|
|
||||||
</if>
|
|
||||||
<if test="principals != null">
|
|
||||||
principals,
|
|
||||||
</if>
|
|
||||||
<if test="createdAt != null">
|
|
||||||
created_at,
|
|
||||||
</if>
|
|
||||||
<if test="createdBy != null">
|
|
||||||
created_by,
|
|
||||||
</if>
|
|
||||||
<if test="updatedAt != null">
|
|
||||||
updated_at,
|
|
||||||
</if>
|
|
||||||
<if test="updatedBy != null">
|
|
||||||
updated_by,
|
|
||||||
</if>
|
|
||||||
<if test="dateInfo != null">
|
|
||||||
date_info,
|
|
||||||
</if>
|
|
||||||
<if test="entities != null">
|
|
||||||
entities,
|
|
||||||
</if>
|
|
||||||
<if test="description != null">
|
|
||||||
description,
|
|
||||||
</if>
|
|
||||||
</trim>
|
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
||||||
<if test="id != null">
|
|
||||||
#{id,jdbcType=BIGINT},
|
|
||||||
</if>
|
|
||||||
<if test="name != null">
|
|
||||||
#{name,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="materializedType != null">
|
|
||||||
#{materializedType,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="updateCycle != null">
|
|
||||||
#{updateCycle,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="modelId != null">
|
|
||||||
#{modelId,jdbcType=BIGINT},
|
|
||||||
</if>
|
|
||||||
<if test="databaseId != null">
|
|
||||||
#{databaseId,jdbcType=BIGINT},
|
|
||||||
</if>
|
|
||||||
<if test="level != null">
|
|
||||||
#{level,jdbcType=INTEGER},
|
|
||||||
</if>
|
|
||||||
<if test="status != null">
|
|
||||||
#{status,jdbcType=INTEGER},
|
|
||||||
</if>
|
|
||||||
<if test="destinationTable != null">
|
|
||||||
#{destinationTable,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="principals != null">
|
|
||||||
#{principals,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="createdAt != null">
|
|
||||||
#{createdAt,jdbcType=TIMESTAMP},
|
|
||||||
</if>
|
|
||||||
<if test="createdBy != null">
|
|
||||||
#{createdBy,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="updatedAt != null">
|
|
||||||
#{updatedAt,jdbcType=TIMESTAMP},
|
|
||||||
</if>
|
|
||||||
<if test="updatedBy != null">
|
|
||||||
#{updatedBy,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="dateInfo != null">
|
|
||||||
#{dateInfo,jdbcType=LONGVARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="entities != null">
|
|
||||||
#{entities,jdbcType=LONGVARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="description != null">
|
|
||||||
#{description,jdbcType=LONGVARCHAR},
|
|
||||||
</if>
|
|
||||||
</trim>
|
|
||||||
</insert>
|
|
||||||
<select id="countByExample" parameterType="com.tencent.supersonic.headless.materialization.domain.dataobject.MaterializationDOExample" resultType="java.lang.Long">
|
|
||||||
select count(*) from s2_materialization
|
|
||||||
<if test="_parameter != null">
|
|
||||||
<include refid="Example_Where_Clause" />
|
|
||||||
</if>
|
|
||||||
</select>
|
|
||||||
<update id="updateByPrimaryKeySelective" parameterType="com.tencent.supersonic.headless.materialization.domain.dataobject.MaterializationDOWithBLOBs">
|
|
||||||
update s2_materialization
|
|
||||||
<set>
|
|
||||||
<if test="name != null">
|
|
||||||
name = #{name,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="materializedType != null">
|
|
||||||
materialized_type = #{materializedType,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="updateCycle != null">
|
|
||||||
update_cycle = #{updateCycle,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="modelId != null">
|
|
||||||
model_id = #{modelId,jdbcType=BIGINT},
|
|
||||||
</if>
|
|
||||||
<if test="databaseId != null">
|
|
||||||
database_id = #{databaseId,jdbcType=BIGINT},
|
|
||||||
</if>
|
|
||||||
<if test="level != null">
|
|
||||||
level = #{level,jdbcType=INTEGER},
|
|
||||||
</if>
|
|
||||||
<if test="status != null">
|
|
||||||
status = #{status,jdbcType=INTEGER},
|
|
||||||
</if>
|
|
||||||
<if test="destinationTable != null">
|
|
||||||
destination_table = #{destinationTable,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="principals != null">
|
|
||||||
principals = #{principals,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="createdAt != null">
|
|
||||||
created_at = #{createdAt,jdbcType=TIMESTAMP},
|
|
||||||
</if>
|
|
||||||
<if test="createdBy != null">
|
|
||||||
created_by = #{createdBy,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="updatedAt != null">
|
|
||||||
updated_at = #{updatedAt,jdbcType=TIMESTAMP},
|
|
||||||
</if>
|
|
||||||
<if test="updatedBy != null">
|
|
||||||
updated_by = #{updatedBy,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="dateInfo != null">
|
|
||||||
date_info = #{dateInfo,jdbcType=LONGVARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="entities != null">
|
|
||||||
entities = #{entities,jdbcType=LONGVARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="description != null">
|
|
||||||
description = #{description,jdbcType=LONGVARCHAR},
|
|
||||||
</if>
|
|
||||||
</set>
|
|
||||||
where id = #{id,jdbcType=BIGINT}
|
|
||||||
</update>
|
|
||||||
<update id="updateByPrimaryKeyWithBLOBs" parameterType="com.tencent.supersonic.headless.materialization.domain.dataobject.MaterializationDOWithBLOBs">
|
|
||||||
update s2_materialization
|
|
||||||
set name = #{name,jdbcType=VARCHAR},
|
|
||||||
materialized_type = #{materializedType,jdbcType=VARCHAR},
|
|
||||||
update_cycle = #{updateCycle,jdbcType=VARCHAR},
|
|
||||||
model_id = #{modelId,jdbcType=BIGINT},
|
|
||||||
database_id = #{databaseId,jdbcType=BIGINT},
|
|
||||||
level = #{level,jdbcType=INTEGER},
|
|
||||||
status = #{status,jdbcType=INTEGER},
|
|
||||||
destination_table = #{destinationTable,jdbcType=VARCHAR},
|
|
||||||
principals = #{principals,jdbcType=VARCHAR},
|
|
||||||
created_at = #{createdAt,jdbcType=TIMESTAMP},
|
|
||||||
created_by = #{createdBy,jdbcType=VARCHAR},
|
|
||||||
updated_at = #{updatedAt,jdbcType=TIMESTAMP},
|
|
||||||
updated_by = #{updatedBy,jdbcType=VARCHAR},
|
|
||||||
date_info = #{dateInfo,jdbcType=LONGVARCHAR},
|
|
||||||
entities = #{entities,jdbcType=LONGVARCHAR},
|
|
||||||
description = #{description,jdbcType=LONGVARCHAR}
|
|
||||||
where id = #{id,jdbcType=BIGINT}
|
|
||||||
</update>
|
|
||||||
<update id="updateByPrimaryKey" parameterType="com.tencent.supersonic.headless.materialization.domain.dataobject.MaterializationDO">
|
|
||||||
update s2_materialization
|
|
||||||
set name = #{name,jdbcType=VARCHAR},
|
|
||||||
materialized_type = #{materializedType,jdbcType=VARCHAR},
|
|
||||||
update_cycle = #{updateCycle,jdbcType=VARCHAR},
|
|
||||||
model_id = #{modelId,jdbcType=BIGINT},
|
|
||||||
database_id = #{databaseId,jdbcType=BIGINT},
|
|
||||||
level = #{level,jdbcType=INTEGER},
|
|
||||||
status = #{status,jdbcType=INTEGER},
|
|
||||||
destination_table = #{destinationTable,jdbcType=VARCHAR},
|
|
||||||
principals = #{principals,jdbcType=VARCHAR},
|
|
||||||
created_at = #{createdAt,jdbcType=TIMESTAMP},
|
|
||||||
created_by = #{createdBy,jdbcType=VARCHAR},
|
|
||||||
updated_at = #{updatedAt,jdbcType=TIMESTAMP},
|
|
||||||
updated_by = #{updatedBy,jdbcType=VARCHAR}
|
|
||||||
where id = #{id,jdbcType=BIGINT}
|
|
||||||
</update>
|
|
||||||
</mapper>
|
|
||||||
@@ -1,291 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
||||||
<mapper namespace="com.tencent.supersonic.headless.materialization.infrastructure.mapper.MaterializationElementDOMapper">
|
|
||||||
<resultMap id="BaseResultMap" type="com.tencent.supersonic.headless.materialization.domain.dataobject.MaterializationElementDO">
|
|
||||||
<id column="id" jdbcType="BIGINT" property="id" />
|
|
||||||
<id column="type" jdbcType="VARCHAR" property="type" />
|
|
||||||
<id column="materialization_id" jdbcType="BIGINT" property="materializationId" />
|
|
||||||
<result column="element_type" jdbcType="VARCHAR" property="elementType" />
|
|
||||||
<result column="default_value" jdbcType="VARCHAR" property="defaultValue" />
|
|
||||||
<result column="outlier" jdbcType="VARCHAR" property="outlier" />
|
|
||||||
<result column="frequency" jdbcType="VARCHAR" property="frequency" />
|
|
||||||
<result column="created_at" jdbcType="TIMESTAMP" property="createdAt" />
|
|
||||||
<result column="created_by" jdbcType="VARCHAR" property="createdBy" />
|
|
||||||
<result column="updated_at" jdbcType="TIMESTAMP" property="updatedAt" />
|
|
||||||
<result column="updated_by" jdbcType="VARCHAR" property="updatedBy" />
|
|
||||||
<result column="status" jdbcType="INTEGER" property="status" />
|
|
||||||
</resultMap>
|
|
||||||
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.tencent.supersonic.headless.materialization.domain.dataobject.MaterializationElementDOWithBLOBs">
|
|
||||||
<result column="depends" jdbcType="LONGVARCHAR" property="depends" />
|
|
||||||
<result column="description" jdbcType="LONGVARCHAR" property="description" />
|
|
||||||
</resultMap>
|
|
||||||
<sql id="Example_Where_Clause">
|
|
||||||
<where>
|
|
||||||
<foreach collection="oredCriteria" item="criteria" separator="or">
|
|
||||||
<if test="criteria.valid">
|
|
||||||
<trim prefix="(" prefixOverrides="and" suffix=")">
|
|
||||||
<foreach collection="criteria.criteria" item="criterion">
|
|
||||||
<choose>
|
|
||||||
<when test="criterion.noValue">
|
|
||||||
and ${criterion.condition}
|
|
||||||
</when>
|
|
||||||
<when test="criterion.singleValue">
|
|
||||||
and ${criterion.condition} #{criterion.value}
|
|
||||||
</when>
|
|
||||||
<when test="criterion.betweenValue">
|
|
||||||
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
|
|
||||||
</when>
|
|
||||||
<when test="criterion.listValue">
|
|
||||||
and ${criterion.condition}
|
|
||||||
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
|
|
||||||
#{listItem}
|
|
||||||
</foreach>
|
|
||||||
</when>
|
|
||||||
</choose>
|
|
||||||
</foreach>
|
|
||||||
</trim>
|
|
||||||
</if>
|
|
||||||
</foreach>
|
|
||||||
</where>
|
|
||||||
</sql>
|
|
||||||
<sql id="Base_Column_List">
|
|
||||||
id, type, materialization_id, element_type, default_value, outlier, frequency, created_at,
|
|
||||||
created_by, updated_at, updated_by, status
|
|
||||||
</sql>
|
|
||||||
<sql id="Blob_Column_List">
|
|
||||||
depends, description
|
|
||||||
</sql>
|
|
||||||
<select id="selectByExampleWithBLOBs" parameterType="com.tencent.supersonic.headless.materialization.domain.dataobject.MaterializationElementDOExample" resultMap="ResultMapWithBLOBs">
|
|
||||||
select
|
|
||||||
<if test="distinct">
|
|
||||||
distinct
|
|
||||||
</if>
|
|
||||||
<include refid="Base_Column_List" />
|
|
||||||
,
|
|
||||||
<include refid="Blob_Column_List" />
|
|
||||||
from s2_materialization_element
|
|
||||||
<if test="_parameter != null">
|
|
||||||
<include refid="Example_Where_Clause" />
|
|
||||||
</if>
|
|
||||||
<if test="orderByClause != null">
|
|
||||||
order by ${orderByClause}
|
|
||||||
</if>
|
|
||||||
</select>
|
|
||||||
<select id="selectByExample" parameterType="com.tencent.supersonic.headless.materialization.domain.dataobject.MaterializationElementDOExample" resultMap="BaseResultMap">
|
|
||||||
select
|
|
||||||
<if test="distinct">
|
|
||||||
distinct
|
|
||||||
</if>
|
|
||||||
<include refid="Base_Column_List" />
|
|
||||||
from s2_materialization_element
|
|
||||||
<if test="_parameter != null">
|
|
||||||
<include refid="Example_Where_Clause" />
|
|
||||||
</if>
|
|
||||||
<if test="orderByClause != null">
|
|
||||||
order by ${orderByClause}
|
|
||||||
</if>
|
|
||||||
</select>
|
|
||||||
<select id="selectByPrimaryKey" parameterType="com.tencent.supersonic.headless.materialization.domain.dataobject.MaterializationElementDOKey" resultMap="ResultMapWithBLOBs">
|
|
||||||
select
|
|
||||||
<include refid="Base_Column_List" />
|
|
||||||
,
|
|
||||||
<include refid="Blob_Column_List" />
|
|
||||||
from s2_materialization_element
|
|
||||||
where id = #{id,jdbcType=BIGINT}
|
|
||||||
and type = #{type,jdbcType=VARCHAR}
|
|
||||||
and materialization_id = #{materializationId,jdbcType=BIGINT}
|
|
||||||
</select>
|
|
||||||
<delete id="deleteByPrimaryKey" parameterType="com.tencent.supersonic.headless.materialization.domain.dataobject.MaterializationElementDOKey">
|
|
||||||
delete from s2_materialization_element
|
|
||||||
where id = #{id,jdbcType=BIGINT}
|
|
||||||
and type = #{type,jdbcType=VARCHAR}
|
|
||||||
and materialization_id = #{materializationId,jdbcType=BIGINT}
|
|
||||||
</delete>
|
|
||||||
<insert id="insert" parameterType="com.tencent.supersonic.headless.materialization.domain.dataobject.MaterializationElementDOWithBLOBs">
|
|
||||||
insert into s2_materialization_element (id, type, materialization_id,
|
|
||||||
element_type, default_value, outlier,
|
|
||||||
frequency, created_at, created_by,
|
|
||||||
updated_at, updated_by, status,
|
|
||||||
depends, description)
|
|
||||||
values (#{id,jdbcType=BIGINT}, #{type,jdbcType=VARCHAR}, #{materializationId,jdbcType=BIGINT},
|
|
||||||
#{elementType,jdbcType=VARCHAR}, #{defaultValue,jdbcType=VARCHAR}, #{outlier,jdbcType=VARCHAR},
|
|
||||||
#{frequency,jdbcType=VARCHAR}, #{createdAt,jdbcType=TIMESTAMP}, #{createdBy,jdbcType=VARCHAR},
|
|
||||||
#{updatedAt,jdbcType=TIMESTAMP}, #{updatedBy,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER},
|
|
||||||
#{depends,jdbcType=LONGVARCHAR}, #{description,jdbcType=LONGVARCHAR})
|
|
||||||
</insert>
|
|
||||||
<insert id="insertSelective" parameterType="com.tencent.supersonic.headless.materialization.domain.dataobject.MaterializationElementDOWithBLOBs">
|
|
||||||
insert into s2_materialization_element
|
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
||||||
<if test="id != null">
|
|
||||||
id,
|
|
||||||
</if>
|
|
||||||
<if test="type != null">
|
|
||||||
type,
|
|
||||||
</if>
|
|
||||||
<if test="materializationId != null">
|
|
||||||
materialization_id,
|
|
||||||
</if>
|
|
||||||
<if test="elementType != null">
|
|
||||||
element_type,
|
|
||||||
</if>
|
|
||||||
<if test="defaultValue != null">
|
|
||||||
default_value,
|
|
||||||
</if>
|
|
||||||
<if test="outlier != null">
|
|
||||||
outlier,
|
|
||||||
</if>
|
|
||||||
<if test="frequency != null">
|
|
||||||
frequency,
|
|
||||||
</if>
|
|
||||||
<if test="createdAt != null">
|
|
||||||
created_at,
|
|
||||||
</if>
|
|
||||||
<if test="createdBy != null">
|
|
||||||
created_by,
|
|
||||||
</if>
|
|
||||||
<if test="updatedAt != null">
|
|
||||||
updated_at,
|
|
||||||
</if>
|
|
||||||
<if test="updatedBy != null">
|
|
||||||
updated_by,
|
|
||||||
</if>
|
|
||||||
<if test="status != null">
|
|
||||||
status,
|
|
||||||
</if>
|
|
||||||
<if test="depends != null">
|
|
||||||
depends,
|
|
||||||
</if>
|
|
||||||
<if test="description != null">
|
|
||||||
description,
|
|
||||||
</if>
|
|
||||||
</trim>
|
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
||||||
<if test="id != null">
|
|
||||||
#{id,jdbcType=BIGINT},
|
|
||||||
</if>
|
|
||||||
<if test="type != null">
|
|
||||||
#{type,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="materializationId != null">
|
|
||||||
#{materializationId,jdbcType=BIGINT},
|
|
||||||
</if>
|
|
||||||
<if test="elementType != null">
|
|
||||||
#{elementType,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="defaultValue != null">
|
|
||||||
#{defaultValue,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="outlier != null">
|
|
||||||
#{outlier,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="frequency != null">
|
|
||||||
#{frequency,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="createdAt != null">
|
|
||||||
#{createdAt,jdbcType=TIMESTAMP},
|
|
||||||
</if>
|
|
||||||
<if test="createdBy != null">
|
|
||||||
#{createdBy,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="updatedAt != null">
|
|
||||||
#{updatedAt,jdbcType=TIMESTAMP},
|
|
||||||
</if>
|
|
||||||
<if test="updatedBy != null">
|
|
||||||
#{updatedBy,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="status != null">
|
|
||||||
#{status,jdbcType=INTEGER},
|
|
||||||
</if>
|
|
||||||
<if test="depends != null">
|
|
||||||
#{depends,jdbcType=LONGVARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="description != null">
|
|
||||||
#{description,jdbcType=LONGVARCHAR},
|
|
||||||
</if>
|
|
||||||
</trim>
|
|
||||||
</insert>
|
|
||||||
<select id="countByExample" parameterType="com.tencent.supersonic.headless.materialization.domain.dataobject.MaterializationElementDOExample" resultType="java.lang.Long">
|
|
||||||
select count(*) from s2_materialization_element
|
|
||||||
<if test="_parameter != null">
|
|
||||||
<include refid="Example_Where_Clause" />
|
|
||||||
</if>
|
|
||||||
</select>
|
|
||||||
<update id="updateByPrimaryKeySelective" parameterType="com.tencent.supersonic.headless.materialization.domain.dataobject.MaterializationElementDOWithBLOBs">
|
|
||||||
update s2_materialization_element
|
|
||||||
<set>
|
|
||||||
<if test="elementType != null">
|
|
||||||
element_type = #{elementType,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="defaultValue != null">
|
|
||||||
default_value = #{defaultValue,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="outlier != null">
|
|
||||||
outlier = #{outlier,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="frequency != null">
|
|
||||||
frequency = #{frequency,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="createdAt != null">
|
|
||||||
created_at = #{createdAt,jdbcType=TIMESTAMP},
|
|
||||||
</if>
|
|
||||||
<if test="createdBy != null">
|
|
||||||
created_by = #{createdBy,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="updatedAt != null">
|
|
||||||
updated_at = #{updatedAt,jdbcType=TIMESTAMP},
|
|
||||||
</if>
|
|
||||||
<if test="updatedBy != null">
|
|
||||||
updated_by = #{updatedBy,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="status != null">
|
|
||||||
status = #{status,jdbcType=INTEGER},
|
|
||||||
</if>
|
|
||||||
<if test="depends != null">
|
|
||||||
depends = #{depends,jdbcType=LONGVARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="description != null">
|
|
||||||
description = #{description,jdbcType=LONGVARCHAR},
|
|
||||||
</if>
|
|
||||||
</set>
|
|
||||||
where id = #{id,jdbcType=BIGINT}
|
|
||||||
and type = #{type,jdbcType=VARCHAR}
|
|
||||||
and materialization_id = #{materializationId,jdbcType=BIGINT}
|
|
||||||
</update>
|
|
||||||
<update id="updateByPrimaryKeyWithBLOBs" parameterType="com.tencent.supersonic.headless.materialization.domain.dataobject.MaterializationElementDOWithBLOBs">
|
|
||||||
update s2_materialization_element
|
|
||||||
set element_type = #{elementType,jdbcType=VARCHAR},
|
|
||||||
default_value = #{defaultValue,jdbcType=VARCHAR},
|
|
||||||
outlier = #{outlier,jdbcType=VARCHAR},
|
|
||||||
frequency = #{frequency,jdbcType=VARCHAR},
|
|
||||||
created_at = #{createdAt,jdbcType=TIMESTAMP},
|
|
||||||
created_by = #{createdBy,jdbcType=VARCHAR},
|
|
||||||
updated_at = #{updatedAt,jdbcType=TIMESTAMP},
|
|
||||||
updated_by = #{updatedBy,jdbcType=VARCHAR},
|
|
||||||
status = #{status,jdbcType=INTEGER},
|
|
||||||
depends = #{depends,jdbcType=LONGVARCHAR},
|
|
||||||
description = #{description,jdbcType=LONGVARCHAR}
|
|
||||||
where id = #{id,jdbcType=BIGINT}
|
|
||||||
and type = #{type,jdbcType=VARCHAR}
|
|
||||||
and materialization_id = #{materializationId,jdbcType=BIGINT}
|
|
||||||
</update>
|
|
||||||
<update id="updateByPrimaryKey" parameterType="com.tencent.supersonic.headless.materialization.domain.dataobject.MaterializationElementDO">
|
|
||||||
update s2_materialization_element
|
|
||||||
set element_type = #{elementType,jdbcType=VARCHAR},
|
|
||||||
default_value = #{defaultValue,jdbcType=VARCHAR},
|
|
||||||
outlier = #{outlier,jdbcType=VARCHAR},
|
|
||||||
frequency = #{frequency,jdbcType=VARCHAR},
|
|
||||||
created_at = #{createdAt,jdbcType=TIMESTAMP},
|
|
||||||
created_by = #{createdBy,jdbcType=VARCHAR},
|
|
||||||
updated_at = #{updatedAt,jdbcType=TIMESTAMP},
|
|
||||||
updated_by = #{updatedBy,jdbcType=VARCHAR},
|
|
||||||
status = #{status,jdbcType=INTEGER}
|
|
||||||
where id = #{id,jdbcType=BIGINT}
|
|
||||||
and type = #{type,jdbcType=VARCHAR}
|
|
||||||
and materialization_id = #{materializationId,jdbcType=BIGINT}
|
|
||||||
</update>
|
|
||||||
|
|
||||||
<update id="cleanMaterializationElement">
|
|
||||||
delete from s2_materialization_element
|
|
||||||
where materialization_id = #{materializationId}
|
|
||||||
</update>
|
|
||||||
</mapper>
|
|
||||||
@@ -1,336 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
||||||
<mapper namespace="com.tencent.supersonic.headless.materialization.infrastructure.mapper.MaterializationRecordDOMapper">
|
|
||||||
<resultMap id="BaseResultMap" type="com.tencent.supersonic.headless.materialization.domain.dataobject.MaterializationRecordDO">
|
|
||||||
<id column="id" jdbcType="BIGINT" property="id" />
|
|
||||||
<result column="materialization_id" jdbcType="BIGINT" property="materializationId" />
|
|
||||||
<result column="element_type" jdbcType="VARCHAR" property="elementType" />
|
|
||||||
<result column="element_id" jdbcType="BIGINT" property="elementId" />
|
|
||||||
<result column="element_name" jdbcType="VARCHAR" property="elementName" />
|
|
||||||
<result column="data_time" jdbcType="VARCHAR" property="dataTime" />
|
|
||||||
<result column="state" jdbcType="VARCHAR" property="state" />
|
|
||||||
<result column="task_id" jdbcType="VARCHAR" property="taskId" />
|
|
||||||
<result column="created_at" jdbcType="TIMESTAMP" property="createdAt" />
|
|
||||||
<result column="updated_at" jdbcType="TIMESTAMP" property="updatedAt" />
|
|
||||||
<result column="created_by" jdbcType="VARCHAR" property="createdBy" />
|
|
||||||
<result column="updated_by" jdbcType="VARCHAR" property="updatedBy" />
|
|
||||||
<result column="retry_count" jdbcType="BIGINT" property="retryCount" />
|
|
||||||
<result column="source_count" jdbcType="BIGINT" property="sourceCount" />
|
|
||||||
<result column="sink_count" jdbcType="BIGINT" property="sinkCount" />
|
|
||||||
</resultMap>
|
|
||||||
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.tencent.supersonic.headless.materialization.domain.dataobject.MaterializationRecordDO">
|
|
||||||
<result column="message" jdbcType="LONGVARCHAR" property="message" />
|
|
||||||
</resultMap>
|
|
||||||
<sql id="Example_Where_Clause">
|
|
||||||
<where>
|
|
||||||
<foreach collection="oredCriteria" item="criteria" separator="or">
|
|
||||||
<if test="criteria.valid">
|
|
||||||
<trim prefix="(" prefixOverrides="and" suffix=")">
|
|
||||||
<foreach collection="criteria.criteria" item="criterion">
|
|
||||||
<choose>
|
|
||||||
<when test="criterion.noValue">
|
|
||||||
and ${criterion.condition}
|
|
||||||
</when>
|
|
||||||
<when test="criterion.singleValue">
|
|
||||||
and ${criterion.condition} #{criterion.value}
|
|
||||||
</when>
|
|
||||||
<when test="criterion.betweenValue">
|
|
||||||
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
|
|
||||||
</when>
|
|
||||||
<when test="criterion.listValue">
|
|
||||||
and ${criterion.condition}
|
|
||||||
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
|
|
||||||
#{listItem}
|
|
||||||
</foreach>
|
|
||||||
</when>
|
|
||||||
</choose>
|
|
||||||
</foreach>
|
|
||||||
</trim>
|
|
||||||
</if>
|
|
||||||
</foreach>
|
|
||||||
</where>
|
|
||||||
</sql>
|
|
||||||
<sql id="Base_Column_List">
|
|
||||||
id, materialization_id, element_type, element_id, element_name, data_time, state,
|
|
||||||
task_id, created_at, updated_at, created_by, updated_by, retry_count, source_count,
|
|
||||||
sink_count
|
|
||||||
</sql>
|
|
||||||
<sql id="Blob_Column_List">
|
|
||||||
message
|
|
||||||
</sql>
|
|
||||||
<select id="selectByExampleWithBLOBs" parameterType="com.tencent.supersonic.headless.materialization.domain.dataobject.MaterializationRecordDOExample" resultMap="ResultMapWithBLOBs">
|
|
||||||
select
|
|
||||||
<if test="distinct">
|
|
||||||
distinct
|
|
||||||
</if>
|
|
||||||
<include refid="Base_Column_List" />
|
|
||||||
,
|
|
||||||
<include refid="Blob_Column_List" />
|
|
||||||
from s2_materialization_record
|
|
||||||
<if test="_parameter != null">
|
|
||||||
<include refid="Example_Where_Clause" />
|
|
||||||
</if>
|
|
||||||
<if test="orderByClause != null">
|
|
||||||
order by ${orderByClause}
|
|
||||||
</if>
|
|
||||||
</select>
|
|
||||||
<select id="selectByExample" parameterType="com.tencent.supersonic.headless.materialization.domain.dataobject.MaterializationRecordDOExample" resultMap="BaseResultMap">
|
|
||||||
select
|
|
||||||
<if test="distinct">
|
|
||||||
distinct
|
|
||||||
</if>
|
|
||||||
<include refid="Base_Column_List" />
|
|
||||||
from s2_materialization_record
|
|
||||||
<if test="_parameter != null">
|
|
||||||
<include refid="Example_Where_Clause" />
|
|
||||||
</if>
|
|
||||||
<if test="orderByClause != null">
|
|
||||||
order by ${orderByClause}
|
|
||||||
</if>
|
|
||||||
</select>
|
|
||||||
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="ResultMapWithBLOBs">
|
|
||||||
select
|
|
||||||
<include refid="Base_Column_List" />
|
|
||||||
,
|
|
||||||
<include refid="Blob_Column_List" />
|
|
||||||
from s2_materialization_record
|
|
||||||
where id = #{id,jdbcType=BIGINT}
|
|
||||||
</select>
|
|
||||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
|
|
||||||
delete from s2_materialization_record
|
|
||||||
where id = #{id,jdbcType=BIGINT}
|
|
||||||
</delete>
|
|
||||||
<insert id="insert" parameterType="com.tencent.supersonic.headless.materialization.domain.dataobject.MaterializationRecordDO">
|
|
||||||
insert into s2_materialization_record (id, materialization_id, element_type,
|
|
||||||
element_id, element_name, data_time,
|
|
||||||
state, task_id, created_at,
|
|
||||||
updated_at, created_by, updated_by,
|
|
||||||
retry_count, source_count, sink_count,
|
|
||||||
message)
|
|
||||||
values (#{id,jdbcType=BIGINT}, #{materializationId,jdbcType=BIGINT}, #{elementType,jdbcType=VARCHAR},
|
|
||||||
#{elementId,jdbcType=BIGINT}, #{elementName,jdbcType=VARCHAR}, #{dataTime,jdbcType=VARCHAR},
|
|
||||||
#{state,jdbcType=VARCHAR}, #{taskId,jdbcType=VARCHAR}, #{createdAt,jdbcType=TIMESTAMP},
|
|
||||||
#{updatedAt,jdbcType=TIMESTAMP}, #{createdBy,jdbcType=VARCHAR}, #{updatedBy,jdbcType=VARCHAR},
|
|
||||||
#{retryCount,jdbcType=BIGINT}, #{sourceCount,jdbcType=BIGINT}, #{sinkCount,jdbcType=BIGINT},
|
|
||||||
#{message,jdbcType=LONGVARCHAR})
|
|
||||||
ON DUPLICATE KEY UPDATE
|
|
||||||
updated_at = #{updatedAt}, retry_count = retry_count + 1
|
|
||||||
</insert>
|
|
||||||
<insert id="insertSelective" parameterType="com.tencent.supersonic.headless.materialization.domain.dataobject.MaterializationRecordDO">
|
|
||||||
insert into s2_materialization_record
|
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
||||||
<if test="id != null">
|
|
||||||
id,
|
|
||||||
</if>
|
|
||||||
<if test="materializationId != null">
|
|
||||||
materialization_id,
|
|
||||||
</if>
|
|
||||||
<if test="elementType != null">
|
|
||||||
element_type,
|
|
||||||
</if>
|
|
||||||
<if test="elementId != null">
|
|
||||||
element_id,
|
|
||||||
</if>
|
|
||||||
<if test="elementName != null">
|
|
||||||
element_name,
|
|
||||||
</if>
|
|
||||||
<if test="dataTime != null">
|
|
||||||
data_time,
|
|
||||||
</if>
|
|
||||||
<if test="state != null">
|
|
||||||
state,
|
|
||||||
</if>
|
|
||||||
<if test="taskId != null">
|
|
||||||
task_id,
|
|
||||||
</if>
|
|
||||||
<if test="createdAt != null">
|
|
||||||
created_at,
|
|
||||||
</if>
|
|
||||||
<if test="updatedAt != null">
|
|
||||||
updated_at,
|
|
||||||
</if>
|
|
||||||
<if test="createdBy != null">
|
|
||||||
created_by,
|
|
||||||
</if>
|
|
||||||
<if test="updatedBy != null">
|
|
||||||
updated_by,
|
|
||||||
</if>
|
|
||||||
<if test="retryCount != null">
|
|
||||||
retry_count,
|
|
||||||
</if>
|
|
||||||
<if test="sourceCount != null">
|
|
||||||
source_count,
|
|
||||||
</if>
|
|
||||||
<if test="sinkCount != null">
|
|
||||||
sink_count,
|
|
||||||
</if>
|
|
||||||
<if test="message != null">
|
|
||||||
message,
|
|
||||||
</if>
|
|
||||||
</trim>
|
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
||||||
<if test="id != null">
|
|
||||||
#{id,jdbcType=BIGINT},
|
|
||||||
</if>
|
|
||||||
<if test="materializationId != null">
|
|
||||||
#{materializationId,jdbcType=BIGINT},
|
|
||||||
</if>
|
|
||||||
<if test="elementType != null">
|
|
||||||
#{elementType,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="elementId != null">
|
|
||||||
#{elementId,jdbcType=BIGINT},
|
|
||||||
</if>
|
|
||||||
<if test="elementName != null">
|
|
||||||
#{elementName,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="dataTime != null">
|
|
||||||
#{dataTime,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="state != null">
|
|
||||||
#{state,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="taskId != null">
|
|
||||||
#{taskId,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="createdAt != null">
|
|
||||||
#{createdAt,jdbcType=TIMESTAMP},
|
|
||||||
</if>
|
|
||||||
<if test="updatedAt != null">
|
|
||||||
#{updatedAt,jdbcType=TIMESTAMP},
|
|
||||||
</if>
|
|
||||||
<if test="createdBy != null">
|
|
||||||
#{createdBy,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="updatedBy != null">
|
|
||||||
#{updatedBy,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="retryCount != null">
|
|
||||||
#{retryCount,jdbcType=BIGINT},
|
|
||||||
</if>
|
|
||||||
<if test="sourceCount != null">
|
|
||||||
#{sourceCount,jdbcType=BIGINT},
|
|
||||||
</if>
|
|
||||||
<if test="sinkCount != null">
|
|
||||||
#{sinkCount,jdbcType=BIGINT},
|
|
||||||
</if>
|
|
||||||
<if test="message != null">
|
|
||||||
#{message,jdbcType=LONGVARCHAR},
|
|
||||||
</if>
|
|
||||||
</trim>
|
|
||||||
</insert>
|
|
||||||
<select id="countByExample" parameterType="com.tencent.supersonic.headless.materialization.domain.dataobject.MaterializationRecordDOExample" resultType="java.lang.Long">
|
|
||||||
select count(*) from s2_materialization_record
|
|
||||||
<if test="_parameter != null">
|
|
||||||
<include refid="Example_Where_Clause" />
|
|
||||||
</if>
|
|
||||||
</select>
|
|
||||||
<update id="updateByPrimaryKeySelective" parameterType="com.tencent.supersonic.headless.materialization.domain.dataobject.MaterializationRecordDO">
|
|
||||||
update s2_materialization_record
|
|
||||||
<set>
|
|
||||||
<if test="materializationId != null">
|
|
||||||
materialization_id = #{materializationId,jdbcType=BIGINT},
|
|
||||||
</if>
|
|
||||||
<if test="elementType != null">
|
|
||||||
element_type = #{elementType,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="elementId != null">
|
|
||||||
element_id = #{elementId,jdbcType=BIGINT},
|
|
||||||
</if>
|
|
||||||
<if test="elementName != null">
|
|
||||||
element_name = #{elementName,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="dataTime != null">
|
|
||||||
data_time = #{dataTime,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="state != null">
|
|
||||||
state = #{state,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="taskId != null">
|
|
||||||
task_id = #{taskId,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="createdAt != null">
|
|
||||||
created_at = #{createdAt,jdbcType=TIMESTAMP},
|
|
||||||
</if>
|
|
||||||
<if test="updatedAt != null">
|
|
||||||
updated_at = #{updatedAt,jdbcType=TIMESTAMP},
|
|
||||||
</if>
|
|
||||||
<if test="createdBy != null">
|
|
||||||
created_by = #{createdBy,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="updatedBy != null">
|
|
||||||
updated_by = #{updatedBy,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="retryCount != null">
|
|
||||||
retry_count = #{retryCount,jdbcType=BIGINT},
|
|
||||||
</if>
|
|
||||||
<if test="sourceCount != null">
|
|
||||||
source_count = #{sourceCount,jdbcType=BIGINT},
|
|
||||||
</if>
|
|
||||||
<if test="sinkCount != null">
|
|
||||||
sink_count = #{sinkCount,jdbcType=BIGINT},
|
|
||||||
</if>
|
|
||||||
<if test="message != null">
|
|
||||||
message = #{message,jdbcType=LONGVARCHAR},
|
|
||||||
</if>
|
|
||||||
</set>
|
|
||||||
where id = #{id,jdbcType=BIGINT}
|
|
||||||
</update>
|
|
||||||
<update id="updateByPrimaryKeyWithBLOBs" parameterType="com.tencent.supersonic.headless.materialization.domain.dataobject.MaterializationRecordDO">
|
|
||||||
update s2_materialization_record
|
|
||||||
set materialization_id = #{materializationId,jdbcType=BIGINT},
|
|
||||||
element_type = #{elementType,jdbcType=VARCHAR},
|
|
||||||
element_id = #{elementId,jdbcType=BIGINT},
|
|
||||||
element_name = #{elementName,jdbcType=VARCHAR},
|
|
||||||
data_time = #{dataTime,jdbcType=VARCHAR},
|
|
||||||
state = #{state,jdbcType=VARCHAR},
|
|
||||||
task_id = #{taskId,jdbcType=VARCHAR},
|
|
||||||
created_at = #{createdAt,jdbcType=TIMESTAMP},
|
|
||||||
updated_at = #{updatedAt,jdbcType=TIMESTAMP},
|
|
||||||
created_by = #{createdBy,jdbcType=VARCHAR},
|
|
||||||
updated_by = #{updatedBy,jdbcType=VARCHAR},
|
|
||||||
retry_count = #{retryCount,jdbcType=BIGINT},
|
|
||||||
source_count = #{sourceCount,jdbcType=BIGINT},
|
|
||||||
sink_count = #{sinkCount,jdbcType=BIGINT},
|
|
||||||
message = #{message,jdbcType=LONGVARCHAR}
|
|
||||||
where id = #{id,jdbcType=BIGINT}
|
|
||||||
</update>
|
|
||||||
|
|
||||||
<update id="updateByBizName" parameterType="com.tencent.supersonic.headless.materialization.domain.dataobject.MaterializationRecordDO">
|
|
||||||
update s2_materialization_record
|
|
||||||
set
|
|
||||||
element_id = #{elementId,jdbcType=BIGINT},
|
|
||||||
state = #{state,jdbcType=VARCHAR},
|
|
||||||
task_id = #{taskId,jdbcType=VARCHAR},
|
|
||||||
updated_at = #{updatedAt,jdbcType=TIMESTAMP},
|
|
||||||
updated_by = #{updatedBy,jdbcType=VARCHAR},
|
|
||||||
retry_count = #{retryCount,jdbcType=BIGINT},
|
|
||||||
source_count = #{sourceCount,jdbcType=BIGINT},
|
|
||||||
sink_count = #{sinkCount,jdbcType=BIGINT},
|
|
||||||
message = #{message,jdbcType=LONGVARCHAR}
|
|
||||||
where
|
|
||||||
materialization_id = #{materializationId}
|
|
||||||
AND element_type = #{elementType}
|
|
||||||
AND element_name = #{elementName}
|
|
||||||
AND data_time = #{dataTime}
|
|
||||||
</update>
|
|
||||||
|
|
||||||
<update id="updateByPrimaryKey" parameterType="com.tencent.supersonic.headless.materialization.domain.dataobject.MaterializationRecordDO">
|
|
||||||
update s2_materialization_record
|
|
||||||
set materialization_id = #{materializationId,jdbcType=BIGINT},
|
|
||||||
element_type = #{elementType,jdbcType=VARCHAR},
|
|
||||||
element_id = #{elementId,jdbcType=BIGINT},
|
|
||||||
element_name = #{elementName,jdbcType=VARCHAR},
|
|
||||||
data_time = #{dataTime,jdbcType=VARCHAR},
|
|
||||||
state = #{state,jdbcType=VARCHAR},
|
|
||||||
task_id = #{taskId,jdbcType=VARCHAR},
|
|
||||||
created_at = #{createdAt,jdbcType=TIMESTAMP},
|
|
||||||
updated_at = #{updatedAt,jdbcType=TIMESTAMP},
|
|
||||||
created_by = #{createdBy,jdbcType=VARCHAR},
|
|
||||||
updated_by = #{updatedBy,jdbcType=VARCHAR},
|
|
||||||
retry_count = #{retryCount,jdbcType=BIGINT},
|
|
||||||
source_count = #{sourceCount,jdbcType=BIGINT},
|
|
||||||
sink_count = #{sinkCount,jdbcType=BIGINT}
|
|
||||||
where id = #{id,jdbcType=BIGINT}
|
|
||||||
</update>
|
|
||||||
</mapper>
|
|
||||||
@@ -16,7 +16,6 @@
|
|||||||
<module>common</module>
|
<module>common</module>
|
||||||
<module>model</module>
|
<module>model</module>
|
||||||
<module>query</module>
|
<module>query</module>
|
||||||
<module>materialization</module>
|
|
||||||
<module>api</module>
|
<module>api</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
|
|||||||
@@ -66,12 +66,6 @@
|
|||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>com.tencent.supersonic</groupId>
|
|
||||||
<artifactId>headless-materialization</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.jayway.jsonpath</groupId>
|
<groupId>com.jayway.jsonpath</groupId>
|
||||||
<artifactId>json-path</artifactId>
|
<artifactId>json-path</artifactId>
|
||||||
|
|||||||
@@ -63,12 +63,6 @@
|
|||||||
<artifactId>headless-model</artifactId>
|
<artifactId>headless-model</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.tencent.supersonic</groupId>
|
|
||||||
<artifactId>headless-materialization</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tencent.supersonic</groupId>
|
<groupId>com.tencent.supersonic</groupId>
|
||||||
<artifactId>auth-api</artifactId>
|
<artifactId>auth-api</artifactId>
|
||||||
|
|||||||
@@ -449,70 +449,6 @@ CREATE TABLE IF NOT EXISTS `song` (
|
|||||||
);
|
);
|
||||||
COMMENT ON TABLE song IS 'song';
|
COMMENT ON TABLE song IS 'song';
|
||||||
|
|
||||||
-- benchmark
|
|
||||||
|
|
||||||
create table s2_materialization
|
|
||||||
(
|
|
||||||
id int AUTO_INCREMENT ,
|
|
||||||
name varchar(255) not null,
|
|
||||||
materialized_type varchar(255) not null ,
|
|
||||||
update_cycle varchar(255) ,
|
|
||||||
model_id bigint ,
|
|
||||||
database_id bigint not null ,
|
|
||||||
level int not null default 0 ,
|
|
||||||
status int not null default 1 ,
|
|
||||||
destination_table varchar(255) not null ,
|
|
||||||
date_info varchar(255) null ,
|
|
||||||
entities varchar(255) null ,
|
|
||||||
principals varchar(255) DEFAULT NULL ,
|
|
||||||
created_at TIMESTAMP null,
|
|
||||||
created_by varchar(100) null,
|
|
||||||
updated_at TIMESTAMP null,
|
|
||||||
updated_by varchar(100) not null,
|
|
||||||
description varchar(255) null,
|
|
||||||
primary key (id)
|
|
||||||
) ;
|
|
||||||
|
|
||||||
create table s2_materialization_element
|
|
||||||
(
|
|
||||||
id bigint not null ,
|
|
||||||
type varchar(255) not null ,
|
|
||||||
materialization_id bigint not null ,
|
|
||||||
depends varchar(255) DEFAULT NULL,
|
|
||||||
element_type varchar(255) DEFAULT NULL ,
|
|
||||||
default_value varchar(255) DEFAULT NULL ,
|
|
||||||
outlier varchar(255) DEFAULT NULL ,
|
|
||||||
frequency varchar(255) DEFAULT NULL ,
|
|
||||||
created_at TIMESTAMP null,
|
|
||||||
created_by varchar(100) null,
|
|
||||||
updated_at TIMESTAMP null,
|
|
||||||
updated_by varchar(100) not null,
|
|
||||||
description varchar(255) null ,
|
|
||||||
status int not null default 1 ,
|
|
||||||
PRIMARY KEY (id, type, materialization_id)
|
|
||||||
) ;
|
|
||||||
|
|
||||||
CREATE TABLE s2_materialization_record
|
|
||||||
(
|
|
||||||
`id` bigint NOT NULL AUTO_INCREMENT ,
|
|
||||||
`materialization_id` bigint NOT null ,
|
|
||||||
`element_type` varchar(255) not null ,
|
|
||||||
`element_id` bigint DEFAULT NULL ,
|
|
||||||
`element_name` varchar(255) not null ,
|
|
||||||
`data_time` varchar(64) DEFAULT NULL ,
|
|
||||||
`state` varchar(255) DEFAULT NULL ,
|
|
||||||
`task_id` varchar(255) DEFAULT NULL,
|
|
||||||
`created_at` TIMESTAMP null,
|
|
||||||
`updated_at` TIMESTAMP null,
|
|
||||||
`created_by` varchar(100) null,
|
|
||||||
`updated_by` varchar(100) not null,
|
|
||||||
`retry_count` bigint NOT NULL default 0,
|
|
||||||
`source_count` bigint NOT NULL default 0,
|
|
||||||
`sink_count` bigint NOT NULL default 0,
|
|
||||||
`message` varchar(255) ,
|
|
||||||
PRIMARY KEY (`id`)
|
|
||||||
);
|
|
||||||
|
|
||||||
CREATE TABLE s2_sys_parameter
|
CREATE TABLE s2_sys_parameter
|
||||||
(
|
(
|
||||||
id INT PRIMARY KEY AUTO_INCREMENT,
|
id INT PRIMARY KEY AUTO_INCREMENT,
|
||||||
|
|||||||
@@ -426,69 +426,6 @@ create table s2_user
|
|||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE `s2_materialization`
|
|
||||||
(
|
|
||||||
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
|
||||||
`name` varchar(255) NOT NULL COMMENT '物化名称',
|
|
||||||
`materialized_type` varchar(255) NOT NULL COMMENT '物化类型 partition 分区 zipper 拉链 ',
|
|
||||||
`update_cycle` varchar(255) DEFAULT NULL COMMENT '更新周期,天更新、周更新、月更新',
|
|
||||||
`model_id` bigint(20) DEFAULT NULL,
|
|
||||||
`database_id` bigint(20) NOT NULL COMMENT '数据库实例ID',
|
|
||||||
`level` int(11) NOT NULL DEFAULT '0' COMMENT '优先级,数值越大优先级越高',
|
|
||||||
`status` int(11) NOT NULL DEFAULT '1' COMMENT '0-废弃,1-使用中',
|
|
||||||
`destination_table` varchar(255) NOT NULL COMMENT '物化表名称',
|
|
||||||
`date_info` mediumtext COMMENT '时间字段',
|
|
||||||
`entities` mediumtext COMMENT 'primary字段',
|
|
||||||
`principals` varchar(255) DEFAULT NULL COMMENT '责任人',
|
|
||||||
`created_at` datetime DEFAULT NULL,
|
|
||||||
`created_by` varchar(100) DEFAULT NULL,
|
|
||||||
`updated_at` datetime DEFAULT NULL,
|
|
||||||
`updated_by` varchar(100) NOT NULL,
|
|
||||||
`description` mediumtext COMMENT '备注说明',
|
|
||||||
PRIMARY KEY (`id`)
|
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
|
|
||||||
|
|
||||||
CREATE TABLE `s2_materialization_element`
|
|
||||||
(
|
|
||||||
`id` bigint(20) NOT NULL COMMENT 'element类型对应id',
|
|
||||||
`type` varchar(255) NOT NULL COMMENT 'element类型 metric、dimension',
|
|
||||||
`materialization_id` bigint(20) NOT NULL COMMENT '关联s2_materialization主键',
|
|
||||||
`depends` text COMMENT '上游依赖标识',
|
|
||||||
`element_type` varchar(255) DEFAULT NULL COMMENT 'varchar,double,bigint,int,array',
|
|
||||||
`default_value` varchar(255) DEFAULT NULL COMMENT '默认值',
|
|
||||||
`outlier` varchar(255) DEFAULT NULL COMMENT '异常值',
|
|
||||||
`frequency` varchar(255) DEFAULT NULL COMMENT '变化频率, UNKNOWN, HIGH, LOW',
|
|
||||||
`created_at` datetime DEFAULT NULL,
|
|
||||||
`created_by` varchar(100) DEFAULT NULL,
|
|
||||||
`updated_at` datetime DEFAULT NULL,
|
|
||||||
`updated_by` varchar(100) NOT NULL,
|
|
||||||
`description` mediumtext COMMENT '备注说明',
|
|
||||||
`status` int(11) NOT NULL DEFAULT '1' COMMENT '0-废弃,1-使用中',
|
|
||||||
PRIMARY KEY (`id`, `type`, `materialization_id`)
|
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
|
||||||
|
|
||||||
CREATE TABLE `s2_materialization_record`
|
|
||||||
(
|
|
||||||
`id` bigint(11) NOT NULL AUTO_INCREMENT COMMENT '主键id',
|
|
||||||
`materialization_id` bigint(20) NOT NULL COMMENT '物化配置ID',
|
|
||||||
`element_type` varchar(255) NOT NULL COMMENT 'element类型 metric、dimension',
|
|
||||||
`element_id` bigint(20) DEFAULT NULL COMMENT '数据名字: 例如标签名、指标名',
|
|
||||||
`element_name` varchar(255) NOT NULL COMMENT 'element 名称',
|
|
||||||
`data_time` varchar(64) DEFAULT NULL COMMENT '数据时间',
|
|
||||||
`state` varchar(255) DEFAULT NULL COMMENT '任务运行状态',
|
|
||||||
`task_id` varchar(255) DEFAULT NULL COMMENT '任务id',
|
|
||||||
`created_at` datetime DEFAULT NULL,
|
|
||||||
`updated_at` datetime DEFAULT NULL,
|
|
||||||
`created_by` varchar(100) DEFAULT NULL,
|
|
||||||
`updated_by` varchar(100) NOT NULL,
|
|
||||||
`retry_count` bigint(20) NOT NULL DEFAULT '0',
|
|
||||||
`source_count` bigint(20) NOT NULL DEFAULT '0',
|
|
||||||
`sink_count` bigint(20) NOT NULL DEFAULT '0',
|
|
||||||
`message` text COMMENT '信息',
|
|
||||||
PRIMARY KEY (`id`),
|
|
||||||
UNIQUE KEY `uq_id` (`materialization_id`,`element_type`,`element_id`,`data_time`)
|
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
|
|
||||||
|
|
||||||
CREATE TABLE s2_sys_parameter
|
CREATE TABLE s2_sys_parameter
|
||||||
(
|
(
|
||||||
id int primary key AUTO_INCREMENT COMMENT '主键id',
|
id int primary key AUTO_INCREMENT COMMENT '主键id',
|
||||||
|
|||||||
@@ -466,67 +466,6 @@ COMMENT ON TABLE song IS 'song';
|
|||||||
|
|
||||||
-- benchmark
|
-- benchmark
|
||||||
|
|
||||||
create table s2_materialization
|
|
||||||
(
|
|
||||||
id int AUTO_INCREMENT ,
|
|
||||||
name varchar(255) not null,
|
|
||||||
materialized_type varchar(255) not null ,
|
|
||||||
update_cycle varchar(255) ,
|
|
||||||
model_id bigint ,
|
|
||||||
database_id bigint not null ,
|
|
||||||
level int not null default 0 ,
|
|
||||||
status int not null default 1 ,
|
|
||||||
destination_table varchar(255) not null ,
|
|
||||||
date_info varchar(255) null ,
|
|
||||||
entities varchar(255) null ,
|
|
||||||
principals varchar(255) DEFAULT NULL ,
|
|
||||||
created_at TIMESTAMP null,
|
|
||||||
created_by varchar(100) null,
|
|
||||||
updated_at TIMESTAMP null,
|
|
||||||
updated_by varchar(100) not null,
|
|
||||||
description varchar(255) null,
|
|
||||||
primary key (id)
|
|
||||||
) ;
|
|
||||||
|
|
||||||
create table s2_materialization_element
|
|
||||||
(
|
|
||||||
id bigint not null ,
|
|
||||||
type varchar(255) not null ,
|
|
||||||
materialization_id bigint not null ,
|
|
||||||
depends varchar(255) DEFAULT NULL,
|
|
||||||
element_type varchar(255) DEFAULT NULL ,
|
|
||||||
default_value varchar(255) DEFAULT NULL ,
|
|
||||||
outlier varchar(255) DEFAULT NULL ,
|
|
||||||
frequency varchar(255) DEFAULT NULL ,
|
|
||||||
created_at TIMESTAMP null,
|
|
||||||
created_by varchar(100) null,
|
|
||||||
updated_at TIMESTAMP null,
|
|
||||||
updated_by varchar(100) not null,
|
|
||||||
description varchar(255) null ,
|
|
||||||
status int not null default 1 ,
|
|
||||||
PRIMARY KEY (id, type, materialization_id)
|
|
||||||
) ;
|
|
||||||
|
|
||||||
CREATE TABLE s2_materialization_record
|
|
||||||
(
|
|
||||||
`id` bigint NOT NULL AUTO_INCREMENT ,
|
|
||||||
`materialization_id` bigint NOT null ,
|
|
||||||
`element_type` varchar(255) not null ,
|
|
||||||
`element_id` bigint DEFAULT NULL ,
|
|
||||||
`element_name` varchar(255) not null ,
|
|
||||||
`data_time` varchar(64) DEFAULT NULL ,
|
|
||||||
`state` varchar(255) DEFAULT NULL ,
|
|
||||||
`task_id` varchar(255) DEFAULT NULL,
|
|
||||||
`created_at` TIMESTAMP null,
|
|
||||||
`updated_at` TIMESTAMP null,
|
|
||||||
`created_by` varchar(100) null,
|
|
||||||
`updated_by` varchar(100) not null,
|
|
||||||
`retry_count` bigint NOT NULL default 0,
|
|
||||||
`source_count` bigint NOT NULL default 0,
|
|
||||||
`sink_count` bigint NOT NULL default 0,
|
|
||||||
`message` varchar(255) ,
|
|
||||||
PRIMARY KEY (`id`)
|
|
||||||
);
|
|
||||||
|
|
||||||
CREATE TABLE s2_sys_parameter
|
CREATE TABLE s2_sys_parameter
|
||||||
(
|
(
|
||||||
|
|||||||
Reference in New Issue
Block a user