mirror of
https://github.com/dataease/dataease.git
synced 2026-05-20 02:58:10 +08:00
Merge remote-tracking branch 'origin/main' into main
# Conflicts: # frontend/src/components/canvas/custom-component/UserView.vue
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
package io.dataease.controller.panel.api;
|
||||
|
||||
|
||||
import io.dataease.base.domain.ChartView;
|
||||
import io.dataease.controller.sys.base.BaseGridRequest;
|
||||
import io.dataease.dto.panel.PanelViewDto;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
@@ -20,6 +22,11 @@ public interface ViewApi {
|
||||
List<PanelViewDto> tree(BaseGridRequest request);
|
||||
|
||||
|
||||
@ApiOperation("根据仪表板Id查询视图")
|
||||
@PostMapping("/viewsWithIds")
|
||||
List<ChartView> viewsWithIds(List<String> viewIds);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
package io.dataease.controller.panel.server;
|
||||
|
||||
import io.dataease.base.domain.ChartView;
|
||||
import io.dataease.commons.utils.AuthUtils;
|
||||
import io.dataease.controller.panel.api.ViewApi;
|
||||
import io.dataease.controller.sys.base.BaseGridRequest;
|
||||
import io.dataease.controller.sys.base.ConditionEntity;
|
||||
import io.dataease.dto.panel.PanelViewDto;
|
||||
import io.dataease.dto.panel.po.PanelViewPo;
|
||||
import io.dataease.service.chart.ChartViewService;
|
||||
import io.dataease.service.panel.PanelViewService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@@ -20,6 +23,9 @@ public class ViewServer implements ViewApi {
|
||||
@Autowired
|
||||
private PanelViewService panelViewService;
|
||||
|
||||
@Autowired
|
||||
private ChartViewService chartViewService;
|
||||
|
||||
/**
|
||||
* 为什么查两次?
|
||||
* 因为left join 会导致全表扫描
|
||||
@@ -40,4 +46,10 @@ public class ViewServer implements ViewApi {
|
||||
List<PanelViewDto> panelViewDtos = panelViewService.buildTree(groups, views);
|
||||
return panelViewDtos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ChartView> viewsWithIds(@RequestBody List<String> viewIds) {
|
||||
|
||||
return chartViewService.viewsByIds(viewIds);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -170,7 +170,11 @@ public class ChartViewService {
|
||||
x.add(a.toString());
|
||||
for (int i = xAxis.size(); i < xAxis.size() + yAxis.size(); i++) {
|
||||
int j = i - xAxis.size();
|
||||
series.get(j).getData().add(new BigDecimal(StringUtils.isEmpty(d[i]) ? "0" : d[i]));
|
||||
try {
|
||||
series.get(j).getData().add(new BigDecimal(StringUtils.isEmpty(d[i]) ? "0" : d[i]));
|
||||
} catch (Exception e) {
|
||||
series.get(j).getData().add(new BigDecimal(0));
|
||||
}
|
||||
}
|
||||
}
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
@@ -316,4 +320,10 @@ public class ChartViewService {
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
public List<ChartView> viewsByIds(List<String> viewIds){
|
||||
ChartViewExample example = new ChartViewExample();
|
||||
example.createCriteria().andIdIn(viewIds);
|
||||
return chartViewMapper.selectByExample(example);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user