[release][project] supersonic 0.7.3 version backend update (#40)

* [improvement] add some features

* [improvement] revise CHANGELOG

---------

Co-authored-by: zuopengge <hwzuopengge@tencent.com>
This commit is contained in:
mainmain
2023-08-29 20:06:34 +08:00
committed by GitHub
parent 6fe9ab79ed
commit e1911bc81b
260 changed files with 6466 additions and 7108 deletions

View File

@@ -1,11 +1,21 @@
package com.tencent.supersonic.semantic.model.application;
import com.tencent.supersonic.semantic.api.model.pojo.ItemDateFilter;
import com.tencent.supersonic.semantic.api.model.response.*;
import com.tencent.supersonic.semantic.api.model.response.MetricResp;
import com.tencent.supersonic.semantic.api.model.response.DatabaseResp;
import com.tencent.supersonic.semantic.api.model.response.ModelResp;
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.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.model.domain.*;
import com.tencent.supersonic.semantic.model.domain.DatabaseService;
import com.tencent.supersonic.semantic.model.domain.ModelService;
import com.tencent.supersonic.semantic.model.domain.DimensionService;
import com.tencent.supersonic.semantic.model.domain.DatasourceService;
import com.tencent.supersonic.semantic.model.domain.MetricService;
import com.tencent.supersonic.semantic.model.domain.Catalog;
import java.util.List;
import java.util.Map;
import java.util.Set;

View File

@@ -2,22 +2,22 @@ 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.DomainResp;
import com.tencent.supersonic.semantic.api.model.response.ModelResp;
import com.tencent.supersonic.semantic.api.model.response.QueryResultWithSchemaResp;
import com.tencent.supersonic.semantic.api.model.response.DomainResp;
import com.tencent.supersonic.semantic.api.model.response.SqlParserResp;
import com.tencent.supersonic.semantic.model.domain.DatabaseService;
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.DomainService;
import com.tencent.supersonic.semantic.model.domain.ModelService;
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.pojo.Database;
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.Map;
import java.util.Optional;
@@ -38,9 +38,9 @@ public class DatabaseServiceImpl implements DatabaseService {
private ModelService modelService;
public DatabaseServiceImpl(DatabaseRepository databaseRepository,
SqlUtils sqlUtils,
DomainService domainService,
ModelService modelService) {
SqlUtils sqlUtils,
DomainService domainService,
ModelService modelService) {
this.databaseRepository = databaseRepository;
this.sqlUtils = sqlUtils;
this.modelService = modelService;

View File

@@ -7,7 +7,6 @@ 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.common.pojo.QueryColumn;
import com.tencent.supersonic.common.util.ChatGptHelper;
import com.tencent.supersonic.semantic.api.model.pojo.DatasourceDetail;
import com.tencent.supersonic.semantic.api.model.pojo.DimValueMap;
@@ -28,9 +27,11 @@ 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.*;
import java.util.List;
import java.util.Map;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
@@ -55,14 +56,14 @@ public class DimensionServiceImpl implements DimensionService {
public DimensionServiceImpl(DimensionRepository dimensionRepository,
DomainService domainService,
DatasourceService datasourceService,
DomainService domainService,
DatasourceService datasourceService,
ChatGptHelper chatGptHelper,
DatabaseService databaseService) {
this.domainService = domainService;
this.dimensionRepository = dimensionRepository;
this.datasourceService = datasourceService;
this.chatGptHelper = chatGptHelper;
this.chatGptHelper = chatGptHelper;
this.databaseService = databaseService;
}
@@ -181,7 +182,7 @@ public class DimensionServiceImpl implements DimensionService {
}
private List<DimensionResp> convertList(List<DimensionDO> dimensionDOS,
Map<Long, DatasourceResp> datasourceRespMap) {
Map<Long, DatasourceResp> datasourceRespMap) {
List<DimensionResp> dimensionResps = Lists.newArrayList();
Map<Long, String> fullDomainPathMap = domainService.getDomainFullPath();
if (!CollectionUtils.isEmpty(dimensionDOS)) {
@@ -259,17 +260,20 @@ public class DimensionServiceImpl implements DimensionService {
@Override
public List<String> mockAlias(DimensionReq dimensionReq, String mockType, User user) {
String mockAlias = chatGptHelper.mockAlias(mockType,dimensionReq.getName(), dimensionReq.getBizName(), "", dimensionReq.getDescription() ,false);
return JSONObject.parseObject(mockAlias, new TypeReference<List<String>>() {});
String mockAlias = chatGptHelper.mockAlias(mockType, dimensionReq.getName(), dimensionReq.getBizName(),
"", dimensionReq.getDescription(), false);
return JSONObject.parseObject(mockAlias, new TypeReference<List<String>>() {
});
}
@Override
public List<DimValueMap> mockDimensionValueAlias(DimensionReq dimensionReq, User user) {
List<DatasourceResp> datasourceList = datasourceService.getDatasourceList();
List<DatasourceResp> collect = datasourceList.stream().filter(datasourceResp -> datasourceResp.getId().equals(dimensionReq.getDatasourceId())).collect(Collectors.toList());
List<DatasourceResp> collect = datasourceList.stream().filter(datasourceResp ->
datasourceResp.getId().equals(dimensionReq.getDatasourceId())).collect(Collectors.toList());
if (collect.isEmpty()){
if (collect.isEmpty()) {
return null;
}
DatasourceResp datasourceResp = collect.get(0);
@@ -278,7 +282,8 @@ public class DimensionServiceImpl implements DimensionService {
DatabaseResp database = databaseService.getDatabase(datasourceResp.getDatabaseId());
String sql = "select ai_talk."+dimensionReq.getBizName()+" from ("+sqlQuery +") as ai_talk group by ai_talk."+dimensionReq.getBizName();
String sql = "select ai_talk." + dimensionReq.getBizName() + " from (" + sqlQuery
+ ") as ai_talk group by ai_talk." + dimensionReq.getBizName();
QueryResultWithSchemaResp queryResultWithSchemaResp = databaseService.executeSql(sql, database);
List<Map<String, Object>> resultList = queryResultWithSchemaResp.getResultList();
List<String> valueList = new ArrayList<>();
@@ -287,7 +292,7 @@ public class DimensionServiceImpl implements DimensionService {
valueList.add(value);
}
String json = chatGptHelper.mockDimensionValueAlias(JSON.toJSONString(valueList));
log.info("return llm res is :{}",json);
log.info("return llm res is :{}", json);
JSONObject jsonObject = JSON.parseObject(json);
@@ -297,9 +302,10 @@ public class DimensionServiceImpl implements DimensionService {
DimValueMap dimValueMap = new DimValueMap();
dimValueMap.setTechName((String) stringObjectMap.get(dimensionReq.getBizName()));
dimValueMap.setBizName(jsonObject.getJSONArray("tran").getString(i));
dimValueMap. setAlias(jsonObject.getJSONObject("alias").getJSONArray((String) stringObjectMap.get(dimensionReq.getBizName())).toJavaList(String.class));
dimValueMap.setAlias(jsonObject.getJSONObject("alias").getJSONArray(
(String) stringObjectMap.get(dimensionReq.getBizName())).toJavaList(String.class));
dimValueMapsResp.add(dimValueMap);
i ++ ;
i++;
}
return dimValueMapsResp;
}

View File

@@ -4,20 +4,29 @@ import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Lists;
import com.tencent.supersonic.auth.api.authentication.pojo.User;
import com.tencent.supersonic.auth.api.authentication.service.UserService;
import com.tencent.supersonic.common.pojo.enums.AuthType;
import com.tencent.supersonic.common.util.BeanMapper;
import com.tencent.supersonic.common.pojo.enums.AuthType;
import com.tencent.supersonic.semantic.api.model.request.DomainReq;
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.ModelResp;
import com.tencent.supersonic.semantic.api.model.response.DomainResp;
import com.tencent.supersonic.semantic.model.domain.DomainService;
import com.tencent.supersonic.semantic.model.domain.ModelService;
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.*;
import java.util.List;
import java.util.Date;
import java.util.Set;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Map;
import java.util.HashMap;
import java.util.Queue;
import java.util.LinkedList;
import java.util.Objects;
import java.util.Comparator;
import java.util.stream.Collectors;
import lombok.extern.slf4j.Slf4j;
import org.assertj.core.util.Sets;
@@ -36,8 +45,8 @@ public class DomainServiceImpl implements DomainService {
public DomainServiceImpl(DomainRepository domainRepository,
@Lazy ModelService modelService,
UserService userService) {
@Lazy ModelService modelService,
UserService userService) {
this.domainRepository = domainRepository;
this.modelService = modelService;
this.userService = userService;

View File

@@ -5,7 +5,6 @@ import com.alibaba.fastjson.TypeReference;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.google.common.collect.Lists;
import com.plexpt.chatgpt.ChatGPT;
import com.tencent.supersonic.auth.api.authentication.pojo.User;
import com.tencent.supersonic.common.util.ChatGptHelper;
import com.tencent.supersonic.semantic.api.model.pojo.Measure;
@@ -81,7 +80,7 @@ public class MetricServiceImpl implements MetricService {
log.info("[insert metric] object:{}", JSONObject.toJSONString(metricToInsert));
saveMetricBatch(metricToInsert, user);
}
@Override
public List<MetricResp> getMetrics(Long modelId) {
return convertList(metricRepository.getMetricList(modelId));
@@ -209,10 +208,12 @@ public class MetricServiceImpl implements MetricService {
}
@Override
public List<String> mockAlias(MetricReq metricReq,String mockType,User user) {
public List<String> mockAlias(MetricReq metricReq, String mockType, User user) {
String mockAlias = chatGptHelper.mockAlias(mockType,metricReq.getName(), metricReq.getBizName(), "", metricReq.getDescription() ,!"".equals(metricReq.getDataFormatType()));
return JSONObject.parseObject(mockAlias, new TypeReference<List<String>>() {});
String mockAlias = chatGptHelper.mockAlias(mockType, metricReq.getName(), metricReq.getBizName(), "",
metricReq.getDescription(), !"".equals(metricReq.getDataFormatType()));
return JSONObject.parseObject(mockAlias, new TypeReference<List<String>>() {
});
}

View File

@@ -4,41 +4,42 @@ import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Lists;
import com.tencent.supersonic.auth.api.authentication.pojo.User;
import com.tencent.supersonic.auth.api.authentication.service.UserService;
import com.tencent.supersonic.common.pojo.enums.AuthType;
import com.tencent.supersonic.common.util.BeanMapper;
import com.tencent.supersonic.common.util.JsonUtil;
import com.tencent.supersonic.common.pojo.enums.AuthType;
import com.tencent.supersonic.semantic.api.model.request.ModelReq;
import com.tencent.supersonic.semantic.api.model.request.ModelSchemaFilterReq;
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.MetricResp;
import com.tencent.supersonic.semantic.api.model.response.MetricSchemaResp;
import com.tencent.supersonic.semantic.api.model.response.ModelResp;
import com.tencent.supersonic.semantic.api.model.response.DomainResp;
import com.tencent.supersonic.semantic.api.model.response.DimensionResp;
import com.tencent.supersonic.semantic.api.model.response.MetricResp;
import com.tencent.supersonic.semantic.api.model.response.DimSchemaResp;
import com.tencent.supersonic.semantic.api.model.response.ModelSchemaResp;
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.api.model.response.MetricSchemaResp;
import com.tencent.supersonic.semantic.api.model.response.DatasourceResp;
import com.tencent.supersonic.semantic.model.domain.ModelService;
import com.tencent.supersonic.semantic.model.domain.DomainService;
import com.tencent.supersonic.semantic.model.domain.DimensionService;
import com.tencent.supersonic.semantic.model.domain.MetricService;
import com.tencent.supersonic.semantic.model.domain.DatasourceService;
import com.tencent.supersonic.semantic.model.domain.dataobject.ModelDO;
import com.tencent.supersonic.semantic.model.domain.pojo.Model;
import com.tencent.supersonic.semantic.model.domain.repository.ModelRepository;
import com.tencent.supersonic.semantic.model.domain.utils.ModelConvert;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashSet;
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.springframework.beans.BeanUtils;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.List;
import java.util.Objects;
import java.util.Date;
import java.util.Set;
import java.util.Map;
import java.util.HashSet;
import java.util.ArrayList;
import java.util.stream.Collectors;
@Slf4j
@Service
@@ -52,8 +53,8 @@ public class ModelServiceImpl implements ModelService {
private final UserService userService;
public ModelServiceImpl(ModelRepository modelRepository, @Lazy MetricService metricService,
@Lazy DimensionService dimensionService, @Lazy DatasourceService datasourceService,
@Lazy DomainService domainService, UserService userService) {
@Lazy DimensionService dimensionService, @Lazy DatasourceService datasourceService,
@Lazy DomainService domainService, UserService userService) {
this.modelRepository = modelRepository;
this.metricService = metricService;
this.dimensionService = dimensionService;
@@ -161,7 +162,7 @@ public class ModelServiceImpl implements ModelService {
@Override
public ModelResp getModel(Long id) {
Map<Long, DomainResp> domainRespMap = domainService.getDomainList().stream()
.collect(Collectors.toMap(DomainResp::getId, d -> d));
.collect(Collectors.toMap(DomainResp::getId, d -> d));
return ModelConvert.convert(getModelDO(id), domainRespMap);
}
@@ -186,8 +187,8 @@ public class ModelServiceImpl implements ModelService {
if (CollectionUtils.isEmpty(modelDOS)) {
return modelResps;
}
Map<Long, DomainResp> domainRespMap = domainService.getDomainList().stream()
.collect(Collectors.toMap(DomainResp::getId, d -> d));
Map<Long, DomainResp> domainRespMap = domainService.getDomainList()
.stream().collect(Collectors.toMap(DomainResp::getId, d -> d));
return modelDOS.stream()
.map(modelDO -> ModelConvert.convert(modelDO, domainRespMap))
.collect(Collectors.toList());
@@ -216,8 +217,29 @@ public class ModelServiceImpl implements ModelService {
@Override
public Map<Long, String> getModelFullPathMap() {
return getModelList().stream()
.collect(Collectors.toMap(ModelResp::getId, ModelResp::getFullPath, (k1, k2) -> k1));
return getModelList().stream().collect(Collectors.toMap(ModelResp::getId,
ModelResp::getFullPath, (k1, k2) -> k1));
}
@Override
public List<String> getModelAdmin(Long id) {
ModelResp modelResp = getModel(id);
if (modelResp == null) {
return Lists.newArrayList();
}
if (!CollectionUtils.isEmpty(modelResp.getAdmins())) {
return modelResp.getAdmins();
}
Long domainId = modelResp.getDomainId();
DomainResp domainResp = domainService.getDomain(domainId);
while (domainResp != null) {
if (!CollectionUtils.isEmpty(domainResp.getAdmins())) {
return domainResp.getAdmins();
}
domainId = domainResp.getParentId();
domainResp = domainService.getDomain(domainId);
}
return Lists.newArrayList();
}
protected ModelDO getModelDO(Long id) {

View File

@@ -11,10 +11,10 @@ public interface DatabaseService {
QueryResultWithSchemaResp executeSql(String sql, DatabaseResp databaseResp);
DatabaseResp getDatabaseByModelId(Long modelId);
QueryResultWithSchemaResp executeSql(String sql, Long domainId);
DatabaseResp getDatabaseByModelId(Long modelId);
boolean testConnect(DatabaseReq databaseReq, User user);
DatabaseResp createOrUpdateDatabase(DatabaseReq databaseReq, User user);

View File

@@ -4,7 +4,6 @@ import com.github.pagehelper.PageInfo;
import com.tencent.supersonic.auth.api.authentication.pojo.User;
import com.tencent.supersonic.semantic.api.model.pojo.DimValueMap;
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.request.PageDimensionReq;
import com.tencent.supersonic.semantic.api.model.response.DimensionResp;
import java.util.List;

View File

@@ -5,6 +5,7 @@ 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 {
@@ -33,5 +34,5 @@ public interface MetricService {
void deleteMetric(Long id) throws Exception;
List<String> mockAlias(MetricReq metricReq,String mockType,User user);
List<String> mockAlias(MetricReq metricReq, String mockType, User user);
}

View File

@@ -33,6 +33,8 @@ public interface ModelService {
Map<Long, String> getModelFullPathMap();
List<String> getModelAdmin(Long id);
ModelSchemaResp fetchSingleModelSchema(Long modelId);
List<ModelSchemaResp> fetchModelSchema(ModelSchemaFilterReq modelSchemaFilterReq);

View File

@@ -29,8 +29,8 @@ public class H2Adaptor extends EngineAdaptor {
@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'";
return "SELECT COLUMN_NAME AS name, DATA_TYPE AS dataType\n"
+ "FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA ='%s' AND TABLE_NAME = '%s'";
}
@Override
@@ -40,6 +40,7 @@ public class H2Adaptor extends EngineAdaptor {
@Override
public String getTableMetaQueryTpl() {
return "SELECT TABLE_NAME as name FROM INFORMATION_SCHEMA.TABLES WHERE STORAGE_TYPE = 'MEMORY' AND TABLE_SCHEMA = '%s'";
return "SELECT TABLE_NAME as name FROM INFORMATION_SCHEMA.TABLES "
+ "WHERE STORAGE_TYPE = 'MEMORY' AND TABLE_SCHEMA = '%s'";
}
}

View File

@@ -35,7 +35,8 @@ public class MysqlAdaptor extends EngineAdaptor {
@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');";
return "select distinct TABLE_SCHEMA as name from information_schema.tables "
+ "where TABLE_SCHEMA not in ('information_schema','mysql','performance_schema','sys');";
}
@Override
@@ -45,8 +46,8 @@ public class MysqlAdaptor extends EngineAdaptor {
@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'";
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

@@ -248,4 +248,4 @@ public class DatabaseDO {
public void setConfig(String config) {
this.config = config == null ? null : config.trim();
}
}
}

View File

@@ -882,38 +882,6 @@ public class DatabaseDOExample {
private String typeHandler;
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;
}
protected Criterion(String condition) {
super();
this.condition = condition;
@@ -949,5 +917,37 @@ public class DatabaseDOExample {
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

@@ -252,4 +252,4 @@ public class DatasourceDO {
public void setDatasourceDetail(String datasourceDetail) {
this.datasourceDetail = datasourceDetail == null ? null : datasourceDetail.trim();
}
}
}

View File

@@ -872,38 +872,6 @@ public class DatasourceDOExample {
private String typeHandler;
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;
}
protected Criterion(String condition) {
super();
this.condition = condition;
@@ -939,5 +907,37 @@ public class DatasourceDOExample {
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

@@ -174,4 +174,4 @@ public class DatasourceRelaDO {
public void setUpdatedBy(String updatedBy) {
this.updatedBy = updatedBy == null ? null : updatedBy.trim();
}
}
}

View File

@@ -792,38 +792,6 @@ public class DatasourceRelaDOExample {
private String typeHandler;
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;
}
protected Criterion(String condition) {
super();
this.condition = condition;
@@ -859,5 +827,37 @@ public class DatasourceRelaDOExample {
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

@@ -432,4 +432,4 @@ public class DimensionDO {
public void setExpr(String expr) {
this.expr = expr == null ? null : expr.trim();
}
}
}

View File

@@ -1342,38 +1342,6 @@ public class DimensionDOExample {
private String typeHandler;
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;
}
protected Criterion(String condition) {
super();
this.condition = condition;
@@ -1409,5 +1377,37 @@ public class DimensionDOExample {
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

@@ -1142,38 +1142,6 @@ public class DomainDOExample {
private String typeHandler;
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;
}
protected Criterion(String condition) {
super();
this.condition = condition;
@@ -1209,5 +1177,37 @@ public class DomainDOExample {
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

@@ -4,265 +4,121 @@ import java.util.Date;
public class MetricDO {
/**
*
*/
private Long id;
/**
* 主体域ID
*/
private Long modelId;
/**
* 指标名称
*/
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 model_id 主体域ID
*/
public Long getModelId() {
return modelId;
}
/**
* 主体域ID
*
* @param modelId 主体域ID
*/
public void setModelId(Long modelId) {
this.modelId = modelId;
}
/**
* 指标名称
*
* @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() {
@@ -271,7 +127,6 @@ public class MetricDO {
/**
* 更新时间
*
* @param updatedAt 更新时间
*/
public void setUpdatedAt(Date updatedAt) {
@@ -280,7 +135,6 @@ public class MetricDO {
/**
* 更新人
*
* @return updated_by 更新人
*/
public String getUpdatedBy() {
@@ -289,7 +143,6 @@ public class MetricDO {
/**
* 更新人
*
* @param updatedBy 更新人
*/
public void setUpdatedBy(String updatedBy) {
@@ -298,7 +151,6 @@ public class MetricDO {
/**
* 数值类型
*
* @return data_format_type 数值类型
*/
public String getDataFormatType() {
@@ -307,7 +159,6 @@ public class MetricDO {
/**
* 数值类型
*
* @param dataFormatType 数值类型
*/
public void setDataFormatType(String dataFormatType) {
@@ -316,7 +167,6 @@ public class MetricDO {
/**
* 数值类型参数
*
* @return data_format 数值类型参数
*/
public String getDataFormat() {
@@ -325,7 +175,6 @@ public class MetricDO {
/**
* 数值类型参数
*
* @param dataFormat 数值类型参数
*/
public void setDataFormat(String dataFormat) {
@@ -333,6 +182,7 @@ public class MetricDO {
}
/**
*
* @return alias
*/
public String getAlias() {
@@ -340,6 +190,7 @@ public class MetricDO {
}
/**
*
* @param alias
*/
public void setAlias(String alias) {
@@ -348,7 +199,6 @@ public class MetricDO {
/**
* 类型参数
*
* @return type_params 类型参数
*/
public String getTypeParams() {
@@ -357,10 +207,9 @@ public class MetricDO {
/**
* 类型参数
*
* @param typeParams 类型参数
*/
public void setTypeParams(String typeParams) {
this.typeParams = typeParams == null ? null : typeParams.trim();
}
}
}

View File

@@ -1212,38 +1212,6 @@ public class MetricDOExample {
private String typeHandler;
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;
}
protected Criterion(String condition) {
super();
this.condition = condition;
@@ -1279,5 +1247,37 @@ public class MetricDOExample {
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

@@ -4,269 +4,143 @@ import java.util.Date;
public class ModelDO {
/**
*
*/
private Long id;
/**
*
*/
private String name;
/**
*
*/
private String bizName;
/**
*
*/
private Long domainId;
/**
*
*/
private String viewer;
/**
*
*/
private String viewOrg;
/**
*
*/
private String admin;
/**
*
*/
private String adminOrg;
/**
*
*/
private Integer isOpen;
/**
*
*/
private String createdBy;
/**
*
*/
private Date createdAt;
/**
*
*/
private String updatedBy;
/**
*
*/
private Date updatedAt;
/**
*
*/
private String entity;
/**
* @return id
*/
public Long getId() {
return id;
}
/**
* @param 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();
}
/**
* @return domain_id
*/
public Long getDomainId() {
return domainId;
}
/**
* @param domainId
*/
public void setDomainId(Long domainId) {
this.domainId = domainId;
}
/**
* @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();
}
/**
* @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 created_by
*/
public String getCreatedBy() {
return createdBy;
}
/**
* @param createdBy
*/
public void setCreatedBy(String createdBy) {
this.createdBy = createdBy == null ? null : createdBy.trim();
}
/**
* @return created_at
*/
public Date getCreatedAt() {
return createdAt;
}
/**
* @param createdAt
*/
public void setCreatedAt(Date createdAt) {
this.createdAt = createdAt;
}
/**
* @return updated_by
*/
public String getUpdatedBy() {
return updatedBy;
}
/**
* @param updatedBy
*/
public void setUpdatedBy(String updatedBy) {
this.updatedBy = updatedBy == null ? null : updatedBy.trim();
}
/**
* @return updated_at
*/
public Date getUpdatedAt() {
return updatedAt;
}
/**
* @param updatedAt
*/
public void setUpdatedAt(Date updatedAt) {
this.updatedAt = updatedAt;
}
/**
* @return entity
*/
public String getEntity() {
return entity;
}
/**
* @param entity
*/
public void setEntity(String entity) {
this.entity = entity == null ? null : entity.trim();
}
}
}

View File

@@ -1082,38 +1082,6 @@ public class ModelDOExample {
private String typeHandler;
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;
}
protected Criterion(String condition) {
super();
this.condition = condition;
@@ -1149,5 +1117,37 @@ public class ModelDOExample {
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

@@ -3,14 +3,11 @@ package com.tencent.supersonic.semantic.model.domain.dataobject;
import java.util.Date;
public class ViewInfoDO {
/**
*
*/
private Long id;
/**
*
*/
private Long modelId;
@@ -20,22 +17,18 @@ public class ViewInfoDO {
private String type;
/**
*
*/
private Date createdAt;
/**
*
*/
private String createdBy;
/**
*
*/
private Date updatedAt;
/**
*
*/
private String updatedBy;
@@ -74,7 +67,6 @@ public class ViewInfoDO {
/**
* datasource、dimension、metric
*
* @return type datasource、dimension、metric
*/
public String getType() {
@@ -83,7 +75,6 @@ public class ViewInfoDO {
/**
* datasource、dimension、metric
*
* @param type datasource、dimension、metric
*/
public void setType(String type) {
@@ -148,7 +139,6 @@ public class ViewInfoDO {
/**
* config detail
*
* @return config config detail
*/
public String getConfig() {
@@ -157,10 +147,9 @@ public class ViewInfoDO {
/**
* config detail
*
* @param config config detail
*/
public void setConfig(String config) {
this.config = config == null ? null : config.trim();
}
}
}

View File

@@ -672,38 +672,6 @@ public class ViewInfoDOExample {
private String typeHandler;
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;
}
protected Criterion(String condition) {
super();
this.condition = condition;
@@ -739,5 +707,37 @@ public class ViewInfoDOExample {
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

@@ -3,17 +3,19 @@ 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.pojo.enums.StatusEnum;
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;
@@ -56,7 +58,8 @@ public class DomainConvert {
}
public static DomainResp convert(DomainDO domainDO, Map<Long, String> domainFullPathMap,
Map<Long, List<DimensionResp>> dimensionMap, Map<Long, List<MetricResp>> metricMap) {
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());

View File

@@ -3,21 +3,22 @@ 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.common.util.BeanMapper;
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.response.MetricResp;
import com.tencent.supersonic.semantic.api.model.response.ModelResp;
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.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 {

View File

@@ -5,15 +5,14 @@ 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.pojo.DimValueMap;
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.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 com.tencent.supersonic.semantic.model.domain.MetricService;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
@@ -27,14 +26,9 @@ import org.springframework.web.bind.annotation.RestController;
@RequestMapping("/api/semantic/dimension")
public class DimensionController {
private DimensionService dimensionService;
private MetricService metricService;
public DimensionController(DimensionService dimensionService,MetricService metricService) {
this.metricService = metricService;
public DimensionController(DimensionService dimensionService) {
this.dimensionService = dimensionService;
}
@@ -46,8 +40,8 @@ public class DimensionController {
*/
@PostMapping("/createDimension")
public Boolean createDimension(@RequestBody DimensionReq dimensionReq,
HttpServletRequest request,
HttpServletResponse response) throws Exception {
HttpServletRequest request,
HttpServletResponse response) throws Exception {
User user = UserHolder.findUser(request, response);
dimensionService.createDimension(dimensionReq, user);
return true;
@@ -56,8 +50,8 @@ public class DimensionController {
@PostMapping("/updateDimension")
public Boolean updateDimension(@RequestBody DimensionReq dimensionReq,
HttpServletRequest request,
HttpServletResponse response) throws Exception {
HttpServletRequest request,
HttpServletResponse response) throws Exception {
User user = UserHolder.findUser(request, response);
dimensionService.updateDimension(dimensionReq, user);
return true;
@@ -66,18 +60,18 @@ public class DimensionController {
@PostMapping("/mockDimensionAlias")
public List<String> mockMetricAlias(@RequestBody DimensionReq dimensionReq,
HttpServletRequest request,
HttpServletResponse response){
HttpServletResponse response) {
User user = UserHolder.findUser(request, response);
return dimensionService.mockAlias(dimensionReq,"dimension",user);
return dimensionService.mockAlias(dimensionReq, "dimension", user);
}
@PostMapping("/mockDimensionValuesAlias")
public List<DimValueMap> mockDimensionValuesAlias(@RequestBody DimensionReq dimensionReq,
HttpServletRequest request,
HttpServletResponse response){
HttpServletResponse response) {
User user = UserHolder.findUser(request, response);
return dimensionService.mockDimensionValueAlias(dimensionReq,user);
return dimensionService.mockDimensionValueAlias(dimensionReq, user);
}
@GetMapping("/getDimensionList/{modelId}")
@@ -88,7 +82,7 @@ public class DimensionController {
@GetMapping("/{modelId}/{dimensionName}")
public DimensionResp getDimensionDescByNameAndId(@PathVariable("modelId") Long modelId,
@PathVariable("dimensionName") String dimensionBizName) {
@PathVariable("dimensionName") String dimensionBizName) {
return dimensionService.getDimension(dimensionBizName, modelId);
}

View File

@@ -12,8 +12,13 @@ import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.DeleteMapping;
@RestController
@@ -51,9 +56,9 @@ public class MetricController {
@PostMapping("/mockMetricAlias")
public List<String> mockMetricAlias(@RequestBody MetricReq metricReq,
HttpServletRequest request,
HttpServletResponse response){
HttpServletResponse response) {
User user = UserHolder.findUser(request, response);
return metricService.mockAlias(metricReq,"indicator",user);
return metricService.mockAlias(metricReq, "indicator", user);
}
@GetMapping("/getMetricList/{modelId}")

View File

@@ -6,18 +6,18 @@ import com.tencent.supersonic.common.pojo.enums.AuthType;
import com.tencent.supersonic.semantic.api.model.request.ModelReq;
import com.tencent.supersonic.semantic.api.model.response.ModelResp;
import com.tencent.supersonic.semantic.model.domain.ModelService;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.GetMapping;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
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
@@ -32,8 +32,8 @@ public class ModelController {
@PostMapping("/createModel")
public Boolean createModel(@RequestBody ModelReq modelReq,
HttpServletRequest request,
HttpServletResponse response) {
HttpServletRequest request,
HttpServletResponse response) {
User user = UserHolder.findUser(request, response);
modelService.createModel(modelReq, user);
return true;
@@ -41,8 +41,8 @@ public class ModelController {
@PostMapping("/updateModel")
public Boolean updateModel(@RequestBody ModelReq modelReq,
HttpServletRequest request,
HttpServletResponse response) {
HttpServletRequest request,
HttpServletResponse response) {
User user = UserHolder.findUser(request, response);
modelService.updateModel(modelReq, user);
return true;
@@ -56,8 +56,8 @@ public class ModelController {
@GetMapping("/getModelList/{domainId}")
public List<ModelResp> getModelList(@PathVariable("domainId") Long domainId,
HttpServletRequest request,
HttpServletResponse response) {
HttpServletRequest request,
HttpServletResponse response) {
User user = UserHolder.findUser(request, response);
return modelService.getModelListWithAuth(user.getName(), domainId, AuthType.ADMIN);
}

View File

@@ -119,7 +119,7 @@
<if test="bizName != null and bizName != ''">
and biz_name like CONCAT('%',#{bizName , jdbcType=VARCHAR},'%')
</if>
<if test="sensitiveLevel != null and sensitiveLevel != ''">
<if test="sensitiveLevel != null">
and sensitive_level = #{sensitiveLevel}
</if>
<if test="modelIds != null and modelIds.size >0">