[improvement][project] supersonic 0.7.0 version backend update (#20)

Co-authored-by: kanedai <kanedai@tencent.com>
This commit is contained in:
daikon
2023-07-31 11:09:58 +08:00
committed by GitHub
parent 078a81038f
commit e2b2d31429
675 changed files with 13089 additions and 13536 deletions

View File

@@ -0,0 +1,100 @@
package com.tencent.supersonic.semantic.model.application;
import com.tencent.supersonic.semantic.api.model.pojo.ItemDateFilter;
import com.tencent.supersonic.semantic.api.model.yaml.DatasourceYamlTpl;
import com.tencent.supersonic.semantic.api.model.yaml.DimensionYamlTpl;
import com.tencent.supersonic.semantic.api.model.yaml.MetricYamlTpl;
import com.tencent.supersonic.semantic.api.model.response.DatabaseResp;
import com.tencent.supersonic.semantic.api.model.response.DatasourceResp;
import com.tencent.supersonic.semantic.api.model.response.DimensionResp;
import com.tencent.supersonic.semantic.api.model.response.ItemDateResp;
import com.tencent.supersonic.semantic.api.model.response.MetricResp;
import com.tencent.supersonic.semantic.model.domain.Catalog;
import com.tencent.supersonic.semantic.model.domain.DatasourceService;
import com.tencent.supersonic.semantic.model.domain.DimensionService;
import com.tencent.supersonic.semantic.model.domain.DomainService;
import com.tencent.supersonic.semantic.model.domain.MetricService;
import com.tencent.supersonic.semantic.model.domain.dataobject.DatabaseDO;
import com.tencent.supersonic.semantic.model.domain.repository.DatabaseRepository;
import com.tencent.supersonic.semantic.model.domain.utils.DatabaseConverter;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
@Slf4j
@Component
public class CatalogImpl implements Catalog {
private final DatabaseRepository databaseRepository;
private final DomainService domainService;
private final DimensionService dimensionService;
private final DatasourceService datasourceService;
private final MetricService metricService;
public CatalogImpl(DatabaseRepository databaseRepository,
DomainService domainService, DimensionService dimensionService,
DatasourceService datasourceService,
MetricService metricService) {
this.databaseRepository = databaseRepository;
this.domainService = domainService;
this.dimensionService = dimensionService;
this.datasourceService = datasourceService;
this.metricService = metricService;
}
public DatabaseResp getDatabase(Long id) {
DatabaseDO databaseDO = databaseRepository.getDatabase(id);
return DatabaseConverter.convert(databaseDO);
}
public DatabaseResp getDatabaseByDomainId(Long domainId) {
List<DatabaseDO> databaseDOS = databaseRepository.getDatabaseByDomainId(domainId);
Optional<DatabaseDO> databaseDO = databaseDOS.stream().findFirst();
return databaseDO.map(DatabaseConverter::convert).orElse(null);
}
@Override
public String getDomainFullPath(Long domainId) {
return domainService.getDomainFullPath(domainId);
}
@Override
public Map<Long, String> getDomainFullPath() {
return domainService.getDomainFullPath();
}
@Override
public DimensionResp getDimension(String bizName, Long domainId) {
return dimensionService.getDimension(bizName, domainId);
}
@Override
public void getModelYamlTplByDomainIds(Set<Long> domainIds, Map<String, List<DimensionYamlTpl>> dimensionYamlMap,
List<DatasourceYamlTpl> datasourceYamlTplList, List<MetricYamlTpl> metricYamlTplList) {
datasourceService.getModelYamlTplByDomainIds(domainIds, dimensionYamlMap, datasourceYamlTplList,
metricYamlTplList);
}
@Override
public List<DimensionResp> getDimensions(Long domainId) {
return dimensionService.getDimensions(domainId);
}
@Override
public List<DatasourceResp> getDatasourceList(Long domainId) {
return datasourceService.getDatasourceList(domainId);
}
@Override
public List<MetricResp> getMetrics(Long domainId) {
return metricService.getMetrics(domainId);
}
@Override
public ItemDateResp getItemDate(ItemDateFilter dimension, ItemDateFilter metric) {
return datasourceService.getItemDate(dimension, metric);
}
}

View File

@@ -0,0 +1,133 @@
package com.tencent.supersonic.semantic.model.application;
import com.tencent.supersonic.auth.api.authentication.pojo.User;
import com.tencent.supersonic.semantic.api.model.request.DatabaseReq;
import com.tencent.supersonic.semantic.api.model.response.DatabaseResp;
import com.tencent.supersonic.semantic.api.model.response.QueryResultWithSchemaResp;
import com.tencent.supersonic.semantic.api.model.response.SqlParserResp;
import com.tencent.supersonic.semantic.model.domain.adaptor.engineadapter.EngineAdaptor;
import com.tencent.supersonic.semantic.model.domain.adaptor.engineadapter.EngineAdaptorFactory;
import com.tencent.supersonic.semantic.model.domain.dataobject.DatabaseDO;
import com.tencent.supersonic.semantic.model.domain.repository.DatabaseRepository;
import com.tencent.supersonic.semantic.model.domain.utils.DatabaseConverter;
import com.tencent.supersonic.semantic.model.domain.utils.JdbcDataSourceUtils;
import com.tencent.supersonic.semantic.model.domain.utils.SqlUtils;
import com.tencent.supersonic.semantic.model.domain.DatabaseService;
import com.tencent.supersonic.semantic.model.domain.pojo.Database;
import java.util.List;
import java.util.Optional;
import lombok.extern.slf4j.Slf4j;
import org.apache.logging.log4j.util.Strings;
import org.springframework.stereotype.Service;
@Slf4j
@Service
public class DatabaseServiceImpl implements DatabaseService {
private final SqlUtils sqlUtils;
private DatabaseRepository databaseRepository;
public DatabaseServiceImpl(DatabaseRepository databaseRepository, SqlUtils sqlUtils) {
this.databaseRepository = databaseRepository;
this.sqlUtils = sqlUtils;
}
@Override
public boolean testConnect(DatabaseReq databaseReq, User user) {
Database database = DatabaseConverter.convert(databaseReq, user);
return JdbcDataSourceUtils.testDatabase(database);
}
@Override
public DatabaseResp createOrUpdateDatabase(DatabaseReq databaseReq, User user) {
Database database = DatabaseConverter.convert(databaseReq, user);
Optional<DatabaseDO> databaseDOOptional = getDatabaseDO(databaseReq.getDomainId());
if (databaseDOOptional.isPresent()) {
DatabaseDO databaseDO = DatabaseConverter.convert(database, databaseDOOptional.get());
databaseRepository.updateDatabase(databaseDO);
return DatabaseConverter.convert(databaseDO);
}
DatabaseDO databaseDO = DatabaseConverter.convert(database);
databaseRepository.createDatabase(databaseDO);
return DatabaseConverter.convert(databaseDO);
}
@Override
public DatabaseResp getDatabase(Long id) {
DatabaseDO databaseDO = databaseRepository.getDatabase(id);
return DatabaseConverter.convert(databaseDO);
}
@Override
// one domain only has one database
public DatabaseResp getDatabaseByDomainId(Long domainId) {
Optional<DatabaseDO> databaseDO = getDatabaseDO(domainId);
return databaseDO.map(DatabaseConverter::convert).orElse(null);
}
@Override
public QueryResultWithSchemaResp executeSql(String sql, Long domainId) {
DatabaseResp databaseResp = getDatabaseByDomainId(domainId);
return executeSql(sql, databaseResp);
}
@Override
public QueryResultWithSchemaResp executeSql(String sql, DatabaseResp databaseResp) {
return queryWithColumns(sql, databaseResp);
}
@Override
public QueryResultWithSchemaResp queryWithColumns(SqlParserResp sqlParser) {
if (Strings.isEmpty(sqlParser.getSourceId())) {
log.warn("data base id is empty");
return null;
}
DatabaseResp databaseResp = getDatabase(Long.parseLong(sqlParser.getSourceId()));
log.info("database info:{}", databaseResp);
return queryWithColumns(sqlParser.getSql(), databaseResp);
}
private QueryResultWithSchemaResp queryWithColumns(String sql, DatabaseResp databaseResp) {
QueryResultWithSchemaResp queryResultWithColumns = new QueryResultWithSchemaResp();
SqlUtils sqlUtils = this.sqlUtils.init(databaseResp);
log.info("query SQL: {}", sql);
sqlUtils.queryInternal(sql, queryResultWithColumns);
return queryResultWithColumns;
}
private Optional<DatabaseDO> getDatabaseDO(Long domainId) {
List<DatabaseDO> databaseDOS = databaseRepository.getDatabaseByDomainId(domainId);
return databaseDOS.stream().findFirst();
}
@Override
public QueryResultWithSchemaResp getDbNames(Long id) {
DatabaseResp databaseResp = getDatabase(id);
EngineAdaptor engineAdaptor = EngineAdaptorFactory.getEngineAdaptor(databaseResp.getType());
String metaQueryTpl = engineAdaptor.getDbMetaQueryTpl();
return queryWithColumns(metaQueryTpl, databaseResp);
}
@Override
public QueryResultWithSchemaResp getTables(Long id, String db) {
DatabaseResp databaseResp = getDatabase(id);
EngineAdaptor engineAdaptor = EngineAdaptorFactory.getEngineAdaptor(databaseResp.getType());
String metaQueryTpl = engineAdaptor.getTableMetaQueryTpl();
String metaQuerySql = String.format(metaQueryTpl, db);
return queryWithColumns(metaQuerySql, databaseResp);
}
@Override
public QueryResultWithSchemaResp getColumns(Long id, String db, String table) {
DatabaseResp databaseResp = getDatabase(id);
EngineAdaptor engineAdaptor = EngineAdaptorFactory.getEngineAdaptor(databaseResp.getType());
String metaQueryTpl = engineAdaptor.getColumnMetaQueryTpl();
String metaQuerySql = String.format(metaQueryTpl, db, table);
return queryWithColumns(metaQuerySql, databaseResp);
}
}

View File

@@ -0,0 +1,384 @@
package com.tencent.supersonic.semantic.model.application;
import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Lists;
import com.tencent.supersonic.auth.api.authentication.pojo.User;
import com.tencent.supersonic.common.util.JsonUtil;
import com.tencent.supersonic.semantic.api.model.pojo.DatasourceDetail;
import com.tencent.supersonic.semantic.api.model.pojo.Dim;
import com.tencent.supersonic.semantic.api.model.pojo.ItemDateFilter;
import com.tencent.supersonic.semantic.api.model.pojo.Measure;
import com.tencent.supersonic.semantic.api.model.yaml.DatasourceYamlTpl;
import com.tencent.supersonic.semantic.api.model.yaml.DimensionYamlTpl;
import com.tencent.supersonic.semantic.api.model.yaml.MetricYamlTpl;
import com.tencent.supersonic.semantic.api.model.request.DatasourceRelaReq;
import com.tencent.supersonic.semantic.api.model.request.DatasourceReq;
import com.tencent.supersonic.semantic.api.model.request.DateInfoReq;
import com.tencent.supersonic.semantic.api.model.request.DimensionReq;
import com.tencent.supersonic.semantic.api.model.request.MetricReq;
import com.tencent.supersonic.semantic.api.model.response.DatabaseResp;
import com.tencent.supersonic.semantic.api.model.response.DatasourceRelaResp;
import com.tencent.supersonic.semantic.api.model.response.DatasourceResp;
import com.tencent.supersonic.semantic.api.model.response.DimensionResp;
import com.tencent.supersonic.semantic.api.model.response.ItemDateResp;
import com.tencent.supersonic.semantic.api.model.response.MeasureResp;
import com.tencent.supersonic.semantic.api.model.response.MetricResp;
import com.tencent.supersonic.semantic.model.domain.DatabaseService;
import com.tencent.supersonic.semantic.model.domain.DatasourceService;
import com.tencent.supersonic.semantic.model.domain.DimensionService;
import com.tencent.supersonic.semantic.model.domain.MetricService;
import com.tencent.supersonic.semantic.model.domain.dataobject.DatasourceDO;
import com.tencent.supersonic.semantic.model.domain.dataobject.DatasourceRelaDO;
import com.tencent.supersonic.semantic.model.domain.dataobject.DateInfoDO;
import com.tencent.supersonic.semantic.model.domain.manager.DatasourceYamlManager;
import com.tencent.supersonic.semantic.model.domain.manager.DimensionYamlManager;
import com.tencent.supersonic.semantic.model.domain.manager.MetricYamlManager;
import com.tencent.supersonic.semantic.model.domain.pojo.Datasource;
import com.tencent.supersonic.semantic.model.domain.repository.DatasourceRepository;
import com.tencent.supersonic.semantic.model.domain.repository.DateInfoRepository;
import com.tencent.supersonic.semantic.model.domain.utils.DatasourceConverter;
import com.tencent.supersonic.semantic.model.domain.utils.DimensionConverter;
import com.tencent.supersonic.semantic.model.domain.utils.MetricConverter;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
import lombok.extern.slf4j.Slf4j;
import org.apache.logging.log4j.util.Strings;
import org.springframework.beans.BeanUtils;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
@Service
@Slf4j
public class DatasourceServiceImpl implements DatasourceService {
private DatasourceRepository datasourceRepository;
private DatabaseService databaseService;
private DimensionService dimensionService;
private MetricService metricService;
private DateInfoRepository dateInfoRepository;
public DatasourceServiceImpl(DatasourceRepository datasourceRepository,
DatabaseService databaseService,
@Lazy DimensionService dimensionService,
@Lazy MetricService metricService,
DateInfoRepository dateInfoRepository) {
this.datasourceRepository = datasourceRepository;
this.databaseService = databaseService;
this.dimensionService = dimensionService;
this.metricService = metricService;
this.dateInfoRepository = dateInfoRepository;
}
@Override
public DatasourceResp createDatasource(DatasourceReq datasourceReq, User user) throws Exception {
preCheck(datasourceReq);
Datasource datasource = DatasourceConverter.convert(datasourceReq);
log.info("[create datasource] object:{}", JSONObject.toJSONString(datasource));
saveDatasource(datasource, user);
Optional<DatasourceResp> datasourceDescOptional = getDatasource(datasourceReq.getDomainId(),
datasourceReq.getBizName());
if (!datasourceDescOptional.isPresent()) {
throw new RuntimeException("create datasource failed");
}
DatasourceResp datasourceDesc = datasourceDescOptional.get();
datasource.setId(datasourceDesc.getId());
batchCreateDimension(datasource, user);
batchCreateMetric(datasource, user);
return datasourceDesc;
}
@Override
public DatasourceResp updateDatasource(DatasourceReq datasourceReq, User user) throws Exception {
preCheck(datasourceReq);
Datasource datasource = DatasourceConverter.convert(datasourceReq);
log.info("[update datasource] object:{}", JSONObject.toJSONString(datasource));
batchCreateDimension(datasource, user);
batchCreateMetric(datasource, user);
DatasourceDO datasourceDO = updateDatasource(datasource, user);
return DatasourceConverter.convert(datasourceDO);
}
private DatasourceDO updateDatasource(Datasource datasource, User user) {
DatasourceDO datasourceDO = datasourceRepository.getDatasourceById(datasource.getId());
datasource.updatedBy(user.getName());
datasourceRepository.updateDatasource(DatasourceConverter.convert(datasourceDO, datasource));
return datasourceDO;
}
@Override
public String getSourceBizNameById(Long id) {
DatasourceDO datasourceDO = getDatasourceById(id);
if (datasourceDO == null) {
String message = String.format("datasource with id:%s not exsit", id);
throw new RuntimeException(message);
}
return datasourceDO.getBizName();
}
private DatasourceDO getDatasourceById(Long id) {
return datasourceRepository.getDatasourceById(id);
}
@Override
public List<MeasureResp> getMeasureListOfDomain(Long domainId) {
List<DatasourceResp> datasourceDescs = getDatasourceList(domainId);
List<MeasureResp> measureDescs = Lists.newArrayList();
if (!CollectionUtils.isEmpty(datasourceDescs)) {
for (DatasourceResp datasourceDesc : datasourceDescs) {
DatasourceDetail datasourceDetail = datasourceDesc.getDatasourceDetail();
List<Measure> measures = datasourceDetail.getMeasures();
if (!CollectionUtils.isEmpty(measures)) {
measureDescs.addAll(
measures.stream().map(measure -> DatasourceConverter.convert(measure, datasourceDesc))
.collect(Collectors.toList()));
}
}
}
return measureDescs;
}
private void batchCreateDimension(Datasource datasource, User user) throws Exception {
List<DimensionReq> dimensionReqs = DatasourceConverter.convertDimensionList(datasource);
dimensionService.createDimensionBatch(dimensionReqs, user);
}
private void batchCreateMetric(Datasource datasource, User user) throws Exception {
List<MetricReq> exprMetricReqs = DatasourceConverter.convertMetricList(datasource);
metricService.createMetricBatch(exprMetricReqs, user);
}
private Optional<DatasourceResp> getDatasource(Long domainId, String bizName) {
List<DatasourceResp> datasourceDescs = getDatasourceList(domainId);
if (CollectionUtils.isEmpty(datasourceDescs)) {
return Optional.empty();
}
for (DatasourceResp datasourceDesc : datasourceDescs) {
if (datasourceDesc.getBizName().equals(bizName)) {
return Optional.of(datasourceDesc);
}
}
return Optional.empty();
}
//保存并获取自增ID
private void saveDatasource(Datasource datasource, User user) {
DatasourceDO datasourceDO = DatasourceConverter.convert(datasource, user);
log.info("[save datasource] datasourceDO:{}", JSONObject.toJSONString(datasourceDO));
datasourceRepository.createDatasource(datasourceDO);
datasource.setId(datasourceDO.getId());
}
private void preCheck(DatasourceReq datasourceReq) {
List<Dim> dims = datasourceReq.getDimensions();
if (CollectionUtils.isEmpty(dims)) {
throw new RuntimeException("lack of dimension");
}
}
@Override
public List<DatasourceResp> getDatasourceList(Long domainId) {
return DatasourceConverter.convertList(datasourceRepository.getDatasourceList(domainId));
}
@Override
public List<DatasourceResp> getDatasourceList() {
return DatasourceConverter.convertList(datasourceRepository.getDatasourceList());
}
@Override
public List<DatasourceResp> getDatasourceListNoMeasurePrefix(Long domainId) {
List<DatasourceResp> datasourceResps = getDatasourceList(domainId);
for (DatasourceResp datasourceResp : datasourceResps) {
if (!CollectionUtils.isEmpty(datasourceResp.getDatasourceDetail().getMeasures())) {
for (Measure measure : datasourceResp.getDatasourceDetail().getMeasures()) {
measure.setBizName(Optional.ofNullable(measure.getBizName()).orElse("")
.replace(getDatasourcePrefix(datasourceResp.getBizName()), ""));
}
}
}
return datasourceResps;
}
private String getDatasourcePrefix(String datasourceBizName) {
return String.format("%s_", datasourceBizName);
}
@Override
public Map<Long, DatasourceResp> getDatasourceMap() {
Map<Long, DatasourceResp> map = new HashMap<>();
List<DatasourceResp> datasourceDescs = getDatasourceList();
if (CollectionUtils.isEmpty(datasourceDescs)) {
return map;
}
return datasourceDescs.stream().collect(Collectors.toMap(DatasourceResp::getId, a -> a, (k1, k2) -> k1));
}
@Override
public void deleteDatasource(Long id) throws Exception {
DatasourceDO datasourceDO = datasourceRepository.getDatasourceById(id);
if (datasourceDO == null) {
return;
}
checkDelete(datasourceDO.getDomainId(), id);
datasourceRepository.deleteDatasource(id);
}
private void checkDelete(Long domainId, Long datasourceId) {
List<MetricResp> metricResps = metricService.getMetrics(domainId, datasourceId);
List<DimensionResp> dimensionResps = dimensionService.getDimensionsByDatasource(datasourceId);
if (!CollectionUtils.isEmpty(metricResps) || !CollectionUtils.isEmpty(dimensionResps)) {
throw new RuntimeException("exist dimension or metric on this datasource, please check");
}
}
private List<DatasourceRelaResp> convertDatasourceRelaList(List<DatasourceRelaDO> datasourceRelaDOS) {
List<DatasourceRelaResp> datasourceRelaResps = Lists.newArrayList();
if (CollectionUtils.isEmpty(datasourceRelaDOS)) {
return datasourceRelaResps;
}
return datasourceRelaDOS.stream().map(DatasourceConverter::convert).collect(Collectors.toList());
}
@Override
public DatasourceRelaResp createOrUpdateDatasourceRela(DatasourceRelaReq datasourceRelaReq, User user) {
if (datasourceRelaReq.getId() == null) {
DatasourceRelaDO datasourceRelaDO = new DatasourceRelaDO();
BeanUtils.copyProperties(datasourceRelaReq, datasourceRelaDO);
datasourceRelaDO.setCreatedAt(new Date());
datasourceRelaDO.setCreatedBy(user.getName());
datasourceRelaDO.setUpdatedAt(new Date());
datasourceRelaDO.setUpdatedBy(user.getName());
datasourceRepository.createDatasourceRela(datasourceRelaDO);
return DatasourceConverter.convert(datasourceRelaDO);
}
Long id = datasourceRelaReq.getId();
DatasourceRelaDO datasourceRelaDO = datasourceRepository.getDatasourceRelaById(id);
BeanUtils.copyProperties(datasourceRelaDO, datasourceRelaReq);
datasourceRelaDO.setUpdatedAt(new Date());
datasourceRelaDO.setUpdatedBy(user.getName());
datasourceRepository.updateDatasourceRela(datasourceRelaDO);
return DatasourceConverter.convert(datasourceRelaDO);
}
@Override
public List<DatasourceRelaResp> getDatasourceRelaList(Long domainId) {
return convertDatasourceRelaList(datasourceRepository.getDatasourceRelaList(domainId));
}
@Override
public void deleteDatasourceRela(Long id) {
datasourceRepository.deleteDatasourceRela(id);
}
@Override
public ItemDateResp getItemDate(ItemDateFilter dimension, ItemDateFilter metric) {
List<DateInfoReq> itemDates = new ArrayList<>();
List<DateInfoDO> dimensions = dateInfoRepository.getDateInfos(dimension);
List<DateInfoDO> metrics = dateInfoRepository.getDateInfos(metric);
log.info("getDateDate, dimension:{}, dimensions dateInfo:{}", dimension, dimensions);
log.info("getDateDate, metric:{}, metrics dateInfo:{}", metric, metrics);
itemDates.addAll(convert(dimensions));
itemDates.addAll(convert(metrics));
ItemDateResp itemDateDescriptor = calculateDateInternal(itemDates);
log.info("itemDateDescriptor:{}", itemDateDescriptor);
return itemDateDescriptor;
}
private List<DateInfoReq> convert(List<DateInfoDO> dateInfoDOList) {
List<DateInfoReq> dateInfoCommendList = new ArrayList<>();
dateInfoDOList.stream().forEach(dateInfoDO -> {
DateInfoReq dateInfoCommend = new DateInfoReq();
BeanUtils.copyProperties(dateInfoDO, dateInfoCommend);
dateInfoCommend.setUnavailableDateList(JsonUtil.toList(dateInfoDO.getUnavailableDateList(), String.class));
dateInfoCommendList.add(dateInfoCommend);
});
return dateInfoCommendList;
}
private ItemDateResp calculateDateInternal(List<DateInfoReq> itemDates) {
if (CollectionUtils.isEmpty(itemDates)) {
log.warn("itemDates is empty!");
return null;
}
String dateFormat = itemDates.get(0).getDateFormat();
String startDate = itemDates.get(0).getStartDate();
String endDate = itemDates.get(0).getEndDate();
String datePeriod = itemDates.get(0).getDatePeriod();
List<String> unavailableDateList = itemDates.get(0).getUnavailableDateList();
for (DateInfoReq item : itemDates) {
String startDate1 = item.getStartDate();
String endDate1 = item.getEndDate();
List<String> unavailableDateList1 = item.getUnavailableDateList();
if (Strings.isNotEmpty(startDate1) && startDate1.compareTo(startDate) > 0) {
startDate = startDate1;
}
if (Strings.isNotEmpty(endDate1) && endDate1.compareTo(endDate) < 0) {
endDate = endDate1;
}
if (!CollectionUtils.isEmpty(unavailableDateList1)) {
unavailableDateList.addAll(unavailableDateList1);
}
}
return new ItemDateResp(dateFormat, startDate, endDate, datePeriod, unavailableDateList);
}
@Override
public void getModelYamlTplByDomainIds(Set<Long> domainIds, Map<String, List<DimensionYamlTpl>> dimensionYamlMap,
List<DatasourceYamlTpl> datasourceYamlTplList, List<MetricYamlTpl> metricYamlTplList) {
for (Long domainId : domainIds) {
List<DatasourceResp> datasourceResps = getDatasourceList(domainId);
List<MetricResp> metricResps = metricService.getMetrics(domainId);
metricYamlTplList.addAll(MetricYamlManager.convert2YamlObj(MetricConverter.metricInfo2Metric(metricResps)));
DatabaseResp databaseResp = databaseService.getDatabaseByDomainId(domainId);
List<DimensionResp> dimensionResps = dimensionService.getDimensions(domainId);
for (DatasourceResp datasourceResp : datasourceResps) {
datasourceYamlTplList.add(DatasourceYamlManager.convert2YamlObj(
DatasourceConverter.datasourceInfo2Datasource(datasourceResp), databaseResp));
if (!dimensionYamlMap.containsKey(datasourceResp.getBizName())) {
dimensionYamlMap.put(datasourceResp.getBizName(), new ArrayList<>());
}
List<DimensionResp> dimensionRespList = dimensionResps.stream()
.filter(d -> d.getDatasourceBizName().equalsIgnoreCase(datasourceResp.getBizName()))
.collect(Collectors.toList());
dimensionYamlMap.get(datasourceResp.getBizName()).addAll(DimensionYamlManager.convert2DimensionYaml(
DimensionConverter.dimensionInfo2Dimension(dimensionRespList)));
}
}
}
}

View File

@@ -0,0 +1,257 @@
package com.tencent.supersonic.semantic.model.application;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.google.common.collect.Lists;
import com.tencent.supersonic.auth.api.authentication.pojo.User;
import com.tencent.supersonic.semantic.api.model.request.DimensionReq;
import com.tencent.supersonic.semantic.api.model.request.PageDimensionReq;
import com.tencent.supersonic.semantic.api.model.response.DatasourceResp;
import com.tencent.supersonic.semantic.api.model.response.DimensionResp;
import com.tencent.supersonic.common.pojo.enums.SensitiveLevelEnum;
import com.tencent.supersonic.semantic.model.domain.dataobject.DimensionDO;
import com.tencent.supersonic.semantic.model.domain.repository.DimensionRepository;
import com.tencent.supersonic.semantic.model.domain.utils.DimensionConverter;
import com.tencent.supersonic.semantic.model.domain.DatasourceService;
import com.tencent.supersonic.semantic.model.domain.DimensionService;
import com.tencent.supersonic.semantic.model.domain.DomainService;
import com.tencent.supersonic.semantic.model.domain.pojo.Dimension;
import com.tencent.supersonic.semantic.model.domain.pojo.DimensionFilter;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
@Service
@Slf4j
public class DimensionServiceImpl implements DimensionService {
private DimensionRepository dimensionRepository;
private DatasourceService datasourceService;
private DomainService domainService;
public DimensionServiceImpl(DimensionRepository dimensionRepository,
DomainService domainService,
DatasourceService datasourceService) {
this.domainService = domainService;
this.dimensionRepository = dimensionRepository;
this.datasourceService = datasourceService;
}
@Override
public void createDimension(DimensionReq dimensionReq, User user) {
checkExist(Lists.newArrayList(dimensionReq));
Dimension dimension = DimensionConverter.convert(dimensionReq);
log.info("[create dimension] object:{}", JSONObject.toJSONString(dimension));
dimension.createdBy(user.getName());
saveDimension(dimension);
}
@Override
public void createDimensionBatch(List<DimensionReq> dimensionReqs, User user) {
if (CollectionUtils.isEmpty(dimensionReqs)) {
return;
}
Long domainId = dimensionReqs.get(0).getDomainId();
List<DimensionResp> dimensionResps = getDimensions(domainId);
Map<String, DimensionResp> dimensionRespMap = dimensionResps.stream()
.collect(Collectors.toMap(DimensionResp::getBizName, a -> a, (k1, k2) -> k1));
List<Dimension> dimensions = dimensionReqs.stream().map(DimensionConverter::convert)
.collect(Collectors.toList());
List<Dimension> dimensionToInsert = dimensions.stream()
.filter(dimension -> !dimensionRespMap.containsKey(dimension.getBizName()))
.collect(Collectors.toList());
log.info("[create dimension] object:{}", JSONObject.toJSONString(dimensions));
saveDimensionBatch(dimensionToInsert, user);
}
@Override
public void updateDimension(DimensionReq dimensionReq, User user) {
Dimension dimension = DimensionConverter.convert(dimensionReq);
dimension.updatedBy(user.getName());
log.info("[update dimension] object:{}", JSONObject.toJSONString(dimension));
updateDimension(dimension);
}
protected void updateDimension(Dimension dimension) {
DimensionDO dimensionDO = dimensionRepository.getDimensionById(dimension.getId());
dimensionRepository.updateDimension(DimensionConverter.convert(dimensionDO, dimension));
}
@Override
public DimensionResp getDimension(String bizName, Long domainId) {
List<DimensionResp> dimensionResps = getDimensions(domainId);
if (CollectionUtils.isEmpty(dimensionResps)) {
return null;
}
for (DimensionResp dimensionResp : dimensionResps) {
if (dimensionResp.getBizName().equalsIgnoreCase(bizName)) {
return dimensionResp;
}
}
return null;
}
@Override
public PageInfo<DimensionResp> queryDimension(PageDimensionReq pageDimensionReq) {
DimensionFilter dimensionFilter = new DimensionFilter();
BeanUtils.copyProperties(pageDimensionReq, dimensionFilter);
PageInfo<DimensionDO> dimensionDOPageInfo = PageHelper.startPage(pageDimensionReq.getCurrent(),
pageDimensionReq.getPageSize())
.doSelectPageInfo(() -> queryDimension(dimensionFilter));
PageInfo<DimensionResp> pageInfo = new PageInfo<>();
BeanUtils.copyProperties(dimensionDOPageInfo, pageInfo);
pageInfo.setList(convertList(dimensionDOPageInfo.getList(), datasourceService.getDatasourceMap()));
return pageInfo;
}
private List<DimensionDO> queryDimension(DimensionFilter dimensionFilter) {
return dimensionRepository.getDimension(dimensionFilter);
}
@Override
public List<DimensionResp> getDimensions(List<Long> ids) {
List<DimensionResp> dimensionResps = Lists.newArrayList();
List<DimensionDO> dimensionDOS = dimensionRepository.getDimensionListByIds(ids);
Map<Long, String> fullDomainPathMap = domainService.getDomainFullPath();
if (!CollectionUtils.isEmpty(dimensionDOS)) {
dimensionResps = dimensionDOS.stream()
.map(dimensionDO -> DimensionConverter.convert2DimensionResp(dimensionDO, fullDomainPathMap,
new HashMap<>()))
.collect(Collectors.toList());
}
return dimensionResps;
}
@Override
public List<DimensionResp> getDimensions(Long domainId) {
return convertList(getDimensionDOS(domainId), datasourceService.getDatasourceMap());
}
@Override
public List<DimensionResp> getDimensions() {
return convertList(getDimensionDOS(), datasourceService.getDatasourceMap());
}
@Override
public List<DimensionResp> getDimensionsByDatasource(Long datasourceId) {
List<DimensionResp> dimensionResps = Lists.newArrayList();
List<DimensionDO> dimensionDOS = dimensionRepository.getDimensionListOfDatasource(datasourceId);
if (!CollectionUtils.isEmpty(dimensionDOS)) {
dimensionResps = dimensionDOS.stream()
.map(dimensionDO -> DimensionConverter.convert2DimensionResp(dimensionDO, new HashMap<>(),
new HashMap<>()))
.collect(Collectors.toList());
}
return dimensionResps;
}
private List<DimensionResp> convertList(List<DimensionDO> dimensionDOS,
Map<Long, DatasourceResp> datasourceRespMap) {
List<DimensionResp> dimensionResps = Lists.newArrayList();
Map<Long, String> fullDomainPathMap = domainService.getDomainFullPath();
if (!CollectionUtils.isEmpty(dimensionDOS)) {
dimensionResps = dimensionDOS.stream()
.map(dimensionDO -> DimensionConverter.convert2DimensionResp(dimensionDO, fullDomainPathMap,
datasourceRespMap))
.collect(Collectors.toList());
}
return dimensionResps;
}
@Override
public List<DimensionResp> getHighSensitiveDimension(Long domainId) {
List<DimensionResp> dimensionResps = getDimensions(domainId);
if (CollectionUtils.isEmpty(dimensionResps)) {
return dimensionResps;
}
return dimensionResps.stream()
.filter(dimensionResp -> SensitiveLevelEnum.HIGH.getCode().equals(dimensionResp.getSensitiveLevel()))
.collect(Collectors.toList());
}
protected List<DimensionDO> getDimensionDOS(Long domainId) {
return dimensionRepository.getDimensionListOfDomain(domainId);
}
protected List<DimensionDO> getDimensionDOS() {
return dimensionRepository.getDimensionList();
}
@Override
public List<DimensionResp> getAllHighSensitiveDimension() {
List<DimensionResp> dimensionResps = Lists.newArrayList();
List<DimensionDO> dimensionDOS = dimensionRepository.getAllDimensionList();
if (CollectionUtils.isEmpty(dimensionDOS)) {
return dimensionResps;
}
return convertList(dimensionDOS.stream()
.filter(dimensionDO -> SensitiveLevelEnum.HIGH.getCode().equals(dimensionDO.getSensitiveLevel()))
.collect(Collectors.toList()), new HashMap<>());
}
public void saveDimension(Dimension dimension) {
DimensionDO dimensionDO = DimensionConverter.convert2DimensionDO(dimension);
log.info("[save dimension] dimensionDO:{}", JSONObject.toJSONString(dimensionDO));
dimensionRepository.createDimension(dimensionDO);
dimension.setId(dimensionDO.getId());
}
private void saveDimensionBatch(List<Dimension> dimensions, User user) {
if (CollectionUtils.isEmpty(dimensions)) {
return;
}
dimensions = dimensions.stream().peek(dimension -> dimension.createdBy(user.getName()))
.collect(Collectors.toList());
List<DimensionDO> dimensionDOS = dimensions.stream()
.map(DimensionConverter::convert2DimensionDO).collect(Collectors.toList());
log.info("[save dimension] dimensionDO:{}", JSONObject.toJSONString(dimensionDOS));
dimensionRepository.createDimensionBatch(dimensionDOS);
}
@Override
public void deleteDimension(Long id) {
DimensionDO dimensionDO = dimensionRepository.getDimensionById(id);
if (dimensionDO == null) {
throw new RuntimeException(String.format("the dimension %s not exist", id));
}
dimensionRepository.deleteDimension(id);
}
private void checkExist(List<DimensionReq> dimensionReqs) {
Long domainId = dimensionReqs.get(0).getDomainId();
List<DimensionResp> dimensionResps = getDimensions(domainId);
for (DimensionReq dimensionReq : dimensionReqs) {
for (DimensionResp dimensionResp : dimensionResps) {
if (dimensionResp.getName().equalsIgnoreCase(dimensionReq.getBizName())) {
throw new RuntimeException(String.format("exist same dimension name:%s", dimensionReq.getName()));
}
if (dimensionResp.getBizName().equalsIgnoreCase(dimensionReq.getBizName())) {
throw new RuntimeException(
String.format("exist same dimension bizName:%s", dimensionReq.getBizName()));
}
}
}
}
}

View File

@@ -0,0 +1,327 @@
package com.tencent.supersonic.semantic.model.application;
import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Lists;
import com.tencent.supersonic.auth.api.authentication.pojo.User;
import com.tencent.supersonic.common.util.BeanMapper;
import com.tencent.supersonic.common.util.JsonUtil;
import com.tencent.supersonic.semantic.api.model.request.DomainReq;
import com.tencent.supersonic.semantic.api.model.request.DomainSchemaFilterReq;
import com.tencent.supersonic.semantic.api.model.request.DomainUpdateReq;
import com.tencent.supersonic.semantic.api.model.response.DatasourceResp;
import com.tencent.supersonic.semantic.api.model.response.DimSchemaResp;
import com.tencent.supersonic.semantic.api.model.response.DimensionResp;
import com.tencent.supersonic.semantic.api.model.response.DomainResp;
import com.tencent.supersonic.semantic.api.model.response.DomainSchemaResp;
import com.tencent.supersonic.semantic.api.model.response.MetricResp;
import com.tencent.supersonic.semantic.api.model.response.MetricSchemaResp;
import com.tencent.supersonic.semantic.model.domain.DatasourceService;
import com.tencent.supersonic.semantic.model.domain.DimensionService;
import com.tencent.supersonic.semantic.model.domain.DomainService;
import com.tencent.supersonic.semantic.model.domain.MetricService;
import com.tencent.supersonic.semantic.model.domain.dataobject.DomainDO;
import com.tencent.supersonic.semantic.model.domain.pojo.Domain;
import com.tencent.supersonic.semantic.model.domain.repository.DomainRepository;
import com.tencent.supersonic.semantic.model.domain.utils.DomainConvert;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
@Service
@Slf4j
public class DomainServiceImpl implements DomainService {
private final DomainRepository domainRepository;
private final MetricService metricService;
private final DimensionService dimensionService;
private final DatasourceService datasourceService;
public DomainServiceImpl(DomainRepository domainRepository, @Lazy MetricService metricService,
@Lazy DimensionService dimensionService, @Lazy DatasourceService datasourceService) {
this.domainRepository = domainRepository;
this.metricService = metricService;
this.dimensionService = dimensionService;
this.datasourceService = datasourceService;
}
@Override
public void createDomain(DomainReq domainReq, User user) {
log.info("[create domain] cmd : {}", JSONObject.toJSONString(domainReq));
Domain domain = DomainConvert.convert(domainReq);
log.info("[create domain] object:{}", JSONObject.toJSONString(domainReq));
saveDomain(domain, user);
}
@Override
public void updateDomain(DomainUpdateReq domainUpdateReq, User user) {
DomainDO domainDO = getDomainDO(domainUpdateReq.getId());
domainDO.setUpdatedAt(new Date());
domainDO.setUpdatedBy(user.getName());
BeanMapper.mapper(domainUpdateReq, domainDO);
domainDO.setAdmin(String.join(",", domainUpdateReq.getAdmins()));
domainDO.setAdminOrg(String.join(",", domainUpdateReq.getAdminOrgs()));
domainDO.setViewer(String.join(",", domainUpdateReq.getViewers()));
domainDO.setViewOrg(String.join(",", domainUpdateReq.getViewOrgs()));
domainDO.setEntity(JsonUtil.toString(domainUpdateReq.getEntity()));
domainRepository.updateDomain(domainDO);
}
@Override
public void deleteDomain(Long id) {
checkDelete(id);
domainRepository.deleteDomain(id);
}
private void checkDelete(Long id) {
List<MetricResp> metricResps = metricService.getMetrics(id);
List<DimensionResp> dimensionResps = dimensionService.getDimensions(id);
List<DatasourceResp> datasourceResps = datasourceService.getDatasourceList(id);
if (!CollectionUtils.isEmpty(metricResps) || !CollectionUtils.isEmpty(datasourceResps)
|| !CollectionUtils.isEmpty(dimensionResps)) {
throw new RuntimeException("exist datasource, dimension or metric in this domain, please check");
}
}
@Override
public String getDomainBizName(Long id) {
if (id == null) {
return "";
}
DomainDO domainDO = getDomainDO(id);
if (domainDO == null) {
String message = String.format("domain with id:%s not exist", id);
throw new RuntimeException(message);
}
return domainDO.getBizName();
}
@Override
public List<DomainResp> getDomainList() {
return convertList(domainRepository.getDomainList(), new HashMap<>(), new HashMap<>());
}
@Override
public List<DomainResp> getDomainList(List<Long> domainIds) {
return getDomainList().stream()
.filter(domainDO -> domainIds.contains(domainDO.getId()))
.collect(Collectors.toList());
}
@Override
public List<DomainResp> getDomainListForAdmin(String userName) {
List<DomainDO> domainDOS = domainRepository.getDomainList();
List<String> orgIds = Lists.newArrayList();
log.info("orgIds:{},userName:{}", orgIds, userName);
Map<Long, List<MetricResp>> metricDomainMap = metricService.getMetrics().stream()
.collect(Collectors.groupingBy(MetricResp::getDomainId));
Map<Long, List<DimensionResp>> dimensionDomainMap = dimensionService.getDimensions().stream()
.collect(Collectors.groupingBy(DimensionResp::getDomainId));
return convertList(domainDOS, metricDomainMap, dimensionDomainMap).stream()
.filter(domainDesc -> checkAdminPermission(orgIds, userName, domainDesc))
.collect(Collectors.toList());
}
@Override
public List<DomainResp> getDomainListForViewer(String userName) {
List<DomainDO> domainDOS = domainRepository.getDomainList();
List<String> orgIds = Lists.newArrayList();
log.info("orgIds:{},userName:{}", orgIds, userName);
return convertList(domainDOS, new HashMap<>(), new HashMap<>()).stream()
.filter(domainDesc -> checkViewerPermission(orgIds, userName, domainDesc))
.collect(Collectors.toList());
}
@Override
public DomainResp getDomain(Long id) {
Map<Long, String> fullDomainPathMap = getDomainFullPathMap();
return DomainConvert.convert(getDomainDO(id), fullDomainPathMap);
}
@Override
public String getDomainFullPath(Long domainId) {
if (domainId == null) {
return "";
}
Map<Long, String> map = getDomainFullPathMap();
return map.containsKey(domainId) ? map.get(domainId) : "";
}
@Override
public Map<Long, String> getDomainFullPath() {
return getDomainFullPathMap();
}
//保存并获取自增ID
private void saveDomain(Domain domain, User user) {
DomainDO domainDO = DomainConvert.convert(domain, user);
domainRepository.createDomain(domainDO);
domain.setId(domainDO.getId());
}
private List<DomainResp> convertList(List<DomainDO> domainDOS, Map<Long, List<MetricResp>> metricDomainMap,
Map<Long, List<DimensionResp>> dimensionDomainMap) {
List<DomainResp> domainDescs = Lists.newArrayList();
if (CollectionUtils.isEmpty(domainDOS)) {
return domainDescs;
}
Map<Long, String> fullDomainPathMap = getDomainFullPath();
return domainDOS.stream()
.map(domainDO -> DomainConvert.convert(domainDO, fullDomainPathMap, dimensionDomainMap,
metricDomainMap))
.collect(Collectors.toList());
}
@Override
public Map<Long, DomainResp> getDomainMap() {
return getDomainList().stream().collect(Collectors.toMap(DomainResp::getId, a -> a, (k1, k2) -> k1));
}
public Map<Long, String> getDomainFullPathMap() {
Map<Long, String> domainFullPathMap = new HashMap<>();
List<DomainDO> domainDOList = domainRepository.getDomainList();
Map<Long, DomainDO> domainDOMap = domainDOList.stream()
.collect(Collectors.toMap(DomainDO::getId, a -> a, (k1, k2) -> k1));
for (DomainDO domainDO : domainDOList) {
final Long domainId = domainDO.getId();
StringBuilder fullPath = new StringBuilder(domainDO.getBizName() + "/");
Long parentId = domainDO.getParentId();
while (parentId != null && parentId > 0) {
domainDO = domainDOMap.get(parentId);
if (domainDO == null) {
String message = String.format("get domain : %s failed", parentId);
throw new RuntimeException(message);
}
fullPath.insert(0, domainDO.getBizName() + "/");
parentId = domainDO.getParentId();
}
domainFullPathMap.put(domainId, fullPath.toString());
}
return domainFullPathMap;
}
public List<DomainSchemaResp> fetchDomainSchema(DomainSchemaFilterReq filter, User user) {
List<DomainSchemaResp> domainSchemaDescList = new ArrayList<>();
List<Long> domainIdsReq = generateDomainIdsReq(filter);
List<DomainResp> getDomainListByIds = getDomainList(domainIdsReq);
getDomainListByIds.stream().forEach(domainDesc -> {
domainSchemaDescList.add(fetchSingleDomainSchema(domainDesc));
});
return domainSchemaDescList;
}
protected DomainDO getDomainDO(Long id) {
return domainRepository.getDomainById(id);
}
private DomainSchemaResp fetchSingleDomainSchema(DomainResp domainDesc) {
Long domainId = domainDesc.getId();
DomainSchemaResp domainSchemaDesc = new DomainSchemaResp();
BeanUtils.copyProperties(domainDesc, domainSchemaDesc);
domainSchemaDesc.setDimensions(generateDimSchema(domainId));
domainSchemaDesc.setMetrics(generateMetricSchema(domainId));
return domainSchemaDesc;
}
private List<MetricSchemaResp> generateMetricSchema(Long domainId) {
List<MetricSchemaResp> metricSchemaDescList = new ArrayList<>();
List<MetricResp> metricDescList = metricService.getMetrics(domainId);
metricDescList.stream().forEach(metricDesc -> {
MetricSchemaResp metricSchemaDesc = new MetricSchemaResp();
BeanUtils.copyProperties(metricDesc, metricSchemaDesc);
metricSchemaDesc.setUseCnt(0L);
metricSchemaDescList.add(metricSchemaDesc);
}
);
return metricSchemaDescList;
}
private List<DimSchemaResp> generateDimSchema(Long domainId) {
List<DimSchemaResp> dimSchemaDescList = new ArrayList<>();
List<DimensionResp> dimDescList = dimensionService.getDimensions(domainId);
dimDescList.stream().forEach(dimDesc -> {
DimSchemaResp dimSchemaDesc = new DimSchemaResp();
BeanUtils.copyProperties(dimDesc, dimSchemaDesc);
dimSchemaDesc.setUseCnt(0L);
dimSchemaDescList.add(dimSchemaDesc);
}
);
return dimSchemaDescList;
}
private List<Long> generateDomainIdsReq(DomainSchemaFilterReq filter) {
if (Objects.nonNull(filter) && !CollectionUtils.isEmpty(filter.getDomainIds())) {
return filter.getDomainIds();
}
return new ArrayList<>(getDomainMap().keySet());
}
private boolean checkAdminPermission(List<String> orgIds, String userName, DomainResp domainDesc) {
List<String> admins = domainDesc.getAdmins();
List<String> adminOrgs = domainDesc.getAdminOrgs();
if (admins.contains(userName) || domainDesc.getCreatedBy().equals(userName)) {
return true;
}
for (String orgId : orgIds) {
if (adminOrgs.contains(orgId)) {
return true;
}
}
return false;
}
private boolean checkViewerPermission(List<String> orgIds, String userName, DomainResp domainDesc) {
if (domainDesc.getIsOpen() == 1) {
return true;
}
List<String> admins = domainDesc.getAdmins();
List<String> viewers = domainDesc.getViewers();
List<String> adminOrgs = domainDesc.getAdminOrgs();
List<String> viewOrgs = domainDesc.getViewOrgs();
if (admins.contains(userName) || viewers.contains(userName) || domainDesc.getCreatedBy().equals(userName)) {
return true;
}
for (String orgId : orgIds) {
if (adminOrgs.contains(orgId)) {
return true;
}
}
for (String orgId : orgIds) {
if (viewOrgs.contains(orgId)) {
return true;
}
}
return false;
}
}

View File

@@ -0,0 +1,251 @@
package com.tencent.supersonic.semantic.model.application;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.google.common.collect.Lists;
import com.tencent.supersonic.auth.api.authentication.pojo.User;
import com.tencent.supersonic.semantic.api.model.pojo.Measure;
import com.tencent.supersonic.semantic.api.model.pojo.MetricTypeParams;
import com.tencent.supersonic.semantic.api.model.request.MetricReq;
import com.tencent.supersonic.semantic.api.model.request.PageMetricReq;
import com.tencent.supersonic.semantic.api.model.response.DomainResp;
import com.tencent.supersonic.semantic.api.model.response.MetricResp;
import com.tencent.supersonic.common.pojo.enums.SensitiveLevelEnum;
import com.tencent.supersonic.semantic.model.domain.dataobject.MetricDO;
import com.tencent.supersonic.semantic.model.domain.pojo.MetricFilter;
import com.tencent.supersonic.semantic.model.domain.repository.MetricRepository;
import com.tencent.supersonic.semantic.model.domain.utils.MetricConverter;
import com.tencent.supersonic.semantic.model.domain.DomainService;
import com.tencent.supersonic.semantic.model.domain.MetricService;
import com.tencent.supersonic.semantic.model.domain.pojo.Metric;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
@Service
@Slf4j
public class MetricServiceImpl implements MetricService {
private MetricRepository metricRepository;
private DomainService domainService;
public MetricServiceImpl(MetricRepository metricRepository,
DomainService domainService) {
this.domainService = domainService;
this.metricRepository = metricRepository;
}
@Override
public void creatExprMetric(MetricReq metricReq, User user) {
checkExist(Lists.newArrayList(metricReq));
Metric metric = MetricConverter.convert(metricReq);
metric.createdBy(user.getName());
log.info("[create metric] object:{}", JSONObject.toJSONString(metric));
saveMetric(metric);
}
@Override
public void createMetricBatch(List<MetricReq> metricReqs, User user) {
if (CollectionUtils.isEmpty(metricReqs)) {
return;
}
List<Metric> metrics = metricReqs.stream().map(MetricConverter::convert).collect(Collectors.toList());
Long domainId = metricReqs.get(0).getDomainId();
List<MetricResp> metricDescs = getMetricByDomainId(domainId);
Map<String, MetricResp> metricDescMap = metricDescs.stream()
.collect(Collectors.toMap(MetricResp::getBizName, a -> a, (k1, k2) -> k1));
List<Metric> metricToInsert = metrics.stream()
.filter(metric -> !metricDescMap.containsKey(metric.getBizName())).collect(Collectors.toList());
log.info("[insert metric] object:{}", JSONObject.toJSONString(metricToInsert));
saveMetricBatch(metricToInsert, user);
}
@Override
public List<MetricResp> getMetrics(Long domainId) {
return convertList(metricRepository.getMetricList(domainId));
}
@Override
public List<MetricResp> getMetrics() {
return convertList(metricRepository.getMetricList());
}
@Override
public List<MetricResp> getMetrics(Long domainId, Long datasourceId) {
List<MetricResp> metricResps = convertList(metricRepository.getMetricList(domainId));
return metricResps.stream().filter(metricResp -> {
Set<Long> datasourceIdSet = metricResp.getTypeParams().getMeasures().stream()
.map(Measure::getDatasourceId)
.filter(Objects::nonNull).collect(Collectors.toSet());
return !CollectionUtils.isEmpty(datasourceIdSet) && datasourceIdSet.contains(datasourceId);
}).collect(Collectors.toList());
}
public List<MetricResp> getMetrics(List<Long> ids) {
return convertList(metricRepository.getMetricListByIds(ids));
}
@Override
public PageInfo<MetricResp> queryMetric(PageMetricReq pageMetricReq) {
MetricFilter metricFilter = new MetricFilter();
BeanUtils.copyProperties(pageMetricReq, metricFilter);
PageInfo<MetricDO> metricDOPageInfo = PageHelper.startPage(pageMetricReq.getCurrent(),
pageMetricReq.getPageSize())
.doSelectPageInfo(() -> queryMetric(metricFilter));
PageInfo<MetricResp> pageInfo = new PageInfo<>();
BeanUtils.copyProperties(metricDOPageInfo, pageInfo);
pageInfo.setList(convertList(metricDOPageInfo.getList()));
return pageInfo;
}
private List<MetricDO> queryMetric(MetricFilter metricFilter) {
return metricRepository.getMetric(metricFilter);
}
@Override
public MetricResp getMetric(Long domainId, String bizName) {
List<MetricResp> metricDescs = getMetricByDomainId(domainId);
MetricResp metricDesc = null;
if (CollectionUtils.isEmpty(metricDescs)) {
return metricDesc;
}
for (MetricResp metric : metricDescs) {
if (metric.getBizName().equalsIgnoreCase(bizName)) {
metricDesc = metric;
}
}
return metricDesc;
}
@Override
public void updateExprMetric(MetricReq metricReq, User user) {
preCheckMetric(metricReq);
Metric metric = MetricConverter.convert(metricReq);
metric.updatedBy(user.getName());
log.info("[update metric] object:{}", JSONObject.toJSONString(metric));
updateMetric(metric);
}
public void saveMetric(Metric metric) {
MetricDO metricDO = MetricConverter.convert2MetricDO(metric);
log.info("[save metric] metricDO:{}", JSONObject.toJSONString(metricDO));
metricRepository.createMetric(metricDO);
metric.setId(metricDO.getId());
}
protected void updateMetric(Metric metric) {
MetricDO metricDO = metricRepository.getMetricById(metric.getId());
metricRepository.updateMetric(MetricConverter.convert(metricDO, metric));
}
public List<MetricResp> getMetricByDomainId(Long domainId) {
return convertList(getMetricDOByDomainId(domainId));
}
protected List<MetricDO> getMetricDOByDomainId(Long domainId) {
List<MetricDO> metricDOS = metricRepository.getAllMetricList();
return metricDOS.stream().filter(metricDO -> Objects.equals(metricDO.getDomainId(), domainId))
.collect(Collectors.toList());
}
@Override
public List<MetricResp> getHighSensitiveMetric(Long domainId) {
List<MetricResp> metricDescs = getMetricByDomainId(domainId);
if (CollectionUtils.isEmpty(metricDescs)) {
return metricDescs;
}
return metricDescs.stream()
.filter(metricDesc -> SensitiveLevelEnum.HIGH.getCode().equals(metricDesc.getSensitiveLevel()))
.collect(Collectors.toList());
}
@Override
public List<MetricResp> getAllHighSensitiveMetric() {
List<MetricResp> metricDescs = Lists.newArrayList();
List<MetricDO> metricDOS = metricRepository.getAllMetricList();
if (CollectionUtils.isEmpty(metricDOS)) {
return metricDescs;
}
return convertList(metricDOS.stream()
.filter(metricDesc -> SensitiveLevelEnum.HIGH.getCode().equals(metricDesc.getSensitiveLevel()))
.collect(Collectors.toList()));
}
@Override
public void deleteMetric(Long id) {
MetricDO metricDO = metricRepository.getMetricById(id);
if (metricDO == null) {
throw new RuntimeException(String.format("the metric %s not exist", id));
}
metricRepository.deleteMetric(id);
}
private void saveMetricBatch(List<Metric> metrics, User user) {
if (CollectionUtils.isEmpty(metrics)) {
return;
}
List<MetricDO> metricDOS = metrics.stream().peek(metric -> metric.createdBy(user.getName()))
.map(MetricConverter::convert2MetricDO).collect(Collectors.toList());
log.info("[save metric] metrics:{}", JSONObject.toJSONString(metricDOS));
metricRepository.createMetricBatch(metricDOS);
}
private void preCheckMetric(MetricReq metricReq) {
MetricTypeParams typeParams = metricReq.getTypeParams();
List<Measure> measures = typeParams.getMeasures();
if (CollectionUtils.isEmpty(measures)) {
throw new RuntimeException("measure can not be none");
}
if (StringUtils.isBlank(typeParams.getExpr())) {
throw new RuntimeException("expr can not be blank");
}
}
private void checkExist(List<MetricReq> exprMetricReqList) {
Long domainId = exprMetricReqList.get(0).getDomainId();
List<MetricResp> metricDescs = getMetrics(domainId);
for (MetricReq exprMetricReq : exprMetricReqList) {
for (MetricResp metricDesc : metricDescs) {
if (metricDesc.getName().equalsIgnoreCase(exprMetricReq.getName())) {
throw new RuntimeException(String.format("exist same metric name:%s", metricDesc.getName()));
}
if (metricDesc.getBizName().equalsIgnoreCase(exprMetricReq.getBizName())) {
throw new RuntimeException(String.format("exist same metric en name:%s", metricDesc.getName()));
}
preCheckMetric(exprMetricReq);
}
}
}
private List<MetricResp> convertList(List<MetricDO> metricDOS) {
List<MetricResp> metricDescs = Lists.newArrayList();
Map<Long, DomainResp> domainMap = domainService.getDomainMap();
if (!CollectionUtils.isEmpty(metricDOS)) {
metricDescs = metricDOS.stream()
.map(metricDO -> MetricConverter.convert2MetricDesc(metricDO, domainMap))
.collect(Collectors.toList());
}
return metricDescs;
}
}

View File

@@ -0,0 +1,88 @@
package com.tencent.supersonic.semantic.model.application;
import com.tencent.supersonic.auth.api.authentication.pojo.User;
import com.tencent.supersonic.semantic.api.model.request.ViewInfoReq;
import com.tencent.supersonic.semantic.api.model.response.DatasourceResp;
import com.tencent.supersonic.semantic.api.model.response.DimensionResp;
import com.tencent.supersonic.semantic.api.model.response.DomainSchemaRelaResp;
import com.tencent.supersonic.semantic.api.model.response.MetricResp;
import com.tencent.supersonic.semantic.model.domain.dataobject.ViewInfoDO;
import com.tencent.supersonic.semantic.model.domain.repository.ViewInfoRepository;
import com.tencent.supersonic.semantic.model.domain.DatasourceService;
import com.tencent.supersonic.semantic.model.domain.DimensionService;
import com.tencent.supersonic.semantic.model.domain.MetricService;
import java.util.Date;
import java.util.List;
import org.assertj.core.util.Lists;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
@Service
public class ViewInfoServiceImpl {
private ViewInfoRepository viewInfoRepository;
private DatasourceService datasourceService;
private DimensionService dimensionService;
private MetricService metricService;
public ViewInfoServiceImpl(ViewInfoRepository viewInfoRepository, DatasourceService datasourceService,
MetricService metricService, DimensionService dimensionService) {
this.viewInfoRepository = viewInfoRepository;
this.dimensionService = dimensionService;
this.metricService = metricService;
this.datasourceService = datasourceService;
}
public List<ViewInfoDO> getViewInfoList(Long domainId) {
return viewInfoRepository.getViewInfoList(domainId);
}
public List<DomainSchemaRelaResp> getDomainSchema(Long domainId) {
List<DomainSchemaRelaResp> domainSchemaRelaResps = Lists.newArrayList();
List<DatasourceResp> datasourceResps = datasourceService.getDatasourceList(domainId);
for (DatasourceResp datasourceResp : datasourceResps) {
DomainSchemaRelaResp domainSchemaRelaResp = new DomainSchemaRelaResp();
Long datasourceId = datasourceResp.getId();
List<MetricResp> metricResps = metricService.getMetrics(domainId, datasourceId);
List<DimensionResp> dimensionResps = dimensionService.getDimensionsByDatasource(datasourceId);
domainSchemaRelaResp.setDatasource(datasourceResp);
domainSchemaRelaResp.setDimensions(dimensionResps);
domainSchemaRelaResp.setMetrics(metricResps);
domainSchemaRelaResp.setDomainId(domainId);
domainSchemaRelaResps.add(domainSchemaRelaResp);
}
return domainSchemaRelaResps;
}
public ViewInfoDO createOrUpdateViewInfo(ViewInfoReq viewInfoReq, User user) {
if (viewInfoReq.getId() == null) {
ViewInfoDO viewInfoDO = new ViewInfoDO();
BeanUtils.copyProperties(viewInfoReq, viewInfoDO);
viewInfoDO.setCreatedAt(new Date());
viewInfoDO.setCreatedBy(user.getName());
viewInfoDO.setUpdatedAt(new Date());
viewInfoDO.setUpdatedBy(user.getName());
viewInfoRepository.createViewInfo(viewInfoDO);
return viewInfoDO;
}
Long id = viewInfoReq.getId();
ViewInfoDO viewInfoDO = viewInfoRepository.getViewInfoById(id);
BeanUtils.copyProperties(viewInfoReq, viewInfoDO);
viewInfoDO.setUpdatedAt(new Date());
viewInfoDO.setUpdatedBy(user.getName());
viewInfoRepository.updateViewInfo(viewInfoDO);
return viewInfoDO;
}
public void deleteViewInfo(Long id) {
viewInfoRepository.deleteViewInfo(id);
}
}

View File

@@ -0,0 +1,39 @@
package com.tencent.supersonic.semantic.model.domain;
import com.tencent.supersonic.semantic.api.model.pojo.ItemDateFilter;
import com.tencent.supersonic.semantic.api.model.yaml.DatasourceYamlTpl;
import com.tencent.supersonic.semantic.api.model.yaml.DimensionYamlTpl;
import com.tencent.supersonic.semantic.api.model.yaml.MetricYamlTpl;
import com.tencent.supersonic.semantic.api.model.response.DatabaseResp;
import com.tencent.supersonic.semantic.api.model.response.DatasourceResp;
import com.tencent.supersonic.semantic.api.model.response.DimensionResp;
import com.tencent.supersonic.semantic.api.model.response.ItemDateResp;
import com.tencent.supersonic.semantic.api.model.response.MetricResp;
import java.util.List;
import java.util.Map;
import java.util.Set;
public interface Catalog {
DatabaseResp getDatabase(Long id);
DatabaseResp getDatabaseByDomainId(Long domainId);
List<DatasourceResp> getDatasourceList(Long domainId);
String getDomainFullPath(Long domainId);
Map<Long, String> getDomainFullPath();
DimensionResp getDimension(String bizName, Long domainId);
List<DimensionResp> getDimensions(Long domainId);
List<MetricResp> getMetrics(Long domainId);
void getModelYamlTplByDomainIds(Set<Long> domainIds, Map<String, List<DimensionYamlTpl>> dimensionYamlMap,
List<DatasourceYamlTpl> datasourceYamlTplList, List<MetricYamlTpl> metricYamlTplList);
ItemDateResp getItemDate(ItemDateFilter dimension, ItemDateFilter metric);
}

View File

@@ -0,0 +1,32 @@
package com.tencent.supersonic.semantic.model.domain;
import com.tencent.supersonic.auth.api.authentication.pojo.User;
import com.tencent.supersonic.semantic.api.model.request.DatabaseReq;
import com.tencent.supersonic.semantic.api.model.response.DatabaseResp;
import com.tencent.supersonic.semantic.api.model.response.QueryResultWithSchemaResp;
import com.tencent.supersonic.semantic.api.model.response.SqlParserResp;
public interface DatabaseService {
QueryResultWithSchemaResp executeSql(String sql, DatabaseResp databaseResp);
QueryResultWithSchemaResp executeSql(String sql, Long domainId);
boolean testConnect(DatabaseReq databaseReq, User user);
DatabaseResp createOrUpdateDatabase(DatabaseReq databaseReq, User user);
DatabaseResp getDatabase(Long id);
// one domain only has one database
DatabaseResp getDatabaseByDomainId(Long domainId);
QueryResultWithSchemaResp queryWithColumns(SqlParserResp sqlParser);
QueryResultWithSchemaResp getDbNames(Long id);
QueryResultWithSchemaResp getTables(Long id, String db);
QueryResultWithSchemaResp getColumns(Long id, String db, String table);
}

View File

@@ -0,0 +1,51 @@
package com.tencent.supersonic.semantic.model.domain;
import com.tencent.supersonic.auth.api.authentication.pojo.User;
import com.tencent.supersonic.semantic.api.model.pojo.ItemDateFilter;
import com.tencent.supersonic.semantic.api.model.yaml.DatasourceYamlTpl;
import com.tencent.supersonic.semantic.api.model.yaml.DimensionYamlTpl;
import com.tencent.supersonic.semantic.api.model.yaml.MetricYamlTpl;
import com.tencent.supersonic.semantic.api.model.request.DatasourceRelaReq;
import com.tencent.supersonic.semantic.api.model.request.DatasourceReq;
import com.tencent.supersonic.semantic.api.model.response.DatasourceRelaResp;
import com.tencent.supersonic.semantic.api.model.response.DatasourceResp;
import com.tencent.supersonic.semantic.api.model.response.ItemDateResp;
import com.tencent.supersonic.semantic.api.model.response.MeasureResp;
import java.util.List;
import java.util.Map;
import java.util.Set;
public interface DatasourceService {
DatasourceResp createDatasource(DatasourceReq datasourceReq, User user) throws Exception;
DatasourceResp updateDatasource(DatasourceReq datasourceReq, User user) throws Exception;
String getSourceBizNameById(Long id);
List<DatasourceResp> getDatasourceListNoMeasurePrefix(Long domainId);
List<DatasourceResp> getDatasourceList();
List<DatasourceResp> getDatasourceList(Long domainId);
Map<Long, DatasourceResp> getDatasourceMap();
void deleteDatasource(Long id) throws Exception;
DatasourceRelaResp createOrUpdateDatasourceRela(DatasourceRelaReq datasourceRelaReq, User user);
List<DatasourceRelaResp> getDatasourceRelaList(Long domainId);
void deleteDatasourceRela(Long id);
ItemDateResp getItemDate(ItemDateFilter dimension, ItemDateFilter metric);
List<MeasureResp> getMeasureListOfDomain(Long domainId);
void getModelYamlTplByDomainIds(Set<Long> domainIds, Map<String, List<DimensionYamlTpl>> dimensionYamlMap,
List<DatasourceYamlTpl> datasourceYamlTplList, List<MetricYamlTpl> metricYamlTplList);
}

View File

@@ -0,0 +1,35 @@
package com.tencent.supersonic.semantic.model.domain;
import com.github.pagehelper.PageInfo;
import com.tencent.supersonic.auth.api.authentication.pojo.User;
import com.tencent.supersonic.semantic.api.model.request.DimensionReq;
import com.tencent.supersonic.semantic.api.model.request.PageDimensionReq;
import com.tencent.supersonic.semantic.api.model.response.DimensionResp;
import java.util.List;
public interface DimensionService {
List<DimensionResp> getDimensions(List<Long> ids);
List<DimensionResp> getDimensions(Long domainId);
List<DimensionResp> getDimensions();
DimensionResp getDimension(String bizName, Long domainId);
void createDimension(DimensionReq dimensionReq, User user) throws Exception;
void createDimensionBatch(List<DimensionReq> dimensionReqs, User user) throws Exception;
List<DimensionResp> getDimensionsByDatasource(Long datasourceId);
void updateDimension(DimensionReq dimensionReq, User user) throws Exception;
PageInfo<DimensionResp> queryDimension(PageDimensionReq pageDimensionReq);
List<DimensionResp> getHighSensitiveDimension(Long domainId);
List<DimensionResp> getAllHighSensitiveDimension();
void deleteDimension(Long id) throws Exception;
}

View File

@@ -0,0 +1,41 @@
package com.tencent.supersonic.semantic.model.domain;
import com.tencent.supersonic.auth.api.authentication.pojo.User;
import com.tencent.supersonic.semantic.api.model.request.DomainReq;
import com.tencent.supersonic.semantic.api.model.request.DomainSchemaFilterReq;
import com.tencent.supersonic.semantic.api.model.request.DomainUpdateReq;
import com.tencent.supersonic.semantic.api.model.response.DomainResp;
import com.tencent.supersonic.semantic.api.model.response.DomainSchemaResp;
import java.util.List;
import java.util.Map;
public interface DomainService {
DomainResp getDomain(Long id);
String getDomainFullPath(Long domainId);
Map<Long, String> getDomainFullPath();
void createDomain(DomainReq domainReq, User user);
void updateDomain(DomainUpdateReq domainUpdateReq, User user);
void deleteDomain(Long id);
String getDomainBizName(Long domainId);
List<DomainResp> getDomainList();
List<DomainResp> getDomainList(List<Long> domainIds);
Map<Long, DomainResp> getDomainMap();
List<DomainResp> getDomainListForAdmin(String userName);
List<DomainResp> getDomainListForViewer(String userName);
List<DomainSchemaResp> fetchDomainSchema(DomainSchemaFilterReq filter, User user);
}

View File

@@ -0,0 +1,35 @@
package com.tencent.supersonic.semantic.model.domain;
import com.github.pagehelper.PageInfo;
import com.tencent.supersonic.auth.api.authentication.pojo.User;
import com.tencent.supersonic.semantic.api.model.request.MetricReq;
import com.tencent.supersonic.semantic.api.model.request.PageMetricReq;
import com.tencent.supersonic.semantic.api.model.response.MetricResp;
import java.util.List;
public interface MetricService {
List<MetricResp> getMetrics(List<Long> ids);
List<MetricResp> getMetrics(Long domainId);
List<MetricResp> getMetrics();
List<MetricResp> getMetrics(Long domainId, Long datasourceId);
void creatExprMetric(MetricReq metricReq, User user) throws Exception;
void createMetricBatch(List<MetricReq> metricReqs, User user) throws Exception;
PageInfo<MetricResp> queryMetric(PageMetricReq pageMetrricReq);
MetricResp getMetric(Long domainId, String bizName);
List<MetricResp> getHighSensitiveMetric(Long domainId);
void updateExprMetric(MetricReq metricReq, User user) throws Exception;
List<MetricResp> getAllHighSensitiveMetric();
void deleteMetric(Long id) throws Exception;
}

View File

@@ -0,0 +1,48 @@
package com.tencent.supersonic.semantic.model.domain.adaptor.engineadapter;
import com.tencent.supersonic.semantic.api.model.enums.TimeDimensionEnum;
import com.tencent.supersonic.common.pojo.Constants;
public class ClickHouseAdaptor extends EngineAdaptor {
@Override
public String getDateFormat(String dateType, String dateFormat, String column) {
if (dateFormat.equalsIgnoreCase(Constants.DAY_FORMAT_INT)) {
if (TimeDimensionEnum.MONTH.name().equalsIgnoreCase(dateType)) {
return "formatDateTime(toDate(parseDateTimeBestEffort(toString(%s))),'%Y-%m')".replace("%s", column);
} else if (TimeDimensionEnum.WEEK.name().equalsIgnoreCase(dateType)) {
return "toMonday(toDate(parseDateTimeBestEffort(toString(%s))))".replace("%s", column);
} else {
return "toDate(parseDateTimeBestEffort(toString(%s)))".replace("%s", column);
}
} else if (dateFormat.equalsIgnoreCase(Constants.DAY_FORMAT)) {
if (TimeDimensionEnum.MONTH.name().equalsIgnoreCase(dateType)) {
return "formatDateTime(toDate(%s),'%Y-%m')".replace("%s", column);
} else if (TimeDimensionEnum.WEEK.name().equalsIgnoreCase(dateType)) {
return "toMonday(toDate(%s))".replace("%s", column);
} else {
return column;
}
}
return column;
}
@Override
public String getDbMetaQueryTpl() {
return " "
+ " select "
+ " name from system.databases "
+ " where name not in('_temporary_and_external_tables','benchmark','default','system');";
}
@Override
public String getTableMetaQueryTpl() {
return "select name from system.tables where database = '%s';";
}
@Override
public String getColumnMetaQueryTpl() {
return "select name,type as dataType, comment from system.columns where database = '%s' and table='%s'";
}
}

View File

@@ -0,0 +1,15 @@
package com.tencent.supersonic.semantic.model.domain.adaptor.engineadapter;
public abstract class EngineAdaptor {
public abstract String getDateFormat(String dateType, String dateFormat, String column);
public abstract String getColumnMetaQueryTpl();
public abstract String getDbMetaQueryTpl();
public abstract String getTableMetaQueryTpl();
}

View File

@@ -0,0 +1,26 @@
package com.tencent.supersonic.semantic.model.domain.adaptor.engineadapter;
import com.tencent.supersonic.semantic.model.domain.pojo.EngineTypeEnum;
import java.util.HashMap;
import java.util.Map;
public class EngineAdaptorFactory {
private static Map<String, EngineAdaptor> engineAdaptorMap;
static {
engineAdaptorMap = new HashMap<>();
engineAdaptorMap.put(EngineTypeEnum.CLICKHOUSE.getName(), new ClickHouseAdaptor());
engineAdaptorMap.put(EngineTypeEnum.MYSQL.getName(), new MysqlAdaptor());
engineAdaptorMap.put(EngineTypeEnum.H2.getName(), new H2Adaptor());
}
public static EngineAdaptor getEngineAdaptor(String engineType) {
return engineAdaptorMap.get(engineType);
}
}

View File

@@ -0,0 +1,45 @@
package com.tencent.supersonic.semantic.model.domain.adaptor.engineadapter;
import com.tencent.supersonic.common.pojo.Constants;
import com.tencent.supersonic.semantic.api.model.enums.TimeDimensionEnum;
public class H2Adaptor extends EngineAdaptor {
@Override
public String getDateFormat(String dateType, String dateFormat, String column) {
if (dateFormat.equalsIgnoreCase(Constants.DAY_FORMAT_INT)) {
if (TimeDimensionEnum.MONTH.name().equalsIgnoreCase(dateType)) {
return "FORMATDATETIME(PARSEDATETIME(%s, 'yyyyMMdd'),'yyyy-MM')".replace("%s", column);
} else if (TimeDimensionEnum.WEEK.name().equalsIgnoreCase(dateType)) {
return "DATE_TRUNC('week',%s)".replace("%s", column);
} else {
return "FORMATDATETIME(PARSEDATETIME(%s, 'yyyyMMdd'),'yyyy-MM-dd')".replace("%s", column);
}
} else if (dateFormat.equalsIgnoreCase(Constants.DAY_FORMAT)) {
if (TimeDimensionEnum.MONTH.name().equalsIgnoreCase(dateType)) {
return "FORMATDATETIME(PARSEDATETIME(%s, 'yyyy-MM-dd'),'yyyy-MM') ".replace("%s", column);
} else if (TimeDimensionEnum.WEEK.name().equalsIgnoreCase(dateType)) {
return "DATE_TRUNC('week',%s)".replace("%s", column);
} else {
return column;
}
}
return column;
}
@Override
public String getColumnMetaQueryTpl() {
return "SELECT COLUMN_NAME AS name, DATA_TYPE AS dataType\n" +
"FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA ='%s' AND TABLE_NAME = '%s'";
}
@Override
public String getDbMetaQueryTpl() {
return "SELECT DISTINCT TABLE_SCHEMA as name FROM INFORMATION_SCHEMA.TABLES WHERE STORAGE_TYPE = 'MEMORY'";
}
@Override
public String getTableMetaQueryTpl() {
return "SELECT TABLE_NAME as name FROM INFORMATION_SCHEMA.TABLES WHERE STORAGE_TYPE = 'MEMORY' AND TABLE_SCHEMA = '%s'";
}
}

View File

@@ -0,0 +1,53 @@
package com.tencent.supersonic.semantic.model.domain.adaptor.engineadapter;
import com.tencent.supersonic.semantic.api.model.enums.TimeDimensionEnum;
import com.tencent.supersonic.common.pojo.Constants;
public class MysqlAdaptor extends EngineAdaptor {
/**
* transform YYYYMMDD to YYYY-MM-DD YYYY-MM YYYY-MM-DD(MONDAY)
*/
@Override
public String getDateFormat(String dateType, String dateFormat, String column) {
if (dateFormat.equalsIgnoreCase(Constants.DAY_FORMAT_INT)) {
if (TimeDimensionEnum.MONTH.name().equalsIgnoreCase(dateType)) {
return "DATE_FORMAT(%s, '%Y-%m')".replace("%s", column);
} else if (TimeDimensionEnum.WEEK.name().equalsIgnoreCase(dateType)) {
return "to_monday(from_unixtime(unix_timestamp(%s), 'yyyy-MM-dd'))".replace("%s", column);
} else {
return "date_format(str_to_date(%s, '%Y%m%d'),'%Y-%m-%d')".replace("%s", column);
}
} else if (dateFormat.equalsIgnoreCase(Constants.DAY_FORMAT)) {
if (TimeDimensionEnum.MONTH.name().equalsIgnoreCase(dateType)) {
return "DATE_FORMAT(%s, '%Y-%m') ".replace("%s", column);
} else if (TimeDimensionEnum.WEEK.name().equalsIgnoreCase(dateType)) {
return "to_monday(from_unixtime(unix_timestamp(%s), 'yyyy-MM-dd'))".replace("%s", column);
} else {
return column;
}
}
return column;
}
@Override
public String getDbMetaQueryTpl() {
return "select distinct TABLE_SCHEMA as name from information_schema.tables where TABLE_SCHEMA not in ('information_schema','mysql','performance_schema','sys');";
}
@Override
public String getTableMetaQueryTpl() {
return "select TABLE_NAME as name from information_schema.tables where TABLE_SCHEMA = '%s';";
}
@Override
public String getColumnMetaQueryTpl() {
return "SELECT COLUMN_NAME as name, DATA_TYPE as dataType, COLUMN_COMMENT as comment " +
"FROM information_schema.columns WHERE table_schema ='%s' AND table_name = '%s'";
}
}

View File

@@ -0,0 +1,18 @@
package com.tencent.supersonic.semantic.model.domain.config;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
@Configuration
public class YamlConfig {
@Value("${model.yaml.file.dir: conf/models/}")
private String metaYamlFileDir;
public String getmetaYamlFileDir() {
return metaYamlFileDir;
}
}

View File

@@ -0,0 +1,249 @@
package com.tencent.supersonic.semantic.model.domain.dataobject;
import java.util.Date;
public class DatabaseDO {
/**
*
*/
private Long id;
/**
* 主题域ID
*/
private Long domainId;
/**
* 名称
*/
private String name;
/**
* 描述
*/
private String description;
/**
* 版本
*/
private String version;
/**
* 类型 mysql,clickhouse,tdw
*/
private String type;
/**
* 创建时间
*/
private Date createdAt;
/**
* 创建人
*/
private String createdBy;
/**
* 更新时间
*/
private Date updatedAt;
/**
* 更新人
*/
private String updatedBy;
/**
* 配置信息
*/
private String config;
/**
* @return id
*/
public Long getId() {
return id;
}
/**
* @param id
*/
public void setId(Long id) {
this.id = id;
}
/**
* 主题域ID
*
* @return domain_id 主题域ID
*/
public Long getDomainId() {
return domainId;
}
/**
* 主题域ID
*
* @param domainId 主题域ID
*/
public void setDomainId(Long domainId) {
this.domainId = domainId;
}
/**
* 名称
*
* @return name 名称
*/
public String getName() {
return name;
}
/**
* 名称
*
* @param name 名称
*/
public void setName(String name) {
this.name = name == null ? null : name.trim();
}
/**
* 描述
*
* @return description 描述
*/
public String getDescription() {
return description;
}
/**
* 描述
*
* @param description 描述
*/
public void setDescription(String description) {
this.description = description == null ? null : description.trim();
}
/**
* 类型 mysql,clickhouse,tdw
*
* @return type 类型 mysql,clickhouse,tdw
*/
public String getType() {
return type;
}
/**
* 类型 mysql,clickhouse,tdw
*
* @param type 类型 mysql,clickhouse,tdw
*/
public void setType(String type) {
this.type = type == null ? null : type.trim();
}
/**
* 创建时间
*
* @return created_at 创建时间
*/
public Date getCreatedAt() {
return createdAt;
}
/**
* 创建时间
*
* @param createdAt 创建时间
*/
public void setCreatedAt(Date createdAt) {
this.createdAt = createdAt;
}
/**
* 创建人
*
* @return created_by 创建人
*/
public String getCreatedBy() {
return createdBy;
}
/**
* 创建人
*
* @param createdBy 创建人
*/
public void setCreatedBy(String createdBy) {
this.createdBy = createdBy == null ? null : createdBy.trim();
}
/**
* 更新时间
*
* @return updated_at 更新时间
*/
public Date getUpdatedAt() {
return updatedAt;
}
/**
* 更新时间
*
* @param updatedAt 更新时间
*/
public void setUpdatedAt(Date updatedAt) {
this.updatedAt = updatedAt;
}
/**
* 更新人
*
* @return updated_by 更新人
*/
public String getUpdatedBy() {
return updatedBy;
}
/**
* 更新人
*
* @param updatedBy 更新人
*/
public void setUpdatedBy(String updatedBy) {
this.updatedBy = updatedBy == null ? null : updatedBy.trim();
}
/**
* 配置信息
*
* @return config 配置信息
*/
public String getConfig() {
return config;
}
/**
* 配置信息
*
* @param config 配置信息
*/
public void setConfig(String config) {
this.config = config == null ? null : config.trim();
}
/**
* 版本信息
*
*/
public String getVersion() {
return version;
}
public void setVersion(String version) {
this.version = version;
}
}

View File

@@ -0,0 +1,883 @@
package com.tencent.supersonic.semantic.model.domain.dataobject;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class DatabaseDOExample {
/**
* s2_database
*/
protected String orderByClause;
/**
* s2_database
*/
protected boolean distinct;
/**
* s2_database
*/
protected List<Criteria> oredCriteria;
/**
* s2_database
*/
protected Integer limitStart;
/**
* s2_database
*/
protected Integer limitEnd;
/**
* @mbg.generated
*/
public DatabaseDOExample() {
oredCriteria = new ArrayList<Criteria>();
}
/**
* @mbg.generated
*/
public String getOrderByClause() {
return orderByClause;
}
/**
* @mbg.generated
*/
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
/**
* @mbg.generated
*/
public boolean isDistinct() {
return distinct;
}
/**
* @mbg.generated
*/
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
/**
* @mbg.generated
*/
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
/**
* @mbg.generated
*/
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
/**
* @mbg.generated
*/
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
/**
* @mbg.generated
*/
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
/**
* @mbg.generated
*/
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
/**
* @mbg.generated
*/
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
/**
* @mbg.generated
*/
public Integer getLimitStart() {
return limitStart;
}
/**
* @mbg.generated
*/
public void setLimitStart(Integer limitStart) {
this.limitStart = limitStart;
}
/**
* @mbg.generated
*/
public Integer getLimitEnd() {
return limitEnd;
}
/**
* @mbg.generated
*/
public void setLimitEnd(Integer limitEnd) {
this.limitEnd = limitEnd;
}
/**
* s2_database null
*/
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
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 andDomainIdIsNull() {
addCriterion("domain_id is null");
return (Criteria) this;
}
public Criteria andDomainIdIsNotNull() {
addCriterion("domain_id is not null");
return (Criteria) this;
}
public Criteria andDomainIdEqualTo(Long value) {
addCriterion("domain_id =", value, "domainId");
return (Criteria) this;
}
public Criteria andDomainIdNotEqualTo(Long value) {
addCriterion("domain_id <>", value, "domainId");
return (Criteria) this;
}
public Criteria andDomainIdGreaterThan(Long value) {
addCriterion("domain_id >", value, "domainId");
return (Criteria) this;
}
public Criteria andDomainIdGreaterThanOrEqualTo(Long value) {
addCriterion("domain_id >=", value, "domainId");
return (Criteria) this;
}
public Criteria andDomainIdLessThan(Long value) {
addCriterion("domain_id <", value, "domainId");
return (Criteria) this;
}
public Criteria andDomainIdLessThanOrEqualTo(Long value) {
addCriterion("domain_id <=", value, "domainId");
return (Criteria) this;
}
public Criteria andDomainIdIn(List<Long> values) {
addCriterion("domain_id in", values, "domainId");
return (Criteria) this;
}
public Criteria andDomainIdNotIn(List<Long> values) {
addCriterion("domain_id not in", values, "domainId");
return (Criteria) this;
}
public Criteria andDomainIdBetween(Long value1, Long value2) {
addCriterion("domain_id between", value1, value2, "domainId");
return (Criteria) this;
}
public Criteria andDomainIdNotBetween(Long value1, Long value2) {
addCriterion("domain_id not between", value1, value2, "domainId");
return (Criteria) this;
}
public Criteria andNameIsNull() {
addCriterion("name is null");
return (Criteria) this;
}
public Criteria andNameIsNotNull() {
addCriterion("name is not null");
return (Criteria) this;
}
public Criteria andNameEqualTo(String value) {
addCriterion("name =", value, "name");
return (Criteria) this;
}
public Criteria andNameNotEqualTo(String value) {
addCriterion("name <>", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThan(String value) {
addCriterion("name >", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThanOrEqualTo(String value) {
addCriterion("name >=", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThan(String value) {
addCriterion("name <", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThanOrEqualTo(String value) {
addCriterion("name <=", value, "name");
return (Criteria) this;
}
public Criteria andNameLike(String value) {
addCriterion("name like", value, "name");
return (Criteria) this;
}
public Criteria andNameNotLike(String value) {
addCriterion("name not like", value, "name");
return (Criteria) this;
}
public Criteria andNameIn(List<String> values) {
addCriterion("name in", values, "name");
return (Criteria) this;
}
public Criteria andNameNotIn(List<String> values) {
addCriterion("name not in", values, "name");
return (Criteria) this;
}
public Criteria andNameBetween(String value1, String value2) {
addCriterion("name between", value1, value2, "name");
return (Criteria) this;
}
public Criteria andNameNotBetween(String value1, String value2) {
addCriterion("name not between", value1, value2, "name");
return (Criteria) this;
}
public Criteria andDescriptionIsNull() {
addCriterion("description is null");
return (Criteria) this;
}
public Criteria andDescriptionIsNotNull() {
addCriterion("description is not null");
return (Criteria) this;
}
public Criteria andDescriptionEqualTo(String value) {
addCriterion("description =", value, "description");
return (Criteria) this;
}
public Criteria andDescriptionNotEqualTo(String value) {
addCriterion("description <>", value, "description");
return (Criteria) this;
}
public Criteria andDescriptionGreaterThan(String value) {
addCriterion("description >", value, "description");
return (Criteria) this;
}
public Criteria andDescriptionGreaterThanOrEqualTo(String value) {
addCriterion("description >=", value, "description");
return (Criteria) this;
}
public Criteria andDescriptionLessThan(String value) {
addCriterion("description <", value, "description");
return (Criteria) this;
}
public Criteria andDescriptionLessThanOrEqualTo(String value) {
addCriterion("description <=", value, "description");
return (Criteria) this;
}
public Criteria andDescriptionLike(String value) {
addCriterion("description like", value, "description");
return (Criteria) this;
}
public Criteria andDescriptionNotLike(String value) {
addCriterion("description not like", value, "description");
return (Criteria) this;
}
public Criteria andDescriptionIn(List<String> values) {
addCriterion("description in", values, "description");
return (Criteria) this;
}
public Criteria andDescriptionNotIn(List<String> values) {
addCriterion("description not in", values, "description");
return (Criteria) this;
}
public Criteria andDescriptionBetween(String value1, String value2) {
addCriterion("description between", value1, value2, "description");
return (Criteria) this;
}
public Criteria andDescriptionNotBetween(String value1, String value2) {
addCriterion("description not between", value1, value2, "description");
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 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;
}
}
/**
* s2_database
*/
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
/**
* s2_database null
*/
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;
}
}
}

View File

@@ -0,0 +1,255 @@
package com.tencent.supersonic.semantic.model.domain.dataobject;
import java.util.Date;
public class DatasourceDO {
/**
*
*/
private Long id;
/**
* 主题域ID
*/
private Long domainId;
/**
* 数据源名称
*/
private String name;
/**
* 内部名称
*/
private String bizName;
/**
* 数据源描述
*/
private String description;
/**
* 数据库实例ID
*/
private Long databaseId;
/**
* 创建时间
*/
private Date createdAt;
/**
* 创建人
*/
private String createdBy;
/**
* 更新时间
*/
private Date updatedAt;
/**
* 更新人
*/
private String updatedBy;
/**
* 数据源配置
*/
private String datasourceDetail;
/**
* @return id
*/
public Long getId() {
return id;
}
/**
* @param id
*/
public void setId(Long id) {
this.id = id;
}
/**
* 主题域ID
*
* @return domain_id 主题域ID
*/
public Long getDomainId() {
return domainId;
}
/**
* 主题域ID
*
* @param domainId 主题域ID
*/
public void setDomainId(Long domainId) {
this.domainId = domainId;
}
/**
* 数据源名称
*
* @return name 数据源名称
*/
public String getName() {
return name;
}
/**
* 数据源名称
*
* @param name 数据源名称
*/
public void setName(String name) {
this.name = name == null ? null : name.trim();
}
/**
* 内部名称
*
* @return biz_name 内部名称
*/
public String getBizName() {
return bizName;
}
/**
* 内部名称
*
* @param bizName 内部名称
*/
public void setBizName(String bizName) {
this.bizName = bizName == null ? null : bizName.trim();
}
/**
* 数据源描述
*
* @return description 数据源描述
*/
public String getDescription() {
return description;
}
/**
* 数据源描述
*
* @param description 数据源描述
*/
public void setDescription(String description) {
this.description = description == null ? null : description.trim();
}
/**
* 数据库实例ID
*
* @return database_id 数据库实例ID
*/
public Long getDatabaseId() {
return databaseId;
}
/**
* 数据库实例ID
*
* @param databaseId 数据库实例ID
*/
public void setDatabaseId(Long databaseId) {
this.databaseId = databaseId;
}
/**
* 创建时间
*
* @return created_at 创建时间
*/
public Date getCreatedAt() {
return createdAt;
}
/**
* 创建时间
*
* @param createdAt 创建时间
*/
public void setCreatedAt(Date createdAt) {
this.createdAt = createdAt;
}
/**
* 创建人
*
* @return created_by 创建人
*/
public String getCreatedBy() {
return createdBy;
}
/**
* 创建人
*
* @param createdBy 创建人
*/
public void setCreatedBy(String createdBy) {
this.createdBy = createdBy == null ? null : createdBy.trim();
}
/**
* 更新时间
*
* @return updated_at 更新时间
*/
public Date getUpdatedAt() {
return updatedAt;
}
/**
* 更新时间
*
* @param updatedAt 更新时间
*/
public void setUpdatedAt(Date updatedAt) {
this.updatedAt = updatedAt;
}
/**
* 更新人
*
* @return updated_by 更新人
*/
public String getUpdatedBy() {
return updatedBy;
}
/**
* 更新人
*
* @param updatedBy 更新人
*/
public void setUpdatedBy(String updatedBy) {
this.updatedBy = updatedBy == null ? null : updatedBy.trim();
}
/**
* 数据源配置
*
* @return datasource_detail 数据源配置
*/
public String getDatasourceDetail() {
return datasourceDetail;
}
/**
* 数据源配置
*
* @param datasourceDetail 数据源配置
*/
public void setDatasourceDetail(String datasourceDetail) {
this.datasourceDetail = datasourceDetail == null ? null : datasourceDetail.trim();
}
}

View File

@@ -0,0 +1,943 @@
package com.tencent.supersonic.semantic.model.domain.dataobject;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class DatasourceDOExample {
/**
* s2_datasource
*/
protected String orderByClause;
/**
* s2_datasource
*/
protected boolean distinct;
/**
* s2_datasource
*/
protected List<Criteria> oredCriteria;
/**
* s2_datasource
*/
protected Integer limitStart;
/**
* s2_datasource
*/
protected Integer limitEnd;
/**
* @mbg.generated
*/
public DatasourceDOExample() {
oredCriteria = new ArrayList<Criteria>();
}
/**
* @mbg.generated
*/
public String getOrderByClause() {
return orderByClause;
}
/**
* @mbg.generated
*/
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
/**
* @mbg.generated
*/
public boolean isDistinct() {
return distinct;
}
/**
* @mbg.generated
*/
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
/**
* @mbg.generated
*/
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
/**
* @mbg.generated
*/
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
/**
* @mbg.generated
*/
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
/**
* @mbg.generated
*/
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
/**
* @mbg.generated
*/
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
/**
* @mbg.generated
*/
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
/**
* @mbg.generated
*/
public Integer getLimitStart() {
return limitStart;
}
/**
* @mbg.generated
*/
public void setLimitStart(Integer limitStart) {
this.limitStart = limitStart;
}
/**
* @mbg.generated
*/
public Integer getLimitEnd() {
return limitEnd;
}
/**
* @mbg.generated
*/
public void setLimitEnd(Integer limitEnd) {
this.limitEnd = limitEnd;
}
/**
* s2_datasource null
*/
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
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 andDomainIdIsNull() {
addCriterion("domain_id is null");
return (Criteria) this;
}
public Criteria andDomainIdIsNotNull() {
addCriterion("domain_id is not null");
return (Criteria) this;
}
public Criteria andDomainIdEqualTo(Long value) {
addCriterion("domain_id =", value, "domainId");
return (Criteria) this;
}
public Criteria andDomainIdNotEqualTo(Long value) {
addCriterion("domain_id <>", value, "domainId");
return (Criteria) this;
}
public Criteria andDomainIdGreaterThan(Long value) {
addCriterion("domain_id >", value, "domainId");
return (Criteria) this;
}
public Criteria andDomainIdGreaterThanOrEqualTo(Long value) {
addCriterion("domain_id >=", value, "domainId");
return (Criteria) this;
}
public Criteria andDomainIdLessThan(Long value) {
addCriterion("domain_id <", value, "domainId");
return (Criteria) this;
}
public Criteria andDomainIdLessThanOrEqualTo(Long value) {
addCriterion("domain_id <=", value, "domainId");
return (Criteria) this;
}
public Criteria andDomainIdIn(List<Long> values) {
addCriterion("domain_id in", values, "domainId");
return (Criteria) this;
}
public Criteria andDomainIdNotIn(List<Long> values) {
addCriterion("domain_id not in", values, "domainId");
return (Criteria) this;
}
public Criteria andDomainIdBetween(Long value1, Long value2) {
addCriterion("domain_id between", value1, value2, "domainId");
return (Criteria) this;
}
public Criteria andDomainIdNotBetween(Long value1, Long value2) {
addCriterion("domain_id not between", value1, value2, "domainId");
return (Criteria) this;
}
public Criteria andNameIsNull() {
addCriterion("name is null");
return (Criteria) this;
}
public Criteria andNameIsNotNull() {
addCriterion("name is not null");
return (Criteria) this;
}
public Criteria andNameEqualTo(String value) {
addCriterion("name =", value, "name");
return (Criteria) this;
}
public Criteria andNameNotEqualTo(String value) {
addCriterion("name <>", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThan(String value) {
addCriterion("name >", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThanOrEqualTo(String value) {
addCriterion("name >=", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThan(String value) {
addCriterion("name <", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThanOrEqualTo(String value) {
addCriterion("name <=", value, "name");
return (Criteria) this;
}
public Criteria andNameLike(String value) {
addCriterion("name like", value, "name");
return (Criteria) this;
}
public Criteria andNameNotLike(String value) {
addCriterion("name not like", value, "name");
return (Criteria) this;
}
public Criteria andNameIn(List<String> values) {
addCriterion("name in", values, "name");
return (Criteria) this;
}
public Criteria andNameNotIn(List<String> values) {
addCriterion("name not in", values, "name");
return (Criteria) this;
}
public Criteria andNameBetween(String value1, String value2) {
addCriterion("name between", value1, value2, "name");
return (Criteria) this;
}
public Criteria andNameNotBetween(String value1, String value2) {
addCriterion("name not between", value1, value2, "name");
return (Criteria) this;
}
public Criteria andBizNameIsNull() {
addCriterion("biz_name is null");
return (Criteria) this;
}
public Criteria andBizNameIsNotNull() {
addCriterion("biz_name is not null");
return (Criteria) this;
}
public Criteria andBizNameEqualTo(String value) {
addCriterion("biz_name =", value, "bizName");
return (Criteria) this;
}
public Criteria andBizNameNotEqualTo(String value) {
addCriterion("biz_name <>", value, "bizName");
return (Criteria) this;
}
public Criteria andBizNameGreaterThan(String value) {
addCriterion("biz_name >", value, "bizName");
return (Criteria) this;
}
public Criteria andBizNameGreaterThanOrEqualTo(String value) {
addCriterion("biz_name >=", value, "bizName");
return (Criteria) this;
}
public Criteria andBizNameLessThan(String value) {
addCriterion("biz_name <", value, "bizName");
return (Criteria) this;
}
public Criteria andBizNameLessThanOrEqualTo(String value) {
addCriterion("biz_name <=", value, "bizName");
return (Criteria) this;
}
public Criteria andBizNameLike(String value) {
addCriterion("biz_name like", value, "bizName");
return (Criteria) this;
}
public Criteria andBizNameNotLike(String value) {
addCriterion("biz_name not like", value, "bizName");
return (Criteria) this;
}
public Criteria andBizNameIn(List<String> values) {
addCriterion("biz_name in", values, "bizName");
return (Criteria) this;
}
public Criteria andBizNameNotIn(List<String> values) {
addCriterion("biz_name not in", values, "bizName");
return (Criteria) this;
}
public Criteria andBizNameBetween(String value1, String value2) {
addCriterion("biz_name between", value1, value2, "bizName");
return (Criteria) this;
}
public Criteria andBizNameNotBetween(String value1, String value2) {
addCriterion("biz_name not between", value1, value2, "bizName");
return (Criteria) this;
}
public Criteria andDescriptionIsNull() {
addCriterion("description is null");
return (Criteria) this;
}
public Criteria andDescriptionIsNotNull() {
addCriterion("description is not null");
return (Criteria) this;
}
public Criteria andDescriptionEqualTo(String value) {
addCriterion("description =", value, "description");
return (Criteria) this;
}
public Criteria andDescriptionNotEqualTo(String value) {
addCriterion("description <>", value, "description");
return (Criteria) this;
}
public Criteria andDescriptionGreaterThan(String value) {
addCriterion("description >", value, "description");
return (Criteria) this;
}
public Criteria andDescriptionGreaterThanOrEqualTo(String value) {
addCriterion("description >=", value, "description");
return (Criteria) this;
}
public Criteria andDescriptionLessThan(String value) {
addCriterion("description <", value, "description");
return (Criteria) this;
}
public Criteria andDescriptionLessThanOrEqualTo(String value) {
addCriterion("description <=", value, "description");
return (Criteria) this;
}
public Criteria andDescriptionLike(String value) {
addCriterion("description like", value, "description");
return (Criteria) this;
}
public Criteria andDescriptionNotLike(String value) {
addCriterion("description not like", value, "description");
return (Criteria) this;
}
public Criteria andDescriptionIn(List<String> values) {
addCriterion("description in", values, "description");
return (Criteria) this;
}
public Criteria andDescriptionNotIn(List<String> values) {
addCriterion("description not in", values, "description");
return (Criteria) this;
}
public Criteria andDescriptionBetween(String value1, String value2) {
addCriterion("description between", value1, value2, "description");
return (Criteria) this;
}
public Criteria andDescriptionNotBetween(String value1, String value2) {
addCriterion("description not between", value1, value2, "description");
return (Criteria) this;
}
public Criteria andDatabaseIdIsNull() {
addCriterion("database_id is null");
return (Criteria) this;
}
public Criteria andDatabaseIdIsNotNull() {
addCriterion("database_id is not null");
return (Criteria) this;
}
public Criteria andDatabaseIdEqualTo(Long value) {
addCriterion("database_id =", value, "databaseId");
return (Criteria) this;
}
public Criteria andDatabaseIdNotEqualTo(Long value) {
addCriterion("database_id <>", value, "databaseId");
return (Criteria) this;
}
public Criteria andDatabaseIdGreaterThan(Long value) {
addCriterion("database_id >", value, "databaseId");
return (Criteria) this;
}
public Criteria andDatabaseIdGreaterThanOrEqualTo(Long value) {
addCriterion("database_id >=", value, "databaseId");
return (Criteria) this;
}
public Criteria andDatabaseIdLessThan(Long value) {
addCriterion("database_id <", value, "databaseId");
return (Criteria) this;
}
public Criteria andDatabaseIdLessThanOrEqualTo(Long value) {
addCriterion("database_id <=", value, "databaseId");
return (Criteria) this;
}
public Criteria andDatabaseIdIn(List<Long> values) {
addCriterion("database_id in", values, "databaseId");
return (Criteria) this;
}
public Criteria andDatabaseIdNotIn(List<Long> values) {
addCriterion("database_id not in", values, "databaseId");
return (Criteria) this;
}
public Criteria andDatabaseIdBetween(Long value1, Long value2) {
addCriterion("database_id between", value1, value2, "databaseId");
return (Criteria) this;
}
public Criteria andDatabaseIdNotBetween(Long value1, Long value2) {
addCriterion("database_id not between", value1, value2, "databaseId");
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;
}
}
/**
* s2_datasource
*/
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
/**
* s2_datasource null
*/
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;
}
}
}

View File

@@ -0,0 +1,177 @@
package com.tencent.supersonic.semantic.model.domain.dataobject;
import java.util.Date;
public class DatasourceRelaDO {
/**
*
*/
private Long id;
/**
*
*/
private Long domainId;
/**
*
*/
private Long datasourceFrom;
/**
*
*/
private Long datasourceTo;
/**
*
*/
private String joinKey;
/**
*
*/
private Date createdAt;
/**
*
*/
private String createdBy;
/**
*
*/
private Date updatedAt;
/**
*
*/
private String updatedBy;
/**
* @return id
*/
public Long getId() {
return id;
}
/**
* @param id
*/
public void setId(Long id) {
this.id = id;
}
/**
* @return domain_id
*/
public Long getDomainId() {
return domainId;
}
/**
* @param domainId
*/
public void setDomainId(Long domainId) {
this.domainId = domainId;
}
/**
* @return datasource_from
*/
public Long getDatasourceFrom() {
return datasourceFrom;
}
/**
* @param datasourceFrom
*/
public void setDatasourceFrom(Long datasourceFrom) {
this.datasourceFrom = datasourceFrom;
}
/**
* @return datasource_to
*/
public Long getDatasourceTo() {
return datasourceTo;
}
/**
* @param datasourceTo
*/
public void setDatasourceTo(Long datasourceTo) {
this.datasourceTo = datasourceTo;
}
/**
* @return join_key
*/
public String getJoinKey() {
return joinKey;
}
/**
* @param joinKey
*/
public void setJoinKey(String joinKey) {
this.joinKey = joinKey == null ? null : joinKey.trim();
}
/**
* @return created_at
*/
public Date getCreatedAt() {
return createdAt;
}
/**
* @param createdAt
*/
public void setCreatedAt(Date createdAt) {
this.createdAt = createdAt;
}
/**
* @return created_by
*/
public String getCreatedBy() {
return createdBy;
}
/**
* @param createdBy
*/
public void setCreatedBy(String createdBy) {
this.createdBy = createdBy == null ? null : createdBy.trim();
}
/**
* @return updated_at
*/
public Date getUpdatedAt() {
return updatedAt;
}
/**
* @param updatedAt
*/
public void setUpdatedAt(Date updatedAt) {
this.updatedAt = updatedAt;
}
/**
* @return updated_by
*/
public String getUpdatedBy() {
return updatedBy;
}
/**
* @param updatedBy
*/
public void setUpdatedBy(String updatedBy) {
this.updatedBy = updatedBy == null ? null : updatedBy.trim();
}
}

View File

@@ -0,0 +1,858 @@
package com.tencent.supersonic.semantic.model.domain.dataobject;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class DatasourceRelaDOExample {
/**
* s2_datasource_rela
*/
protected String orderByClause;
/**
* s2_datasource_rela
*/
protected boolean distinct;
/**
* s2_datasource_rela
*/
protected List<Criteria> oredCriteria;
/**
* s2_datasource_rela
*/
protected Integer limitStart;
/**
* s2_datasource_rela
*/
protected Integer limitEnd;
/**
* @mbg.generated
*/
public DatasourceRelaDOExample() {
oredCriteria = new ArrayList<Criteria>();
}
/**
* @mbg.generated
*/
public String getOrderByClause() {
return orderByClause;
}
/**
* @mbg.generated
*/
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
/**
* @mbg.generated
*/
public boolean isDistinct() {
return distinct;
}
/**
* @mbg.generated
*/
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
/**
* @mbg.generated
*/
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
/**
* @mbg.generated
*/
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
/**
* @mbg.generated
*/
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
/**
* @mbg.generated
*/
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
/**
* @mbg.generated
*/
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
/**
* @mbg.generated
*/
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
/**
* @mbg.generated
*/
public Integer getLimitStart() {
return limitStart;
}
/**
* @mbg.generated
*/
public void setLimitStart(Integer limitStart) {
this.limitStart = limitStart;
}
/**
* @mbg.generated
*/
public Integer getLimitEnd() {
return limitEnd;
}
/**
* @mbg.generated
*/
public void setLimitEnd(Integer limitEnd) {
this.limitEnd = limitEnd;
}
/**
* s2_datasource_rela null
*/
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
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 andDomainIdIsNull() {
addCriterion("domain_id is null");
return (Criteria) this;
}
public Criteria andDomainIdIsNotNull() {
addCriterion("domain_id is not null");
return (Criteria) this;
}
public Criteria andDomainIdEqualTo(Long value) {
addCriterion("domain_id =", value, "domainId");
return (Criteria) this;
}
public Criteria andDomainIdNotEqualTo(Long value) {
addCriterion("domain_id <>", value, "domainId");
return (Criteria) this;
}
public Criteria andDomainIdGreaterThan(Long value) {
addCriterion("domain_id >", value, "domainId");
return (Criteria) this;
}
public Criteria andDomainIdGreaterThanOrEqualTo(Long value) {
addCriterion("domain_id >=", value, "domainId");
return (Criteria) this;
}
public Criteria andDomainIdLessThan(Long value) {
addCriterion("domain_id <", value, "domainId");
return (Criteria) this;
}
public Criteria andDomainIdLessThanOrEqualTo(Long value) {
addCriterion("domain_id <=", value, "domainId");
return (Criteria) this;
}
public Criteria andDomainIdIn(List<Long> values) {
addCriterion("domain_id in", values, "domainId");
return (Criteria) this;
}
public Criteria andDomainIdNotIn(List<Long> values) {
addCriterion("domain_id not in", values, "domainId");
return (Criteria) this;
}
public Criteria andDomainIdBetween(Long value1, Long value2) {
addCriterion("domain_id between", value1, value2, "domainId");
return (Criteria) this;
}
public Criteria andDomainIdNotBetween(Long value1, Long value2) {
addCriterion("domain_id not between", value1, value2, "domainId");
return (Criteria) this;
}
public Criteria andDatasourceFromIsNull() {
addCriterion("datasource_from is null");
return (Criteria) this;
}
public Criteria andDatasourceFromIsNotNull() {
addCriterion("datasource_from is not null");
return (Criteria) this;
}
public Criteria andDatasourceFromEqualTo(Long value) {
addCriterion("datasource_from =", value, "datasourceFrom");
return (Criteria) this;
}
public Criteria andDatasourceFromNotEqualTo(Long value) {
addCriterion("datasource_from <>", value, "datasourceFrom");
return (Criteria) this;
}
public Criteria andDatasourceFromGreaterThan(Long value) {
addCriterion("datasource_from >", value, "datasourceFrom");
return (Criteria) this;
}
public Criteria andDatasourceFromLessThan(Long value) {
addCriterion("datasource_from <", value, "datasourceFrom");
return (Criteria) this;
}
public Criteria andDatasourceFromLessThanOrEqualTo(Long value) {
addCriterion("datasource_from <=", value, "datasourceFrom");
return (Criteria) this;
}
public Criteria andDatasourceFromIn(List<Long> values) {
addCriterion("datasource_from in", values, "datasourceFrom");
return (Criteria) this;
}
public Criteria andDatasourceFromNotIn(List<Long> values) {
addCriterion("datasource_from not in", values, "datasourceFrom");
return (Criteria) this;
}
public Criteria andDatasourceFromBetween(Long value1, Long value2) {
addCriterion("datasource_from between", value1, value2, "datasourceFrom");
return (Criteria) this;
}
public Criteria andDatasourceFromNotBetween(Long value1, Long value2) {
addCriterion("datasource_from not between", value1, value2, "datasourceFrom");
return (Criteria) this;
}
public Criteria andDatasourceToIsNull() {
addCriterion("datasource_to is null");
return (Criteria) this;
}
public Criteria andDatasourceToIsNotNull() {
addCriterion("datasource_to is not null");
return (Criteria) this;
}
public Criteria andDatasourceToEqualTo(Long value) {
addCriterion("datasource_to =", value, "datasourceTo");
return (Criteria) this;
}
public Criteria andDatasourceToNotEqualTo(Long value) {
addCriterion("datasource_to <>", value, "datasourceTo");
return (Criteria) this;
}
public Criteria andDatasourceToGreaterThan(Long value) {
addCriterion("datasource_to >", value, "datasourceTo");
return (Criteria) this;
}
public Criteria andDatasourceToGreaterThanOrEqualTo(Long value) {
addCriterion("datasource_to >=", value, "datasourceTo");
return (Criteria) this;
}
public Criteria andDatasourceToLessThan(Long value) {
addCriterion("datasource_to <", value, "datasourceTo");
return (Criteria) this;
}
public Criteria andDatasourceToLessThanOrEqualTo(Long value) {
addCriterion("datasource_to <=", value, "datasourceTo");
return (Criteria) this;
}
public Criteria andDatasourceToIn(List<Long> values) {
addCriterion("datasource_to in", values, "datasourceTo");
return (Criteria) this;
}
public Criteria andDatasourceToNotIn(List<Long> values) {
addCriterion("datasource_to not in", values, "datasourceTo");
return (Criteria) this;
}
public Criteria andDatasourceToBetween(Long value1, Long value2) {
addCriterion("datasource_to between", value1, value2, "datasourceTo");
return (Criteria) this;
}
public Criteria andDatasourceToNotBetween(Long value1, Long value2) {
addCriterion("datasource_to not between", value1, value2, "datasourceTo");
return (Criteria) this;
}
public Criteria andJoinKeyIsNull() {
addCriterion("join_key is null");
return (Criteria) this;
}
public Criteria andJoinKeyIsNotNull() {
addCriterion("join_key is not null");
return (Criteria) this;
}
public Criteria andJoinKeyEqualTo(String value) {
addCriterion("join_key =", value, "joinKey");
return (Criteria) this;
}
public Criteria andJoinKeyNotEqualTo(String value) {
addCriterion("join_key <>", value, "joinKey");
return (Criteria) this;
}
public Criteria andJoinKeyGreaterThan(String value) {
addCriterion("join_key >", value, "joinKey");
return (Criteria) this;
}
public Criteria andJoinKeyGreaterThanOrEqualTo(String value) {
addCriterion("join_key >=", value, "joinKey");
return (Criteria) this;
}
public Criteria andJoinKeyLessThan(String value) {
addCriterion("join_key <", value, "joinKey");
return (Criteria) this;
}
public Criteria andJoinKeyLessThanOrEqualTo(String value) {
addCriterion("join_key <=", value, "joinKey");
return (Criteria) this;
}
public Criteria andJoinKeyLike(String value) {
addCriterion("join_key like", value, "joinKey");
return (Criteria) this;
}
public Criteria andJoinKeyNotLike(String value) {
addCriterion("join_key not like", value, "joinKey");
return (Criteria) this;
}
public Criteria andJoinKeyIn(List<String> values) {
addCriterion("join_key in", values, "joinKey");
return (Criteria) this;
}
public Criteria andJoinKeyNotIn(List<String> values) {
addCriterion("join_key not in", values, "joinKey");
return (Criteria) this;
}
public Criteria andJoinKeyBetween(String value1, String value2) {
addCriterion("join_key between", value1, value2, "joinKey");
return (Criteria) this;
}
public Criteria andJoinKeyNotBetween(String value1, String value2) {
addCriterion("join_key not between", value1, value2, "joinKey");
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;
}
}
/**
* s2_datasource_rela
*/
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
/**
* s2_datasource_rela null
*/
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;
}
}
}

View File

@@ -0,0 +1,20 @@
package com.tencent.supersonic.semantic.model.domain.dataobject;
import lombok.Data;
@Data
public class DateInfoDO {
private Long id;
private String type;
private Long itemId;
private String dateFormat;
private String startDate;
private String endDate;
private String unavailableDateList;
private String createdBy;
private String updatedBy;
private String datePeriod;
}

View File

@@ -0,0 +1,278 @@
package com.tencent.supersonic.semantic.model.domain.dataobject;
import java.util.Date;
public class DictionaryDO {
/**
*
*/
private Long id;
/**
* 对应维度id、指标id等
*/
private Long itemId;
/**
* 对应维度、指标等
*/
private String type;
/**
* 1-开启写入字典0-不开启
*/
private Boolean isDictInfo;
/**
* 创建时间
*/
private Date createdAt;
/**
* 更新时间
*/
private Date updatedAt;
/**
* 创建人
*/
private String createdBy;
/**
* 更新人
*/
private String updatedBy;
/**
* 1-删除,0-可用
*/
private Boolean isDeleted;
/**
* 字典黑名单
*/
private String blackList;
/**
* 字典白名单
*/
private String whiteList;
/**
* 字典规则
*/
private String ruleList;
/**
* @return id
*/
public Long getId() {
return id;
}
/**
* @param id
*/
public void setId(Long id) {
this.id = id;
}
/**
* 对应维度id、指标id等
*
* @return item_id 对应维度id、指标id等
*/
public Long getItemId() {
return itemId;
}
/**
* 对应维度id、指标id等
*
* @param itemId 对应维度id、指标id等
*/
public void setItemId(Long itemId) {
this.itemId = itemId;
}
/**
* 对应维度、指标等
*
* @return type 对应维度、指标等
*/
public String getType() {
return type;
}
/**
* 对应维度、指标等
*
* @param type 对应维度、指标等
*/
public void setType(String type) {
this.type = type == null ? null : type.trim();
}
/**
* 1-开启写入字典0-不开启
*
* @return is_dict_Info 1-开启写入字典0-不开启
*/
public Boolean getIsDictInfo() {
return isDictInfo;
}
/**
* 1-开启写入字典0-不开启
*
* @param isDictInfo 1-开启写入字典0-不开启
*/
public void setIsDictInfo(Boolean isDictInfo) {
this.isDictInfo = isDictInfo;
}
/**
* 创建时间
*
* @return created_at 创建时间
*/
public Date getCreatedAt() {
return createdAt;
}
/**
* 创建时间
*
* @param createdAt 创建时间
*/
public void setCreatedAt(Date createdAt) {
this.createdAt = createdAt;
}
/**
* 更新时间
*
* @return updated_at 更新时间
*/
public Date getUpdatedAt() {
return updatedAt;
}
/**
* 更新时间
*
* @param updatedAt 更新时间
*/
public void setUpdatedAt(Date updatedAt) {
this.updatedAt = updatedAt;
}
/**
* 创建人
*
* @return created_by 创建人
*/
public String getCreatedBy() {
return createdBy;
}
/**
* 创建人
*
* @param createdBy 创建人
*/
public void setCreatedBy(String createdBy) {
this.createdBy = createdBy == null ? null : createdBy.trim();
}
/**
* 更新人
*
* @return updated_by 更新人
*/
public String getUpdatedBy() {
return updatedBy;
}
/**
* 更新人
*
* @param updatedBy 更新人
*/
public void setUpdatedBy(String updatedBy) {
this.updatedBy = updatedBy == null ? null : updatedBy.trim();
}
/**
* 1-删除,0-可用
*
* @return is_deleted 1-删除,0-可用
*/
public Boolean getIsDeleted() {
return isDeleted;
}
/**
* 1-删除,0-可用
*
* @param isDeleted 1-删除,0-可用
*/
public void setIsDeleted(Boolean isDeleted) {
this.isDeleted = isDeleted;
}
/**
* 字典黑名单
*
* @return black_list 字典黑名单
*/
public String getBlackList() {
return blackList;
}
/**
* 字典黑名单
*
* @param blackList 字典黑名单
*/
public void setBlackList(String blackList) {
this.blackList = blackList == null ? null : blackList.trim();
}
/**
* 字典白名单
*
* @return white_list 字典白名单
*/
public String getWhiteList() {
return whiteList;
}
/**
* 字典白名单
*
* @param whiteList 字典白名单
*/
public void setWhiteList(String whiteList) {
this.whiteList = whiteList == null ? null : whiteList.trim();
}
/**
* 字典规则
*
* @return rule_list 字典规则
*/
public String getRuleList() {
return ruleList;
}
/**
* 字典规则
*
* @param ruleList 字典规则
*/
public void setRuleList(String ruleList) {
this.ruleList = ruleList == null ? null : ruleList.trim();
}
}

View File

@@ -0,0 +1,863 @@
package com.tencent.supersonic.semantic.model.domain.dataobject;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class DictionaryDOExample {
/**
* s2_dictionary
*/
protected String orderByClause;
/**
* s2_dictionary
*/
protected boolean distinct;
/**
* s2_dictionary
*/
protected List<Criteria> oredCriteria;
/**
* s2_dictionary
*/
protected Integer limitStart;
/**
* s2_dictionary
*/
protected Integer limitEnd;
/**
* @mbg.generated
*/
public DictionaryDOExample() {
oredCriteria = new ArrayList<Criteria>();
}
/**
* @mbg.generated
*/
public String getOrderByClause() {
return orderByClause;
}
/**
* @mbg.generated
*/
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
/**
* @mbg.generated
*/
public boolean isDistinct() {
return distinct;
}
/**
* @mbg.generated
*/
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
/**
* @mbg.generated
*/
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
/**
* @mbg.generated
*/
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
/**
* @mbg.generated
*/
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
/**
* @mbg.generated
*/
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
/**
* @mbg.generated
*/
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
/**
* @mbg.generated
*/
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
/**
* @mbg.generated
*/
public Integer getLimitStart() {
return limitStart;
}
/**
* @mbg.generated
*/
public void setLimitStart(Integer limitStart) {
this.limitStart = limitStart;
}
/**
* @mbg.generated
*/
public Integer getLimitEnd() {
return limitEnd;
}
/**
* @mbg.generated
*/
public void setLimitEnd(Integer limitEnd) {
this.limitEnd = limitEnd;
}
/**
* s2_dictionary null
*/
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
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 andItemIdIsNull() {
addCriterion("item_id is null");
return (Criteria) this;
}
public Criteria andItemIdIsNotNull() {
addCriterion("item_id is not null");
return (Criteria) this;
}
public Criteria andItemIdEqualTo(Long value) {
addCriterion("item_id =", value, "itemId");
return (Criteria) this;
}
public Criteria andItemIdNotEqualTo(Long value) {
addCriterion("item_id <>", value, "itemId");
return (Criteria) this;
}
public Criteria andItemIdGreaterThan(Long value) {
addCriterion("item_id >", value, "itemId");
return (Criteria) this;
}
public Criteria andItemIdGreaterThanOrEqualTo(Long value) {
addCriterion("item_id >=", value, "itemId");
return (Criteria) this;
}
public Criteria andItemIdLessThan(Long value) {
addCriterion("item_id <", value, "itemId");
return (Criteria) this;
}
public Criteria andItemIdLessThanOrEqualTo(Long value) {
addCriterion("item_id <=", value, "itemId");
return (Criteria) this;
}
public Criteria andItemIdIn(List<Long> values) {
addCriterion("item_id in", values, "itemId");
return (Criteria) this;
}
public Criteria andItemIdNotIn(List<Long> values) {
addCriterion("item_id not in", values, "itemId");
return (Criteria) this;
}
public Criteria andItemIdBetween(Long value1, Long value2) {
addCriterion("item_id between", value1, value2, "itemId");
return (Criteria) this;
}
public Criteria andItemIdNotBetween(Long value1, Long value2) {
addCriterion("item_id not between", value1, value2, "itemId");
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 andIsDictInfoIsNull() {
addCriterion("is_dict_Info is null");
return (Criteria) this;
}
public Criteria andIsDictInfoIsNotNull() {
addCriterion("is_dict_Info is not null");
return (Criteria) this;
}
public Criteria andIsDictInfoEqualTo(Boolean value) {
addCriterion("is_dict_Info =", value, "isDictInfo");
return (Criteria) this;
}
public Criteria andIsDictInfoNotEqualTo(Boolean value) {
addCriterion("is_dict_Info <>", value, "isDictInfo");
return (Criteria) this;
}
public Criteria andIsDictInfoGreaterThan(Boolean value) {
addCriterion("is_dict_Info >", value, "isDictInfo");
return (Criteria) this;
}
public Criteria andIsDictInfoGreaterThanOrEqualTo(Boolean value) {
addCriterion("is_dict_Info >=", value, "isDictInfo");
return (Criteria) this;
}
public Criteria andIsDictInfoLessThan(Boolean value) {
addCriterion("is_dict_Info <", value, "isDictInfo");
return (Criteria) this;
}
public Criteria andIsDictInfoLessThanOrEqualTo(Boolean value) {
addCriterion("is_dict_Info <=", value, "isDictInfo");
return (Criteria) this;
}
public Criteria andIsDictInfoIn(List<Boolean> values) {
addCriterion("is_dict_Info in", values, "isDictInfo");
return (Criteria) this;
}
public Criteria andIsDictInfoNotIn(List<Boolean> values) {
addCriterion("is_dict_Info not in", values, "isDictInfo");
return (Criteria) this;
}
public Criteria andIsDictInfoBetween(Boolean value1, Boolean value2) {
addCriterion("is_dict_Info between", value1, value2, "isDictInfo");
return (Criteria) this;
}
public Criteria andIsDictInfoNotBetween(Boolean value1, Boolean value2) {
addCriterion("is_dict_Info not between", value1, value2, "isDictInfo");
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 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 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 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 andIsDeletedIsNull() {
addCriterion("is_deleted is null");
return (Criteria) this;
}
public Criteria andIsDeletedIsNotNull() {
addCriterion("is_deleted is not null");
return (Criteria) this;
}
public Criteria andIsDeletedEqualTo(Boolean value) {
addCriterion("is_deleted =", value, "isDeleted");
return (Criteria) this;
}
public Criteria andIsDeletedNotEqualTo(Boolean value) {
addCriterion("is_deleted <>", value, "isDeleted");
return (Criteria) this;
}
public Criteria andIsDeletedGreaterThan(Boolean value) {
addCriterion("is_deleted >", value, "isDeleted");
return (Criteria) this;
}
public Criteria andIsDeletedGreaterThanOrEqualTo(Boolean value) {
addCriterion("is_deleted >=", value, "isDeleted");
return (Criteria) this;
}
public Criteria andIsDeletedLessThan(Boolean value) {
addCriterion("is_deleted <", value, "isDeleted");
return (Criteria) this;
}
public Criteria andIsDeletedLessThanOrEqualTo(Boolean value) {
addCriterion("is_deleted <=", value, "isDeleted");
return (Criteria) this;
}
public Criteria andIsDeletedIn(List<Boolean> values) {
addCriterion("is_deleted in", values, "isDeleted");
return (Criteria) this;
}
public Criteria andIsDeletedNotIn(List<Boolean> values) {
addCriterion("is_deleted not in", values, "isDeleted");
return (Criteria) this;
}
public Criteria andIsDeletedBetween(Boolean value1, Boolean value2) {
addCriterion("is_deleted between", value1, value2, "isDeleted");
return (Criteria) this;
}
public Criteria andIsDeletedNotBetween(Boolean value1, Boolean value2) {
addCriterion("is_deleted not between", value1, value2, "isDeleted");
return (Criteria) this;
}
}
/**
* s2_dictionary
*/
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
/**
* s2_dictionary null
*/
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;
}
}
}

View File

@@ -0,0 +1,207 @@
package com.tencent.supersonic.semantic.model.domain.dataobject;
public class DictionaryTaskDO {
/**
*
*/
private Long id;
/**
* 主体域ID
*/
private Long domainId;
/**
* 任务最终运行状态
*/
private Integer status;
/**
* 任务耗时
*/
private Long elapsedMs;
/**
* 查询涉及的维度
*/
private String dimensions;
/**
* 查询涉及的指标
*/
private String metrics;
/**
* 查询的过滤信息
*/
private String filters;
/**
* 查询的排序信息
*/
private String orderBy;
/**
* 查询涉及的日期信息
*/
private String dateInfo;
/**
* @return id
*/
public Long getId() {
return id;
}
/**
* @param id
*/
public void setId(Long id) {
this.id = id;
}
/**
* 主体域ID
*
* @return domain_id 主体域ID
*/
public Long getDomainId() {
return domainId;
}
/**
* 主体域ID
*
* @param domainId 主体域ID
*/
public void setDomainId(Long domainId) {
this.domainId = domainId;
}
/**
* 任务最终运行状态
*
* @return status 任务最终运行状态
*/
public Integer getStatus() {
return status;
}
/**
* 任务最终运行状态
*
* @param status 任务最终运行状态
*/
public void setStatus(Integer status) {
this.status = status;
}
/**
* 任务耗时
*
* @return elapsed_ms 任务耗时
*/
public Long getElapsedMs() {
return elapsedMs;
}
/**
* 任务耗时
*
* @param elapsedMs 任务耗时
*/
public void setElapsedMs(Long elapsedMs) {
this.elapsedMs = elapsedMs;
}
/**
* 查询涉及的维度
*
* @return dimensions 查询涉及的维度
*/
public String getDimensions() {
return dimensions;
}
/**
* 查询涉及的维度
*
* @param dimensions 查询涉及的维度
*/
public void setDimensions(String dimensions) {
this.dimensions = dimensions == null ? null : dimensions.trim();
}
/**
* 查询涉及的指标
*
* @return metrics 查询涉及的指标
*/
public String getMetrics() {
return metrics;
}
/**
* 查询涉及的指标
*
* @param metrics 查询涉及的指标
*/
public void setMetrics(String metrics) {
this.metrics = metrics == null ? null : metrics.trim();
}
/**
* 查询的过滤信息
*
* @return filters 查询的过滤信息
*/
public String getFilters() {
return filters;
}
/**
* 查询的过滤信息
*
* @param filters 查询的过滤信息
*/
public void setFilters(String filters) {
this.filters = filters == null ? null : filters.trim();
}
/**
* 查询的排序信息
*
* @return order_by 查询的排序信息
*/
public String getOrderBy() {
return orderBy;
}
/**
* 查询的排序信息
*
* @param orderBy 查询的排序信息
*/
public void setOrderBy(String orderBy) {
this.orderBy = orderBy == null ? null : orderBy.trim();
}
/**
* 查询涉及的日期信息
*
* @return date_info 查询涉及的日期信息
*/
public String getDateInfo() {
return dateInfo;
}
/**
* 查询涉及的日期信息
*
* @param dateInfo 查询涉及的日期信息
*/
public void setDateInfo(String dateInfo) {
this.dateInfo = dateInfo == null ? null : dateInfo.trim();
}
}

View File

@@ -0,0 +1,532 @@
package com.tencent.supersonic.semantic.model.domain.dataobject;
import java.util.ArrayList;
import java.util.List;
public class DictionaryTaskDOExample {
/**
* s2_dictionary_task
*/
protected String orderByClause;
/**
* s2_dictionary_task
*/
protected boolean distinct;
/**
* s2_dictionary_task
*/
protected List<Criteria> oredCriteria;
/**
* s2_dictionary_task
*/
protected Integer limitStart;
/**
* s2_dictionary_task
*/
protected Integer limitEnd;
/**
* @mbg.generated
*/
public DictionaryTaskDOExample() {
oredCriteria = new ArrayList<Criteria>();
}
/**
* @mbg.generated
*/
public String getOrderByClause() {
return orderByClause;
}
/**
* @mbg.generated
*/
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
/**
* @mbg.generated
*/
public boolean isDistinct() {
return distinct;
}
/**
* @mbg.generated
*/
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
/**
* @mbg.generated
*/
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
/**
* @mbg.generated
*/
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
/**
* @mbg.generated
*/
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
/**
* @mbg.generated
*/
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
/**
* @mbg.generated
*/
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
/**
* @mbg.generated
*/
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
/**
* @mbg.generated
*/
public Integer getLimitStart() {
return limitStart;
}
/**
* @mbg.generated
*/
public void setLimitStart(Integer limitStart) {
this.limitStart = limitStart;
}
/**
* @mbg.generated
*/
public Integer getLimitEnd() {
return limitEnd;
}
/**
* @mbg.generated
*/
public void setLimitEnd(Integer limitEnd) {
this.limitEnd = limitEnd;
}
/**
* s2_dictionary_task null
*/
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
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 andDomainIdIsNull() {
addCriterion("domain_id is null");
return (Criteria) this;
}
public Criteria andDomainIdIsNotNull() {
addCriterion("domain_id is not null");
return (Criteria) this;
}
public Criteria andDomainIdEqualTo(Long value) {
addCriterion("domain_id =", value, "domainId");
return (Criteria) this;
}
public Criteria andDomainIdNotEqualTo(Long value) {
addCriterion("domain_id <>", value, "domainId");
return (Criteria) this;
}
public Criteria andDomainIdGreaterThan(Long value) {
addCriterion("domain_id >", value, "domainId");
return (Criteria) this;
}
public Criteria andDomainIdGreaterThanOrEqualTo(Long value) {
addCriterion("domain_id >=", value, "domainId");
return (Criteria) this;
}
public Criteria andDomainIdLessThan(Long value) {
addCriterion("domain_id <", value, "domainId");
return (Criteria) this;
}
public Criteria andDomainIdLessThanOrEqualTo(Long value) {
addCriterion("domain_id <=", value, "domainId");
return (Criteria) this;
}
public Criteria andDomainIdIn(List<Long> values) {
addCriterion("domain_id in", values, "domainId");
return (Criteria) this;
}
public Criteria andDomainIdNotIn(List<Long> values) {
addCriterion("domain_id not in", values, "domainId");
return (Criteria) this;
}
public Criteria andDomainIdBetween(Long value1, Long value2) {
addCriterion("domain_id between", value1, value2, "domainId");
return (Criteria) this;
}
public Criteria andDomainIdNotBetween(Long value1, Long value2) {
addCriterion("domain_id not between", value1, value2, "domainId");
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 Criteria andElapsedMsIsNull() {
addCriterion("elapsed_ms is null");
return (Criteria) this;
}
public Criteria andElapsedMsIsNotNull() {
addCriterion("elapsed_ms is not null");
return (Criteria) this;
}
public Criteria andElapsedMsEqualTo(Long value) {
addCriterion("elapsed_ms =", value, "elapsedMs");
return (Criteria) this;
}
public Criteria andElapsedMsNotEqualTo(Long value) {
addCriterion("elapsed_ms <>", value, "elapsedMs");
return (Criteria) this;
}
public Criteria andElapsedMsGreaterThan(Long value) {
addCriterion("elapsed_ms >", value, "elapsedMs");
return (Criteria) this;
}
public Criteria andElapsedMsGreaterThanOrEqualTo(Long value) {
addCriterion("elapsed_ms >=", value, "elapsedMs");
return (Criteria) this;
}
public Criteria andElapsedMsLessThan(Long value) {
addCriterion("elapsed_ms <", value, "elapsedMs");
return (Criteria) this;
}
public Criteria andElapsedMsLessThanOrEqualTo(Long value) {
addCriterion("elapsed_ms <=", value, "elapsedMs");
return (Criteria) this;
}
public Criteria andElapsedMsIn(List<Long> values) {
addCriterion("elapsed_ms in", values, "elapsedMs");
return (Criteria) this;
}
public Criteria andElapsedMsNotIn(List<Long> values) {
addCriterion("elapsed_ms not in", values, "elapsedMs");
return (Criteria) this;
}
public Criteria andElapsedMsBetween(Long value1, Long value2) {
addCriterion("elapsed_ms between", value1, value2, "elapsedMs");
return (Criteria) this;
}
public Criteria andElapsedMsNotBetween(Long value1, Long value2) {
addCriterion("elapsed_ms not between", value1, value2, "elapsedMs");
return (Criteria) this;
}
}
/**
* s2_dictionary_task
*/
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
/**
* s2_dictionary_task null
*/
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;
}
}
}

View File

@@ -0,0 +1,429 @@
package com.tencent.supersonic.semantic.model.domain.dataobject;
import java.util.Date;
public class DimensionDO {
/**
* 维度ID
*/
private Long id;
/**
* 主题域id
*/
private Long domainId;
/**
* 所属数据源id
*/
private Long datasourceId;
/**
* 维度名称
*/
private String name;
/**
* 字段名称
*/
private String bizName;
/**
* 描述
*/
private String description;
/**
* 维度状态,0正常,1下架,2删除
*/
private Integer status;
/**
* 敏感级别
*/
private Integer sensitiveLevel;
/**
* 维度类型 categorical,time
*/
private String type;
/**
* 创建时间
*/
private Date createdAt;
/**
* 创建人
*/
private String createdBy;
/**
* 更新时间
*/
private Date updatedAt;
/**
* 更新人
*/
private String updatedBy;
/**
* 语义类型DATE, ID, CATEGORY
*/
private String semanticType;
/**
*
*/
private String alias;
/**
* default values of dimension when query
*/
private String defaultValues;
/**
* 类型参数
*/
private String typeParams;
/**
* 表达式
*/
private String expr;
/**
* dimension value map info
*/
private String dimValueMaps;
/**
* 维度ID
*
* @return id 维度ID
*/
public Long getId() {
return id;
}
/**
* 维度ID
*
* @param id 维度ID
*/
public void setId(Long id) {
this.id = id;
}
/**
* 主题域id
*
* @return domain_id 主题域id
*/
public Long getDomainId() {
return domainId;
}
/**
* 主题域id
*
* @param domainId 主题域id
*/
public void setDomainId(Long domainId) {
this.domainId = domainId;
}
/**
* 所属数据源id
*
* @return datasource_id 所属数据源id
*/
public Long getDatasourceId() {
return datasourceId;
}
/**
* 所属数据源id
*
* @param datasourceId 所属数据源id
*/
public void setDatasourceId(Long datasourceId) {
this.datasourceId = datasourceId;
}
/**
* 维度名称
*
* @return name 维度名称
*/
public String getName() {
return name;
}
/**
* 维度名称
*
* @param name 维度名称
*/
public void setName(String name) {
this.name = name == null ? null : name.trim();
}
/**
* 字段名称
*
* @return biz_name 字段名称
*/
public String getBizName() {
return bizName;
}
/**
* 字段名称
*
* @param bizName 字段名称
*/
public void setBizName(String bizName) {
this.bizName = bizName == null ? null : bizName.trim();
}
/**
* 描述
*
* @return description 描述
*/
public String getDescription() {
return description;
}
/**
* 描述
*
* @param description 描述
*/
public void setDescription(String description) {
this.description = description == null ? null : description.trim();
}
/**
* 维度状态,0正常,1下架,2删除
*
* @return status 维度状态,0正常,1下架,2删除
*/
public Integer getStatus() {
return status;
}
/**
* 维度状态,0正常,1下架,2删除
*
* @param status 维度状态,0正常,1下架,2删除
*/
public void setStatus(Integer status) {
this.status = status;
}
/**
* 敏感级别
*
* @return sensitive_level 敏感级别
*/
public Integer getSensitiveLevel() {
return sensitiveLevel;
}
/**
* 敏感级别
*
* @param sensitiveLevel 敏感级别
*/
public void setSensitiveLevel(Integer sensitiveLevel) {
this.sensitiveLevel = sensitiveLevel;
}
/**
* 维度类型 categorical,time
*
* @return type 维度类型 categorical,time
*/
public String getType() {
return type;
}
/**
* 维度类型 categorical,time
*
* @param type 维度类型 categorical,time
*/
public void setType(String type) {
this.type = type == null ? null : type.trim();
}
/**
* 创建时间
*
* @return created_at 创建时间
*/
public Date getCreatedAt() {
return createdAt;
}
/**
* 创建时间
*
* @param createdAt 创建时间
*/
public void setCreatedAt(Date createdAt) {
this.createdAt = createdAt;
}
/**
* 创建人
*
* @return created_by 创建人
*/
public String getCreatedBy() {
return createdBy;
}
/**
* 创建人
*
* @param createdBy 创建人
*/
public void setCreatedBy(String createdBy) {
this.createdBy = createdBy == null ? null : createdBy.trim();
}
/**
* 更新时间
*
* @return updated_at 更新时间
*/
public Date getUpdatedAt() {
return updatedAt;
}
/**
* 更新时间
*
* @param updatedAt 更新时间
*/
public void setUpdatedAt(Date updatedAt) {
this.updatedAt = updatedAt;
}
/**
* 更新人
*
* @return updated_by 更新人
*/
public String getUpdatedBy() {
return updatedBy;
}
/**
* 更新人
*
* @param updatedBy 更新人
*/
public void setUpdatedBy(String updatedBy) {
this.updatedBy = updatedBy == null ? null : updatedBy.trim();
}
/**
* 语义类型DATE, ID, CATEGORY
*
* @return semantic_type 语义类型DATE, ID, CATEGORY
*/
public String getSemanticType() {
return semanticType;
}
/**
* 语义类型DATE, ID, CATEGORY
*
* @param semanticType 语义类型DATE, ID, CATEGORY
*/
public void setSemanticType(String semanticType) {
this.semanticType = semanticType == null ? null : semanticType.trim();
}
/**
* @return alias
*/
public String getAlias() {
return alias;
}
/**
* @param alias
*/
public void setAlias(String alias) {
this.alias = alias == null ? null : alias.trim();
}
/**
* default values of dimension when query
*
* @return default_values default values of dimension when query
*/
public String getDefaultValues() {
return defaultValues;
}
/**
* default values of dimension when query
*
* @param defaultValues default values of dimension when query
*/
public void setDefaultValues(String defaultValues) {
this.defaultValues = defaultValues == null ? null : defaultValues.trim();
}
/**
* 类型参数
*
* @return type_params 类型参数
*/
public String getTypeParams() {
return typeParams;
}
/**
* 类型参数
*
* @param typeParams 类型参数
*/
public void setTypeParams(String typeParams) {
this.typeParams = typeParams == null ? null : typeParams.trim();
}
/**
* 表达式
*
* @return expr 表达式
*/
public String getExpr() {
return expr;
}
/**
* 表达式
*
* @param expr 表达式
*/
public void setExpr(String expr) {
this.expr = expr == null ? null : expr.trim();
}
public String getDimValueMaps() {
return dimValueMaps;
}
public void setDimValueMaps(String dimValueMaps) {
this.dimValueMaps = dimValueMaps;
}
}

View File

@@ -0,0 +1,13 @@
package com.tencent.supersonic.semantic.model.domain.dataobject;
import lombok.Data;
@Data
public class DimensionDOWithDictInfo extends DimensionDO {
private boolean isDictInfo;
}

View File

@@ -0,0 +1,342 @@
package com.tencent.supersonic.semantic.model.domain.dataobject;
import java.util.Date;
public class DomainDO {
/**
* 自增ID
*/
private Long id;
/**
* 主题域名称
*/
private String name;
/**
* 内部名称
*/
private String bizName;
/**
* 父主题域ID
*/
private Long parentId;
/**
* 主题域状态
*/
private Integer status;
/**
* 创建时间
*/
private Date createdAt;
/**
* 创建人
*/
private String createdBy;
/**
* 更新时间
*/
private Date updatedAt;
/**
* 更新人
*/
private String updatedBy;
/**
* 主题域管理员
*/
private String admin;
/**
* 主题域管理员组织
*/
private String adminOrg;
/**
* 主题域是否公开
*/
private Integer isOpen;
/**
* 主题域可用用户
*/
private String viewer;
/**
* 主题域可用组织
*/
private String viewOrg;
/**
* 主题域实体信息
*/
private String entity;
/**
* 自增ID
*
* @return id 自增ID
*/
public Long getId() {
return id;
}
/**
* 自增ID
*
* @param id 自增ID
*/
public void setId(Long id) {
this.id = id;
}
/**
* 主题域名称
*
* @return name 主题域名称
*/
public String getName() {
return name;
}
/**
* 主题域名称
*
* @param name 主题域名称
*/
public void setName(String name) {
this.name = name == null ? null : name.trim();
}
/**
* 内部名称
*
* @return biz_name 内部名称
*/
public String getBizName() {
return bizName;
}
/**
* 内部名称
*
* @param bizName 内部名称
*/
public void setBizName(String bizName) {
this.bizName = bizName == null ? null : bizName.trim();
}
/**
* 父主题域ID
*
* @return parent_id 父主题域ID
*/
public Long getParentId() {
return parentId;
}
/**
* 父主题域ID
*
* @param parentId 父主题域ID
*/
public void setParentId(Long parentId) {
this.parentId = parentId;
}
/**
* 主题域状态
*
* @return status 主题域状态
*/
public Integer getStatus() {
return status;
}
/**
* 主题域状态
*
* @param status 主题域状态
*/
public void setStatus(Integer status) {
this.status = status;
}
/**
* 创建时间
*
* @return created_at 创建时间
*/
public Date getCreatedAt() {
return createdAt;
}
/**
* 创建时间
*
* @param createdAt 创建时间
*/
public void setCreatedAt(Date createdAt) {
this.createdAt = createdAt;
}
/**
* 创建人
*
* @return created_by 创建人
*/
public String getCreatedBy() {
return createdBy;
}
/**
* 创建人
*
* @param createdBy 创建人
*/
public void setCreatedBy(String createdBy) {
this.createdBy = createdBy == null ? null : createdBy.trim();
}
/**
* 更新时间
*
* @return updated_at 更新时间
*/
public Date getUpdatedAt() {
return updatedAt;
}
/**
* 更新时间
*
* @param updatedAt 更新时间
*/
public void setUpdatedAt(Date updatedAt) {
this.updatedAt = updatedAt;
}
/**
* 更新人
*
* @return updated_by 更新人
*/
public String getUpdatedBy() {
return updatedBy;
}
/**
* 更新人
*
* @param updatedBy 更新人
*/
public void setUpdatedBy(String updatedBy) {
this.updatedBy = updatedBy == null ? null : updatedBy.trim();
}
/**
* 主题域管理员
*
* @return admin 主题域管理员
*/
public String getAdmin() {
return admin;
}
/**
* 主题域管理员
*
* @param admin 主题域管理员
*/
public void setAdmin(String admin) {
this.admin = admin == null ? null : admin.trim();
}
/**
* 主题域管理员组织
*
* @return admin_org 主题域管理员组织
*/
public String getAdminOrg() {
return adminOrg;
}
/**
* 主题域管理员组织
*
* @param adminOrg 主题域管理员组织
*/
public void setAdminOrg(String adminOrg) {
this.adminOrg = adminOrg == null ? null : adminOrg.trim();
}
/**
* 主题域是否公开
*
* @return is_open 主题域是否公开
*/
public Integer getIsOpen() {
return isOpen;
}
/**
* 主题域是否公开
*
* @param isOpen 主题域是否公开
*/
public void setIsOpen(Integer isOpen) {
this.isOpen = isOpen;
}
/**
* 主题域可用用户
*
* @return viewer 主题域可用用户
*/
public String getViewer() {
return viewer;
}
/**
* 主题域可用用户
*
* @param viewer 主题域可用用户
*/
public void setViewer(String viewer) {
this.viewer = viewer == null ? null : viewer.trim();
}
/**
* 主题域可用组织
*
* @return view_org 主题域可用组织
*/
public String getViewOrg() {
return viewOrg;
}
/**
* 主题域可用组织
*
* @param viewOrg 主题域可用组织
*/
public void setViewOrg(String viewOrg) {
this.viewOrg = viewOrg == null ? null : viewOrg.trim();
}
public String getEntity() {
return entity;
}
public void setEntity(String entity) {
this.entity = entity;
}
}

View File

@@ -0,0 +1,255 @@
package com.tencent.supersonic.semantic.model.domain.dataobject;
import java.util.Date;
public class DomainExtendDO {
/**
*
*/
private Long id;
/**
* 主题域id
*/
private Long domainId;
/**
* 默认指标
*/
private String defaultMetrics;
/**
* 创建时间
*/
private Date createdAt;
/**
* 更新时间
*/
private Date updatedAt;
/**
* 创建人
*/
private String createdBy;
/**
* 更新人
*/
private String updatedBy;
/**
* 主题域扩展信息状态, 0-删除1-生效
*/
private Integer status;
/**
* 不可见指标信息
*/
private String metricsInvisible;
/**
* 不可见维度信息
*/
private String dimensionsInvisible;
/**
* 实体信息
*/
private String entityInfo;
/**
* @return id
*/
public Long getId() {
return id;
}
/**
* @param id
*/
public void setId(Long id) {
this.id = id;
}
/**
* 主题域id
*
* @return domain_id 主题域id
*/
public Long getDomainId() {
return domainId;
}
/**
* 主题域id
*
* @param domainId 主题域id
*/
public void setDomainId(Long domainId) {
this.domainId = domainId;
}
/**
* 默认指标
*
* @return default_metrics 默认指标
*/
public String getDefaultMetrics() {
return defaultMetrics;
}
/**
* 默认指标
*
* @param defaultMetrics 默认指标
*/
public void setDefaultMetrics(String defaultMetrics) {
this.defaultMetrics = defaultMetrics == null ? null : defaultMetrics.trim();
}
/**
* 创建时间
*
* @return created_at 创建时间
*/
public Date getCreatedAt() {
return createdAt;
}
/**
* 创建时间
*
* @param createdAt 创建时间
*/
public void setCreatedAt(Date createdAt) {
this.createdAt = createdAt;
}
/**
* 更新时间
*
* @return updated_at 更新时间
*/
public Date getUpdatedAt() {
return updatedAt;
}
/**
* 更新时间
*
* @param updatedAt 更新时间
*/
public void setUpdatedAt(Date updatedAt) {
this.updatedAt = updatedAt;
}
/**
* 创建人
*
* @return created_by 创建人
*/
public String getCreatedBy() {
return createdBy;
}
/**
* 创建人
*
* @param createdBy 创建人
*/
public void setCreatedBy(String createdBy) {
this.createdBy = createdBy == null ? null : createdBy.trim();
}
/**
* 更新人
*
* @return updated_by 更新人
*/
public String getUpdatedBy() {
return updatedBy;
}
/**
* 更新人
*
* @param updatedBy 更新人
*/
public void setUpdatedBy(String updatedBy) {
this.updatedBy = updatedBy == null ? null : updatedBy.trim();
}
/**
* 主题域扩展信息状态, 0-删除1-生效
*
* @return status 主题域扩展信息状态, 0-删除1-生效
*/
public Integer getStatus() {
return status;
}
/**
* 主题域扩展信息状态, 0-删除1-生效
*
* @param status 主题域扩展信息状态, 0-删除1-生效
*/
public void setStatus(Integer status) {
this.status = status;
}
/**
* 不可见指标信息
*
* @return metrics_invisible 不可见指标信息
*/
public String getMetricsInvisible() {
return metricsInvisible;
}
/**
* 不可见指标信息
*
* @param metricsInvisible 不可见指标信息
*/
public void setMetricsInvisible(String metricsInvisible) {
this.metricsInvisible = metricsInvisible == null ? null : metricsInvisible.trim();
}
/**
* 不可见维度信息
*
* @return dimensions_invisible 不可见维度信息
*/
public String getDimensionsInvisible() {
return dimensionsInvisible;
}
/**
* 不可见维度信息
*
* @param dimensionsInvisible 不可见维度信息
*/
public void setDimensionsInvisible(String dimensionsInvisible) {
this.dimensionsInvisible = dimensionsInvisible == null ? null : dimensionsInvisible.trim();
}
/**
* 实体信息
*
* @return entity_info 实体信息
*/
public String getEntityInfo() {
return entityInfo;
}
/**
* 实体信息
*
* @param entityInfo 实体信息
*/
public void setEntityInfo(String entityInfo) {
this.entityInfo = entityInfo == null ? null : entityInfo.trim();
}
}

View File

@@ -0,0 +1,798 @@
package com.tencent.supersonic.semantic.model.domain.dataobject;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class DomainExtendDOExample {
/**
* s2_domain_extend
*/
protected String orderByClause;
/**
* s2_domain_extend
*/
protected boolean distinct;
/**
* s2_domain_extend
*/
protected List<Criteria> oredCriteria;
/**
* s2_domain_extend
*/
protected Integer limitStart;
/**
* s2_domain_extend
*/
protected Integer limitEnd;
/**
* @mbg.generated
*/
public DomainExtendDOExample() {
oredCriteria = new ArrayList<Criteria>();
}
/**
* @mbg.generated
*/
public String getOrderByClause() {
return orderByClause;
}
/**
* @mbg.generated
*/
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
/**
* @mbg.generated
*/
public boolean isDistinct() {
return distinct;
}
/**
* @mbg.generated
*/
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
/**
* @mbg.generated
*/
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
/**
* @mbg.generated
*/
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
/**
* @mbg.generated
*/
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
/**
* @mbg.generated
*/
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
/**
* @mbg.generated
*/
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
/**
* @mbg.generated
*/
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
/**
* @mbg.generated
*/
public Integer getLimitStart() {
return limitStart;
}
/**
* @mbg.generated
*/
public void setLimitStart(Integer limitStart) {
this.limitStart = limitStart;
}
/**
* @mbg.generated
*/
public Integer getLimitEnd() {
return limitEnd;
}
/**
* @mbg.generated
*/
public void setLimitEnd(Integer limitEnd) {
this.limitEnd = limitEnd;
}
/**
* s2_domain_extend null
*/
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
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 andDomainIdIsNull() {
addCriterion("domain_id is null");
return (Criteria) this;
}
public Criteria andDomainIdIsNotNull() {
addCriterion("domain_id is not null");
return (Criteria) this;
}
public Criteria andDomainIdEqualTo(Long value) {
addCriterion("domain_id =", value, "domainId");
return (Criteria) this;
}
public Criteria andDomainIdNotEqualTo(Long value) {
addCriterion("domain_id <>", value, "domainId");
return (Criteria) this;
}
public Criteria andDomainIdGreaterThan(Long value) {
addCriterion("domain_id >", value, "domainId");
return (Criteria) this;
}
public Criteria andDomainIdGreaterThanOrEqualTo(Long value) {
addCriterion("domain_id >=", value, "domainId");
return (Criteria) this;
}
public Criteria andDomainIdLessThan(Long value) {
addCriterion("domain_id <", value, "domainId");
return (Criteria) this;
}
public Criteria andDomainIdLessThanOrEqualTo(Long value) {
addCriterion("domain_id <=", value, "domainId");
return (Criteria) this;
}
public Criteria andDomainIdIn(List<Long> values) {
addCriterion("domain_id in", values, "domainId");
return (Criteria) this;
}
public Criteria andDomainIdNotIn(List<Long> values) {
addCriterion("domain_id not in", values, "domainId");
return (Criteria) this;
}
public Criteria andDomainIdBetween(Long value1, Long value2) {
addCriterion("domain_id between", value1, value2, "domainId");
return (Criteria) this;
}
public Criteria andDomainIdNotBetween(Long value1, Long value2) {
addCriterion("domain_id not between", value1, value2, "domainId");
return (Criteria) this;
}
public Criteria andDefaultMetricsIsNull() {
addCriterion("default_metrics is null");
return (Criteria) this;
}
public Criteria andDefaultMetricsIsNotNull() {
addCriterion("default_metrics is not null");
return (Criteria) this;
}
public Criteria andDefaultMetricsEqualTo(String value) {
addCriterion("default_metrics =", value, "defaultMetrics");
return (Criteria) this;
}
public Criteria andDefaultMetricsNotEqualTo(String value) {
addCriterion("default_metrics <>", value, "defaultMetrics");
return (Criteria) this;
}
public Criteria andDefaultMetricsGreaterThan(String value) {
addCriterion("default_metrics >", value, "defaultMetrics");
return (Criteria) this;
}
public Criteria andDefaultMetricsLessThan(String value) {
addCriterion("default_metrics <", value, "defaultMetrics");
return (Criteria) this;
}
public Criteria andDefaultMetricsLessThanOrEqualTo(String value) {
addCriterion("default_metrics <=", value, "defaultMetrics");
return (Criteria) this;
}
public Criteria andDefaultMetricsLike(String value) {
addCriterion("default_metrics like", value, "defaultMetrics");
return (Criteria) this;
}
public Criteria andDefaultMetricsNotLike(String value) {
addCriterion("default_metrics not like", value, "defaultMetrics");
return (Criteria) this;
}
public Criteria andDefaultMetricsIn(List<String> values) {
addCriterion("default_metrics in", values, "defaultMetrics");
return (Criteria) this;
}
public Criteria andDefaultMetricsNotIn(List<String> values) {
addCriterion("default_metrics not in", values, "defaultMetrics");
return (Criteria) this;
}
public Criteria andDefaultMetricsBetween(String value1, String value2) {
addCriterion("default_metrics between", value1, value2, "defaultMetrics");
return (Criteria) this;
}
public Criteria andDefaultMetricsNotBetween(String value1, String value2) {
addCriterion("default_metrics not between", value1, value2, "defaultMetrics");
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 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 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 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;
}
}
/**
* s2_domain_extend
*/
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
/**
* s2_domain_extend null
*/
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;
}
}
}

View File

@@ -0,0 +1,366 @@
package com.tencent.supersonic.semantic.model.domain.dataobject;
import java.util.Date;
public class MetricDO {
/**
*
*/
private Long id;
/**
* 主体域ID
*/
private Long domainId;
/**
* 指标名称
*/
private String name;
/**
* 字段名称
*/
private String bizName;
/**
* 描述
*/
private String description;
/**
* 指标状态,0正常,1下架,2删除
*/
private Integer status;
/**
* 敏感级别
*/
private Integer sensitiveLevel;
/**
* 指标类型 proxy,expr
*/
private String type;
/**
* 创建时间
*/
private Date createdAt;
/**
* 创建人
*/
private String createdBy;
/**
* 更新时间
*/
private Date updatedAt;
/**
* 更新人
*/
private String updatedBy;
/**
* 数值类型
*/
private String dataFormatType;
/**
* 数值类型参数
*/
private String dataFormat;
/**
*
*/
private String alias;
/**
* 类型参数
*/
private String typeParams;
/**
* @return id
*/
public Long getId() {
return id;
}
/**
* @param id
*/
public void setId(Long id) {
this.id = id;
}
/**
* 主体域ID
*
* @return domain_id 主体域ID
*/
public Long getDomainId() {
return domainId;
}
/**
* 主体域ID
*
* @param domainId 主体域ID
*/
public void setDomainId(Long domainId) {
this.domainId = domainId;
}
/**
* 指标名称
*
* @return name 指标名称
*/
public String getName() {
return name;
}
/**
* 指标名称
*
* @param name 指标名称
*/
public void setName(String name) {
this.name = name == null ? null : name.trim();
}
/**
* 字段名称
*
* @return biz_name 字段名称
*/
public String getBizName() {
return bizName;
}
/**
* 字段名称
*
* @param bizName 字段名称
*/
public void setBizName(String bizName) {
this.bizName = bizName == null ? null : bizName.trim();
}
/**
* 描述
*
* @return description 描述
*/
public String getDescription() {
return description;
}
/**
* 描述
*
* @param description 描述
*/
public void setDescription(String description) {
this.description = description == null ? null : description.trim();
}
/**
* 指标状态,0正常,1下架,2删除
*
* @return status 指标状态,0正常,1下架,2删除
*/
public Integer getStatus() {
return status;
}
/**
* 指标状态,0正常,1下架,2删除
*
* @param status 指标状态,0正常,1下架,2删除
*/
public void setStatus(Integer status) {
this.status = status;
}
/**
* 敏感级别
*
* @return sensitive_level 敏感级别
*/
public Integer getSensitiveLevel() {
return sensitiveLevel;
}
/**
* 敏感级别
*
* @param sensitiveLevel 敏感级别
*/
public void setSensitiveLevel(Integer sensitiveLevel) {
this.sensitiveLevel = sensitiveLevel;
}
/**
* 指标类型 proxy,expr
*
* @return type 指标类型 proxy,expr
*/
public String getType() {
return type;
}
/**
* 指标类型 proxy,expr
*
* @param type 指标类型 proxy,expr
*/
public void setType(String type) {
this.type = type == null ? null : type.trim();
}
/**
* 创建时间
*
* @return created_at 创建时间
*/
public Date getCreatedAt() {
return createdAt;
}
/**
* 创建时间
*
* @param createdAt 创建时间
*/
public void setCreatedAt(Date createdAt) {
this.createdAt = createdAt;
}
/**
* 创建人
*
* @return created_by 创建人
*/
public String getCreatedBy() {
return createdBy;
}
/**
* 创建人
*
* @param createdBy 创建人
*/
public void setCreatedBy(String createdBy) {
this.createdBy = createdBy == null ? null : createdBy.trim();
}
/**
* 更新时间
*
* @return updated_at 更新时间
*/
public Date getUpdatedAt() {
return updatedAt;
}
/**
* 更新时间
*
* @param updatedAt 更新时间
*/
public void setUpdatedAt(Date updatedAt) {
this.updatedAt = updatedAt;
}
/**
* 更新人
*
* @return updated_by 更新人
*/
public String getUpdatedBy() {
return updatedBy;
}
/**
* 更新人
*
* @param updatedBy 更新人
*/
public void setUpdatedBy(String updatedBy) {
this.updatedBy = updatedBy == null ? null : updatedBy.trim();
}
/**
* 数值类型
*
* @return data_format_type 数值类型
*/
public String getDataFormatType() {
return dataFormatType;
}
/**
* 数值类型
*
* @param dataFormatType 数值类型
*/
public void setDataFormatType(String dataFormatType) {
this.dataFormatType = dataFormatType == null ? null : dataFormatType.trim();
}
/**
* 数值类型参数
*
* @return data_format 数值类型参数
*/
public String getDataFormat() {
return dataFormat;
}
/**
* 数值类型参数
*
* @param dataFormat 数值类型参数
*/
public void setDataFormat(String dataFormat) {
this.dataFormat = dataFormat == null ? null : dataFormat.trim();
}
/**
* @return alias
*/
public String getAlias() {
return alias;
}
/**
* @param alias
*/
public void setAlias(String alias) {
this.alias = alias == null ? null : alias.trim();
}
/**
* 类型参数
*
* @return type_params 类型参数
*/
public String getTypeParams() {
return typeParams;
}
/**
* 类型参数
*
* @param typeParams 类型参数
*/
public void setTypeParams(String typeParams) {
this.typeParams = typeParams == null ? null : typeParams.trim();
}
}

View File

@@ -0,0 +1,16 @@
package com.tencent.supersonic.semantic.model.domain.dataobject;
import java.util.ArrayList;
import java.util.List;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class UpdateDimValueDictBatchDO {
private List<Long> itemIdList = new ArrayList<>();
private String rules;
}

View File

@@ -0,0 +1,166 @@
package com.tencent.supersonic.semantic.model.domain.dataobject;
import java.util.Date;
public class ViewInfoDO {
/**
*
*/
private Long id;
/**
*
*/
private Long domainId;
/**
* datasource、dimension、metric
*/
private String type;
/**
*
*/
private Date createdAt;
/**
*
*/
private String createdBy;
/**
*
*/
private Date updatedAt;
/**
*
*/
private String updatedBy;
/**
* config detail
*/
private String config;
/**
* @return id
*/
public Long getId() {
return id;
}
/**
* @param id
*/
public void setId(Long id) {
this.id = id;
}
/**
* @return domain_id
*/
public Long getDomainId() {
return domainId;
}
/**
* @param domainId
*/
public void setDomainId(Long domainId) {
this.domainId = domainId;
}
/**
* datasource、dimension、metric
*
* @return type datasource、dimension、metric
*/
public String getType() {
return type;
}
/**
* datasource、dimension、metric
*
* @param type datasource、dimension、metric
*/
public void setType(String type) {
this.type = type == null ? null : type.trim();
}
/**
* @return created_at
*/
public Date getCreatedAt() {
return createdAt;
}
/**
* @param createdAt
*/
public void setCreatedAt(Date createdAt) {
this.createdAt = createdAt;
}
/**
* @return created_by
*/
public String getCreatedBy() {
return createdBy;
}
/**
* @param createdBy
*/
public void setCreatedBy(String createdBy) {
this.createdBy = createdBy == null ? null : createdBy.trim();
}
/**
* @return updated_at
*/
public Date getUpdatedAt() {
return updatedAt;
}
/**
* @param updatedAt
*/
public void setUpdatedAt(Date updatedAt) {
this.updatedAt = updatedAt;
}
/**
* @return updated_by
*/
public String getUpdatedBy() {
return updatedBy;
}
/**
* @param updatedBy
*/
public void setUpdatedBy(String updatedBy) {
this.updatedBy = updatedBy == null ? null : updatedBy.trim();
}
/**
* config detail
*
* @return config config detail
*/
public String getConfig() {
return config;
}
/**
* config detail
*
* @param config config detail
*/
public void setConfig(String config) {
this.config = config == null ? null : config.trim();
}
}

View File

@@ -0,0 +1,743 @@
package com.tencent.supersonic.semantic.model.domain.dataobject;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class ViewInfoDOExample {
/**
* s2_view_info
*/
protected String orderByClause;
/**
* s2_view_info
*/
protected boolean distinct;
/**
* s2_view_info
*/
protected List<Criteria> oredCriteria;
/**
* s2_view_info
*/
protected Integer limitStart;
/**
* s2_view_info
*/
protected Integer limitEnd;
/**
* @mbg.generated
*/
public ViewInfoDOExample() {
oredCriteria = new ArrayList<Criteria>();
}
/**
* @mbg.generated
*/
public String getOrderByClause() {
return orderByClause;
}
/**
* @mbg.generated
*/
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
/**
* @mbg.generated
*/
public boolean isDistinct() {
return distinct;
}
/**
* @mbg.generated
*/
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
/**
* @mbg.generated
*/
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
/**
* @mbg.generated
*/
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
/**
* @mbg.generated
*/
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
/**
* @mbg.generated
*/
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
/**
* @mbg.generated
*/
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
/**
* @mbg.generated
*/
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
/**
* @mbg.generated
*/
public Integer getLimitStart() {
return limitStart;
}
/**
* @mbg.generated
*/
public void setLimitStart(Integer limitStart) {
this.limitStart = limitStart;
}
/**
* @mbg.generated
*/
public Integer getLimitEnd() {
return limitEnd;
}
/**
* @mbg.generated
*/
public void setLimitEnd(Integer limitEnd) {
this.limitEnd = limitEnd;
}
/**
* s2_view_info null
*/
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
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 andDomainIdIsNull() {
addCriterion("domain_id is null");
return (Criteria) this;
}
public Criteria andDomainIdIsNotNull() {
addCriterion("domain_id is not null");
return (Criteria) this;
}
public Criteria andDomainIdEqualTo(Long value) {
addCriterion("domain_id =", value, "domainId");
return (Criteria) this;
}
public Criteria andDomainIdNotEqualTo(Long value) {
addCriterion("domain_id <>", value, "domainId");
return (Criteria) this;
}
public Criteria andDomainIdGreaterThan(Long value) {
addCriterion("domain_id >", value, "domainId");
return (Criteria) this;
}
public Criteria andDomainIdGreaterThanOrEqualTo(Long value) {
addCriterion("domain_id >=", value, "domainId");
return (Criteria) this;
}
public Criteria andDomainIdLessThan(Long value) {
addCriterion("domain_id <", value, "domainId");
return (Criteria) this;
}
public Criteria andDomainIdLessThanOrEqualTo(Long value) {
addCriterion("domain_id <=", value, "domainId");
return (Criteria) this;
}
public Criteria andDomainIdIn(List<Long> values) {
addCriterion("domain_id in", values, "domainId");
return (Criteria) this;
}
public Criteria andDomainIdNotIn(List<Long> values) {
addCriterion("domain_id not in", values, "domainId");
return (Criteria) this;
}
public Criteria andDomainIdBetween(Long value1, Long value2) {
addCriterion("domain_id between", value1, value2, "domainId");
return (Criteria) this;
}
public Criteria andDomainIdNotBetween(Long value1, Long value2) {
addCriterion("domain_id not between", value1, value2, "domainId");
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 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;
}
}
/**
* s2_view_info
*/
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
/**
* s2_view_info null
*/
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;
}
}
}

