mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-11 12:07:42 +00:00
(improvement)(chat) Update ConfigureDemo and dict txt for test (#438)
Co-authored-by: jolunoluo
This commit is contained in:
@@ -17,4 +17,5 @@ public class PageSchemaItemReq extends PageBaseReq {
|
||||
private Integer sensitiveLevel;
|
||||
private Integer status;
|
||||
private String key;
|
||||
private List<Long> ids;
|
||||
}
|
||||
|
||||
@@ -46,6 +46,8 @@ public class MetricResp extends SchemaItem {
|
||||
|
||||
private boolean hasAdminRes = false;
|
||||
|
||||
private Boolean isCollect;
|
||||
|
||||
public void setTag(String tag) {
|
||||
if (StringUtils.isBlank(tag)) {
|
||||
tags = Lists.newArrayList();
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.tencent.supersonic.semantic.model.application;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.tencent.supersonic.auth.api.authentication.pojo.User;
|
||||
import com.tencent.supersonic.semantic.model.domain.CollectService;
|
||||
import com.tencent.supersonic.semantic.model.domain.dataobject.CollectDO;
|
||||
import com.tencent.supersonic.semantic.model.infrastructure.mapper.CollectMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class CollectServiceImpl implements CollectService {
|
||||
|
||||
|
||||
|
||||
@Resource
|
||||
private CollectMapper collectMapper;
|
||||
|
||||
|
||||
String type = "metric";
|
||||
|
||||
|
||||
@Override
|
||||
public Boolean createCollectionIndicators(User user, Long id) {
|
||||
CollectDO collectDO = new CollectDO();
|
||||
collectDO.setType(type);
|
||||
collectDO.setUsername(user.getName());
|
||||
collectDO.setCollectId(id);
|
||||
collectMapper.insert(collectDO);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean deleteCollectionIndicators(User user, Long id) {
|
||||
QueryWrapper<CollectDO> collectDOQueryWrapper = new QueryWrapper<>();
|
||||
collectDOQueryWrapper.lambda().eq(CollectDO::getUsername,user.getName());
|
||||
collectDOQueryWrapper.lambda().eq(CollectDO::getCollectId,id);
|
||||
collectDOQueryWrapper.lambda().eq(CollectDO::getType,type);
|
||||
collectMapper.delete(collectDOQueryWrapper);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CollectDO> getCollectList(String username) {
|
||||
QueryWrapper<CollectDO> queryWrapper = new QueryWrapper<>();
|
||||
if (!StringUtils.isEmpty(username)){
|
||||
queryWrapper.lambda().eq(CollectDO::getUsername,username);
|
||||
}
|
||||
return collectMapper.selectList(queryWrapper);
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,7 @@ import com.google.common.collect.Lists;
|
||||
import com.tencent.supersonic.auth.api.authentication.pojo.User;
|
||||
import com.tencent.supersonic.common.pojo.DataEvent;
|
||||
import com.tencent.supersonic.common.pojo.DataItem;
|
||||
import com.tencent.supersonic.common.pojo.ModelRela;
|
||||
import com.tencent.supersonic.common.pojo.enums.EventType;
|
||||
import com.tencent.supersonic.common.pojo.enums.StatusEnum;
|
||||
import com.tencent.supersonic.common.pojo.enums.TypeEnums;
|
||||
@@ -25,6 +26,7 @@ import com.tencent.supersonic.semantic.api.model.response.ModelResp;
|
||||
import com.tencent.supersonic.semantic.api.model.response.QueryResultWithSchemaResp;
|
||||
import com.tencent.supersonic.semantic.model.domain.DatabaseService;
|
||||
import com.tencent.supersonic.semantic.model.domain.DimensionService;
|
||||
import com.tencent.supersonic.semantic.model.domain.ModelRelaService;
|
||||
import com.tencent.supersonic.semantic.model.domain.ModelService;
|
||||
import com.tencent.supersonic.semantic.model.domain.dataobject.DimensionDO;
|
||||
import com.tencent.supersonic.semantic.model.domain.pojo.DimensionFilter;
|
||||
@@ -46,7 +48,6 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class DimensionServiceImpl implements DimensionService {
|
||||
@@ -60,6 +61,8 @@ public class DimensionServiceImpl implements DimensionService {
|
||||
|
||||
private DatabaseService databaseService;
|
||||
|
||||
private ModelRelaService modelRelaService;
|
||||
|
||||
@Autowired
|
||||
private ApplicationEventPublisher eventPublisher;
|
||||
|
||||
@@ -67,11 +70,13 @@ public class DimensionServiceImpl implements DimensionService {
|
||||
public DimensionServiceImpl(DimensionRepository dimensionRepository,
|
||||
ModelService modelService,
|
||||
ChatGptHelper chatGptHelper,
|
||||
DatabaseService databaseService) {
|
||||
DatabaseService databaseService,
|
||||
ModelRelaService modelRelaService) {
|
||||
this.modelService = modelService;
|
||||
this.dimensionRepository = dimensionRepository;
|
||||
this.chatGptHelper = chatGptHelper;
|
||||
this.databaseService = databaseService;
|
||||
this.modelRelaService = modelRelaService;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -213,6 +218,21 @@ public class DimensionServiceImpl implements DimensionService {
|
||||
return getDimensions(new MetaFilter(Lists.newArrayList(modelId)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DimensionResp> getDimensionInModelCluster(Long modelId) {
|
||||
ModelResp modelResp = modelService.getModel(modelId);
|
||||
List<ModelRela> modelRelas = modelRelaService.getModelRelaList(modelResp.getDomainId());
|
||||
List<Long> modelIds = new ArrayList<>();
|
||||
modelIds.add(modelId);
|
||||
for (ModelRela modelRela : modelRelas) {
|
||||
modelIds.add(modelRela.getFromModelId());
|
||||
modelIds.add(modelRela.getToModelId());
|
||||
}
|
||||
DimensionFilter dimensionFilter = new DimensionFilter();
|
||||
dimensionFilter.setModelIds(modelIds);
|
||||
return getDimensions(dimensionFilter);
|
||||
}
|
||||
|
||||
private List<DimensionResp> convertList(List<DimensionDO> dimensionDOS,
|
||||
Map<Long, ModelResp> modelRespMap) {
|
||||
List<DimensionResp> dimensionResps = Lists.newArrayList();
|
||||
@@ -287,10 +307,17 @@ public class DimensionServiceImpl implements DimensionService {
|
||||
return dimValueMapsResp;
|
||||
}
|
||||
|
||||
private List<DimensionResp> getDimensionInSameDomain(Long modelId) {
|
||||
ModelResp modelResp = modelService.getModel(modelId);
|
||||
Long domainId = modelResp.getDomainId();
|
||||
List<ModelResp> modelResps = modelService.getModelByDomainIds(Lists.newArrayList(domainId));
|
||||
List<Long> modelIds = modelResps.stream().map(ModelResp::getId).collect(Collectors.toList());
|
||||
return getDimensions(new MetaFilter(modelIds));
|
||||
}
|
||||
|
||||
private void checkExist(List<DimensionReq> dimensionReqs) {
|
||||
Long modelId = dimensionReqs.get(0).getModelId();
|
||||
List<DimensionResp> dimensionResps = getDimensions(modelId);
|
||||
List<DimensionResp> dimensionResps = getDimensionInSameDomain(modelId);
|
||||
Map<String, DimensionResp> bizNameMap = dimensionResps.stream()
|
||||
.collect(Collectors.toMap(DimensionResp::getBizName, a -> a, (k1, k2) -> k1));
|
||||
Map<String, DimensionResp> nameMap = dimensionResps.stream()
|
||||
@@ -316,6 +343,14 @@ public class DimensionServiceImpl implements DimensionService {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendDimensionEventBatch(List<Long> modelIds, EventType eventType) {
|
||||
DimensionFilter dimensionFilter = new DimensionFilter();
|
||||
dimensionFilter.setModelIds(modelIds);
|
||||
List<DimensionDO> dimensionDOS = queryDimension(dimensionFilter);
|
||||
sendEventBatch(dimensionDOS, eventType);
|
||||
}
|
||||
|
||||
private void sendEventBatch(List<DimensionDO> dimensionDOS, EventType eventType) {
|
||||
List<DataItem> dataItems = dimensionDOS.stream().map(dimensionDO ->
|
||||
DataItem.builder().id(dimensionDO.getId()).name(dimensionDO.getName())
|
||||
|
||||
@@ -23,9 +23,11 @@ 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.semantic.api.model.response.ModelResp;
|
||||
import com.tencent.supersonic.semantic.model.domain.CollectService;
|
||||
import com.tencent.supersonic.semantic.model.domain.DomainService;
|
||||
import com.tencent.supersonic.semantic.model.domain.MetricService;
|
||||
import com.tencent.supersonic.semantic.model.domain.ModelService;
|
||||
import com.tencent.supersonic.semantic.model.domain.dataobject.CollectDO;
|
||||
import com.tencent.supersonic.semantic.model.domain.dataobject.MetricDO;
|
||||
import com.tencent.supersonic.semantic.model.domain.pojo.MetaFilter;
|
||||
import com.tencent.supersonic.semantic.model.domain.pojo.MetricFilter;
|
||||
@@ -58,18 +60,22 @@ public class MetricServiceImpl implements MetricService {
|
||||
|
||||
private ChatGptHelper chatGptHelper;
|
||||
|
||||
private CollectService collectService;
|
||||
|
||||
private ApplicationEventPublisher eventPublisher;
|
||||
|
||||
public MetricServiceImpl(MetricRepository metricRepository,
|
||||
ModelService modelService,
|
||||
DomainService domainService,
|
||||
ChatGptHelper chatGptHelper,
|
||||
CollectService collectService,
|
||||
ApplicationEventPublisher eventPublisher) {
|
||||
this.domainService = domainService;
|
||||
this.metricRepository = metricRepository;
|
||||
this.modelService = modelService;
|
||||
this.chatGptHelper = chatGptHelper;
|
||||
this.eventPublisher = eventPublisher;
|
||||
this.collectService = collectService;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -177,7 +183,9 @@ public class MetricServiceImpl implements MetricService {
|
||||
.doSelectPageInfo(() -> queryMetric(metricFilter));
|
||||
PageInfo<MetricResp> pageInfo = new PageInfo<>();
|
||||
BeanUtils.copyProperties(metricDOPageInfo, pageInfo);
|
||||
List<MetricResp> metricResps = convertList(metricDOPageInfo.getList());
|
||||
List<CollectDO> collectList = collectService.getCollectList(user.getName());
|
||||
List<Long> collect = collectList.stream().map(CollectDO::getCollectId).collect(Collectors.toList());
|
||||
List<MetricResp> metricResps = convertList(metricDOPageInfo.getList(),collect);
|
||||
fillAdminRes(metricResps, user);
|
||||
pageInfo.setList(metricResps);
|
||||
return pageInfo;
|
||||
@@ -191,7 +199,7 @@ public class MetricServiceImpl implements MetricService {
|
||||
public List<MetricResp> getMetrics(MetaFilter metaFilter) {
|
||||
MetricFilter metricFilter = new MetricFilter();
|
||||
BeanUtils.copyProperties(metaFilter, metricFilter);
|
||||
return convertList(queryMetric(metricFilter));
|
||||
return convertList(queryMetric(metricFilter), Lists.newArrayList());
|
||||
}
|
||||
|
||||
private void fillAdminRes(List<MetricResp> metricResps, User user) {
|
||||
@@ -236,7 +244,7 @@ public class MetricServiceImpl implements MetricService {
|
||||
if (metricDO == null) {
|
||||
return null;
|
||||
}
|
||||
return MetricConverter.convert2MetricResp(metricDO, new HashMap<>());
|
||||
return MetricConverter.convert2MetricResp(metricDO, new HashMap<>(), Lists.newArrayList());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -333,17 +341,25 @@ public class MetricServiceImpl implements MetricService {
|
||||
return getMetrics(new MetaFilter(modelIds));
|
||||
}
|
||||
|
||||
private List<MetricResp> convertList(List<MetricDO> metricDOS) {
|
||||
private List<MetricResp> convertList(List<MetricDO> metricDOS, List<Long> collect) {
|
||||
List<MetricResp> metricResps = Lists.newArrayList();
|
||||
Map<Long, ModelResp> modelMap = modelService.getModelMap();
|
||||
if (!CollectionUtils.isEmpty(metricDOS)) {
|
||||
metricResps = metricDOS.stream()
|
||||
.map(metricDO -> MetricConverter.convert2MetricResp(metricDO, modelMap))
|
||||
.map(metricDO -> MetricConverter.convert2MetricResp(metricDO, modelMap, collect))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
return metricResps;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendMetricEventBatch(List<Long> modelIds, EventType eventType) {
|
||||
MetricFilter metricFilter = new MetricFilter();
|
||||
metricFilter.setModelIds(modelIds);
|
||||
List<MetricDO> metricDOS = queryMetric(metricFilter);
|
||||
sendEventBatch(metricDOS, eventType);
|
||||
}
|
||||
|
||||
private void sendEventBatch(List<MetricDO> metricDOS, EventType eventType) {
|
||||
List<DataItem> dataItems = metricDOS.stream().map(this::getDataItem)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.tencent.supersonic.auth.api.authentication.service.UserService;
|
||||
import com.tencent.supersonic.common.pojo.ItemDateResp;
|
||||
import com.tencent.supersonic.common.pojo.ModelRela;
|
||||
import com.tencent.supersonic.common.pojo.enums.AuthType;
|
||||
import com.tencent.supersonic.common.pojo.enums.EventType;
|
||||
import com.tencent.supersonic.common.pojo.enums.StatusEnum;
|
||||
import com.tencent.supersonic.common.pojo.exception.InvalidArgumentException;
|
||||
import com.tencent.supersonic.common.util.JsonUtil;
|
||||
@@ -130,13 +131,32 @@ public class ModelServiceImpl implements ModelService {
|
||||
public ModelResp updateModel(ModelReq modelReq, User user) throws Exception {
|
||||
checkName(modelReq);
|
||||
ModelDO modelDO = modelRepository.getModelById(modelReq.getId());
|
||||
int oldStatus = modelDO.getStatus();
|
||||
ModelConverter.convert(modelDO, modelReq, user);
|
||||
modelRepository.updateModel(modelDO);
|
||||
batchCreateDimension(modelDO, user);
|
||||
batchCreateMetric(modelDO, user);
|
||||
statusPublish(oldStatus, modelDO);
|
||||
return ModelConverter.convert(modelDO);
|
||||
}
|
||||
|
||||
private void statusPublish(Integer oldStatus, ModelDO modelDO) {
|
||||
if (oldStatus.equals(modelDO.getStatus())) {
|
||||
return;
|
||||
}
|
||||
EventType eventType = null;
|
||||
if (oldStatus.equals(StatusEnum.ONLINE.getCode())
|
||||
&& modelDO.getStatus().equals(StatusEnum.OFFLINE.getCode())) {
|
||||
eventType = EventType.DELETE;
|
||||
} else if (oldStatus.equals(StatusEnum.OFFLINE.getCode())
|
||||
&& modelDO.getStatus().equals(StatusEnum.ONLINE.getCode())) {
|
||||
eventType = EventType.ADD;
|
||||
}
|
||||
log.info("model:{} status from {} to {}", modelDO.getId(), oldStatus, modelDO.getStatus());
|
||||
metricService.sendMetricEventBatch(Lists.newArrayList(modelDO.getId()), eventType);
|
||||
dimensionService.sendDimensionEventBatch(Lists.newArrayList(modelDO.getId()), eventType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ModelResp> getModelList(ModelFilter modelFilter) {
|
||||
return ModelConverter.convertList(modelRepository.getModelList(modelFilter));
|
||||
|
||||
@@ -40,8 +40,8 @@ public class ViewInfoServiceImpl {
|
||||
this.modelService = modelService;
|
||||
}
|
||||
|
||||
public List<ViewInfoDO> getViewInfoList(Long modelId) {
|
||||
return viewInfoRepository.getViewInfoList(modelId);
|
||||
public List<ViewInfoDO> getViewInfoList(Long domainId) {
|
||||
return viewInfoRepository.getViewInfoList(domainId);
|
||||
}
|
||||
|
||||
public List<ModelSchemaRelaResp> getDomainSchema(Long domainId) {
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.tencent.supersonic.semantic.model.domain;
|
||||
|
||||
import com.tencent.supersonic.auth.api.authentication.pojo.User;
|
||||
import com.tencent.supersonic.semantic.model.domain.dataobject.CollectDO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @author yannsu
|
||||
*/
|
||||
|
||||
public interface CollectService {
|
||||
|
||||
Boolean createCollectionIndicators(User user, Long id);
|
||||
|
||||
Boolean deleteCollectionIndicators(User user,Long id);
|
||||
|
||||
List<CollectDO> getCollectList(String username);
|
||||
|
||||
}
|
||||
@@ -3,6 +3,7 @@ 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.common.pojo.DataItem;
|
||||
import com.tencent.supersonic.common.pojo.enums.EventType;
|
||||
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.MetaBatchReq;
|
||||
@@ -32,9 +33,13 @@ public interface DimensionService {
|
||||
|
||||
void deleteDimension(Long id, User user);
|
||||
|
||||
List<DimensionResp> getDimensionInModelCluster(Long modelId);
|
||||
|
||||
List<DataItem> getDataItems(Long modelId);
|
||||
|
||||
List<String> mockAlias(DimensionReq dimensionReq, String mockType, User user);
|
||||
|
||||
List<DimValueMap> mockDimensionValueAlias(DimensionReq dimensionReq, User user);
|
||||
|
||||
void sendDimensionEventBatch(List<Long> modelIds, EventType eventType);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ 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.common.pojo.DataItem;
|
||||
import com.tencent.supersonic.common.pojo.enums.EventType;
|
||||
import com.tencent.supersonic.semantic.api.model.pojo.DrillDownDimension;
|
||||
import com.tencent.supersonic.semantic.api.model.request.MetaBatchReq;
|
||||
import com.tencent.supersonic.semantic.api.model.request.MetricReq;
|
||||
@@ -39,4 +40,6 @@ public interface MetricService {
|
||||
List<DrillDownDimension> getDrillDownDimension(Long metricId);
|
||||
|
||||
List<DataItem> getDataItems(Long modelId);
|
||||
|
||||
void sendMetricEventBatch(List<Long> modelIds, EventType eventType);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.tencent.supersonic.semantic.model.domain.dataobject;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 收藏项表
|
||||
* </p>
|
||||
*
|
||||
* @author yannsu
|
||||
* @since 2023-11-09 03:49:33
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@TableName("s2_collect")
|
||||
public class CollectDO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 收藏项ID
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 收藏的类型
|
||||
*/
|
||||
@TableField("type")
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 收藏人
|
||||
*/
|
||||
@TableField("username")
|
||||
private String username;
|
||||
|
||||
/**
|
||||
* 收藏ID
|
||||
*/
|
||||
@TableField("collect_id")
|
||||
private Long collectId;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(value = "create_time", fill = FieldFill.INSERT)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
|
||||
private LocalDateTime updateTime;
|
||||
}
|
||||
@@ -1,15 +1,22 @@
|
||||
package com.tencent.supersonic.semantic.model.domain.dataobject;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@TableName("s2_view_info")
|
||||
public class ViewInfoDO {
|
||||
/**
|
||||
*/
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
*/
|
||||
private Long modelId;
|
||||
private Long domainId;
|
||||
|
||||
/**
|
||||
* datasource、dimension、metric
|
||||
@@ -36,120 +43,4 @@ public class ViewInfoDO {
|
||||
* config detail
|
||||
*/
|
||||
private String config;
|
||||
|
||||
/**
|
||||
* @return id
|
||||
*/
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id
|
||||
*/
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return model_id
|
||||
*/
|
||||
public Long getModelId() {
|
||||
return modelId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param modelId
|
||||
*/
|
||||
public void setModelId(Long modelId) {
|
||||
this.modelId = modelId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ public class MetricConverter {
|
||||
return measureYamlTpl;
|
||||
}
|
||||
|
||||
public static MetricResp convert2MetricResp(MetricDO metricDO, Map<Long, ModelResp> modelMap) {
|
||||
public static MetricResp convert2MetricResp(MetricDO metricDO, Map<Long, ModelResp> modelMap, List<Long> collect) {
|
||||
MetricResp metricResp = new MetricResp();
|
||||
BeanUtils.copyProperties(metricDO, metricResp);
|
||||
metricResp.setTypeParams(JSONObject.parseObject(metricDO.getTypeParams(), MetricTypeParams.class));
|
||||
@@ -66,6 +66,11 @@ public class MetricConverter {
|
||||
metricResp.setModelName(modelResp.getName());
|
||||
metricResp.setDomainId(modelResp.getDomainId());
|
||||
}
|
||||
if (collect != null && collect.contains(metricDO.getId())){
|
||||
metricResp.setIsCollect(true);
|
||||
}else {
|
||||
metricResp.setIsCollect(false);
|
||||
}
|
||||
metricResp.setTag(metricDO.getTags());
|
||||
metricResp.setRelateDimension(JSONObject.parseObject(metricDO.getRelateDimensions(),
|
||||
RelateDimension.class));
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.tencent.supersonic.semantic.model.infrastructure.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.tencent.supersonic.semantic.model.domain.dataobject.CollectDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 收藏项表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author yannsu
|
||||
* @since 2023-11-09 03:49:33
|
||||
*/
|
||||
@Mapper
|
||||
public interface CollectMapper extends BaseMapper<CollectDO> {
|
||||
|
||||
}
|
||||
@@ -1,70 +1,10 @@
|
||||
package com.tencent.supersonic.semantic.model.infrastructure.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.tencent.supersonic.semantic.model.domain.dataobject.ViewInfoDO;
|
||||
import com.tencent.supersonic.semantic.model.domain.dataobject.ViewInfoDOExample;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface ViewInfoDOMapper {
|
||||
/**
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
long countByExample(ViewInfoDOExample example);
|
||||
public interface ViewInfoDOMapper extends BaseMapper<ViewInfoDO> {
|
||||
|
||||
/**
|
||||
*
|
||||
* @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);
|
||||
}
|
||||
@@ -1,13 +1,11 @@
|
||||
package com.tencent.supersonic.semantic.model.infrastructure.repository;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
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;
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
public class ViewInfoRepositoryImpl implements ViewInfoRepository {
|
||||
@@ -21,21 +19,21 @@ public class ViewInfoRepositoryImpl implements ViewInfoRepository {
|
||||
|
||||
@Override
|
||||
public List<ViewInfoDO> getViewInfoList(Long domainId) {
|
||||
ViewInfoDOExample viewInfoDOExample = new ViewInfoDOExample();
|
||||
viewInfoDOExample.createCriteria().andModelIdEqualTo(domainId);
|
||||
return viewInfoDOMapper.selectByExampleWithBLOBs(viewInfoDOExample);
|
||||
QueryWrapper<ViewInfoDO> wrapper = new QueryWrapper<>();
|
||||
wrapper.lambda().eq(ViewInfoDO::getDomainId, domainId);
|
||||
return viewInfoDOMapper.selectList(wrapper);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ViewInfoDO getViewInfoById(Long id) {
|
||||
return viewInfoDOMapper.selectByPrimaryKey(id);
|
||||
return viewInfoDOMapper.selectById(id);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void deleteViewInfo(Long id) {
|
||||
viewInfoDOMapper.deleteByPrimaryKey(id);
|
||||
viewInfoDOMapper.deleteById(id);
|
||||
}
|
||||
|
||||
|
||||
@@ -47,7 +45,7 @@ public class ViewInfoRepositoryImpl implements ViewInfoRepository {
|
||||
|
||||
@Override
|
||||
public void updateViewInfo(ViewInfoDO viewInfoDO) {
|
||||
viewInfoDOMapper.updateByPrimaryKeyWithBLOBs(viewInfoDO);
|
||||
viewInfoDOMapper.updateById(viewInfoDO);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
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.model.domain.CollectService;
|
||||
import com.tencent.supersonic.semantic.model.domain.dataobject.CollectDO;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
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;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/***
|
||||
* 创建收藏指标的逻辑
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/api/semantic/collect")
|
||||
public class CollectController {
|
||||
|
||||
|
||||
private CollectService collectService;
|
||||
|
||||
public CollectController(CollectService collectService) {
|
||||
this.collectService = collectService;
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/createCollectionIndicators")
|
||||
public boolean createCollectionIndicators(@RequestBody CollectDO collectDO,
|
||||
HttpServletRequest request,
|
||||
HttpServletResponse response) {
|
||||
User user = UserHolder.findUser(request, response);
|
||||
return collectService.createCollectionIndicators(user, collectDO.getId());
|
||||
}
|
||||
|
||||
|
||||
@DeleteMapping("/deleteCollectionIndicators/{id}")
|
||||
public boolean deleteCollectionIndicators(@PathVariable Long id,
|
||||
HttpServletRequest request,
|
||||
HttpServletResponse response) {
|
||||
User user = UserHolder.findUser(request, response);
|
||||
return collectService.deleteCollectionIndicators(user,id);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -11,11 +11,6 @@ import com.tencent.supersonic.semantic.api.model.request.MetaBatchReq;
|
||||
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.pojo.DimensionFilter;
|
||||
import com.tencent.supersonic.semantic.model.domain.pojo.MetaFilter;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
@@ -26,6 +21,10 @@ import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/semantic/dimension")
|
||||
@@ -95,6 +94,11 @@ public class DimensionController {
|
||||
return dimensionService.getDimensions(dimensionFilter);
|
||||
}
|
||||
|
||||
@GetMapping("/getDimensionInModelCluster/{modelId}")
|
||||
public List<DimensionResp> getDimensionInModelCluster(@PathVariable("modelId") Long modelId) {
|
||||
return dimensionService.getDimensionInModelCluster(modelId);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/{modelId}/{dimensionName}")
|
||||
public DimensionResp getDimensionDescByNameAndId(@PathVariable("modelId") Long modelId,
|
||||
|
||||
@@ -37,9 +37,9 @@ public class ViewInfoController {
|
||||
return viewInfoServiceImpl.createOrUpdateViewInfo(viewInfoReq, user);
|
||||
}
|
||||
|
||||
@GetMapping("/getViewInfoList/{modelId}")
|
||||
public List<ViewInfoDO> getViewInfoList(@PathVariable("modelId") Long modelId) {
|
||||
return viewInfoServiceImpl.getViewInfoList(modelId);
|
||||
@GetMapping("/getViewInfoList/{domainId}")
|
||||
public List<ViewInfoDO> getViewInfoList(@PathVariable("domainId") Long domainId) {
|
||||
return viewInfoServiceImpl.getViewInfoList(domainId);
|
||||
}
|
||||
|
||||
@DeleteMapping("/deleteViewInfo/{id}")
|
||||
|
||||
@@ -1,213 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.tencent.supersonic.semantic.model.infrastructure.mapper.ViewInfoDOMapper">
|
||||
<resultMap id="BaseResultMap" type="com.tencent.supersonic.semantic.model.domain.dataobject.ViewInfoDO">
|
||||
<id column="id" jdbcType="BIGINT" property="id" />
|
||||
<result column="model_id" jdbcType="BIGINT" property="modelId" />
|
||||
<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.ViewInfoDO">
|
||||
<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, model_id, 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.ViewInfoDOExample" resultMap="ResultMapWithBLOBs">
|
||||
select
|
||||
<if test="distinct">
|
||||
distinct
|
||||
</if>
|
||||
<include refid="Base_Column_List" />
|
||||
,
|
||||
<include refid="Blob_Column_List" />
|
||||
from s2_view_info
|
||||
<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.ViewInfoDOExample" resultMap="BaseResultMap">
|
||||
select
|
||||
<if test="distinct">
|
||||
distinct
|
||||
</if>
|
||||
<include refid="Base_Column_List" />
|
||||
from s2_view_info
|
||||
<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_view_info
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</select>
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
|
||||
delete from s2_view_info
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</delete>
|
||||
<insert id="insert" parameterType="com.tencent.supersonic.semantic.model.domain.dataobject.ViewInfoDO">
|
||||
insert into s2_view_info (id, model_id, type,
|
||||
created_at, created_by, updated_at,
|
||||
updated_by, config)
|
||||
values (#{id,jdbcType=BIGINT}, #{modelId,jdbcType=BIGINT}, #{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.ViewInfoDO">
|
||||
insert into s2_view_info
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
id,
|
||||
</if>
|
||||
<if test="modelId != null">
|
||||
model_id,
|
||||
</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="modelId != null">
|
||||
#{modelId,jdbcType=BIGINT},
|
||||
</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.ViewInfoDOExample" resultType="java.lang.Long">
|
||||
select count(*) from s2_view_info
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
</select>
|
||||
<update id="updateByPrimaryKeySelective" parameterType="com.tencent.supersonic.semantic.model.domain.dataobject.ViewInfoDO">
|
||||
update s2_view_info
|
||||
<set>
|
||||
<if test="modelId != null">
|
||||
model_id = #{modelId,jdbcType=BIGINT},
|
||||
</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.ViewInfoDO">
|
||||
update s2_view_info
|
||||
set model_id = #{modelId,jdbcType=BIGINT},
|
||||
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.ViewInfoDO">
|
||||
update s2_view_info
|
||||
set model_id = #{modelId,jdbcType=BIGINT},
|
||||
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>
|
||||
@@ -42,6 +42,7 @@ import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
@@ -65,7 +66,7 @@ public class DownloadServiceImpl implements DownloadService {
|
||||
List<List<String>> data = new ArrayList<>();
|
||||
List<List<String>> header = org.assertj.core.util.Lists.newArrayList();
|
||||
for (QueryColumn column : queryResultWithSchemaResp.getColumns()) {
|
||||
header.add(org.assertj.core.util.Lists.newArrayList(column.getName()));
|
||||
header.add(Lists.newArrayList(column.getName()));
|
||||
}
|
||||
for (Map<String, Object> row : queryResultWithSchemaResp.getResultList()) {
|
||||
List<String> rowData = new ArrayList<>();
|
||||
@@ -212,6 +213,8 @@ public class DownloadServiceImpl implements DownloadService {
|
||||
|
||||
private QueryResultWithSchemaResp getQueryResult(List<DimSchemaResp> dimensionResps, MetricResp metricResp,
|
||||
DateConf dateConf, User user) throws Exception {
|
||||
Set<Long> modelIds = dimensionResps.stream().map(DimSchemaResp::getModelId).collect(Collectors.toSet());
|
||||
modelIds.add(metricResp.getModelId());
|
||||
QueryStructReq queryStructReq = new QueryStructReq();
|
||||
queryStructReq.setGroups(dimensionResps.stream().map(DimSchemaResp::getBizName).collect(Collectors.toList()));
|
||||
queryStructReq.getGroups().add(0, getTimeDimension(dateConf));
|
||||
@@ -219,7 +222,7 @@ public class DownloadServiceImpl implements DownloadService {
|
||||
aggregator.setColumn(metricResp.getBizName());
|
||||
queryStructReq.setAggregators(Lists.newArrayList(aggregator));
|
||||
queryStructReq.setDateInfo(dateConf);
|
||||
queryStructReq.setModelId(metricResp.getModelId());
|
||||
queryStructReq.setModelIds(modelIds);
|
||||
queryStructReq.setLimit(10000L);
|
||||
return queryService.queryByStructWithAuth(queryStructReq, user);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user