diff --git a/core/core-backend/pom.xml b/core/core-backend/pom.xml index f648cd5038..922e1ac258 100644 --- a/core/core-backend/pom.xml +++ b/core/core-backend/pom.xml @@ -117,6 +117,16 @@ + + io.dataease + xpack-permissions + ${project.version} + + + io.dataease + xpack-base + ${project.version} + com.h2database h2 diff --git a/core/core-backend/src/main/java/io/dataease/MybatisPlusGenerator.java b/core/core-backend/src/main/java/io/dataease/MybatisPlusGenerator.java index 2c7d9c5aa8..3e5d0ddc25 100644 --- a/core/core-backend/src/main/java/io/dataease/MybatisPlusGenerator.java +++ b/core/core-backend/src/main/java/io/dataease/MybatisPlusGenerator.java @@ -14,18 +14,18 @@ public class MybatisPlusGenerator { * 第一 我嫌麻烦 * 第二 后面配置会放到nacos读起来更麻烦了 */ - private static final String url = "jdbc:mysql://localhost:3306/de_standalone?autoReconnect=false&useUnicode=true&characterEncoding=UTF-8&characterSetResults=UTF-8&zeroDateTimeBehavior=convertToNull&useSSL=false"; + private static final String url = "jdbc:mysql://localhost:3306/dataease?autoReconnect=false&useUnicode=true&characterEncoding=UTF-8&characterSetResults=UTF-8&zeroDateTimeBehavior=convertToNull&useSSL=false"; private static final String username = "root"; - private static final String password = "Password123@mysql"; + private static final String password = "123456"; /** * 业务模块例如datasource,dataset,panel等 */ - private static final String busi = "share"; + private static final String busi = "visualization"; /** * 这是要生成代码的表名称 */ - private static final String TABLE_NAME = "xpack_share"; + private static final String TABLE_NAME = "visualization_report_filter"; /** * 下面两个配置基本上不用动 diff --git a/core/core-backend/src/main/java/io/dataease/commons/constants/DataVisualizationConstants.java b/core/core-backend/src/main/java/io/dataease/commons/constants/DataVisualizationConstants.java index 19cc6e310c..8be7710b92 100644 --- a/core/core-backend/src/main/java/io/dataease/commons/constants/DataVisualizationConstants.java +++ b/core/core-backend/src/main/java/io/dataease/commons/constants/DataVisualizationConstants.java @@ -2,6 +2,16 @@ package io.dataease.commons.constants; public class DataVisualizationConstants { + //新建仪表板来源 + public static final class QUERY_SOURCE { + + // 定时报告 + public static final String REPORT = "report"; + + // 主工程 + public static final String MAIN = "main"; + } + //新建仪表板来源 public static final class NEW_PANEL_FROM { diff --git a/core/core-backend/src/main/java/io/dataease/visualization/dao/ext/mapper/ExtDataVisualizationMapper.java b/core/core-backend/src/main/java/io/dataease/visualization/dao/ext/mapper/ExtDataVisualizationMapper.java index d823ec0db2..bc2bda435a 100644 --- a/core/core-backend/src/main/java/io/dataease/visualization/dao/ext/mapper/ExtDataVisualizationMapper.java +++ b/core/core-backend/src/main/java/io/dataease/visualization/dao/ext/mapper/ExtDataVisualizationMapper.java @@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import io.dataease.api.visualization.dto.VisualizationViewTableDTO; import io.dataease.api.visualization.vo.DataVisualizationBaseVO; import io.dataease.api.visualization.vo.DataVisualizationVO; +import io.dataease.api.visualization.vo.VisualizationReportFilterVO; import io.dataease.api.visualization.vo.VisualizationResourceVO; import io.dataease.chart.dao.auto.entity.CoreChartView; import io.dataease.visualization.dao.ext.po.StorePO; @@ -48,5 +49,7 @@ public interface ExtDataVisualizationMapper { List getVisualizationViewDetails(@Param("dvId") Long dvId); + List queryReportFilter(@Param("dvId") Long dvId,@Param("reportId") Long reportId); + } diff --git a/core/core-backend/src/main/java/io/dataease/visualization/server/DataVisualizationServer.java b/core/core-backend/src/main/java/io/dataease/visualization/server/DataVisualizationServer.java index 275494ddda..3143814dd4 100644 --- a/core/core-backend/src/main/java/io/dataease/visualization/server/DataVisualizationServer.java +++ b/core/core-backend/src/main/java/io/dataease/visualization/server/DataVisualizationServer.java @@ -2,6 +2,7 @@ package io.dataease.visualization.server; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; +import io.dataease.api.visualization.vo.VisualizationReportFilterVO; import io.dataease.extensions.view.dto.ChartViewDTO; import io.dataease.api.template.dto.TemplateManageFileDTO; import io.dataease.api.template.dto.VisualizationTemplateExtendDataDTO; @@ -35,6 +36,7 @@ import io.dataease.utils.*; import io.dataease.visualization.dao.auto.entity.DataVisualizationInfo; import io.dataease.visualization.dao.auto.entity.VisualizationWatermark; import io.dataease.visualization.dao.auto.mapper.DataVisualizationInfoMapper; +import io.dataease.visualization.dao.auto.mapper.VisualizationReportFilterMapper; import io.dataease.visualization.dao.auto.mapper.VisualizationWatermarkMapper; import io.dataease.visualization.dao.ext.mapper.ExtDataVisualizationMapper; import io.dataease.visualization.manage.CoreVisualizationManage; @@ -90,9 +92,12 @@ public class DataVisualizationServer implements DataVisualizationApi { @Resource private VisualizationWatermarkMapper watermarkMapper; + @Resource + private VisualizationReportFilterMapper reportFilterMapper; + @Override public DataVisualizationVO findCopyResource(Long dvId, String busiFlag) { - DataVisualizationVO result = findById(dvId, busiFlag); + DataVisualizationVO result = findById(new DataVisualizationBaseRequest(dvId, busiFlag)); if (result != null && result.getPid() == -1) { return result; } else { @@ -100,10 +105,12 @@ public class DataVisualizationServer implements DataVisualizationApi { } } - @DeLog(id = "#p0", ot = LogOT.READ, stExp = "#p1") + @DeLog(id = "#p0.id", ot = LogOT.READ, stExp = "#p0.busiFlag") @Override @XpackInteract(value = "dataVisualizationServer", original = true) - public DataVisualizationVO findById(Long dvId, String busiFlag) { + public DataVisualizationVO findById(DataVisualizationBaseRequest request) { + Long dvId = request.getId(); + String busiFlag = request.getBusiFlag(); DataVisualizationVO result = extDataVisualizationMapper.findDvInfo(dvId, busiFlag); if (result != null) { //获取图表信息 @@ -116,6 +123,16 @@ public class DataVisualizationServer implements DataVisualizationApi { VisualizationWatermarkVO watermarkVO = new VisualizationWatermarkVO(); BeanUtils.copyBean(watermarkVO, watermark); result.setWatermarkInfo(watermarkVO); + + if(DataVisualizationConstants.QUERY_SOURCE.REPORT.equals(request.getSource()) && request.getReportId() != null){ + //获取定时报告过自定义过滤组件信息 + List filterVOS = extDataVisualizationMapper.queryReportFilter(dvId,request.getReportId()); + if (!CollectionUtils.isEmpty(filterVOS)) { + Map reportFilterInfo = filterVOS.stream().collect(Collectors.toMap(VisualizationReportFilterVO::getFilterId, filterVo ->filterVo)); + result.setReportFilterInfo(reportFilterInfo); + } + } + return result; } else { DEException.throwException("资源不存在或已经被删除..."); diff --git a/core/core-backend/src/main/resources/mybatis/ExtDataVisualizationMapper.xml b/core/core-backend/src/main/resources/mybatis/ExtDataVisualizationMapper.xml index 76729f21a3..55958b2a87 100644 --- a/core/core-backend/src/main/resources/mybatis/ExtDataVisualizationMapper.xml +++ b/core/core-backend/src/main/resources/mybatis/ExtDataVisualizationMapper.xml @@ -403,4 +403,20 @@ WHERE core_chart_view.scene_id = #{dvId} AND core_chart_view.id IS NOT NULL and core_chart_view.`type` != 'VQuery' + + diff --git a/core/core-frontend/src/api/visualization/dataVisualization.ts b/core/core-frontend/src/api/visualization/dataVisualization.ts index d5f3d71fe7..3998639690 100644 --- a/core/core-frontend/src/api/visualization/dataVisualization.ts +++ b/core/core-frontend/src/api/visualization/dataVisualization.ts @@ -20,14 +20,15 @@ export const findCopyResource = async (dvId, busiFlag): Promise => { return request.get({ url: '/dataVisualization/findCopyResource/' + dvId + '/' + busiFlag }) } -export const findById = async (dvId, busiFlag): Promise => { +export const findById = async (dvId, busiFlag, source = 'main'): Promise => { let busiFlagResult = busiFlag if (!busiFlagResult) { await findDvType(dvId).then(res => { busiFlagResult = res.data }) } - return request.get({ url: '/dataVisualization/findById/' + dvId + '/' + busiFlagResult }) + const data = { id: dvId, busiFlag: busiFlagResult, source } + return request.post({ url: '/dataVisualization/findById', data }) } export const queryTreeApi = async (data: BusiTreeRequest): Promise => {