View File

@@ -0,0 +1,93 @@
package com.tencent.supersonic.semantic.model.domain.manager;
import com.tencent.supersonic.semantic.api.model.pojo.DatasourceDetail;
import com.tencent.supersonic.semantic.api.model.pojo.Dim;
import com.tencent.supersonic.semantic.api.model.pojo.Identify;
import com.tencent.supersonic.semantic.api.model.pojo.Measure;
import com.tencent.supersonic.semantic.api.model.yaml.DatasourceYamlTpl;
import com.tencent.supersonic.semantic.api.model.yaml.DimensionTimeTypeParamsTpl;
import com.tencent.supersonic.semantic.api.model.yaml.DimensionYamlTpl;
import com.tencent.supersonic.semantic.api.model.yaml.IdentifyYamlTpl;
import com.tencent.supersonic.semantic.api.model.yaml.MeasureYamlTpl;
import com.tencent.supersonic.semantic.api.model.response.DatabaseResp;
import com.tencent.supersonic.semantic.model.domain.utils.SysTimeDimensionBuilder;
import com.tencent.supersonic.semantic.model.domain.adaptor.engineadapter.EngineAdaptor;
import com.tencent.supersonic.semantic.model.domain.adaptor.engineadapter.EngineAdaptorFactory;
import com.tencent.supersonic.semantic.model.domain.pojo.Datasource;
import com.tencent.supersonic.semantic.model.domain.pojo.DatasourceQueryEnum;
import java.util.stream.Collectors;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
@Service
@Slf4j
public class DatasourceYamlManager {
public static DatasourceYamlTpl convert2YamlObj(Datasource datasource, DatabaseResp databaseResp) {
DatasourceDetail datasourceDetail = datasource.getDatasourceDetail();
EngineAdaptor engineAdaptor = EngineAdaptorFactory.getEngineAdaptor(databaseResp.getType());
SysTimeDimensionBuilder.addSysTimeDimension(datasourceDetail.getDimensions(), engineAdaptor);
addInterCntMetric(datasource.getBizName(), datasourceDetail);
DatasourceYamlTpl datasourceYamlTpl = new DatasourceYamlTpl();
BeanUtils.copyProperties(datasourceDetail, datasourceYamlTpl);
datasourceYamlTpl.setIdentifiers(datasourceDetail.getIdentifiers().stream().map(DatasourceYamlManager::convert)
.collect(Collectors.toList()));
datasourceYamlTpl.setDimensions(datasourceDetail.getDimensions().stream().map(DatasourceYamlManager::convert)
.collect(Collectors.toList()));
datasourceYamlTpl.setMeasures(datasourceDetail.getMeasures().stream().map(DatasourceYamlManager::convert)
.collect(Collectors.toList()));
datasourceYamlTpl.setName(datasource.getBizName());
datasourceYamlTpl.setSourceId(datasource.getDatabaseId());
if (datasourceDetail.getQueryType().equalsIgnoreCase(DatasourceQueryEnum.SQL_QUERY.getName())) {
datasourceYamlTpl.setSqlQuery(datasourceDetail.getSqlQuery());
} else {
datasourceYamlTpl.setTableQuery(datasourceDetail.getTableQuery());
}
return datasourceYamlTpl;
}
public static DimensionYamlTpl convert(Dim dim) {
DimensionYamlTpl dimensionYamlTpl = new DimensionYamlTpl();
BeanUtils.copyProperties(dim, dimensionYamlTpl);
dimensionYamlTpl.setName(dim.getBizName());
if (dim.getTypeParams() != null) {
DimensionTimeTypeParamsTpl dimensionTimeTypeParamsTpl = new DimensionTimeTypeParamsTpl();
dimensionTimeTypeParamsTpl.setIsPrimary(dim.getTypeParams().getIsPrimary());
dimensionTimeTypeParamsTpl.setTimeGranularity(dim.getTypeParams().getTimeGranularity());
dimensionYamlTpl.setTypeParams(dimensionTimeTypeParamsTpl);
}
return dimensionYamlTpl;
}
public static MeasureYamlTpl convert(Measure measure) {
MeasureYamlTpl measureYamlTpl = new MeasureYamlTpl();
BeanUtils.copyProperties(measure, measureYamlTpl);
measureYamlTpl.setName(measure.getBizName());
return measureYamlTpl;
}
public static IdentifyYamlTpl convert(Identify identify) {
IdentifyYamlTpl identifyYamlTpl = new IdentifyYamlTpl();
identifyYamlTpl.setName(identify.getBizName());
identifyYamlTpl.setType(identify.getType());
return identifyYamlTpl;
}
private static void addInterCntMetric(String datasourceEnName, DatasourceDetail datasourceDetail) {
Measure measure = new Measure();
measure.setExpr("1");
if (!CollectionUtils.isEmpty(datasourceDetail.getIdentifiers())) {
measure.setExpr(datasourceDetail.getIdentifiers().get(0).getBizName());
}
measure.setAgg("count");
measure.setBizName(String.format("%s_%s", datasourceEnName, "internal_cnt"));
measure.setCreateMetric("true");
datasourceDetail.getMeasures().add(measure);
}
}

View File

@@ -0,0 +1,31 @@
package com.tencent.supersonic.semantic.model.domain.manager;
import com.tencent.supersonic.semantic.api.model.yaml.DimensionYamlTpl;
import com.tencent.supersonic.semantic.model.domain.pojo.Dimension;
import com.tencent.supersonic.semantic.model.domain.utils.DimensionConverter;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
@Slf4j
@Service
public class DimensionYamlManager {
public static List<DimensionYamlTpl> convert2DimensionYaml(List<Dimension> dimensions) {
if (CollectionUtils.isEmpty(dimensions)) {
return new ArrayList<>();
}
List<DimensionYamlTpl> dimensionYamlTpls = dimensions.stream()
.filter(dimension -> !dimension.getType().equalsIgnoreCase("primary"))
.map(DimensionConverter::convert2DimensionYamlTpl).collect(Collectors.toList());
return dimensionYamlTpls;
}
}

View File

@@ -0,0 +1,27 @@
package com.tencent.supersonic.semantic.model.domain.manager;
import com.tencent.supersonic.semantic.api.model.yaml.MetricYamlTpl;
import com.tencent.supersonic.semantic.model.domain.pojo.Metric;
import com.tencent.supersonic.semantic.model.domain.utils.MetricConverter;
import java.util.ArrayList;
import java.util.List;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@Slf4j
@Service
public class MetricYamlManager {
public static List<MetricYamlTpl> convert2YamlObj(List<Metric> metrics) {
List<MetricYamlTpl> metricYamlTpls = new ArrayList<>();
for (Metric metric : metrics) {
MetricYamlTpl metricYamlTpl = MetricConverter.convert2MetricYamlTpl(metric);
metricYamlTpls.add(metricYamlTpl);
}
return metricYamlTpls;
}
}

View File

@@ -0,0 +1,16 @@
package com.tencent.supersonic.semantic.model.domain.pojo;
import lombok.Data;
@Data
public class ConnectInfo {
private String url;
private String userName;
private String password;
}

View File

@@ -0,0 +1,29 @@
package com.tencent.supersonic.semantic.model.domain.pojo;
import com.tencent.supersonic.common.pojo.RecordInfo;
import lombok.Data;
@Data
public class Database extends RecordInfo {
private Long id;
private Long domainId;
private String name;
private String description;
private String version;
/**
* mysql,clickhouse
*/
private String type;
private ConnectInfo connectInfo;
}

View File

@@ -0,0 +1,19 @@
package com.tencent.supersonic.semantic.model.domain.pojo;
import com.tencent.supersonic.semantic.api.model.pojo.DatasourceDetail;
import com.tencent.supersonic.semantic.api.model.pojo.SchemaItem;
import lombok.Data;
@Data
public class Datasource extends SchemaItem {
private Long domainId;
private Long databaseId;
private DatasourceDetail datasourceDetail;
}

View File

@@ -0,0 +1,19 @@
package com.tencent.supersonic.semantic.model.domain.pojo;
public enum DatasourceQueryEnum {
SQL_QUERY("sql_query"),
TABLE_QUERY("table_query");
private String name;
DatasourceQueryEnum(String name) {
this.name = name;
}
public String getName() {
return name;
}
}

View File

@@ -0,0 +1,29 @@
package com.tencent.supersonic.semantic.model.domain.pojo;
import com.tencent.supersonic.semantic.api.model.pojo.DimValueMap;
import com.tencent.supersonic.semantic.api.model.pojo.SchemaItem;
import lombok.Data;
import java.util.List;
@Data
public class Dimension extends SchemaItem {
//categorical time
private String type;
private String expr;
private Long domainId;
private Long datasourceId;
private String semanticType;
private String alias;
private List<String> defaultValues;
private List<DimValueMap> dimValueMaps;
}

View File

@@ -0,0 +1,10 @@
package com.tencent.supersonic.semantic.model.domain.pojo;
import lombok.Data;
@Data
public class DimensionFilter extends MetaFilter {
}

View File

@@ -0,0 +1,38 @@
package com.tencent.supersonic.semantic.model.domain.pojo;
import com.tencent.supersonic.semantic.api.model.pojo.Entity;
import com.tencent.supersonic.semantic.api.model.request.DomainReq;
import com.tencent.supersonic.common.pojo.enums.StatusEnum;
import com.tencent.supersonic.semantic.api.model.pojo.SchemaItem;
import java.util.List;
import lombok.Data;
import org.springframework.beans.BeanUtils;
@Data
public class Domain extends SchemaItem {
private Long parentId;
private Integer isOpen;
private List<String> viewers;
private List<String> viewOrgs;
private List<String> admins;
private List<String> adminOrgs;
private Entity entity;
public static Domain create(DomainReq domainCmd) {
Domain domain = new Domain();
BeanUtils.copyProperties(domainCmd, domain);
domain.setStatus(StatusEnum.ONLINE.getCode());
return domain;
}
}

View File

@@ -0,0 +1,30 @@
package com.tencent.supersonic.semantic.model.domain.pojo;
public enum EngineTypeEnum {
TDW(0, "tdw"),
MYSQL(1, "mysql"),
DORIS(2, "doris"),
CLICKHOUSE(3, "clickhouse"),
KAFKA(4, "kafka"),
H2(5, "h2");
private Integer code;
private String name;
EngineTypeEnum(Integer code, String name) {
this.code = code;
this.name = name;
}
public Integer getCode() {
return code;
}
public String getName() {
return name;
}
}

View File

@@ -0,0 +1,316 @@
package com.tencent.supersonic.semantic.model.domain.pojo;
import static com.tencent.supersonic.common.pojo.Constants.STATISTIC;
import com.alibaba.druid.filter.Filter;
import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.wall.WallConfig;
import com.alibaba.druid.wall.WallFilter;
import com.tencent.supersonic.semantic.api.model.enums.DataTypeEnum;
import com.tencent.supersonic.semantic.api.model.response.DatabaseResp;
import com.tencent.supersonic.semantic.model.domain.utils.JdbcDataSourceUtils;
import java.util.Arrays;
import java.util.Map;
import java.util.Properties;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.DependsOn;
import org.springframework.stereotype.Component;
@Slf4j
@Component
public class JdbcDataSource {
private static final Object lockLock = new Object();
private static volatile Map<String, DruidDataSource> dataSourceMap = new ConcurrentHashMap<>();
private static volatile Map<String, Lock> dataSourceLockMap = new ConcurrentHashMap<>();
@Value("${source.lock-time:30}")
@Getter
protected Long lockTime;
@Value("${source.max-active:2}")
@Getter
protected int maxActive;
@Value("${source.initial-size:0}")
@Getter
protected int initialSize;
@Value("${source.min-idle:1}")
@Getter
protected int minIdle;
@Value("${source.max-wait:60000}")
@Getter
protected long maxWait;
@Value("${source.time-between-eviction-runs-millis:2000}")
@Getter
protected long timeBetweenEvictionRunsMillis;
@Value("${source.min-evictable-idle-time-millis:600000}")
@Getter
protected long minEvictableIdleTimeMillis;
@Value("${source.max-evictable-idle-time-millis:900000}")
@Getter
protected long maxEvictableIdleTimeMillis;
@Value("${source.time-between-connect-error-millis:60000}")
@Getter
protected long timeBetweenConnectErrorMillis;
@Value("${source.test-while-idle:true}")
@Getter
protected boolean testWhileIdle;
@Value("${source.test-on-borrow:false}")
@Getter
protected boolean testOnBorrow;
@Value("${source.test-on-return:false}")
@Getter
protected boolean testOnReturn;
@Value("${source.break-after-acquire-failure:true}")
@Getter
protected boolean breakAfterAcquireFailure;
@Value("${source.connection-error-retry-attempts:1}")
@Getter
protected int connectionErrorRetryAttempts;
@Value("${source.keep-alive:false}")
@Getter
protected boolean keepAlive;
@Value("${source.validation-query-timeout:5}")
@Getter
protected int validationQueryTimeout;
@Value("${source.validation-query:'select 1'}")
@Getter
protected String validationQuery;
@Value("${source.filters:'stat'}")
@Getter
protected String filters;
@Autowired
WallFilter wallFilter;
@Bean(name = "wallConfig")
WallConfig wallConfig() {
WallConfig config = new WallConfig();
config.setDeleteAllow(false);
config.setUpdateAllow(false);
config.setInsertAllow(false);
config.setReplaceAllow(false);
config.setMergeAllow(false);
config.setTruncateAllow(false);
config.setCreateTableAllow(false);
config.setAlterTableAllow(false);
config.setDropTableAllow(false);
config.setCommentAllow(true);
config.setUseAllow(false);
config.setDescribeAllow(false);
config.setShowAllow(false);
config.setSelectWhereAlwayTrueCheck(false);
config.setSelectHavingAlwayTrueCheck(false);
config.setSelectUnionCheck(false);
config.setConditionDoubleConstAllow(true);
config.setConditionAndAlwayTrueAllow(true);
config.setConditionAndAlwayFalseAllow(true);
return config;
}
@Bean(name = "wallFilter")
@DependsOn("wallConfig")
WallFilter wallFilter(WallConfig wallConfig) {
WallFilter wfilter = new WallFilter();
wfilter.setConfig(wallConfig);
return wfilter;
}
private Lock getDataSourceLock(String key) {
if (dataSourceLockMap.containsKey(key)) {
return dataSourceLockMap.get(key);
}
synchronized (lockLock) {
if (dataSourceLockMap.containsKey(key)) {
return dataSourceLockMap.get(key);
}
Lock lock = new ReentrantLock();
dataSourceLockMap.put(key, lock);
return lock;
}
}
public void removeDatasource(DatabaseResp jdbcSourceInfo) {
String key = getDataSourceKey(jdbcSourceInfo);
Lock lock = getDataSourceLock(key);
if (!lock.tryLock()) {
return;
}
try {
DruidDataSource druidDataSource = dataSourceMap.remove(key);
if (druidDataSource != null) {
druidDataSource.close();
}
dataSourceLockMap.remove(key);
} finally {
lock.unlock();
}
}
public DruidDataSource getDataSource(DatabaseResp jdbcSourceInfo) throws RuntimeException {
String name = jdbcSourceInfo.getName();
String type = jdbcSourceInfo.getType();
String jdbcUrl = jdbcSourceInfo.getUrl();
String username = jdbcSourceInfo.getUsername();
String password = jdbcSourceInfo.getPassword();
String key = getDataSourceKey(jdbcSourceInfo);
DruidDataSource druidDataSource = dataSourceMap.get(key);
if (druidDataSource != null && !druidDataSource.isClosed()) {
return druidDataSource;
}
Lock lock = getDataSourceLock(key);
try {
if (!lock.tryLock(lockTime, TimeUnit.SECONDS)) {
druidDataSource = dataSourceMap.get(key);
if (druidDataSource != null && !druidDataSource.isClosed()) {
return druidDataSource;
}
throw new RuntimeException("Unable to get datasource for jdbcUrl: " + jdbcUrl);
}
} catch (InterruptedException e) {
throw new RuntimeException("Unable to get datasource for jdbcUrl: " + jdbcUrl);
}
druidDataSource = dataSourceMap.get(key);
if (druidDataSource != null && !druidDataSource.isClosed()) {
lock.unlock();
return druidDataSource;
}
druidDataSource = new DruidDataSource();
try {
String className = JdbcDataSourceUtils.getDriverClassName(jdbcUrl);
try {
Class.forName(className);
} catch (ClassNotFoundException e) {
throw new RuntimeException("Unable to get driver instance for jdbcUrl: " + jdbcUrl);
}
druidDataSource.setDriverClassName(className);
druidDataSource.setName(name);
druidDataSource.setUrl(jdbcUrl);
druidDataSource.setUsername(username);
if (!jdbcUrl.toLowerCase().contains(DataTypeEnum.PRESTO.getFeature())) {
druidDataSource.setPassword(password);
}
druidDataSource.setInitialSize(initialSize);
druidDataSource.setMinIdle(minIdle);
druidDataSource.setMaxActive(maxActive);
druidDataSource.setMaxWait(maxWait);
druidDataSource.setTimeBetweenEvictionRunsMillis(timeBetweenEvictionRunsMillis);
druidDataSource.setMinEvictableIdleTimeMillis(minEvictableIdleTimeMillis);
druidDataSource.setMaxEvictableIdleTimeMillis(maxEvictableIdleTimeMillis);
druidDataSource.setTimeBetweenConnectErrorMillis(timeBetweenConnectErrorMillis);
druidDataSource.setTestWhileIdle(testWhileIdle);
druidDataSource.setTestOnBorrow(testOnBorrow);
druidDataSource.setTestOnReturn(testOnReturn);
druidDataSource.setConnectionErrorRetryAttempts(connectionErrorRetryAttempts);
druidDataSource.setBreakAfterAcquireFailure(breakAfterAcquireFailure);
druidDataSource.setKeepAlive(keepAlive);
druidDataSource.setValidationQueryTimeout(validationQueryTimeout);
druidDataSource.setRemoveAbandoned(true);
druidDataSource.setRemoveAbandonedTimeout(3600 + 5 * 60);
druidDataSource.setLogAbandoned(true);
// default validation query
String driverName = druidDataSource.getDriverClassName();
if (driverName.indexOf("sqlserver") != -1 || driverName.indexOf("mysql") != -1
|| driverName.indexOf("h2") != -1 || driverName.indexOf("moonbox") != -1) {
druidDataSource.setValidationQuery("select 1");
}
if (driverName.indexOf("oracle") != -1) {
druidDataSource.setValidationQuery("select 1 from dual");
}
if (driverName.indexOf("elasticsearch") != -1) {
druidDataSource.setValidationQuery(null);
}
// druid wall filter not support some database so set type mysql
if (DataTypeEnum.MOONBOX == DataTypeEnum.urlOf(jdbcUrl)
|| DataTypeEnum.MONGODB == DataTypeEnum.urlOf(jdbcUrl)
|| DataTypeEnum.ELASTICSEARCH == DataTypeEnum.urlOf(jdbcUrl)
|| DataTypeEnum.CASSANDRA == DataTypeEnum.urlOf(jdbcUrl)
|| DataTypeEnum.VERTICA == DataTypeEnum.urlOf(jdbcUrl)
|| DataTypeEnum.KYLIN == DataTypeEnum.urlOf(jdbcUrl)
|| DataTypeEnum.HANA == DataTypeEnum.urlOf(jdbcUrl)
|| DataTypeEnum.IMPALA == DataTypeEnum.urlOf(jdbcUrl)
|| DataTypeEnum.TDENGINE == DataTypeEnum.urlOf(jdbcUrl)) {
wallFilter.setDbType(DataTypeEnum.MYSQL.getFeature());
}
Properties properties = new Properties();
if (driverName.indexOf("mysql") != -1) {
properties.setProperty("druid.mysql.usePingMethod", "false");
}
druidDataSource.setConnectProperties(properties);
try {
// statistic and ck source don't need wall filter
if (!STATISTIC.equals(name) && !DataTypeEnum.CLICKHOUSE.getFeature().equalsIgnoreCase(type)) {
druidDataSource.setProxyFilters(Arrays.asList(new Filter[]{wallFilter}));
}
druidDataSource.setFilters(filters);
druidDataSource.init();
} catch (Exception e) {
log.error("Exception during pool initialization", e);
throw new RuntimeException(e.getMessage());
}
dataSourceMap.put(key, druidDataSource);
} finally {
lock.unlock();
}
return druidDataSource;
}
private String getDataSourceKey(DatabaseResp jdbcSourceInfo) {
return JdbcDataSourceUtils.getKey(jdbcSourceInfo.getName(),
jdbcSourceInfo.getUrl(),
jdbcSourceInfo.getUsername(),
jdbcSourceInfo.getPassword(), "", false);
}
}

View File

@@ -0,0 +1,23 @@
package com.tencent.supersonic.semantic.model.domain.pojo;
import lombok.Data;
@Data
public class MetaFilter {
private Long id;
private String name;
private String bizName;
private String createdBy;
private Long domainId;
private Integer sensitiveLevel;
private Integer status;
}

View File

@@ -0,0 +1,26 @@
package com.tencent.supersonic.semantic.model.domain.pojo;
import com.tencent.supersonic.common.pojo.DataFormat;
import com.tencent.supersonic.semantic.api.model.pojo.MetricTypeParams;
import com.tencent.supersonic.semantic.api.model.pojo.SchemaItem;
import lombok.Data;
@Data
public class Metric extends SchemaItem {
private Long domainId;
//measure_proxy ratio expr cumulative derived
private String type;
private MetricTypeParams typeParams;
private String dataFormatType;
private DataFormat dataFormat;
private String alias;
}

View File

@@ -0,0 +1,10 @@
package com.tencent.supersonic.semantic.model.domain.pojo;
import lombok.Data;
@Data
public class MetricFilter extends MetaFilter {
private String type;
}

View File

@@ -0,0 +1,17 @@
package com.tencent.supersonic.semantic.model.domain.repository;
import com.tencent.supersonic.semantic.model.domain.dataobject.DatabaseDO;
import java.util.List;
public interface DatabaseRepository {
void createDatabase(DatabaseDO databaseDO);
void updateDatabase(DatabaseDO databaseDO);
DatabaseDO getDatabase(Long id);
List<DatabaseDO> getDatabaseByDomainId(Long domainId);
}

View File

@@ -0,0 +1,33 @@
package com.tencent.supersonic.semantic.model.domain.repository;
import com.tencent.supersonic.semantic.model.domain.dataobject.DatasourceDO;
import com.tencent.supersonic.semantic.model.domain.dataobject.DatasourceRelaDO;
import java.util.List;
public interface DatasourceRepository {
void createDatasource(DatasourceDO datasourceDO);
void updateDatasource(DatasourceDO datasourceDO);
List<DatasourceDO> getDatasourceList();
List<DatasourceDO> getDatasourceList(Long domainId);
DatasourceDO getDatasourceById(Long id);
void deleteDatasource(Long id);
void createDatasourceRela(DatasourceRelaDO datasourceRelaDO);
void updateDatasourceRela(DatasourceRelaDO datasourceRelaDO);
DatasourceRelaDO getDatasourceRelaById(Long id);
List<DatasourceRelaDO> getDatasourceRelaList(Long domainId);
void deleteDatasourceRela(Long id);
}

View File

@@ -0,0 +1,16 @@
package com.tencent.supersonic.semantic.model.domain.repository;
import com.tencent.supersonic.semantic.api.model.pojo.ItemDateFilter;
import com.tencent.supersonic.semantic.api.model.request.DateInfoReq;
import com.tencent.supersonic.semantic.model.domain.dataobject.DateInfoDO;
import java.util.List;
public interface DateInfoRepository {
Integer upsertDateInfo(List<DateInfoReq> dateInfoReqs);
List<DateInfoDO> getDateInfos(ItemDateFilter itemDateFilter);
}

View File

@@ -0,0 +1,33 @@
package com.tencent.supersonic.semantic.model.domain.repository;
import com.tencent.supersonic.semantic.model.domain.dataobject.DimensionDO;
import com.tencent.supersonic.semantic.model.domain.pojo.DimensionFilter;
import java.util.List;
public interface DimensionRepository {
void createDimension(DimensionDO dimensionDO);
void createDimensionBatch(List<DimensionDO> dimensionDOS);
void updateDimension(DimensionDO dimensionDO);
List<DimensionDO> getDimensionListOfDatasource(Long datasourceId);
List<DimensionDO> getDimensionListOfDomain(Long domainId);
List<DimensionDO> getDimensionList();
List<DimensionDO> getDimensionListByIds(List<Long> ids);
DimensionDO getDimensionById(Long id);
List<DimensionDO> getAllDimensionList();
List<DimensionDO> getDimension(DimensionFilter dimensionFilter);
void deleteDimension(Long id);
}

View File

@@ -0,0 +1,22 @@
package com.tencent.supersonic.semantic.model.domain.repository;
import com.tencent.supersonic.semantic.model.domain.dataobject.DomainDO;
import java.util.List;
public interface DomainRepository {
void createDomain(DomainDO metaDomainDO);
void updateDomain(DomainDO metaDomainDO);
void deleteDomain(Long id);
List<DomainDO> getDomainList();
DomainDO getDomainById(Long id);
}

View File

@@ -0,0 +1,31 @@
package com.tencent.supersonic.semantic.model.domain.repository;
import com.tencent.supersonic.semantic.model.domain.pojo.MetricFilter;
import com.tencent.supersonic.semantic.model.domain.dataobject.MetricDO;
import java.util.List;
public interface MetricRepository {
Long createMetric(MetricDO metricDO);
void createMetricBatch(List<MetricDO> metricDOS);
void updateMetric(MetricDO metricDO);
List<MetricDO> getMetricList(Long domainId);
List<MetricDO> getMetricList();
List<MetricDO> getMetricListByIds(List<Long> ids);
MetricDO getMetricById(Long id);
List<MetricDO> getAllMetricList();
List<MetricDO> getMetric(MetricFilter metricFilter);
void deleteMetric(Long id);
}

View File

@@ -0,0 +1,17 @@
package com.tencent.supersonic.semantic.model.domain.repository;
import com.tencent.supersonic.semantic.model.domain.dataobject.ViewInfoDO;
import java.util.List;
public interface ViewInfoRepository {
List<ViewInfoDO> getViewInfoList(Long domainId);
ViewInfoDO getViewInfoById(Long id);
void deleteViewInfo(Long id);
void createViewInfo(ViewInfoDO viewInfoDO);
void updateViewInfo(ViewInfoDO viewInfoDO);
}

View File

@@ -0,0 +1,59 @@
package com.tencent.supersonic.semantic.model.domain.utils;
import com.alibaba.fastjson.JSONObject;
import com.tencent.supersonic.auth.api.authentication.pojo.User;
import com.tencent.supersonic.semantic.api.model.request.DatabaseReq;
import com.tencent.supersonic.semantic.api.model.response.DatabaseResp;
import com.tencent.supersonic.semantic.model.domain.dataobject.DatabaseDO;
import com.tencent.supersonic.semantic.model.domain.pojo.ConnectInfo;
import com.tencent.supersonic.semantic.model.domain.pojo.Database;
import java.util.Date;
import org.springframework.beans.BeanUtils;
public class DatabaseConverter {
public static Database convert(DatabaseReq databaseReq, User user) {
Database database = new Database();
BeanUtils.copyProperties(databaseReq, database);
ConnectInfo connectInfo = new ConnectInfo();
connectInfo.setUserName(databaseReq.getUsername());
connectInfo.setPassword(databaseReq.getPassword());
connectInfo.setUrl(databaseReq.getUrl());
database.setConnectInfo(connectInfo);
database.setCreatedAt(new Date());
database.setCreatedBy(user.getName());
database.setUpdatedAt(new Date());
database.setUpdatedBy(user.getName());
database.setVersion(databaseReq.getVersion());
return database;
}
public static DatabaseDO convert(Database database, DatabaseDO databaseDO) {
database.setId(databaseDO.getId());
BeanUtils.copyProperties(database, databaseDO);
databaseDO.setConfig(JSONObject.toJSONString(database.getConnectInfo()));
return databaseDO;
}
public static DatabaseDO convert(Database database) {
DatabaseDO databaseDO = new DatabaseDO();
BeanUtils.copyProperties(database, databaseDO);
databaseDO.setConfig(JSONObject.toJSONString(database.getConnectInfo()));
return databaseDO;
}
public static DatabaseResp convert(DatabaseDO databaseDO) {
DatabaseResp databaseResp = new DatabaseResp();
BeanUtils.copyProperties(databaseDO, databaseResp);
ConnectInfo connectInfo = JSONObject.parseObject(databaseDO.getConfig(), ConnectInfo.class);
databaseResp.setUrl(connectInfo.getUrl());
databaseResp.setPassword(connectInfo.getPassword());
databaseResp.setUsername(connectInfo.getUserName());
return databaseResp;
}
}

View File

@@ -0,0 +1,205 @@
package com.tencent.supersonic.semantic.model.domain.utils;
import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Lists;
import com.tencent.supersonic.auth.api.authentication.pojo.User;
import com.tencent.supersonic.semantic.api.model.enums.MetricTypeEnum;
import com.tencent.supersonic.semantic.api.model.pojo.DatasourceDetail;
import com.tencent.supersonic.semantic.api.model.pojo.Dim;
import com.tencent.supersonic.semantic.api.model.pojo.Identify;
import com.tencent.supersonic.semantic.api.model.pojo.Measure;
import com.tencent.supersonic.semantic.api.model.pojo.MetricTypeParams;
import com.tencent.supersonic.semantic.api.model.request.DatasourceReq;
import com.tencent.supersonic.semantic.api.model.request.DimensionReq;
import com.tencent.supersonic.semantic.api.model.request.MetricReq;
import com.tencent.supersonic.semantic.api.model.response.DatasourceRelaResp;
import com.tencent.supersonic.semantic.api.model.response.DatasourceResp;
import com.tencent.supersonic.semantic.api.model.response.MeasureResp;
import com.tencent.supersonic.common.pojo.enums.StatusEnum;
import com.tencent.supersonic.common.util.BeanMapper;
import com.tencent.supersonic.semantic.model.domain.dataobject.DatasourceDO;
import com.tencent.supersonic.semantic.model.domain.dataobject.DatasourceRelaDO;
import com.tencent.supersonic.semantic.model.domain.pojo.Datasource;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.util.CollectionUtils;
public class DatasourceConverter {
public static Datasource convert(DatasourceReq datasourceReq) {
Datasource datasource = new Datasource();
DatasourceDetail datasourceDetail = new DatasourceDetail();
BeanUtils.copyProperties(datasourceReq, datasource);
BeanUtils.copyProperties(datasourceReq, datasourceDetail);
List<Measure> measures = datasourceDetail.getMeasures();
for (Measure measure : measures) {
if (StringUtils.isBlank(measure.getExpr())) {
measure.setExpr(measure.getBizName());
}
if (StringUtils.isBlank(measure.getConstraint())) {
measure.setConstraint(null);
}
if (StringUtils.isBlank(measure.getAlias())) {
measure.setAlias(null);
}
measure.setBizName(String.format("%s_%s", datasource.getBizName(), measure.getBizName()));
}
datasource.setStatus(StatusEnum.ONLINE.getCode());
datasource.setDatasourceDetail(datasourceDetail);
return datasource;
}
public static DatasourceRelaResp convert(DatasourceRelaDO datasourceRelaDO) {
DatasourceRelaResp datasourceRelaResp = new DatasourceRelaResp();
BeanUtils.copyProperties(datasourceRelaDO, datasourceRelaResp);
return datasourceRelaResp;
}
public static DatasourceDO convert(DatasourceDO datasourceDO, Datasource datasource) {
BeanMapper.mapper(datasource, datasourceDO);
datasourceDO.setDatasourceDetail(JSONObject.toJSONString((datasource.getDatasourceDetail())));
return datasourceDO;
}
public static DatasourceDO convert(Datasource datasource, User user) {
DatasourceDO datasourceDO = new DatasourceDO();
BeanUtils.copyProperties(datasource, datasourceDO);
datasourceDO.setDatasourceDetail(JSONObject.toJSONString(datasource.getDatasourceDetail()));
datasourceDO.setUpdatedBy(user.getName());
datasourceDO.setUpdatedAt(new Date());
datasourceDO.setCreatedBy(user.getName());
datasourceDO.setCreatedAt(new Date());
return datasourceDO;
}
public static DatasourceResp convert(DatasourceDO datasourceDO) {
DatasourceResp datasourceDesc = new DatasourceResp();
BeanUtils.copyProperties(datasourceDO, datasourceDesc);
datasourceDesc.setDatasourceDetail(
JSONObject.parseObject(datasourceDO.getDatasourceDetail(), DatasourceDetail.class));
return datasourceDesc;
}
public static MeasureResp convert(Measure measure, DatasourceResp datasourceDesc) {
MeasureResp measureDesc = new MeasureResp();
BeanUtils.copyProperties(measure, measureDesc);
measureDesc.setDatasourceId(datasourceDesc.getId());
measureDesc.setDatasourceName(datasourceDesc.getName());
measureDesc.setDatasourceBizName(datasourceDesc.getBizName());
return measureDesc;
}
public static DimensionReq convert(Dim dim, Datasource datasource) {
DimensionReq dimensionReq = new DimensionReq();
dimensionReq.setName(dim.getName());
dimensionReq.setBizName(dim.getBizName());
dimensionReq.setDescription(dim.getName());
dimensionReq.setSemanticType("CATEGORY");
dimensionReq.setDatasourceId(datasource.getId());
dimensionReq.setDomainId(datasource.getDomainId());
dimensionReq.setExpr(dim.getBizName());
dimensionReq.setType("categorical");
return dimensionReq;
}
public static MetricReq convert(Measure measure, Datasource datasource) {
measure.setDatasourceId(datasource.getId());
MetricReq metricReq = new MetricReq();
metricReq.setName(measure.getName());
metricReq.setBizName(measure.getBizName().replace(datasource.getBizName() + "_", ""));
metricReq.setDescription(measure.getName());
metricReq.setDomainId(datasource.getDomainId());
metricReq.setMetricType(MetricTypeEnum.ATOMIC);
MetricTypeParams exprTypeParams = new MetricTypeParams();
exprTypeParams.setExpr(measure.getBizName());
exprTypeParams.setMeasures(Lists.newArrayList(measure));
metricReq.setTypeParams(exprTypeParams);
return metricReq;
}
public static DimensionReq convert(Identify identify, Datasource datasource) {
DimensionReq dimensionReq = new DimensionReq();
dimensionReq.setName(identify.getName());
dimensionReq.setBizName(identify.getBizName());
dimensionReq.setDescription(identify.getName());
dimensionReq.setSemanticType("CATEGORY");
dimensionReq.setDatasourceId(datasource.getId());
dimensionReq.setDomainId(datasource.getDomainId());
dimensionReq.setExpr(identify.getBizName());
dimensionReq.setType(identify.getType());
return dimensionReq;
}
public static List<DatasourceResp> convertList(List<DatasourceDO> datasourceDOS) {
List<DatasourceResp> datasourceDescs = Lists.newArrayList();
if (!CollectionUtils.isEmpty(datasourceDOS)) {
datasourceDescs = datasourceDOS.stream().map(DatasourceConverter::convert).collect(Collectors.toList());
}
return datasourceDescs;
}
private static boolean isCraeteDimension(Dim dim) {
return dim.getIsCreateDimension() == 1
&& StringUtils.isNotBlank(dim.getName())
&& !dim.getType().equalsIgnoreCase("time");
}
private static boolean isCraeteMetric(Measure measure) {
return measure.getIsCreateMetric() == 1
&& StringUtils.isNotBlank(measure.getName());
}
public static List<Dim> getDimToCreateDimension(Datasource datasource) {
return datasource.getDatasourceDetail().getDimensions().stream()
.filter(DatasourceConverter::isCraeteDimension)
.collect(Collectors.toList());
}
public static List<Measure> getMeasureToCreateMetric(Datasource datasource) {
return datasource.getDatasourceDetail().getMeasures().stream()
.filter(DatasourceConverter::isCraeteMetric)
.collect(Collectors.toList());
}
public static List<DimensionReq> convertDimensionList(Datasource datasource) {
List<DimensionReq> dimensionReqs = Lists.newArrayList();
List<Dim> dims = getDimToCreateDimension(datasource);
if (!CollectionUtils.isEmpty(dims)) {
dimensionReqs = dims.stream().filter(dim -> StringUtils.isNotBlank(dim.getName()))
.map(dim -> convert(dim, datasource)).collect(Collectors.toList());
}
List<Identify> identifies = datasource.getDatasourceDetail().getIdentifiers();
if (CollectionUtils.isEmpty(identifies)) {
return dimensionReqs;
}
dimensionReqs.addAll(identifies.stream()
.filter(i -> i.getType().equalsIgnoreCase("primary"))
.filter(i -> StringUtils.isNotBlank(i.getName()))
.map(identify -> convert(identify, datasource)).collect(Collectors.toList()));
return dimensionReqs;
}
public static List<MetricReq> convertMetricList(Datasource datasource) {
List<Measure> measures = getMeasureToCreateMetric(datasource);
if (CollectionUtils.isEmpty(measures)) {
return Lists.newArrayList();
}
return measures.stream().map(measure -> convert(measure, datasource)).collect(Collectors.toList());
}
public static Datasource datasourceInfo2Datasource(DatasourceResp datasourceResp) {
Datasource datasource = new Datasource();
BeanUtils.copyProperties(datasourceResp, datasource);
return datasource;
}
}

View File

@@ -0,0 +1,88 @@
package com.tencent.supersonic.semantic.model.domain.utils;
import com.alibaba.fastjson.JSONObject;
import com.tencent.supersonic.common.util.JsonUtil;
import com.tencent.supersonic.semantic.api.model.pojo.DimValueMap;
import com.tencent.supersonic.semantic.api.model.yaml.DimensionYamlTpl;
import com.tencent.supersonic.semantic.api.model.request.DimensionReq;
import com.tencent.supersonic.semantic.api.model.response.DatasourceResp;
import com.tencent.supersonic.semantic.api.model.response.DimensionResp;
import com.tencent.supersonic.common.util.BeanMapper;
import com.tencent.supersonic.semantic.model.domain.dataobject.DimensionDO;
import com.tencent.supersonic.semantic.model.domain.pojo.Dimension;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.apache.logging.log4j.util.Strings;
import org.springframework.beans.BeanUtils;
import org.springframework.util.CollectionUtils;
public class DimensionConverter {
public static Dimension convert(DimensionReq dimensionReq) {
Dimension dimension = new Dimension();
BeanUtils.copyProperties(dimensionReq, dimension);
return dimension;
}
public static DimensionDO convert(DimensionDO dimensionDO, Dimension dimension) {
BeanMapper.mapper(dimension, dimensionDO);
dimensionDO.setDefaultValues(JSONObject.toJSONString(dimension.getDefaultValues()));
if (!CollectionUtils.isEmpty(dimension.getDimValueMaps())) {
dimensionDO.setDimValueMaps(JSONObject.toJSONString(dimension.getDimValueMaps()));
}
return dimensionDO;
}
public static DimensionDO convert2DimensionDO(Dimension dimension) {
DimensionDO dimensionDO = new DimensionDO();
BeanUtils.copyProperties(dimension, dimensionDO);
dimensionDO.setDefaultValues(JSONObject.toJSONString(dimension.getDefaultValues()));
dimensionDO.setDimValueMaps(JSONObject.toJSONString(dimension.getDimValueMaps()));
return dimensionDO;
}
public static DimensionResp convert2DimensionResp(DimensionDO dimensionDO,
Map<Long, String> fullPathMap,
Map<Long, DatasourceResp> datasourceRespMap) {
DimensionResp dimensionResp = new DimensionResp();
BeanUtils.copyProperties(dimensionDO, dimensionResp);
dimensionResp.setFullPath(fullPathMap.get(dimensionDO.getDomainId()) + dimensionDO.getBizName());
dimensionResp.setDatasourceId(
datasourceRespMap.getOrDefault(dimensionResp.getDatasourceId(), new DatasourceResp()).getId());
dimensionResp.setDatasourceName(
datasourceRespMap.getOrDefault(dimensionResp.getDatasourceId(), new DatasourceResp()).getName());
dimensionResp.setDatasourceBizName(
datasourceRespMap.getOrDefault(dimensionResp.getDatasourceId(), new DatasourceResp()).getBizName());
if (dimensionDO.getDefaultValues() != null) {
dimensionResp.setDefaultValues(JSONObject.parseObject(dimensionDO.getDefaultValues(), List.class));
}
if (Strings.isNotEmpty(dimensionDO.getDimValueMaps())) {
dimensionResp.setDimValueMaps(JsonUtil.toList(dimensionDO.getDimValueMaps(), DimValueMap.class));
}
return dimensionResp;
}
public static DimensionYamlTpl convert2DimensionYamlTpl(Dimension dimension) {
DimensionYamlTpl dimensionYamlTpl = new DimensionYamlTpl();
BeanUtils.copyProperties(dimension, dimensionYamlTpl);
dimensionYamlTpl.setName(dimension.getBizName());
dimensionYamlTpl.setOwners(dimension.getCreatedBy());
return dimensionYamlTpl;
}
public static List<Dimension> dimensionInfo2Dimension(List<DimensionResp> dimensionResps) {
List<Dimension> dimensions = new ArrayList<>();
for (DimensionResp dimensionResp : dimensionResps) {
Dimension dimension = new Dimension();
BeanUtils.copyProperties(dimensionResp, dimension);
dimensions.add(dimension);
}
return dimensions;
}
}

View File

@@ -0,0 +1,73 @@
package com.tencent.supersonic.semantic.model.domain.utils;
import com.google.common.collect.Lists;
import com.tencent.supersonic.auth.api.authentication.pojo.User;
import com.tencent.supersonic.common.util.JsonUtil;
import com.tencent.supersonic.semantic.api.model.pojo.Entity;
import com.tencent.supersonic.semantic.api.model.request.DomainReq;
import com.tencent.supersonic.semantic.api.model.response.DimensionResp;
import com.tencent.supersonic.semantic.api.model.response.DomainResp;
import com.tencent.supersonic.common.pojo.enums.StatusEnum;
import com.tencent.supersonic.semantic.api.model.response.MetricResp;
import com.tencent.supersonic.semantic.model.domain.dataobject.DomainDO;
import com.tencent.supersonic.semantic.model.domain.pojo.Domain;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
public class DomainConvert {
public static Domain convert(DomainReq domainReq) {
Domain domain = new Domain();
BeanUtils.copyProperties(domainReq, domain);
domain.setStatus(StatusEnum.ONLINE.getCode());
return domain;
}
public static DomainDO convert(Domain domain, User user) {
DomainDO domainDO = new DomainDO();
BeanUtils.copyProperties(domain, domainDO);
domainDO.setCreatedBy(user.getName());
domainDO.setUpdatedBy(user.getName());
domainDO.setCreatedAt(new Date());
domainDO.setUpdatedAt(new Date());
domainDO.setAdmin(String.join(",", domain.getAdmins()));
domainDO.setAdminOrg(String.join(",", domain.getAdminOrgs()));
domainDO.setViewer(String.join(",", domain.getViewers()));
domainDO.setViewOrg(String.join(",", domain.getViewOrgs()));
domainDO.setEntity(JsonUtil.toString(domain.getEntity()));
return domainDO;
}
public static DomainResp convert(DomainDO domainDO, Map<Long, String> domainFullPathMap) {
DomainResp domainResp = new DomainResp();
BeanUtils.copyProperties(domainDO, domainResp);
domainResp.setFullPath(domainFullPathMap.get(domainDO.getId()));
domainResp.setAdmins(StringUtils.isBlank(domainDO.getAdmin())
? Lists.newArrayList() : Arrays.asList(domainDO.getAdmin().split(",")));
domainResp.setAdminOrgs(StringUtils.isBlank(domainDO.getAdminOrg())
? Lists.newArrayList() : Arrays.asList(domainDO.getAdminOrg().split(",")));
domainResp.setViewers(StringUtils.isBlank(domainDO.getViewer())
? Lists.newArrayList() : Arrays.asList(domainDO.getViewer().split(",")));
domainResp.setViewOrgs(StringUtils.isBlank(domainDO.getViewOrg())
? Lists.newArrayList() : Arrays.asList(domainDO.getViewOrg().split(",")));
domainResp.setEntity(JsonUtil.toObject(domainDO.getEntity(), Entity.class));
return domainResp;
}
public static DomainResp convert(DomainDO domainDO, Map<Long, String> domainFullPathMap,
Map<Long, List<DimensionResp>> dimensionMap, Map<Long, List<MetricResp>> metricMap) {
DomainResp domainResp = convert(domainDO, domainFullPathMap);
domainResp.setDimensionCnt(dimensionMap.getOrDefault(domainResp.getId(), Lists.newArrayList()).size());
domainResp.setMetricCnt(metricMap.getOrDefault(domainResp.getId(), Lists.newArrayList()).size());
return domainResp;
}
}

View File

@@ -0,0 +1,199 @@
package com.tencent.supersonic.semantic.model.domain.utils;
import static com.tencent.supersonic.common.pojo.Constants.AT_SYMBOL;
import static com.tencent.supersonic.common.pojo.Constants.COLON;
import static com.tencent.supersonic.common.pojo.Constants.DOUBLE_SLASH;
import static com.tencent.supersonic.common.pojo.Constants.EMPTY;
import static com.tencent.supersonic.common.pojo.Constants.JDBC_PREFIX_FORMATTER;
import static com.tencent.supersonic.common.pojo.Constants.NEW_LINE_CHAR;
import static com.tencent.supersonic.common.pojo.Constants.PATTERN_JDBC_TYPE;
import static com.tencent.supersonic.common.pojo.Constants.SPACE;
import com.alibaba.druid.util.StringUtils;
import com.tencent.supersonic.semantic.api.model.enums.DataTypeEnum;
import com.tencent.supersonic.semantic.api.model.response.DatabaseResp;
import com.tencent.supersonic.common.util.MD5Util;
import com.tencent.supersonic.semantic.model.domain.pojo.Database;
import com.tencent.supersonic.semantic.model.domain.pojo.JdbcDataSource;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.HashSet;
import java.util.Set;
import java.util.regex.Matcher;
import javax.sql.DataSource;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
@Slf4j
public class JdbcDataSourceUtils {
@Getter
private static Set releaseSourceSet = new HashSet();
private JdbcDataSource jdbcDataSource;
public JdbcDataSourceUtils(JdbcDataSource jdbcDataSource) {
this.jdbcDataSource = jdbcDataSource;
}
public static boolean testDatabase(Database database) {
try {
Class.forName(getDriverClassName(database.getConnectInfo().getUrl()));
} catch (ClassNotFoundException e) {
log.error(e.toString(), e);
return false;
}
try (Connection con = DriverManager.getConnection(database.getConnectInfo().getUrl(),
database.getConnectInfo().getUserName(), database.getConnectInfo().getPassword());) {
return con != null;
} catch (SQLException e) {
log.error(e.toString(), e);
}
return false;
}
public static void releaseConnection(Connection connection) {
if (null != connection) {
try {
connection.close();
} catch (Exception e) {
log.error("Connection release error", e);
}
}
}
public static void closeResult(ResultSet rs) {
if (rs != null) {
try {
rs.close();
} catch (Exception e) {
log.error("ResultSet close error", e);
}
}
}
public static String isSupportedDatasource(String jdbcUrl) {
String dataSourceName = getDataSourceName(jdbcUrl);
if (StringUtils.isEmpty(dataSourceName)) {
throw new RuntimeException("Not supported dataSource: jdbcUrl=" + jdbcUrl);
}
if (!DataTypeEnum.getAllSupportedDatasourceNameSet().contains(dataSourceName)) {
throw new RuntimeException("Not supported dataSource: jdbcUrl=" + jdbcUrl);
}
String urlPrefix = String.format(JDBC_PREFIX_FORMATTER, dataSourceName);
String checkUrl = jdbcUrl.replaceFirst(DOUBLE_SLASH, EMPTY).replaceFirst(AT_SYMBOL, EMPTY);
if (urlPrefix.equals(checkUrl)) {
throw new RuntimeException("Communications link failure");
}
return dataSourceName;
}
public static String getDataSourceName(String jdbcUrl) {
String dataSourceName = null;
jdbcUrl = jdbcUrl.replaceAll(NEW_LINE_CHAR, EMPTY).replaceAll(SPACE, EMPTY).trim();
Matcher matcher = PATTERN_JDBC_TYPE.matcher(jdbcUrl);
if (matcher.find()) {
dataSourceName = matcher.group().split(COLON)[1];
}
return dataSourceName;
}
public static String getDriverClassName(String jdbcUrl) {
String className = null;
try {
className = DriverManager.getDriver(jdbcUrl.trim()).getClass().getName();
} catch (SQLException e) {
log.error("e", e);
}
if (!StringUtils.isEmpty(className) && !className.contains("com.sun.proxy")
&& !className.contains("net.sf.cglib.proxy")) {
return className;
}
DataTypeEnum dataTypeEnum = DataTypeEnum.urlOf(jdbcUrl);
if (dataTypeEnum != null) {
return dataTypeEnum.getDriver();
}
throw new RuntimeException("Not supported data type: jdbcUrl=" + jdbcUrl);
}
public static String getKey(String name, String jdbcUrl, String username, String password, String version,
boolean isExt) {
StringBuilder sb = new StringBuilder();
sb.append(StringUtils.isEmpty(name) ? "null" : name).append(COLON);
sb.append(StringUtils.isEmpty(username) ? "null" : username).append(COLON);
sb.append(StringUtils.isEmpty(password) ? "null" : password).append(COLON);
sb.append(jdbcUrl.trim()).append(COLON);
if (isExt && !StringUtils.isEmpty(version)) {
sb.append(version);
} else {
sb.append("null");
}
return MD5Util.getMD5(sb.toString(), true, 64);
}
public DataSource getDataSource(DatabaseResp databaseResp) throws RuntimeException {
return jdbcDataSource.getDataSource(databaseResp);
}
public Connection getConnection(DatabaseResp databaseResp) throws RuntimeException {
Connection conn = getConnectionWithRetry(databaseResp);
if (conn == null) {
try {
releaseDataSource(databaseResp);
DataSource dataSource = getDataSource(databaseResp);
return dataSource.getConnection();
} catch (Exception e) {
log.error("Get connection error, jdbcUrl:{}, e:{}", databaseResp.getUrl(), e);
throw new RuntimeException("Get connection error, jdbcUrl:" + databaseResp.getUrl()
+ " you can try again later or reset datasource");
}
}
return conn;
}
private Connection getConnectionWithRetry(DatabaseResp databaseResp) {
int rc = 1;
for (; ; ) {
if (rc > 3) {
return null;
}
try {
Connection connection = getDataSource(databaseResp).getConnection();
if (connection != null && connection.isValid(5)) {
return connection;
}
} catch (Exception e) {
log.error("e", e);
}
try {
Thread.sleep((long) Math.pow(2, rc) * 1000);
} catch (InterruptedException e) {
log.error("e", e);
}
rc++;
}
}
public void releaseDataSource(DatabaseResp databaseResp) {
jdbcDataSource.removeDatasource(databaseResp);
}
}

View File

@@ -0,0 +1,103 @@
package com.tencent.supersonic.semantic.model.domain.utils;
import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Lists;
import com.tencent.supersonic.common.pojo.DataFormat;
import com.tencent.supersonic.semantic.api.model.pojo.Measure;
import com.tencent.supersonic.semantic.api.model.pojo.MetricTypeParams;
import com.tencent.supersonic.semantic.api.model.yaml.MeasureYamlTpl;
import com.tencent.supersonic.semantic.api.model.yaml.MetricTypeParamsYamlTpl;
import com.tencent.supersonic.semantic.api.model.yaml.MetricYamlTpl;
import com.tencent.supersonic.semantic.api.model.request.MetricReq;
import com.tencent.supersonic.semantic.api.model.response.DomainResp;
import com.tencent.supersonic.semantic.api.model.response.MetricResp;
import com.tencent.supersonic.common.util.BeanMapper;
import com.tencent.supersonic.semantic.model.domain.dataobject.MetricDO;
import com.tencent.supersonic.semantic.model.domain.pojo.Metric;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import org.springframework.beans.BeanUtils;
public class MetricConverter {
public static Metric convert(MetricReq metricReq) {
Metric metric = new Metric();
BeanUtils.copyProperties(metricReq, metric);
metric.setType(metricReq.getMetricType().name());
metric.setTypeParams(metricReq.getTypeParams());
return metric;
}
public static MetricDO convert(MetricDO metricDO, Metric metric) {
BeanMapper.mapper(metric, metricDO);
metricDO.setTypeParams(JSONObject.toJSONString(metric.getTypeParams()));
if (metric.getDataFormat() != null) {
metricDO.setDataFormat(JSONObject.toJSONString(metric.getDataFormat()));
}
return metricDO;
}
public static MeasureYamlTpl convert(Measure measure) {
MeasureYamlTpl measureYamlTpl = new MeasureYamlTpl();
measureYamlTpl.setName(measure.getBizName());
return measureYamlTpl;
}
public static MetricDO convert2MetricDO(Metric metric) {
MetricDO metricDO = new MetricDO();
BeanUtils.copyProperties(metric, metricDO);
metricDO.setTypeParams(JSONObject.toJSONString(metric.getTypeParams()));
metricDO.setDataFormat(JSONObject.toJSONString(metric.getDataFormat()));
return metricDO;
}
public static MetricResp convert2MetricDesc(MetricDO metricDO, Map<Long, DomainResp> domainMap) {
MetricResp metricDesc = new MetricResp();
BeanUtils.copyProperties(metricDO, metricDesc);
metricDesc.setTypeParams(JSONObject.parseObject(metricDO.getTypeParams(), MetricTypeParams.class));
metricDesc.setDataFormat(JSONObject.parseObject(metricDO.getDataFormat(), DataFormat.class));
DomainResp domainResp = domainMap.get(metricDO.getDomainId());
if (domainResp != null) {
metricDesc.setFullPath(domainMap.get(metricDO.getDomainId()).getFullPath() + metricDO.getBizName());
metricDesc.setDomainName(domainMap.get(metricDO.getDomainId()).getName());
}
return metricDesc;
}
public static Metric convert2Metric(MetricDO metricDO) {
Metric metric = new Metric();
BeanUtils.copyProperties(metricDO, metric);
metric.setTypeParams(JSONObject.parseObject(metricDO.getTypeParams(), MetricTypeParams.class));
return metric;
}
public static MetricYamlTpl convert2MetricYamlTpl(Metric metric) {
MetricYamlTpl metricYamlTpl = new MetricYamlTpl();
BeanUtils.copyProperties(metric, metricYamlTpl);
metricYamlTpl.setName(metric.getBizName());
metricYamlTpl.setOwners(Lists.newArrayList(metric.getCreatedBy()));
MetricTypeParams exprMetricTypeParams = metric.getTypeParams();
MetricTypeParamsYamlTpl metricTypeParamsYamlTpl = new MetricTypeParamsYamlTpl();
metricTypeParamsYamlTpl.setExpr(exprMetricTypeParams.getExpr());
List<Measure> measures = exprMetricTypeParams.getMeasures();
metricTypeParamsYamlTpl.setMeasures(
measures.stream().map(MetricConverter::convert).collect(Collectors.toList()));
metricYamlTpl.setTypeParams(metricTypeParamsYamlTpl);
return metricYamlTpl;
}
public static List<Metric> metricInfo2Metric(List<MetricResp> metricDescs) {
List<Metric> metrics = new ArrayList<>();
for (MetricResp metricDesc : metricDescs) {
Metric metric = new Metric();
BeanUtils.copyProperties(metricDesc, metric);
metrics.add(metric);
}
return metrics;
}
}

View File

@@ -0,0 +1,233 @@
package com.tencent.supersonic.semantic.model.domain.utils;
import static com.tencent.supersonic.common.pojo.Constants.AT_SYMBOL;
import com.tencent.supersonic.semantic.api.model.enums.DataTypeEnum;
import com.tencent.supersonic.common.pojo.QueryColumn;
import com.tencent.supersonic.semantic.api.model.response.DatabaseResp;
import com.tencent.supersonic.semantic.api.model.response.QueryResultWithSchemaResp;
import com.tencent.supersonic.semantic.model.domain.pojo.JdbcDataSource;
import java.rmi.ServerException;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import javax.sql.DataSource;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
@Slf4j
@Component
public class SqlUtils {
@Getter
private DatabaseResp databaseResp;
@Autowired
private JdbcDataSource jdbcDataSource;
@Value("${source.result-limit:1000000}")
private int resultLimit;
@Value("${source.enable-query-log:false}")
private boolean isQueryLogEnable;
@Getter
private DataTypeEnum dataTypeEnum;
@Getter
private JdbcDataSourceUtils jdbcDataSourceUtils;
public SqlUtils() {
}
public SqlUtils(DatabaseResp databaseResp) {
this.databaseResp = databaseResp;
this.dataTypeEnum = DataTypeEnum.urlOf(databaseResp.getUrl());
}
public SqlUtils init(DatabaseResp databaseResp) {
//todo Password decryption
return SqlUtilsBuilder
.getBuilder()
.withName(databaseResp.getId() + AT_SYMBOL + databaseResp.getName())
.withType(databaseResp.getType())
.withJdbcUrl(databaseResp.getUrl())
.withUsername(databaseResp.getUsername())
.withPassword(databaseResp.getPassword())
.withJdbcDataSource(this.jdbcDataSource)
.withResultLimit(this.resultLimit)
.withIsQueryLogEnable(this.isQueryLogEnable)
.build();
}
public List<Map<String, Object>> execute(String sql) throws ServerException {
try {
List<Map<String, Object>> list = jdbcTemplate().queryForList(sql);
log.info("list:{}", list);
return list;
} catch (Exception e) {
log.error(e.toString(), e);
throw new ServerException(e.getMessage());
}
}
public void execute(String sql, QueryResultWithSchemaResp queryResultWithColumns) {
getResult(sql, queryResultWithColumns, jdbcTemplate());
}
public JdbcTemplate jdbcTemplate() throws RuntimeException {
Connection connection = null;
try {
connection = jdbcDataSourceUtils.getConnection(databaseResp);
} catch (Exception e) {
log.warn("e:", e);
} finally {
JdbcDataSourceUtils.releaseConnection(connection);
}
DataSource dataSource = jdbcDataSourceUtils.getDataSource(databaseResp);
JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
jdbcTemplate.setDatabaseProductName(databaseResp.getName());
jdbcTemplate.setFetchSize(500);
log.info("jdbcTemplate:{}, dataSource:{}", jdbcTemplate, dataSource);
return jdbcTemplate;
}
public void queryInternal(String sql, QueryResultWithSchemaResp queryResultWithColumns) {
getResult(sql, queryResultWithColumns, jdbcTemplate());
}
private QueryResultWithSchemaResp getResult(String sql, QueryResultWithSchemaResp queryResultWithColumns,
JdbcTemplate jdbcTemplate) {
jdbcTemplate.query(sql, rs -> {
if (null == rs) {
return queryResultWithColumns;
}
ResultSetMetaData metaData = rs.getMetaData();
List<QueryColumn> queryColumns = new ArrayList<>();
for (int i = 1; i <= metaData.getColumnCount(); i++) {
String key = metaData.getColumnLabel(i);
queryColumns.add(new QueryColumn(key, metaData.getColumnTypeName(i)));
}
queryResultWithColumns.setColumns(queryColumns);
List<Map<String, Object>> resultList = getAllData(rs, queryColumns);
queryResultWithColumns.setResultList(resultList);
return queryResultWithColumns;
});
return queryResultWithColumns;
}
private List<Map<String, Object>> getAllData(ResultSet rs, List<QueryColumn> queryColumns) {
List<Map<String, Object>> data = new ArrayList<>();
try {
while (rs.next()) {
data.add(getLineData(rs, queryColumns));
}
} catch (Exception e) {
log.warn("error in getAllData, e:", e);
}
return data;
}
private Map<String, Object> getLineData(ResultSet rs, List<QueryColumn> queryColumns) throws SQLException {
Map<String, Object> map = new LinkedHashMap<>();
for (QueryColumn queryColumn : queryColumns) {
String colName = queryColumn.getNameEn();
Object value = rs.getObject(colName);
map.put(colName, value instanceof byte[] ? new String((byte[]) value) : value);
}
return map;
}
public static final class SqlUtilsBuilder {
private JdbcDataSource jdbcDataSource;
private int resultLimit;
private boolean isQueryLogEnable;
private String name;
private String type;
private String jdbcUrl;
private String username;
private String password;
private SqlUtilsBuilder() {
}
public static SqlUtilsBuilder getBuilder() {
return new SqlUtilsBuilder();
}
SqlUtilsBuilder withJdbcDataSource(JdbcDataSource jdbcDataSource) {
this.jdbcDataSource = jdbcDataSource;
return this;
}
SqlUtilsBuilder withResultLimit(int resultLimit) {
this.resultLimit = resultLimit;
return this;
}
SqlUtilsBuilder withIsQueryLogEnable(boolean isQueryLogEnable) {
this.isQueryLogEnable = isQueryLogEnable;
return this;
}
SqlUtilsBuilder withName(String name) {
this.name = name;
return this;
}
SqlUtilsBuilder withType(String type) {
this.type = type;
return this;
}
SqlUtilsBuilder withJdbcUrl(String jdbcUrl) {
this.jdbcUrl = jdbcUrl;
return this;
}
SqlUtilsBuilder withUsername(String username) {
this.username = username;
return this;
}
SqlUtilsBuilder withPassword(String password) {
this.password = password;
return this;
}
public SqlUtils build() {
DatabaseResp databaseResp = DatabaseResp.builder()
.name(this.name)
.type(this.type)
.url(this.jdbcUrl)
.username(this.username)
.password(this.password)
.build();
SqlUtils sqlUtils = new SqlUtils(databaseResp);
sqlUtils.jdbcDataSource = this.jdbcDataSource;
sqlUtils.resultLimit = this.resultLimit;
sqlUtils.isQueryLogEnable = this.isQueryLogEnable;
sqlUtils.jdbcDataSourceUtils = new JdbcDataSourceUtils(this.jdbcDataSource);
return sqlUtils;
}
}
}

View File

@@ -0,0 +1,81 @@
package com.tencent.supersonic.semantic.model.domain.utils;
import com.tencent.supersonic.semantic.api.model.enums.DimensionTypeEnum;
import com.tencent.supersonic.semantic.api.model.enums.TimeDimensionEnum;
import com.tencent.supersonic.semantic.api.model.pojo.Dim;
import com.tencent.supersonic.semantic.api.model.pojo.DimensionTimeTypeParams;
import com.tencent.supersonic.semantic.model.domain.adaptor.engineadapter.EngineAdaptor;
import java.util.List;
import lombok.extern.slf4j.Slf4j;
@Slf4j
public class SysTimeDimensionBuilder {
public static void addSysTimeDimension(List<Dim> dims, EngineAdaptor engineAdaptor) {
log.info("addSysTimeDimension before:{}, engineAdaptor:{}", dims, engineAdaptor);
Dim timeDim = getTimeDim(dims);
if (timeDim == null) {
timeDim = Dim.getDefault();
//todo not find the time dimension
return;
}
dims.add(generateSysDayDimension(timeDim, engineAdaptor));
dims.add(generateSysWeekDimension(timeDim, engineAdaptor));
dims.add(generateSysMonthDimension(timeDim, engineAdaptor));
log.debug("addSysTimeDimension after:{}, engineAdaptor:{}", dims, engineAdaptor);
}
private static Dim generateSysDayDimension(Dim timeDim, EngineAdaptor engineAdaptor) {
Dim dim = new Dim();
dim.setBizName(TimeDimensionEnum.DAY.getName());
dim.setType(DimensionTypeEnum.time.name());
dim.setExpr(generateTimeExpr(timeDim, TimeDimensionEnum.DAY.name().toLowerCase(), engineAdaptor));
DimensionTimeTypeParams typeParams = new DimensionTimeTypeParams();
typeParams.setTimeGranularity(TimeDimensionEnum.DAY.name().toLowerCase());
typeParams.setIsPrimary("true");
dim.setTypeParams(typeParams);
return dim;
}
private static Dim generateSysWeekDimension(Dim timeDim, EngineAdaptor engineAdaptor) {
Dim dim = new Dim();
dim.setBizName(TimeDimensionEnum.WEEK.getName());
dim.setType(DimensionTypeEnum.time.name());
dim.setExpr(generateTimeExpr(timeDim, TimeDimensionEnum.WEEK.name().toLowerCase(), engineAdaptor));
DimensionTimeTypeParams typeParams = new DimensionTimeTypeParams();
typeParams.setTimeGranularity(TimeDimensionEnum.DAY.name().toLowerCase());
typeParams.setIsPrimary("false");
dim.setTypeParams(typeParams);
return dim;
}
private static Dim generateSysMonthDimension(Dim timeDim, EngineAdaptor engineAdaptor) {
Dim dim = new Dim();
dim.setBizName(TimeDimensionEnum.MONTH.getName());
dim.setType(DimensionTypeEnum.time.name());
dim.setExpr(generateTimeExpr(timeDim, TimeDimensionEnum.MONTH.name().toLowerCase(), engineAdaptor));
DimensionTimeTypeParams typeParams = new DimensionTimeTypeParams();
typeParams.setTimeGranularity(TimeDimensionEnum.DAY.name().toLowerCase());
typeParams.setIsPrimary("false");
dim.setTypeParams(typeParams);
return dim;
}
private static String generateTimeExpr(Dim timeDim, String dateType, EngineAdaptor engineAdaptor) {
String bizName = timeDim.getBizName();
String dateFormat = timeDim.getDateFormat();
return engineAdaptor.getDateFormat(dateType, dateFormat, bizName);
}
private static Dim getTimeDim(List<Dim> timeDims) {
for (Dim dim : timeDims) {
if (dim.getType().equalsIgnoreCase(DimensionTypeEnum.time.name())) {
return dim;
}
}
return null;
}
}

View File

@@ -0,0 +1,60 @@
package com.tencent.supersonic.semantic.model.infrastructure.mapper;
import com.tencent.supersonic.semantic.model.domain.dataobject.DatabaseDO;
import com.tencent.supersonic.semantic.model.domain.dataobject.DatabaseDOExample;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface DatabaseDOMapper {
/**
* @mbg.generated
*/
long countByExample(DatabaseDOExample example);
/**
* @mbg.generated
*/
int deleteByPrimaryKey(Long id);
/**
* @mbg.generated
*/
int insert(DatabaseDO record);
/**
* @mbg.generated
*/
int insertSelective(DatabaseDO record);
/**
* @mbg.generated
*/
List<DatabaseDO> selectByExampleWithBLOBs(DatabaseDOExample example);
/**
* @mbg.generated
*/
List<DatabaseDO> selectByExample(DatabaseDOExample example);
/**
* @mbg.generated
*/
DatabaseDO selectByPrimaryKey(Long id);
/**
* @mbg.generated
*/
int updateByPrimaryKeySelective(DatabaseDO record);
/**
* @mbg.generated
*/
int updateByPrimaryKeyWithBLOBs(DatabaseDO record);
/**
* @mbg.generated
*/
int updateByPrimaryKey(DatabaseDO record);
}

View File

@@ -0,0 +1,60 @@
package com.tencent.supersonic.semantic.model.infrastructure.mapper;
import com.tencent.supersonic.semantic.model.domain.dataobject.DatasourceDO;
import com.tencent.supersonic.semantic.model.domain.dataobject.DatasourceDOExample;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface DatasourceDOMapper {
/**
* @mbg.generated
*/
long countByExample(DatasourceDOExample example);
/**
* @mbg.generated
*/
int deleteByPrimaryKey(Long id);
/**
* @mbg.generated
*/
int insert(DatasourceDO record);
/**
* @mbg.generated
*/
int insertSelective(DatasourceDO record);
/**
* @mbg.generated
*/
List<DatasourceDO> selectByExampleWithBLOBs(DatasourceDOExample example);
/**
* @mbg.generated
*/
List<DatasourceDO> selectByExample(DatasourceDOExample example);
/**
* @mbg.generated
*/
DatasourceDO selectByPrimaryKey(Long id);
/**
* @mbg.generated
*/
int updateByPrimaryKeySelective(DatasourceDO record);
/**
* @mbg.generated
*/
int updateByPrimaryKeyWithBLOBs(DatasourceDO record);
/**
* @mbg.generated
*/
int updateByPrimaryKey(DatasourceDO record);
}

View File

@@ -0,0 +1,51 @@
package com.tencent.supersonic.semantic.model.infrastructure.mapper;
import com.tencent.supersonic.semantic.model.domain.dataobject.DatasourceRelaDO;
import com.tencent.supersonic.semantic.model.domain.dataobject.DatasourceRelaDOExample;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface DatasourceRelaDOMapper {
/**
* @mbg.generated
*/
long countByExample(DatasourceRelaDOExample example);
/**
* @mbg.generated
*/
int deleteByPrimaryKey(Long id);
/**
* @mbg.generated
*/
int insert(DatasourceRelaDO record);
/**
* @mbg.generated
*/
int insertSelective(DatasourceRelaDO record);
/**
* @mbg.generated
*/
List<DatasourceRelaDO> selectByExample(DatasourceRelaDOExample example);
/**
* @mbg.generated
*/
DatasourceRelaDO selectByPrimaryKey(Long id);
/**
* @mbg.generated
*/
int updateByPrimaryKeySelective(DatasourceRelaDO record);
/**
* @mbg.generated
*/
int updateByPrimaryKey(DatasourceRelaDO record);
}

View File

@@ -0,0 +1,16 @@
package com.tencent.supersonic.semantic.model.infrastructure.mapper;
import com.tencent.supersonic.semantic.api.model.pojo.ItemDateFilter;
import com.tencent.supersonic.semantic.model.domain.dataobject.DateInfoDO;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface DateInfoMapper {
Boolean upsertDateInfo(DateInfoDO dateInfoDO);
List<DateInfoDO> getDateInfos(ItemDateFilter itemDateFilter);
}

View File

@@ -0,0 +1,16 @@
package com.tencent.supersonic.semantic.model.infrastructure.mapper;
import com.tencent.supersonic.semantic.model.domain.dataobject.DimensionDO;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface DimensionDOCustomMapper {
void batchInsert(List<DimensionDO> dimensionDOS);
void batchUpdate(List<DimensionDO> dimensionDOS);
}

View File

@@ -0,0 +1,62 @@
package com.tencent.supersonic.semantic.model.infrastructure.mapper;
import com.tencent.supersonic.semantic.model.domain.dataobject.DimensionDO;
import com.tencent.supersonic.semantic.model.domain.dataobject.DimensionDOExample;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface DimensionDOMapper {
/**
* @mbg.generated
*/
long countByExample(DimensionDOExample example);
/**
* @mbg.generated
*/
int deleteByPrimaryKey(Long id);
/**
* @mbg.generated
*/
int insert(DimensionDO record);
/**
* @mbg.generated
*/
int insertSelective(DimensionDO record);
/**
* @mbg.generated
*/
List<DimensionDO> selectByExampleWithBLOBs(DimensionDOExample example);
/**
* @mbg.generated
*/
List<DimensionDO> selectByExample(DimensionDOExample example);
/**
* @mbg.generated
*/
DimensionDO selectByPrimaryKey(Long id);
/**
* @mbg.generated
*/
int updateByPrimaryKeySelective(DimensionDO record);
/**
* @mbg.generated
*/
int updateByPrimaryKeyWithBLOBs(DimensionDO record);
/**
* @mbg.generated
*/
int updateByPrimaryKey(DimensionDO record);
}

View File

@@ -0,0 +1,51 @@
package com.tencent.supersonic.semantic.model.infrastructure.mapper;
import com.tencent.supersonic.semantic.model.domain.dataobject.DomainDO;
import com.tencent.supersonic.semantic.model.domain.dataobject.DomainDOExample;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface DomainDOMapper {
/**
* @mbg.generated
*/
long countByExample(DomainDOExample example);
/**
* @mbg.generated
*/
int deleteByPrimaryKey(Long id);
/**
* @mbg.generated
*/
int insert(DomainDO record);
/**
* @mbg.generated
*/
int insertSelective(DomainDO record);
/**
* @mbg.generated
*/
List<DomainDO> selectByExample(DomainDOExample example);
/**
* @mbg.generated
*/
DomainDO selectByPrimaryKey(Long id);
/**
* @mbg.generated
*/
int updateByPrimaryKeySelective(DomainDO record);
/**
* @mbg.generated
*/
int updateByPrimaryKey(DomainDO record);
}

View File

@@ -0,0 +1,17 @@
package com.tencent.supersonic.semantic.model.infrastructure.mapper;
import com.tencent.supersonic.semantic.model.domain.dataobject.MetricDO;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface MetricDOCustomMapper {
void batchInsert(List<MetricDO> metricDOS);
void batchUpdate(List<MetricDO> metricDOS);
}

View File

@@ -0,0 +1,61 @@
package com.tencent.supersonic.semantic.model.infrastructure.mapper;
import com.tencent.supersonic.semantic.model.domain.dataobject.MetricDO;
import com.tencent.supersonic.semantic.model.domain.dataobject.MetricDOExample;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface MetricDOMapper {
/**
* @mbg.generated
*/
long countByExample(MetricDOExample example);
/**
* @mbg.generated
*/
int deleteByPrimaryKey(Long id);
/**
* @mbg.generated
*/
int insert(MetricDO record);
/**
* @mbg.generated
*/
int insertSelective(MetricDO record);
/**
* @mbg.generated
*/
List<MetricDO> selectByExampleWithBLOBs(MetricDOExample example);
/**
* @mbg.generated
*/
List<MetricDO> selectByExample(MetricDOExample example);
/**
* @mbg.generated
*/
MetricDO selectByPrimaryKey(Long id);
/**
* @mbg.generated
*/
int updateByPrimaryKeySelective(MetricDO record);
/**
* @mbg.generated
*/
int updateByPrimaryKeyWithBLOBs(MetricDO record);
/**
* @mbg.generated
*/
int updateByPrimaryKey(MetricDO record);
}

View File

@@ -0,0 +1,61 @@
package com.tencent.supersonic.semantic.model.infrastructure.mapper;
import com.tencent.supersonic.semantic.model.domain.dataobject.ViewInfoDO;
import com.tencent.supersonic.semantic.model.domain.dataobject.ViewInfoDOExample;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface ViewInfoDOMapper {
/**
* @mbg.generated
*/
long countByExample(ViewInfoDOExample example);
/**
* @mbg.generated
*/
int deleteByPrimaryKey(Long id);
/**
* @mbg.generated
*/
int insert(ViewInfoDO record);
/**
* @mbg.generated
*/
int insertSelective(ViewInfoDO record);
/**
* @mbg.generated
*/
List<ViewInfoDO> selectByExampleWithBLOBs(ViewInfoDOExample example);
/**
* @mbg.generated
*/
List<ViewInfoDO> selectByExample(ViewInfoDOExample example);
/**
* @mbg.generated
*/
ViewInfoDO selectByPrimaryKey(Long id);
/**
* @mbg.generated
*/
int updateByPrimaryKeySelective(ViewInfoDO record);
/**
* @mbg.generated
*/
int updateByPrimaryKeyWithBLOBs(ViewInfoDO record);
/**
* @mbg.generated
*/
int updateByPrimaryKey(ViewInfoDO record);
}

View File

@@ -0,0 +1,47 @@
package com.tencent.supersonic.semantic.model.infrastructure.repository;
import com.tencent.supersonic.semantic.model.domain.dataobject.DatabaseDO;
import com.tencent.supersonic.semantic.model.domain.dataobject.DatabaseDOExample;
import com.tencent.supersonic.semantic.model.domain.repository.DatabaseRepository;
import com.tencent.supersonic.semantic.model.infrastructure.mapper.DatabaseDOMapper;
import java.util.List;
import org.springframework.stereotype.Component;
@Component
public class DatabaseRepositoryImpl implements DatabaseRepository {
private DatabaseDOMapper databaseDOMapper;
public DatabaseRepositoryImpl(DatabaseDOMapper databaseDOMapper) {
this.databaseDOMapper = databaseDOMapper;
}
@Override
public void createDatabase(DatabaseDO databaseDO) {
databaseDOMapper.insert(databaseDO);
}
@Override
public void updateDatabase(DatabaseDO databaseDO) {
databaseDOMapper.updateByPrimaryKeyWithBLOBs(databaseDO);
}
@Override
public DatabaseDO getDatabase(Long id) {
return databaseDOMapper.selectByPrimaryKey(id);
}
@Override
public List<DatabaseDO> getDatabaseByDomainId(Long domainId) {
DatabaseDOExample databaseDOExample = new DatabaseDOExample();
databaseDOExample.createCriteria().andDomainIdEqualTo(domainId);
return databaseDOMapper.selectByExampleWithBLOBs(databaseDOExample);
}
}

View File

@@ -0,0 +1,90 @@
package com.tencent.supersonic.semantic.model.infrastructure.repository;
import com.tencent.supersonic.semantic.model.domain.dataobject.DatasourceDO;
import com.tencent.supersonic.semantic.model.domain.dataobject.DatasourceDOExample;
import com.tencent.supersonic.semantic.model.domain.dataobject.DatasourceRelaDO;
import com.tencent.supersonic.semantic.model.domain.dataobject.DatasourceRelaDOExample;
import com.tencent.supersonic.semantic.model.domain.repository.DatasourceRepository;
import com.tencent.supersonic.semantic.model.infrastructure.mapper.DatasourceDOMapper;
import com.tencent.supersonic.semantic.model.infrastructure.mapper.DatasourceRelaDOMapper;
import java.util.List;
import org.springframework.stereotype.Component;
@Component
public class DatasourceRepositoryImpl implements DatasourceRepository {
private DatasourceDOMapper datasourceMapper;
private DatasourceRelaDOMapper datasourceRelaDOMapper;
public DatasourceRepositoryImpl(DatasourceDOMapper datasourceMapper,
DatasourceRelaDOMapper datasourceRelaDOMapper) {
this.datasourceMapper = datasourceMapper;
this.datasourceRelaDOMapper = datasourceRelaDOMapper;
}
@Override
public void createDatasource(DatasourceDO datasourceDO) {
datasourceMapper.insert(datasourceDO);
}
@Override
public void updateDatasource(DatasourceDO datasourceDO) {
datasourceMapper.updateByPrimaryKeyWithBLOBs(datasourceDO);
}
@Override
public List<DatasourceDO> getDatasourceList() {
DatasourceDOExample datasourceExample = new DatasourceDOExample();
return datasourceMapper.selectByExampleWithBLOBs(datasourceExample);
}
@Override
public List<DatasourceDO> getDatasourceList(Long domainId) {
DatasourceDOExample datasourceExample = new DatasourceDOExample();
datasourceExample.createCriteria().andDomainIdEqualTo(domainId);
return datasourceMapper.selectByExampleWithBLOBs(datasourceExample);
}
@Override
public DatasourceDO getDatasourceById(Long id) {
return datasourceMapper.selectByPrimaryKey(id);
}
@Override
public void deleteDatasource(Long id) {
datasourceMapper.deleteByPrimaryKey(id);
}
@Override
public void createDatasourceRela(DatasourceRelaDO datasourceRelaDO) {
datasourceRelaDOMapper.insert(datasourceRelaDO);
}
@Override
public void updateDatasourceRela(DatasourceRelaDO datasourceRelaDO) {
datasourceRelaDOMapper.updateByPrimaryKey(datasourceRelaDO);
}
@Override
public DatasourceRelaDO getDatasourceRelaById(Long id) {
return datasourceRelaDOMapper.selectByPrimaryKey(id);
}
@Override
public List<DatasourceRelaDO> getDatasourceRelaList(Long domainId) {
DatasourceRelaDOExample datasourceRelaDOExample = new DatasourceRelaDOExample();
datasourceRelaDOExample.createCriteria().andDomainIdEqualTo(domainId);
return datasourceRelaDOMapper.selectByExample(datasourceRelaDOExample);
}
@Override
public void deleteDatasourceRela(Long id) {
datasourceRelaDOMapper.deleteByPrimaryKey(id);
}
}

View File

@@ -0,0 +1,73 @@
package com.tencent.supersonic.semantic.model.infrastructure.repository;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.base.Stopwatch;
import com.tencent.supersonic.semantic.api.model.pojo.ItemDateFilter;
import com.tencent.supersonic.semantic.api.model.request.DateInfoReq;
import com.tencent.supersonic.common.pojo.Constants;
import com.tencent.supersonic.semantic.model.domain.dataobject.DateInfoDO;
import com.tencent.supersonic.semantic.model.domain.repository.DateInfoRepository;
import com.tencent.supersonic.semantic.model.infrastructure.mapper.DateInfoMapper;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.TimeUnit;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.util.CollectionUtils;
@Slf4j
@Repository
public class DateInfoRepositoryImpl implements DateInfoRepository {
private ObjectMapper mapper = new ObjectMapper();
@Autowired
private DateInfoMapper dateInfoMapper;
@Override
public Integer upsertDateInfo(List<DateInfoReq> dateInfoCommends) {
List<DateInfoDO> dateInfoDOList = new ArrayList<>();
if (CollectionUtils.isEmpty(dateInfoCommends)) {
log.info("dateInfoCommends size is 0");
return 0;
}
dateInfoCommends.stream().forEach(commend -> {
DateInfoDO dateInfoDO = new DateInfoDO();
BeanUtils.copyProperties(commend, dateInfoDO);
try {
dateInfoDO.setUnavailableDateList(mapper.writeValueAsString(commend.getUnavailableDateList()));
dateInfoDO.setCreatedBy(Constants.ADMIN_LOWER);
dateInfoDO.setUpdatedBy(Constants.ADMIN_LOWER);
} catch (JsonProcessingException e) {
log.info("e,", e);
}
dateInfoDOList.add(dateInfoDO);
});
return batchUpsert(dateInfoDOList);
}
@Override
public List<DateInfoDO> getDateInfos(ItemDateFilter itemDateFilter) {
if (Objects.nonNull(itemDateFilter) && CollectionUtils.isEmpty(itemDateFilter.getItemIds())) {
return new ArrayList<>();
}
return dateInfoMapper.getDateInfos(itemDateFilter);
}
private Integer batchUpsert(List<DateInfoDO> dateInfoDOList) {
Stopwatch stopwatch = Stopwatch.createStarted();
for (DateInfoDO dateInfoDO : dateInfoDOList) {
dateInfoMapper.upsertDateInfo(dateInfoDO);
}
log.info("before final, elapsed time:{}", stopwatch.elapsed(TimeUnit.MILLISECONDS));
return 0;
}
}

View File

@@ -0,0 +1,115 @@
package com.tencent.supersonic.semantic.model.infrastructure.repository;
import com.tencent.supersonic.semantic.model.domain.dataobject.DimensionDO;
import com.tencent.supersonic.semantic.model.domain.dataobject.DimensionDOExample;
import com.tencent.supersonic.semantic.model.domain.repository.DimensionRepository;
import com.tencent.supersonic.semantic.model.domain.pojo.DimensionFilter;
import com.tencent.supersonic.semantic.model.infrastructure.mapper.DimensionDOCustomMapper;
import com.tencent.supersonic.semantic.model.infrastructure.mapper.DimensionDOMapper;
import java.util.List;
import org.springframework.stereotype.Service;
@Service
public class DimensionRepositoryImpl implements DimensionRepository {
private DimensionDOMapper dimensionDOMapper;
private DimensionDOCustomMapper dimensionDOCustomMapper;
public DimensionRepositoryImpl(DimensionDOMapper dimensionDOMapper,
DimensionDOCustomMapper dimensionDOCustomMapper) {
this.dimensionDOMapper = dimensionDOMapper;
this.dimensionDOCustomMapper = dimensionDOCustomMapper;
}
@Override
public void createDimension(DimensionDO dimensionDO) {
dimensionDOMapper.insert(dimensionDO);
}
@Override
public void createDimensionBatch(List<DimensionDO> dimensionDOS) {
dimensionDOCustomMapper.batchInsert(dimensionDOS);
}
@Override
public void updateDimension(DimensionDO dimensionDO) {
dimensionDOMapper.updateByPrimaryKeyWithBLOBs(dimensionDO);
}
@Override
public List<DimensionDO> getDimensionListOfDatasource(Long datasourceId) {
DimensionDOExample dimensionDOExample = new DimensionDOExample();
dimensionDOExample.createCriteria().andDatasourceIdEqualTo(datasourceId);
return dimensionDOMapper.selectByExampleWithBLOBs(dimensionDOExample);
}
@Override
public List<DimensionDO> getDimensionListOfDomain(Long domainId) {
DimensionDOExample dimensionDOExample = new DimensionDOExample();
dimensionDOExample.createCriteria().andDomainIdEqualTo(domainId);
return dimensionDOMapper.selectByExampleWithBLOBs(dimensionDOExample);
}
@Override
public List<DimensionDO> getDimensionList() {
DimensionDOExample dimensionDOExample = new DimensionDOExample();
return dimensionDOMapper.selectByExampleWithBLOBs(dimensionDOExample);
}
@Override
public List<DimensionDO> getDimensionListByIds(List<Long> ids) {
DimensionDOExample dimensionDOExample = new DimensionDOExample();
dimensionDOExample.createCriteria().andIdIn(ids);
return dimensionDOMapper.selectByExampleWithBLOBs(dimensionDOExample);
}
@Override
public DimensionDO getDimensionById(Long id) {
return dimensionDOMapper.selectByPrimaryKey(id);
}
@Override
public List<DimensionDO> getAllDimensionList() {
DimensionDOExample dimensionDOExample = new DimensionDOExample();
return dimensionDOMapper.selectByExampleWithBLOBs(dimensionDOExample);
}
@Override
public List<DimensionDO> getDimension(DimensionFilter dimensionFilter) {
DimensionDOExample dimensionDOExample = new DimensionDOExample();
dimensionDOExample.createCriteria();
if (dimensionFilter.getId() != null) {
dimensionDOExample.getOredCriteria().get(0).andIdEqualTo(dimensionFilter.getId());
}
if (dimensionFilter.getName() != null) {
dimensionDOExample.getOredCriteria().get(0).andNameLike("%" + dimensionFilter.getName() + "%");
}
if (dimensionFilter.getBizName() != null) {
dimensionDOExample.getOredCriteria().get(0).andBizNameLike("%" + dimensionFilter.getBizName() + "%");
}
if (dimensionFilter.getCreatedBy() != null) {
dimensionDOExample.getOredCriteria().get(0).andCreatedByEqualTo(dimensionFilter.getCreatedBy());
}
if (dimensionFilter.getDomainId() != null) {
dimensionDOExample.getOredCriteria().get(0).andDomainIdEqualTo(dimensionFilter.getDomainId());
}
if (dimensionFilter.getSensitiveLevel() != null) {
dimensionDOExample.getOredCriteria().get(0).andSensitiveLevelEqualTo(dimensionFilter.getSensitiveLevel());
}
return dimensionDOMapper.selectByExampleWithBLOBs(dimensionDOExample);
}
@Override
public void deleteDimension(Long id) {
dimensionDOMapper.deleteByPrimaryKey(id);
}
}

View File

@@ -0,0 +1,50 @@
package com.tencent.supersonic.semantic.model.infrastructure.repository;
import com.tencent.supersonic.semantic.model.domain.dataobject.DomainDO;
import com.tencent.supersonic.semantic.model.domain.dataobject.DomainDOExample;
import com.tencent.supersonic.semantic.model.domain.repository.DomainRepository;
import com.tencent.supersonic.semantic.model.infrastructure.mapper.DomainDOMapper;
import java.util.List;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
@Component
@Slf4j
public class DomainRepositoryImpl implements DomainRepository {
private DomainDOMapper domainDOMapper;
public DomainRepositoryImpl(DomainDOMapper domainDOMapper) {
this.domainDOMapper = domainDOMapper;
}
@Override
public void createDomain(DomainDO metaDomainDO) {
domainDOMapper.insert(metaDomainDO);
}
@Override
public void updateDomain(DomainDO metaDomainDO) {
domainDOMapper.updateByPrimaryKey(metaDomainDO);
}
@Override
public void deleteDomain(Long id) {
domainDOMapper.deleteByPrimaryKey(id);
}
@Override
public List<DomainDO> getDomainList() {
DomainDOExample metaDomainDOExample = new DomainDOExample();
return domainDOMapper.selectByExample(metaDomainDOExample);
}
@Override
public DomainDO getDomainById(Long id) {
return domainDOMapper.selectByPrimaryKey(id);
}
}

View File

@@ -0,0 +1,112 @@
package com.tencent.supersonic.semantic.model.infrastructure.repository;
import com.tencent.supersonic.semantic.model.domain.dataobject.MetricDO;
import com.tencent.supersonic.semantic.model.domain.dataobject.MetricDOExample;
import com.tencent.supersonic.semantic.model.domain.pojo.MetricFilter;
import com.tencent.supersonic.semantic.model.domain.repository.MetricRepository;
import com.tencent.supersonic.semantic.model.infrastructure.mapper.MetricDOCustomMapper;
import com.tencent.supersonic.semantic.model.infrastructure.mapper.MetricDOMapper;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component;
@Component
public class MetricRepositoryImpl implements MetricRepository {
private MetricDOMapper metricDOMapper;
private MetricDOCustomMapper metricDOCustomMapper;
public MetricRepositoryImpl(MetricDOMapper metricDOMapper,
MetricDOCustomMapper metricDOCustomMapper) {
this.metricDOMapper = metricDOMapper;
this.metricDOCustomMapper = metricDOCustomMapper;
}
@Override
public Long createMetric(MetricDO metricDO) {
metricDOMapper.insert(metricDO);
return metricDO.getId();
}
@Override
public void createMetricBatch(List<MetricDO> metricDOS) {
metricDOCustomMapper.batchInsert(metricDOS);
}
@Override
public void updateMetric(MetricDO metricDO) {
metricDOMapper.updateByPrimaryKeyWithBLOBs(metricDO);
}
@Override
public List<MetricDO> getMetricList(Long domainId) {
MetricDOExample metricDOExample = new MetricDOExample();
metricDOExample.createCriteria().andDomainIdEqualTo(domainId);
return metricDOMapper.selectByExampleWithBLOBs(metricDOExample);
}
@Override
public List<MetricDO> getMetricList() {
MetricDOExample metricDOExample = new MetricDOExample();
return metricDOMapper.selectByExampleWithBLOBs(metricDOExample);
}
@Override
public List<MetricDO> getMetricListByIds(List<Long> ids) {
MetricDOExample metricDOExample = new MetricDOExample();
metricDOExample.createCriteria().andIdIn(ids);
return metricDOMapper.selectByExampleWithBLOBs(metricDOExample);
}
@Override
public MetricDO getMetricById(Long id) {
return metricDOMapper.selectByPrimaryKey(id);
}
@Override
public List<MetricDO> getAllMetricList() {
return metricDOMapper.selectByExampleWithBLOBs(new MetricDOExample());
}
@Override
public List<MetricDO> getMetric(MetricFilter metricFilter) {
MetricDOExample metricDOExample = new MetricDOExample();
metricDOExample.createCriteria();
if (metricFilter.getId() != null) {
metricDOExample.getOredCriteria().get(0).andIdEqualTo(metricFilter.getId());
}
if (metricFilter.getName() != null) {
metricDOExample.getOredCriteria().get(0).andNameLike("%" + metricFilter.getName() + "%");
}
if (metricFilter.getBizName() != null) {
metricDOExample.getOredCriteria().get(0).andBizNameLike("%" + metricFilter.getBizName() + "%");
}
if (metricFilter.getCreatedBy() != null) {
metricDOExample.getOredCriteria().get(0).andCreatedByEqualTo(metricFilter.getCreatedBy());
}
if (metricFilter.getDomainId() != null) {
metricDOExample.getOredCriteria().get(0).andDomainIdEqualTo(metricFilter.getDomainId());
}
if (metricFilter.getSensitiveLevel() != null) {
metricDOExample.getOredCriteria().get(0).andSensitiveLevelEqualTo(metricFilter.getSensitiveLevel());
}
if (metricFilter.getStatus() != null) {
metricDOExample.getOredCriteria().get(0).andStatusEqualTo(metricFilter.getStatus());
}
if (StringUtils.isNotBlank(metricFilter.getType())) {
metricDOExample.getOredCriteria().get(0).andTypeEqualTo(metricFilter.getType());
}
return metricDOMapper.selectByExampleWithBLOBs(metricDOExample);
}
@Override
public void deleteMetric(Long id) {
metricDOMapper.deleteByPrimaryKey(id);
}
}

View File

@@ -0,0 +1,52 @@
package com.tencent.supersonic.semantic.model.infrastructure.repository;
import com.tencent.supersonic.semantic.model.domain.dataobject.ViewInfoDO;
import com.tencent.supersonic.semantic.model.domain.dataobject.ViewInfoDOExample;
import com.tencent.supersonic.semantic.model.domain.repository.ViewInfoRepository;
import com.tencent.supersonic.semantic.model.infrastructure.mapper.ViewInfoDOMapper;
import java.util.List;
import org.springframework.stereotype.Component;
@Component
public class ViewInfoRepositoryImpl implements ViewInfoRepository {
private ViewInfoDOMapper viewInfoDOMapper;
public ViewInfoRepositoryImpl(ViewInfoDOMapper viewInfoDOMapper) {
this.viewInfoDOMapper = viewInfoDOMapper;
}
@Override
public List<ViewInfoDO> getViewInfoList(Long domainId) {
ViewInfoDOExample viewInfoDOExample = new ViewInfoDOExample();
viewInfoDOExample.createCriteria().andDomainIdEqualTo(domainId);
return viewInfoDOMapper.selectByExampleWithBLOBs(viewInfoDOExample);
}
@Override
public ViewInfoDO getViewInfoById(Long id) {
return viewInfoDOMapper.selectByPrimaryKey(id);
}
@Override
public void deleteViewInfo(Long id) {
viewInfoDOMapper.deleteByPrimaryKey(id);
}
@Override
public void createViewInfo(ViewInfoDO viewInfoDO) {
viewInfoDOMapper.insert(viewInfoDO);
}
@Override
public void updateViewInfo(ViewInfoDO viewInfoDO) {
viewInfoDOMapper.updateByPrimaryKeyWithBLOBs(viewInfoDO);
}
}

View File

@@ -0,0 +1,82 @@
package com.tencent.supersonic.semantic.model.rest;
import com.tencent.supersonic.auth.api.authentication.pojo.User;
import com.tencent.supersonic.auth.api.authentication.utils.UserHolder;
import com.tencent.supersonic.semantic.api.model.request.DatabaseReq;
import com.tencent.supersonic.semantic.api.model.request.SqlExecuteReq;
import com.tencent.supersonic.semantic.api.model.response.DatabaseResp;
import com.tencent.supersonic.semantic.api.model.response.QueryResultWithSchemaResp;
import com.tencent.supersonic.semantic.model.domain.DatabaseService;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/api/semantic/database")
public class DatabaseController {
private DatabaseService databaseService;
public DatabaseController(DatabaseService databaseService) {
this.databaseService = databaseService;
}
@PostMapping("/testConnect")
public boolean testConnect(@RequestBody DatabaseReq databaseReq,
HttpServletRequest request,
HttpServletResponse response) {
User user = UserHolder.findUser(request, response);
return databaseService.testConnect(databaseReq, user);
}
@PostMapping("/createOrUpdateDatabase")
public DatabaseResp createOrUpdateDatabase(@RequestBody DatabaseReq databaseReq,
HttpServletRequest request,
HttpServletResponse response) {
User user = UserHolder.findUser(request, response);
return databaseService.createOrUpdateDatabase(databaseReq, user);
}
@GetMapping("/{id}")
public DatabaseResp getDatabase(@PathVariable("id") Long id) {
return databaseService.getDatabase(id);
}
@GetMapping("/getDatabaseByDomainId/{domainId}")
public DatabaseResp getDatabaseByDomainId(@PathVariable("domainId") Long domainId) {
return databaseService.getDatabaseByDomainId(domainId);
}
@PostMapping("/executeSql")
public QueryResultWithSchemaResp executeSql(@RequestBody SqlExecuteReq sqlExecuteReq) {
return databaseService.executeSql(sqlExecuteReq.getSql(), sqlExecuteReq.getDomainId());
}
@RequestMapping("/getDbNames/{id}")
public QueryResultWithSchemaResp getDbNames(@PathVariable("id") Long id) {
return databaseService.getDbNames(id);
}
@RequestMapping("/getTables/{id}/{db}")
public QueryResultWithSchemaResp getTables(@PathVariable("id") Long id,
@PathVariable("db") String db) {
return databaseService.getTables(id, db);
}
@RequestMapping("/getColumns/{id}/{db}/{table}")
public QueryResultWithSchemaResp getColumns(@PathVariable("id") Long id,
@PathVariable("db") String db,
@PathVariable("table") String table) {
return databaseService.getColumns(id, db, table);
}
}

View File

@@ -0,0 +1,89 @@
package com.tencent.supersonic.semantic.model.rest;
import com.tencent.supersonic.auth.api.authentication.pojo.User;
import com.tencent.supersonic.auth.api.authentication.utils.UserHolder;
import com.tencent.supersonic.semantic.api.model.request.DatasourceRelaReq;
import com.tencent.supersonic.semantic.api.model.request.DatasourceReq;
import com.tencent.supersonic.semantic.api.model.response.DatasourceRelaResp;
import com.tencent.supersonic.semantic.api.model.response.DatasourceResp;
import com.tencent.supersonic.semantic.api.model.response.MeasureResp;
import com.tencent.supersonic.semantic.model.domain.DatasourceService;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/api/semantic/datasource")
public class DatasourceController {
private DatasourceService datasourceService;
public DatasourceController(DatasourceService datasourceService) {
this.datasourceService = datasourceService;
}
@PostMapping("/createDatasource")
public DatasourceResp createDatasource(@RequestBody DatasourceReq datasourceReq,
HttpServletRequest request,
HttpServletResponse response) throws Exception {
User user = UserHolder.findUser(request, response);
return datasourceService.createDatasource(datasourceReq, user);
}
@PostMapping("/updateDatasource")
public DatasourceResp updateDatasource(@RequestBody DatasourceReq datasourceReq,
HttpServletRequest request,
HttpServletResponse response) throws Exception {
User user = UserHolder.findUser(request, response);
return datasourceService.updateDatasource(datasourceReq, user);
}
@GetMapping("/getDatasourceList/{domainId}")
public List<DatasourceResp> getDatasourceList(@PathVariable("domainId") Long domainId) {
return datasourceService.getDatasourceListNoMeasurePrefix(domainId);
}
@GetMapping("/getMeasureListOfDomain/{domainId}")
public List<MeasureResp> getMeasureListOfDomain(@PathVariable("domainId") Long domainId) {
return datasourceService.getMeasureListOfDomain(domainId);
}
@DeleteMapping("deleteDatasource/{id}")
public void deleteDatasource(@PathVariable("id") Long id) throws Exception {
datasourceService.deleteDatasource(id);
}
/**
* @param datasourceRelaReq
* @return
*/
@PostMapping("/createOrUpdateDatasourceRela")
public DatasourceRelaResp createOrUpdateDatasourceRela(@RequestBody DatasourceRelaReq datasourceRelaReq,
HttpServletRequest request,
HttpServletResponse response) {
User user = UserHolder.findUser(request, response);
return datasourceService.createOrUpdateDatasourceRela(datasourceRelaReq, user);
}
@GetMapping("/getDatasourceRelaList/{domainId}")
public List<DatasourceRelaResp> getDatasourceRelaList(@PathVariable("domainId") Long domainId) {
return datasourceService.getDatasourceRelaList(domainId);
}
@DeleteMapping("/deleteDatasourceRela/{id}")
public void deleteDatasourceRela(@PathVariable("id") Long id) {
datasourceService.deleteDatasourceRela(id);
}
}

View File

@@ -0,0 +1,92 @@
package com.tencent.supersonic.semantic.model.rest;
import com.github.pagehelper.PageInfo;
import com.tencent.supersonic.auth.api.authentication.pojo.User;
import com.tencent.supersonic.auth.api.authentication.utils.UserHolder;
import com.tencent.supersonic.semantic.api.model.request.DimensionReq;
import com.tencent.supersonic.semantic.api.model.request.PageDimensionReq;
import com.tencent.supersonic.semantic.api.model.response.DimensionResp;
import com.tencent.supersonic.semantic.model.domain.DimensionService;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/api/semantic/dimension")
public class DimensionController {
private DimensionService dimensionService;
public DimensionController(DimensionService dimensionService) {
this.dimensionService = dimensionService;
}
/**
* 创建维度
*
* @param dimensionReq
*/
@PostMapping("/createDimension")
public Boolean createDimension(@RequestBody DimensionReq dimensionReq,
HttpServletRequest request,
HttpServletResponse response) throws Exception {
User user = UserHolder.findUser(request, response);
dimensionService.createDimension(dimensionReq, user);
return true;
}
@PostMapping("/updateDimension")
public Boolean updateDimension(@RequestBody DimensionReq dimensionReq,
HttpServletRequest request,
HttpServletResponse response) throws Exception {
User user = UserHolder.findUser(request, response);
dimensionService.updateDimension(dimensionReq, user);
return true;
}
@GetMapping("/getDimensionList/{domainId}")
public List<DimensionResp> getDimension(@PathVariable("domainId") Long domainId) {
return dimensionService.getDimensions(domainId);
}
@GetMapping("/{domainId}/{dimensionName}")
public DimensionResp getDimensionDescByNameAndId(@PathVariable("domainId") Long domainId,
@PathVariable("dimensionName") String dimensionBizName) {
return dimensionService.getDimension(dimensionBizName, domainId);
}
@PostMapping("/queryDimension")
public PageInfo<DimensionResp> queryDimension(@RequestBody PageDimensionReq pageDimensionReq) {
return dimensionService.queryDimension(pageDimensionReq);
}
@DeleteMapping("deleteDimension/{id}")
public Boolean deleteDimension(@PathVariable("id") Long id) throws Exception {
dimensionService.deleteDimension(id);
return true;
}
@GetMapping("/getAllHighSensitiveDimension")
public List<DimensionResp> getAllHighSensitiveDimension() {
return dimensionService.getAllHighSensitiveDimension();
}
}

View File

@@ -0,0 +1,99 @@
package com.tencent.supersonic.semantic.model.rest;
import com.tencent.supersonic.auth.api.authentication.pojo.User;
import com.tencent.supersonic.auth.api.authentication.utils.UserHolder;
import com.tencent.supersonic.semantic.api.model.request.DomainReq;
import com.tencent.supersonic.semantic.api.model.request.DomainSchemaFilterReq;
import com.tencent.supersonic.semantic.api.model.request.DomainUpdateReq;
import com.tencent.supersonic.semantic.api.model.response.DomainResp;
import com.tencent.supersonic.semantic.api.model.response.DomainSchemaResp;
import com.tencent.supersonic.semantic.model.domain.DomainService;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/api/semantic/domain")
public class DomainController {
private DomainService domainService;
public DomainController(DomainService domainService) {
this.domainService = domainService;
}
@PostMapping("/createDomain")
public Boolean createDomain(@RequestBody DomainReq domainReq,
HttpServletRequest request,
HttpServletResponse response) {
User user = UserHolder.findUser(request, response);
domainService.createDomain(domainReq, user);
return true;
}
@PostMapping("/updateDomain")
public Boolean updateDomain(@RequestBody DomainUpdateReq domainUpdateReq,
HttpServletRequest request,
HttpServletResponse response) {
User user = UserHolder.findUser(request, response);
domainService.updateDomain(domainUpdateReq, user);
return true;
}
@DeleteMapping("/deleteDomain/{domainId}")
public Boolean deleteDomain(@PathVariable("domainId") Long domainId) {
domainService.deleteDomain(domainId);
return true;
}
/**
* get domain list
*
* @param
*/
@GetMapping("/getDomainList")
public List<DomainResp> getDomainList(HttpServletRequest request,
HttpServletResponse response) {
User user = UserHolder.findUser(request, response);
return domainService.getDomainListForAdmin(user.getName());
}
/**
* get domain by id
*
* @param id
* @return
*/
@GetMapping("/getDomain/{id}")
public DomainResp getDomain(@PathVariable("id") Long id) {
return domainService.getDomain(id);
}
@GetMapping("/getDomainListByIds/{domainIds}")
public List<DomainResp> getDomainListByIds(@PathVariable("domainIds") String domainIds) {
return domainService.getDomainList(Arrays.stream(domainIds.split(",")).map(Long::parseLong)
.collect(Collectors.toList()));
}
@PostMapping("/schema")
public List<DomainSchemaResp> fetchDomainSchema(@RequestBody DomainSchemaFilterReq filter,
HttpServletRequest request,
HttpServletResponse response) {
User user = UserHolder.findUser(request, response);
return domainService.fetchDomainSchema(filter, user);
}
}

View File

@@ -0,0 +1,84 @@
package com.tencent.supersonic.semantic.model.rest;
import com.github.pagehelper.PageInfo;
import com.tencent.supersonic.auth.api.authentication.pojo.User;
import com.tencent.supersonic.auth.api.authentication.utils.UserHolder;
import com.tencent.supersonic.semantic.api.model.request.MetricReq;
import com.tencent.supersonic.semantic.api.model.request.PageMetricReq;
import com.tencent.supersonic.semantic.api.model.response.MetricResp;
import com.tencent.supersonic.semantic.model.domain.MetricService;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/api/semantic/metric")
public class MetricController {
private MetricService metricService;
public MetricController(MetricService metricService) {
this.metricService = metricService;
}
@PostMapping("/creatExprMetric")
public Boolean creatExprMetric(@RequestBody MetricReq metricReq,
HttpServletRequest request,
HttpServletResponse response) throws Exception {
User user = UserHolder.findUser(request, response);
metricService.creatExprMetric(metricReq, user);
return true;
}
@PostMapping("/updateExprMetric")
public Boolean updateExprMetric(@RequestBody MetricReq metricReq,
HttpServletRequest request,
HttpServletResponse response) throws Exception {
User user = UserHolder.findUser(request, response);
metricService.updateExprMetric(metricReq, user);
return true;
}
@GetMapping("/getMetricList/{domainId}")
public List<MetricResp> getMetricList(@PathVariable("domainId") Long domainId) {
return metricService.getMetrics(domainId);
}
@PostMapping("/queryMetric")
public PageInfo<MetricResp> queryMetric(@RequestBody PageMetricReq pageMetrricReq) {
return metricService.queryMetric(pageMetrricReq);
}
@GetMapping("getMetric/{domainId}/{bizName}")
public MetricResp getMetric(@PathVariable("domainId") Long domainId, @PathVariable("bizName") String bizName) {
return metricService.getMetric(domainId, bizName);
}
@DeleteMapping("deleteMetric/{id}")
public Boolean deleteMetric(@PathVariable("id") Long id) throws Exception {
metricService.deleteMetric(id);
return true;
}
@GetMapping("/getAllHighSensitiveMetric")
public List<MetricResp> getAllHighSensitiveMetric() {
return metricService.getAllHighSensitiveMetric();
}
}

View File

@@ -0,0 +1,56 @@
package com.tencent.supersonic.semantic.model.rest;
import com.tencent.supersonic.auth.api.authentication.pojo.User;
import com.tencent.supersonic.auth.api.authentication.utils.UserHolder;
import com.tencent.supersonic.semantic.api.model.request.ViewInfoReq;
import com.tencent.supersonic.semantic.api.model.response.DomainSchemaRelaResp;
import com.tencent.supersonic.semantic.model.domain.dataobject.ViewInfoDO;
import com.tencent.supersonic.semantic.model.application.ViewInfoServiceImpl;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/api/semantic/viewInfo")
public class ViewInfoController {
private ViewInfoServiceImpl viewInfoServiceImpl;
public ViewInfoController(ViewInfoServiceImpl viewInfoServiceImpl) {
this.viewInfoServiceImpl = viewInfoServiceImpl;
}
@PostMapping("/createOrUpdateViewInfo")
public ViewInfoDO createOrUpdateViewInfo(@RequestBody ViewInfoReq viewInfoReq, HttpServletRequest request,
HttpServletResponse response) {
User user = UserHolder.findUser(request, response);
return viewInfoServiceImpl.createOrUpdateViewInfo(viewInfoReq, user);
}
@GetMapping("/getViewInfoList/{domainId}")
public List<ViewInfoDO> getViewInfoList(@PathVariable("domainId") Long domainId) {
return viewInfoServiceImpl.getViewInfoList(domainId);
}
@DeleteMapping("/deleteViewInfo/{id}")
public void deleteViewInfo(@PathVariable("id") Long id) {
viewInfoServiceImpl.deleteViewInfo(id);
}
@GetMapping("/getDomainSchemaRela/{domainId}")
public List<DomainSchemaRelaResp> getDomainSchema(@PathVariable("domainId") Long domainId) {
return viewInfoServiceImpl.getDomainSchema(domainId);
}
}

View File

@@ -0,0 +1,271 @@
<?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.semantic.model.infrastructure.mapper.DatabaseDOMapper">
<resultMap id="BaseResultMap"
type="com.tencent.supersonic.semantic.model.domain.dataobject.DatabaseDO">
<id column="id" jdbcType="BIGINT" property="id"/>
<result column="domain_id" jdbcType="BIGINT" property="domainId"/>
<result column="name" jdbcType="VARCHAR" property="name"/>
<result column="description" jdbcType="VARCHAR" property="description"/>
<result column="version" jdbcType="VARCHAR" property="version"/>
<result column="type" jdbcType="VARCHAR" property="type"/>
<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.semantic.model.domain.dataobject.DatabaseDO">
<result column="config" jdbcType="LONGVARCHAR" property="config"/>
</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
, domain_id, name, description, version, type, created_at, created_by, updated_at, updated_by
</sql>
<sql id="Blob_Column_List">
config
</sql>
<select id="selectByExampleWithBLOBs"
parameterType="com.tencent.supersonic.semantic.model.domain.dataobject.DatabaseDOExample"
resultMap="ResultMapWithBLOBs">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List"/>
,
<include refid="Blob_Column_List"/>
from s2_database
<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.semantic.model.domain.dataobject.DatabaseDOExample"
resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List"/>
from s2_database
<if test="_parameter != null">
<include refid="Example_Where_Clause"/>
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
<if test="limitStart != null and limitStart>=0">
limit #{limitStart} , #{limitEnd}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="ResultMapWithBLOBs">
select
<include refid="Base_Column_List"/>
,
<include refid="Blob_Column_List"/>
from s2_database
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete
from s2_database
where id = #{id,jdbcType=BIGINT}
</delete>
<insert id="insert"
parameterType="com.tencent.supersonic.semantic.model.domain.dataobject.DatabaseDO">
insert into s2_database (id, domain_id, name,
description, version, type, created_at,
created_by, updated_at, updated_by,
config)
values (#{id,jdbcType=BIGINT}, #{domainId,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR},
#{description,jdbcType=VARCHAR},#{version,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR},
#{createdAt,jdbcType=TIMESTAMP},
#{createdBy,jdbcType=VARCHAR}, #{updatedAt,jdbcType=TIMESTAMP},
#{updatedBy,jdbcType=VARCHAR},
#{config,jdbcType=LONGVARCHAR})
</insert>
<insert id="insertSelective"
parameterType="com.tencent.supersonic.semantic.model.domain.dataobject.DatabaseDO">
insert into s2_database
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="domainId != null">
domain_id,
</if>
<if test="name != null">
name,
</if>
<if test="description != null">
description,
</if>
<if test="version != null">
version,
</if>
<if test="type != null">
type,
</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="config != null">
config,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=BIGINT},
</if>
<if test="domainId != null">
#{domainId,jdbcType=BIGINT},
</if>
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="description != null">
#{description,jdbcType=VARCHAR},
</if>
<if test="version != null">
#{version,jdbcType=VARCHAR},
</if>
<if test="type != null">
#{type,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="config != null">
#{config,jdbcType=LONGVARCHAR},
</if>
</trim>
</insert>
<select id="countByExample"
parameterType="com.tencent.supersonic.semantic.model.domain.dataobject.DatabaseDOExample"
resultType="java.lang.Long">
select count(*) from s2_database
<if test="_parameter != null">
<include refid="Example_Where_Clause"/>
</if>
</select>
<update id="updateByPrimaryKeySelective"
parameterType="com.tencent.supersonic.semantic.model.domain.dataobject.DatabaseDO">
update s2_database
<set>
<if test="domainId != null">
domain_id = #{domainId,jdbcType=BIGINT},
</if>
<if test="name != null">
name = #{name,jdbcType=VARCHAR},
</if>
<if test="description != null">
description = #{description,jdbcType=VARCHAR},
</if>
<if test="version != null">
version = #{version,jdbcType=VARCHAR},
</if>
<if test="type != null">
type = #{type,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="config != null">
config = #{config,jdbcType=LONGVARCHAR},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKeyWithBLOBs"
parameterType="com.tencent.supersonic.semantic.model.domain.dataobject.DatabaseDO">
update s2_database
set domain_id = #{domainId,jdbcType=BIGINT},
name = #{name,jdbcType=VARCHAR},
description = #{description,jdbcType=VARCHAR},
version = #{version,jdbcType=VARCHAR},
type = #{type,jdbcType=VARCHAR},
created_at = #{createdAt,jdbcType=TIMESTAMP},
created_by = #{createdBy,jdbcType=VARCHAR},
updated_at = #{updatedAt,jdbcType=TIMESTAMP},
updated_by = #{updatedBy,jdbcType=VARCHAR},
config = #{config,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey"
parameterType="com.tencent.supersonic.semantic.model.domain.dataobject.DatabaseDO">
update s2_database
set domain_id = #{domainId,jdbcType=BIGINT},
name = #{name,jdbcType=VARCHAR},
description = #{description,jdbcType=VARCHAR},
version = #{version,jdbcType=VARCHAR},
type = #{type,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>

View File

@@ -0,0 +1,272 @@
<?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.semantic.model.infrastructure.mapper.DatasourceDOMapper">
<resultMap id="BaseResultMap"
type="com.tencent.supersonic.semantic.model.domain.dataobject.DatasourceDO">
<id column="id" jdbcType="BIGINT" property="id"/>
<result column="domain_id" jdbcType="BIGINT" property="domainId"/>
<result column="name" jdbcType="VARCHAR" property="name"/>
<result column="biz_name" jdbcType="VARCHAR" property="bizName"/>
<result column="description" jdbcType="VARCHAR" property="description"/>
<result column="database_id" jdbcType="BIGINT" property="databaseId"/>
<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.semantic.model.domain.dataobject.DatasourceDO">
<result column="datasource_detail" jdbcType="LONGVARCHAR" property="datasourceDetail"/>
</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
, domain_id, name, biz_name, description, database_id, created_at, created_by,
updated_at, updated_by
</sql>
<sql id="Blob_Column_List">
datasource_detail
</sql>
<select id="selectByExampleWithBLOBs"
parameterType="com.tencent.supersonic.semantic.model.domain.dataobject.DatasourceDOExample"
resultMap="ResultMapWithBLOBs">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List"/>
,
<include refid="Blob_Column_List"/>
from s2_datasource
<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.semantic.model.domain.dataobject.DatasourceDOExample"
resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List"/>
from s2_datasource
<if test="_parameter != null">
<include refid="Example_Where_Clause"/>
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
<if test="limitStart != null and limitStart>=0">
limit #{limitStart} , #{limitEnd}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="ResultMapWithBLOBs">
select
<include refid="Base_Column_List"/>
,
<include refid="Blob_Column_List"/>
from s2_datasource
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete
from s2_datasource
where id = #{id,jdbcType=BIGINT}
</delete>
<insert id="insert"
parameterType="com.tencent.supersonic.semantic.model.domain.dataobject.DatasourceDO">
insert into s2_datasource (id, domain_id, name,
biz_name, description, database_id,
created_at, created_by, updated_at,
updated_by, datasource_detail)
values (#{id,jdbcType=BIGINT}, #{domainId,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR},
#{bizName,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR},
#{databaseId,jdbcType=BIGINT},
#{createdAt,jdbcType=TIMESTAMP}, #{createdBy,jdbcType=VARCHAR},
#{updatedAt,jdbcType=TIMESTAMP},
#{updatedBy,jdbcType=VARCHAR}, #{datasourceDetail,jdbcType=LONGVARCHAR})
</insert>
<insert id="insertSelective"
parameterType="com.tencent.supersonic.semantic.model.domain.dataobject.DatasourceDO">
insert into s2_datasource
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="domainId != null">
domain_id,
</if>
<if test="name != null">
name,
</if>
<if test="bizName != null">
biz_name,
</if>
<if test="description != null">
description,
</if>
<if test="databaseId != null">
database_id,
</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="datasourceDetail != null">
datasource_detail,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=BIGINT},
</if>
<if test="domainId != null">
#{domainId,jdbcType=BIGINT},
</if>
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="bizName != null">
#{bizName,jdbcType=VARCHAR},
</if>
<if test="description != null">
#{description,jdbcType=VARCHAR},
</if>
<if test="databaseId != null">
#{databaseId,jdbcType=BIGINT},
</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="datasourceDetail != null">
#{datasourceDetail,jdbcType=LONGVARCHAR},
</if>
</trim>
</insert>
<select id="countByExample"
parameterType="com.tencent.supersonic.semantic.model.domain.dataobject.DatasourceDOExample"
resultType="java.lang.Long">
select count(*) from s2_datasource
<if test="_parameter != null">
<include refid="Example_Where_Clause"/>
</if>
</select>
<update id="updateByPrimaryKeySelective"
parameterType="com.tencent.supersonic.semantic.model.domain.dataobject.DatasourceDO">
update s2_datasource
<set>
<if test="domainId != null">
domain_id = #{domainId,jdbcType=BIGINT},
</if>
<if test="name != null">
name = #{name,jdbcType=VARCHAR},
</if>
<if test="bizName != null">
biz_name = #{bizName,jdbcType=VARCHAR},
</if>
<if test="description != null">
description = #{description,jdbcType=VARCHAR},
</if>
<if test="databaseId != null">
database_id = #{databaseId,jdbcType=BIGINT},
</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="datasourceDetail != null">
datasource_detail = #{datasourceDetail,jdbcType=LONGVARCHAR},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKeyWithBLOBs"
parameterType="com.tencent.supersonic.semantic.model.domain.dataobject.DatasourceDO">
update s2_datasource
set domain_id = #{domainId,jdbcType=BIGINT},
name = #{name,jdbcType=VARCHAR},
biz_name = #{bizName,jdbcType=VARCHAR},
description = #{description,jdbcType=VARCHAR},
database_id = #{databaseId,jdbcType=BIGINT},
created_at = #{createdAt,jdbcType=TIMESTAMP},
created_by = #{createdBy,jdbcType=VARCHAR},
updated_at = #{updatedAt,jdbcType=TIMESTAMP},
updated_by = #{updatedBy,jdbcType=VARCHAR},
datasource_detail = #{datasourceDetail,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey"
parameterType="com.tencent.supersonic.semantic.model.domain.dataobject.DatasourceDO">
update s2_datasource
set domain_id = #{domainId,jdbcType=BIGINT},
name = #{name,jdbcType=VARCHAR},
biz_name = #{bizName,jdbcType=VARCHAR},
description = #{description,jdbcType=VARCHAR},
database_id = #{databaseId,jdbcType=BIGINT},
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>

View File

@@ -0,0 +1,209 @@
<?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.semantic.model.infrastructure.mapper.DatasourceRelaDOMapper">
<resultMap id="BaseResultMap"
type="com.tencent.supersonic.semantic.model.domain.dataobject.DatasourceRelaDO">
<id column="id" jdbcType="BIGINT" property="id"/>
<result column="domain_id" jdbcType="BIGINT" property="domainId"/>
<result column="datasource_from" jdbcType="BIGINT" property="datasourceFrom"/>
<result column="datasource_to" jdbcType="BIGINT" property="datasourceTo"/>
<result column="join_key" jdbcType="VARCHAR" property="joinKey"/>
<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>
<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
, domain_id, datasource_from, datasource_to, join_key, created_at, created_by,
updated_at, updated_by
</sql>
<select id="selectByExample"
parameterType="com.tencent.supersonic.semantic.model.domain.dataobject.DatasourceRelaDOExample"
resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List"/>
from s2_datasource_rela
<if test="_parameter != null">
<include refid="Example_Where_Clause"/>
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
<if test="limitStart != null and limitStart>=0">
limit #{limitStart} , #{limitEnd}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from s2_datasource_rela
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete
from s2_datasource_rela
where id = #{id,jdbcType=BIGINT}
</delete>
<insert id="insert"
parameterType="com.tencent.supersonic.semantic.model.domain.dataobject.DatasourceRelaDO">
insert into s2_datasource_rela (id, domain_id, datasource_from,
datasource_to, join_key, created_at,
created_by, updated_at, updated_by)
values (#{id,jdbcType=BIGINT}, #{domainId,jdbcType=BIGINT},
#{datasourceFrom,jdbcType=BIGINT},
#{datasourceTo,jdbcType=BIGINT}, #{joinKey,jdbcType=VARCHAR},
#{createdAt,jdbcType=TIMESTAMP},
#{createdBy,jdbcType=VARCHAR}, #{updatedAt,jdbcType=TIMESTAMP},
#{updatedBy,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective"
parameterType="com.tencent.supersonic.semantic.model.domain.dataobject.DatasourceRelaDO">
insert into s2_datasource_rela
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="domainId != null">
domain_id,
</if>
<if test="datasourceFrom != null">
datasource_from,
</if>
<if test="datasourceTo != null">
datasource_to,
</if>
<if test="joinKey != null">
join_key,
</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>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=BIGINT},
</if>
<if test="domainId != null">
#{domainId,jdbcType=BIGINT},
</if>
<if test="datasourceFrom != null">
#{datasourceFrom,jdbcType=BIGINT},
</if>
<if test="datasourceTo != null">
#{datasourceTo,jdbcType=BIGINT},
</if>
<if test="joinKey != null">
#{joinKey,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>
</trim>
</insert>
<select id="countByExample"
parameterType="com.tencent.supersonic.semantic.model.domain.dataobject.DatasourceRelaDOExample"
resultType="java.lang.Long">
select count(*) from s2_datasource_rela
<if test="_parameter != null">
<include refid="Example_Where_Clause"/>
</if>
</select>
<update id="updateByPrimaryKeySelective"
parameterType="com.tencent.supersonic.semantic.model.domain.dataobject.DatasourceRelaDO">
update s2_datasource_rela
<set>
<if test="domainId != null">
domain_id = #{domainId,jdbcType=BIGINT},
</if>
<if test="datasourceFrom != null">
datasource_from = #{datasourceFrom,jdbcType=BIGINT},
</if>
<if test="datasourceTo != null">
datasource_to = #{datasourceTo,jdbcType=BIGINT},
</if>
<if test="joinKey != null">
join_key = #{joinKey,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>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey"
parameterType="com.tencent.supersonic.semantic.model.domain.dataobject.DatasourceRelaDO">
update s2_datasource_rela
set domain_id = #{domainId,jdbcType=BIGINT},
datasource_from = #{datasourceFrom,jdbcType=BIGINT},
datasource_to = #{datasourceTo,jdbcType=BIGINT},
join_key = #{joinKey,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>

View File

@@ -0,0 +1,355 @@
<?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.semantic.model.infrastructure.mapper.DimensionDOMapper">
<resultMap id="BaseResultMap" type="com.tencent.supersonic.semantic.model.domain.dataobject.DimensionDO">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="domain_id" jdbcType="BIGINT" property="domainId" />
<result column="datasource_id" jdbcType="BIGINT" property="datasourceId" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="biz_name" jdbcType="VARCHAR" property="bizName" />
<result column="description" jdbcType="VARCHAR" property="description" />
<result column="status" jdbcType="INTEGER" property="status" />
<result column="sensitive_level" jdbcType="INTEGER" property="sensitiveLevel" />
<result column="type" jdbcType="VARCHAR" property="type" />
<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="semantic_type" jdbcType="VARCHAR" property="semanticType" />
<result column="alias" jdbcType="VARCHAR" property="alias" />
<result column="default_values" jdbcType="VARCHAR" property="defaultValues" />
<result column="dim_value_maps" jdbcType="VARCHAR" property="dimValueMaps" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.tencent.supersonic.semantic.model.domain.dataobject.DimensionDO">
<result column="type_params" jdbcType="LONGVARCHAR" property="typeParams" />
<result column="expr" jdbcType="LONGVARCHAR" property="expr" />
</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, domain_id, datasource_id, name, biz_name, description, status, sensitive_level,
type, created_at, created_by, updated_at, updated_by, semantic_type, alias, default_values, dim_value_maps
</sql>
<sql id="Blob_Column_List">
type_params, expr
</sql>
<select id="selectByExampleWithBLOBs" parameterType="com.tencent.supersonic.semantic.model.domain.dataobject.DimensionDOExample" resultMap="ResultMapWithBLOBs">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from s2_dimension
<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.semantic.model.domain.dataobject.DimensionDOExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from s2_dimension
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
<if test="limitStart != null and limitStart>=0">
limit #{limitStart} , #{limitEnd}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="ResultMapWithBLOBs">
select
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from s2_dimension
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from s2_dimension
where id = #{id,jdbcType=BIGINT}
</delete>
<insert id="insert" parameterType="com.tencent.supersonic.semantic.model.domain.dataobject.DimensionDO">
insert into s2_dimension (id, domain_id, datasource_id,
name, biz_name, description,
status, sensitive_level, type,
created_at, created_by, updated_at,
updated_by, semantic_type, alias,
default_values, type_params, expr,
dim_value_maps
)
values (#{id,jdbcType=BIGINT}, #{domainId,jdbcType=BIGINT}, #{datasourceId,jdbcType=BIGINT},
#{name,jdbcType=VARCHAR}, #{bizName,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR},
#{status,jdbcType=INTEGER}, #{sensitiveLevel,jdbcType=INTEGER}, #{type,jdbcType=VARCHAR},
#{createdAt,jdbcType=TIMESTAMP}, #{createdBy,jdbcType=VARCHAR}, #{updatedAt,jdbcType=TIMESTAMP},
#{updatedBy,jdbcType=VARCHAR}, #{semanticType,jdbcType=VARCHAR}, #{alias,jdbcType=VARCHAR},
#{defaultValues,jdbcType=VARCHAR}, #{typeParams,jdbcType=LONGVARCHAR}, #{expr,jdbcType=LONGVARCHAR},
#{dimValueMaps,jdbcType=VARCHAR}
)
</insert>
<insert id="insertSelective" parameterType="com.tencent.supersonic.semantic.model.domain.dataobject.DimensionDO">
insert into s2_dimension
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="domainId != null">
domain_id,
</if>
<if test="datasourceId != null">
datasource_id,
</if>
<if test="name != null">
name,
</if>
<if test="bizName != null">
biz_name,
</if>
<if test="description != null">
description,
</if>
<if test="status != null">
status,
</if>
<if test="sensitiveLevel != null">
sensitive_level,
</if>
<if test="type != null">
type,
</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="semanticType != null">
semantic_type,
</if>
<if test="alias != null">
alias,
</if>
<if test="defaultValues != null">
default_values,
</if>
<if test="dimValueMaps != null">
dim_value_maps,
</if>
<if test="typeParams != null">
type_params,
</if>
<if test="expr != null">
expr,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=BIGINT},
</if>
<if test="domainId != null">
#{domainId,jdbcType=BIGINT},
</if>
<if test="datasourceId != null">
#{datasourceId,jdbcType=BIGINT},
</if>
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="bizName != null">
#{bizName,jdbcType=VARCHAR},
</if>
<if test="description != null">
#{description,jdbcType=VARCHAR},
</if>
<if test="status != null">
#{status,jdbcType=INTEGER},
</if>
<if test="sensitiveLevel != null">
#{sensitiveLevel,jdbcType=INTEGER},
</if>
<if test="type != null">
#{type,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="semanticType != null">
#{semanticType,jdbcType=VARCHAR},
</if>
<if test="alias != null">
#{alias,jdbcType=VARCHAR},
</if>
<if test="defaultValues != null">
#{defaultValues,jdbcType=VARCHAR},
</if>
<if test="dimValueMaps != null">
#{dimValueMaps,jdbcType=VARCHAR},
</if>
<if test="typeParams != null">
#{typeParams,jdbcType=LONGVARCHAR},
</if>
<if test="expr != null">
#{expr,jdbcType=LONGVARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.tencent.supersonic.semantic.model.domain.dataobject.DimensionDOExample" resultType="java.lang.Long">
select count(*) from s2_dimension
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByPrimaryKeySelective" parameterType="com.tencent.supersonic.semantic.model.domain.dataobject.DimensionDO">
update s2_dimension
<set>
<if test="domainId != null">
domain_id = #{domainId,jdbcType=BIGINT},
</if>
<if test="datasourceId != null">
datasource_id = #{datasourceId,jdbcType=BIGINT},
</if>
<if test="name != null">
name = #{name,jdbcType=VARCHAR},
</if>
<if test="bizName != null">
biz_name = #{bizName,jdbcType=VARCHAR},
</if>
<if test="description != null">
description = #{description,jdbcType=VARCHAR},
</if>
<if test="status != null">
status = #{status,jdbcType=INTEGER},
</if>
<if test="sensitiveLevel != null">
sensitive_level = #{sensitiveLevel,jdbcType=INTEGER},
</if>
<if test="type != null">
type = #{type,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="semanticType != null">
semantic_type = #{semanticType,jdbcType=VARCHAR},
</if>
<if test="alias != null">
alias = #{alias,jdbcType=VARCHAR},
</if>
<if test="defaultValues != null">
default_values = #{defaultValues,jdbcType=VARCHAR},
</if>
<if test="dimValueMaps != null">
dim_value_maps = #{dimValueMaps,jdbcType=VARCHAR},
</if>
<if test="typeParams != null">
type_params = #{typeParams,jdbcType=LONGVARCHAR},
</if>
<if test="expr != null">
expr = #{expr,jdbcType=LONGVARCHAR},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKeyWithBLOBs" parameterType="com.tencent.supersonic.semantic.model.domain.dataobject.DimensionDO">
update s2_dimension
set domain_id = #{domainId,jdbcType=BIGINT},
datasource_id = #{datasourceId,jdbcType=BIGINT},
name = #{name,jdbcType=VARCHAR},
biz_name = #{bizName,jdbcType=VARCHAR},
description = #{description,jdbcType=VARCHAR},
status = #{status,jdbcType=INTEGER},
sensitive_level = #{sensitiveLevel,jdbcType=INTEGER},
type = #{type,jdbcType=VARCHAR},
created_at = #{createdAt,jdbcType=TIMESTAMP},
created_by = #{createdBy,jdbcType=VARCHAR},
updated_at = #{updatedAt,jdbcType=TIMESTAMP},
updated_by = #{updatedBy,jdbcType=VARCHAR},
semantic_type = #{semanticType,jdbcType=VARCHAR},
alias = #{alias,jdbcType=VARCHAR},
default_values = #{defaultValues,jdbcType=VARCHAR},
dim_value_maps = #{dimValueMaps,jdbcType=VARCHAR},
type_params = #{typeParams,jdbcType=LONGVARCHAR},
expr = #{expr,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.tencent.supersonic.semantic.model.domain.dataobject.DimensionDO">
update s2_dimension
set domain_id = #{domainId,jdbcType=BIGINT},
datasource_id = #{datasourceId,jdbcType=BIGINT},
name = #{name,jdbcType=VARCHAR},
biz_name = #{bizName,jdbcType=VARCHAR},
description = #{description,jdbcType=VARCHAR},
status = #{status,jdbcType=INTEGER},
sensitive_level = #{sensitiveLevel,jdbcType=INTEGER},
type = #{type,jdbcType=VARCHAR},
created_at = #{createdAt,jdbcType=TIMESTAMP},
created_by = #{createdBy,jdbcType=VARCHAR},
updated_at = #{updatedAt,jdbcType=TIMESTAMP},
updated_by = #{updatedBy,jdbcType=VARCHAR},
semantic_type = #{semanticType,jdbcType=VARCHAR},
alias = #{alias,jdbcType=VARCHAR},
default_values = #{defaultValues,jdbcType=VARCHAR},
dim_value_maps = #{dimValueMaps,jdbcType=VARCHAR}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>

View File

@@ -0,0 +1,278 @@
<?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.semantic.model.infrastructure.mapper.DomainDOMapper">
<resultMap id="BaseResultMap"
type="com.tencent.supersonic.semantic.model.domain.dataobject.DomainDO">
<id column="id" jdbcType="BIGINT" property="id"/>
<result column="name" jdbcType="VARCHAR" property="name"/>
<result column="biz_name" jdbcType="VARCHAR" property="bizName"/>
<result column="parent_id" jdbcType="BIGINT" property="parentId"/>
<result column="status" jdbcType="INTEGER" property="status"/>
<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="admin" jdbcType="VARCHAR" property="admin"/>
<result column="admin_org" jdbcType="VARCHAR" property="adminOrg"/>
<result column="is_open" jdbcType="INTEGER" property="isOpen"/>
<result column="viewer" jdbcType="VARCHAR" property="viewer"/>
<result column="view_org" jdbcType="VARCHAR" property="viewOrg"/>
<result column="entity" jdbcType="VARCHAR" property="entity"/>
</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, biz_name, parent_id, status, created_at, created_by, updated_at, updated_by,
admin, admin_org, is_open, viewer, view_org, entity
</sql>
<select id="selectByExample"
parameterType="com.tencent.supersonic.semantic.model.domain.dataobject.DomainDOExample"
resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List"/>
from s2_domain
<if test="_parameter != null">
<include refid="Example_Where_Clause"/>
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
<if test="limitStart != null and limitStart>=0">
limit #{limitStart} , #{limitEnd}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from s2_domain
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete
from s2_domain
where id = #{id,jdbcType=BIGINT}
</delete>
<insert id="insert"
parameterType="com.tencent.supersonic.semantic.model.domain.dataobject.DomainDO">
insert into s2_domain (id, name, biz_name,
parent_id, status, created_at,
created_by, updated_at, updated_by,
admin, admin_org, is_open,
viewer, view_org, entity)
values (#{id,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{bizName,jdbcType=VARCHAR},
#{parentId,jdbcType=BIGINT}, #{status,jdbcType=INTEGER},
#{createdAt,jdbcType=TIMESTAMP},
#{createdBy,jdbcType=VARCHAR}, #{updatedAt,jdbcType=TIMESTAMP},
#{updatedBy,jdbcType=VARCHAR},
#{admin,jdbcType=VARCHAR}, #{adminOrg,jdbcType=VARCHAR}, #{isOpen,jdbcType=INTEGER},
#{viewer,jdbcType=VARCHAR}, #{viewOrg,jdbcType=VARCHAR}, #{entity,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective"
parameterType="com.tencent.supersonic.semantic.model.domain.dataobject.DomainDO">
insert into s2_domain
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="name != null">
name,
</if>
<if test="bizName != null">
biz_name,
</if>
<if test="parentId != null">
parent_id,
</if>
<if test="status != null">
status,
</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="admin != null">
admin,
</if>
<if test="adminOrg != null">
admin_org,
</if>
<if test="isOpen != null">
is_open,
</if>
<if test="viewer != null">
viewer,
</if>
<if test="viewOrg != null">
view_org,
</if>
<if test="entity != null">
entity,
</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="bizName != null">
#{bizName,jdbcType=VARCHAR},
</if>
<if test="parentId != null">
#{parentId,jdbcType=BIGINT},
</if>
<if test="status != null">
#{status,jdbcType=INTEGER},
</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="admin != null">
#{admin,jdbcType=VARCHAR},
</if>
<if test="adminOrg != null">
#{adminOrg,jdbcType=VARCHAR},
</if>
<if test="isOpen != null">
#{isOpen,jdbcType=INTEGER},
</if>
<if test="viewer != null">
#{viewer,jdbcType=VARCHAR},
</if>
<if test="viewOrg != null">
#{viewOrg,jdbcType=VARCHAR},
</if>
<if test="entity != null">
#{entity,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample"
parameterType="com.tencent.supersonic.semantic.model.domain.dataobject.DomainDOExample"
resultType="java.lang.Long">
select count(*) from s2_domain
<if test="_parameter != null">
<include refid="Example_Where_Clause"/>
</if>
</select>
<update id="updateByPrimaryKeySelective"
parameterType="com.tencent.supersonic.semantic.model.domain.dataobject.DomainDO">
update s2_domain
<set>
<if test="name != null">
name = #{name,jdbcType=VARCHAR},
</if>
<if test="bizName != null">
biz_name = #{bizName,jdbcType=VARCHAR},
</if>
<if test="parentId != null">
parent_id = #{parentId,jdbcType=BIGINT},
</if>
<if test="status != null">
status = #{status,jdbcType=INTEGER},
</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="admin != null">
admin = #{admin,jdbcType=VARCHAR},
</if>
<if test="adminOrg != null">
admin_org = #{adminOrg,jdbcType=VARCHAR},
</if>
<if test="isOpen != null">
is_open = #{isOpen,jdbcType=INTEGER},
</if>
<if test="viewer != null">
viewer = #{viewer,jdbcType=VARCHAR},
</if>
<if test="viewOrg != null">
view_org = #{viewOrg,jdbcType=VARCHAR},
</if>
<if test="entity != null">
entity = #{entity,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey"
parameterType="com.tencent.supersonic.semantic.model.domain.dataobject.DomainDO">
update s2_domain
set name = #{name,jdbcType=VARCHAR},
biz_name = #{bizName,jdbcType=VARCHAR},
parent_id = #{parentId,jdbcType=BIGINT},
status = #{status,jdbcType=INTEGER},
created_at = #{createdAt,jdbcType=TIMESTAMP},
created_by = #{createdBy,jdbcType=VARCHAR},
updated_at = #{updatedAt,jdbcType=TIMESTAMP},
updated_by = #{updatedBy,jdbcType=VARCHAR},
admin = #{admin,jdbcType=VARCHAR},
admin_org = #{adminOrg,jdbcType=VARCHAR},
is_open = #{isOpen,jdbcType=INTEGER},
viewer = #{viewer,jdbcType=VARCHAR},
view_org = #{viewOrg,jdbcType=VARCHAR},
entity = #{entity,jdbcType=VARCHAR}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>

Some files were not shown because too many files have changed in this diff Show More