diff --git a/backend/src/main/java/io/dataease/commons/utils/HttpClientUtil.java b/backend/src/main/java/io/dataease/commons/utils/HttpClientUtil.java index d0faaf8d2a..39a383a0ec 100755 --- a/backend/src/main/java/io/dataease/commons/utils/HttpClientUtil.java +++ b/backend/src/main/java/io/dataease/commons/utils/HttpClientUtil.java @@ -123,7 +123,6 @@ public class HttpClientUtil { EntityBuilder entityBuilder = EntityBuilder.create(); entityBuilder.setText(json); entityBuilder.setContentType(ContentType.APPLICATION_JSON); - entityBuilder.setContentEncoding(config.getCharset()); HttpEntity requestEntity = entityBuilder.build(); httpPost.setEntity(requestEntity); diff --git a/backend/src/main/java/io/dataease/controller/datasource/DatasourceController.java b/backend/src/main/java/io/dataease/controller/datasource/DatasourceController.java index 0103a5398c..281466dbbd 100644 --- a/backend/src/main/java/io/dataease/controller/datasource/DatasourceController.java +++ b/backend/src/main/java/io/dataease/controller/datasource/DatasourceController.java @@ -1,6 +1,8 @@ package io.dataease.controller.datasource; import com.github.xiaoymin.knife4j.annotations.ApiSupport; +import com.google.common.reflect.TypeToken; +import com.google.gson.Gson; import io.dataease.auth.annotation.DeLog; import io.dataease.auth.annotation.DePermission; import io.dataease.commons.constants.DePermissionType; @@ -27,6 +29,7 @@ import springfox.documentation.annotations.ApiIgnore; import javax.annotation.Resource; import java.util.Collection; import java.util.List; +import java.util.Map; import java.util.stream.Collectors; @Api(tags = "数据源:数据源管理") @@ -135,7 +138,9 @@ public class DatasourceController { @ApiIgnore @PostMapping("/checkApiDatasource") - public ApiDefinition checkApiDatasource(@RequestBody ApiDefinition apiDefinition) throws Exception { + public ApiDefinition checkApiDatasource(@RequestBody Map data) throws Exception { + ApiDefinition apiDefinition = new Gson().fromJson(new String(java.util.Base64.getDecoder().decode(data.get("data"))), new TypeToken() { + }.getType()); return datasourceService.checkApiDatasource(apiDefinition); } diff --git a/backend/src/main/java/io/dataease/controller/panel/PanelGroupController.java b/backend/src/main/java/io/dataease/controller/panel/PanelGroupController.java index 28bb812286..dbe2e68035 100644 --- a/backend/src/main/java/io/dataease/controller/panel/PanelGroupController.java +++ b/backend/src/main/java/io/dataease/controller/panel/PanelGroupController.java @@ -14,6 +14,7 @@ import io.dataease.dto.PermissionProxy; import io.dataease.dto.authModel.VAuthModelDTO; import io.dataease.dto.panel.PanelExport2App; import io.dataease.dto.panel.PanelGroupDTO; +import io.dataease.plugins.common.base.domain.PanelGroup; import io.dataease.service.panel.PanelGroupService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -50,6 +51,12 @@ public class PanelGroupController { return panelGroupService.tree(request); } + @ApiOperation("查询当前用户仪表板") + @GetMapping("/list") + public List list() { + return panelGroupService.list(); + } + @ApiOperation("默认树") @PostMapping("/defaultTree") public List defaultTree(@RequestBody PanelGroupRequest request) { diff --git a/backend/src/main/java/io/dataease/controller/request/panel/PanelViewDetailsRequest.java b/backend/src/main/java/io/dataease/controller/request/panel/PanelViewDetailsRequest.java index 2523167f11..dc2293f938 100644 --- a/backend/src/main/java/io/dataease/controller/request/panel/PanelViewDetailsRequest.java +++ b/backend/src/main/java/io/dataease/controller/request/panel/PanelViewDetailsRequest.java @@ -20,7 +20,7 @@ public class PanelViewDetailsRequest { private Integer[] excelTypes; - private List details; + private List details; private String snapshot; @@ -28,6 +28,6 @@ public class PanelViewDetailsRequest { private int snapshotHeight; - + private ViewDetailField[] detailFields; } diff --git a/backend/src/main/java/io/dataease/controller/request/panel/ViewDetailField.java b/backend/src/main/java/io/dataease/controller/request/panel/ViewDetailField.java new file mode 100644 index 0000000000..e3293f3bb0 --- /dev/null +++ b/backend/src/main/java/io/dataease/controller/request/panel/ViewDetailField.java @@ -0,0 +1,15 @@ +package io.dataease.controller.request.panel; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class ViewDetailField implements Serializable { + + private String name; + + private String dataeaseName; + + private Integer deType; +} diff --git a/backend/src/main/java/io/dataease/ext/ExtChartViewMapper.xml b/backend/src/main/java/io/dataease/ext/ExtChartViewMapper.xml index 8e5db11c37..45809e80bf 100644 --- a/backend/src/main/java/io/dataease/ext/ExtChartViewMapper.xml +++ b/backend/src/main/java/io/dataease/ext/ExtChartViewMapper.xml @@ -58,7 +58,8 @@ data_from, refresh_view_enable, refresh_unit, - refresh_time) + refresh_time, + view_fields) SELECT id, `name`, title, @@ -89,7 +90,8 @@ data_from, refresh_view_enable, refresh_unit, - refresh_time + refresh_time, + view_fields from chart_view WHERE chart_view.id = #{id} @@ -306,7 +308,8 @@ `chart_type`, `is_plugin`, `senior`, - `data_from`) + `data_from`, + `view_fields`) SELECT #{newChartId}, GET_CHART_VIEW_COPY_NAME(#{oldChartId}, #{panelId}) as `name`, #{panelId}, @@ -334,7 +337,8 @@ 'private', `is_plugin`, `senior`, - `data_from` + `data_from`, + `view_fields` FROM chart_view WHERE id = #{oldChartId} @@ -521,7 +525,8 @@ cv.data_from = cve.data_from, cv.refresh_view_enable = cve.refresh_view_enable, cv.refresh_unit = cve.refresh_unit, - cv.refresh_time = cve.refresh_time + cv.refresh_time = cve.refresh_time, + cv.view_fields = cve.view_fields where cve.id = cv.id and cv.id in #{viewId} @@ -560,7 +565,8 @@ cv.data_from = cve.data_from, cv.refresh_view_enable = cve.refresh_view_enable, cv.refresh_unit = cve.refresh_unit, - cv.refresh_time = cve.refresh_time + cv.refresh_time = cve.refresh_time, + cv.view_fields = cve.view_fields where cve.id = cv.id and cv.id =#{viewId} diff --git a/backend/src/main/java/io/dataease/ext/ExtPanelGroupMapper.java b/backend/src/main/java/io/dataease/ext/ExtPanelGroupMapper.java index 68d10de928..30dbcd2c75 100644 --- a/backend/src/main/java/io/dataease/ext/ExtPanelGroupMapper.java +++ b/backend/src/main/java/io/dataease/ext/ExtPanelGroupMapper.java @@ -3,6 +3,7 @@ package io.dataease.ext; import io.dataease.controller.request.panel.PanelGroupRequest; import io.dataease.dto.RelationDTO; import io.dataease.dto.panel.PanelGroupDTO; +import io.dataease.plugins.common.base.domain.PanelGroup; import org.apache.ibatis.annotations.Param; import java.util.List; @@ -30,4 +31,6 @@ public interface ExtPanelGroupMapper { List panelGroupInit(); List queryPanelRelation(@Param("panelId") String panelId, @Param("userId") Long userId); + + List listPanelByUser(@Param("userId") long userId); } diff --git a/backend/src/main/java/io/dataease/ext/ExtPanelGroupMapper.xml b/backend/src/main/java/io/dataease/ext/ExtPanelGroupMapper.xml index d172a7e8f4..4c6343e5e3 100644 --- a/backend/src/main/java/io/dataease/ext/ExtPanelGroupMapper.xml +++ b/backend/src/main/java/io/dataease/ext/ExtPanelGroupMapper.xml @@ -320,4 +320,38 @@ where pg.id=#{panelId,jdbcType=VARCHAR} group by dt.id + + diff --git a/backend/src/main/java/io/dataease/ext/ExtPanelLinkJumpMapper.xml b/backend/src/main/java/io/dataease/ext/ExtPanelLinkJumpMapper.xml index 47c0df8a6a..a0e492ad34 100644 --- a/backend/src/main/java/io/dataease/ext/ExtPanelLinkJumpMapper.xml +++ b/backend/src/main/java/io/dataease/ext/ExtPanelLinkJumpMapper.xml @@ -9,11 +9,13 @@ - + - + @@ -27,230 +29,244 @@ - - - DELETE ljtv - FROM - panel_link_jump_target_view_info ljtv, - panel_link_jump_info lji, - panel_link_jump lj - WHERE - ljtv.link_jump_info_id = lji.id - AND lji.link_jump_id = lj.id - AND lj.source_panel_id = #{panelId} - AND lj.source_view_id = #{viewId} - - - - DELETE lji - FROM - panel_link_jump_info lji, - panel_link_jump lj - WHERE - lji.link_jump_id = lj.id - AND lj.source_panel_id = #{panelId} - AND lj.source_view_id = #{viewId} - - - - DELETE lj - FROM - panel_link_jump lj - WHERE - lj.source_panel_id = #{panelId} - AND lj.source_view_id = #{viewId} - - - - - - DELETE ljtv - FROM - panel_link_jump_target_view_info ljtv, - panel_link_jump_info lji, - panel_link_jump lj - WHERE - ljtv.link_jump_info_id = lji.id - AND lji.link_jump_id = lj.id - AND (lj.source_panel_id = #{panelId} or lji.target_panel_id = #{panelId}) - - - - DELETE lji - FROM - panel_link_jump_info lji, - panel_link_jump lj - WHERE - lji.link_jump_id = lj.id - AND (lj.source_panel_id = #{panelId} or lji.target_panel_id = #{panelId}) - - - - DELETE lj - FROM - panel_link_jump lj - WHERE - lj.source_panel_id = #{panelId} - - - - - insert into panel_link_jump (id, source_panel_id, source_view_id, link_jump_info, `checked`, copy_from, copy_id) - select - UUID() as id, - panel_view_copy.t_panel_id as source_panel_id, - panel_view_copy.t_chart_view_id as source_view_id, - panel_link_jump.link_jump_info, - panel_link_jump.checked, - panel_link_jump.id as copy_from, - #{copyId} as copy_id - from panel_link_jump inner join - (SELECT - pvs.panel_id as s_panel_id, - pvs.chart_view_id as s_chart_view_id, - pvt.panel_id as t_panel_id, - pvt.chart_view_id as t_chart_view_id + + DELETE + ljtv FROM - panel_view pvt - inner JOIN panel_view pvs ON pvt.copy_from = pvs.id - WHERE - pvt.copy_id = #{copyId}) panel_view_copy on panel_link_jump.source_panel_id = panel_view_copy.s_panel_id - and panel_link_jump.source_view_id = panel_view_copy.s_chart_view_id - + panel_link_jump_target_view_info ljtv, + panel_link_jump_info lji, + panel_link_jump lj + WHERE + ljtv.link_jump_info_id = lji.id + AND lji.link_jump_id = lj.id + AND lj.source_panel_id = + #{panelId} + AND + lj + . + source_view_id + = + #{viewId} + + + + DELETE + lji + FROM + panel_link_jump_info lji, + panel_link_jump lj + WHERE + lji.link_jump_id = lj.id + AND lj.source_panel_id = + #{panelId} + AND + lj + . + source_view_id + = + #{viewId} + + + + DELETE + lj + FROM + panel_link_jump lj + WHERE + lj.source_panel_id = + #{panelId} + AND + lj + . + source_view_id + = + #{viewId} + + + + + DELETE + ljtv + FROM + panel_link_jump_target_view_info ljtv, + panel_link_jump_info lji, + panel_link_jump lj + WHERE + ljtv.link_jump_info_id = lji.id + AND lji.link_jump_id = lj.id + AND (lj.source_panel_id = + #{panelId} + or + lji + . + target_panel_id + = + #{panelId} + ) + + + + DELETE + lji + FROM + panel_link_jump_info lji, + panel_link_jump lj + WHERE + lji.link_jump_id = lj.id + AND (lj.source_panel_id = + #{panelId} + or + lji + . + target_panel_id + = + #{panelId} + ) + + + + DELETE + lj + FROM + panel_link_jump lj + WHERE + lj.source_panel_id = + #{panelId} + + + + + + insert into panel_link_jump (id, source_panel_id, source_view_id, link_jump_info, `checked`, copy_from, copy_id) + select UUID() as id, + panel_view_copy.t_panel_id as source_panel_id, + panel_view_copy.t_chart_view_id as source_view_id, + panel_link_jump.link_jump_info, + panel_link_jump.checked, + panel_link_jump.id as copy_from, + #{copyId} as copy_id + from panel_link_jump + inner join + (SELECT pvs.panel_id as s_panel_id, + pvs.chart_view_id as s_chart_view_id, + pvt.panel_id as t_panel_id, + pvt.chart_view_id as t_chart_view_id + FROM panel_view pvt + inner JOIN panel_view pvs ON pvt.copy_from = pvs.id + WHERE pvt.copy_id = #{copyId}) panel_view_copy + on panel_link_jump.source_panel_id = panel_view_copy.s_panel_id + and panel_link_jump.source_view_id = panel_view_copy.s_chart_view_id + - INSERT INTO panel_link_jump_info ( - id, - link_jump_id, - link_type, - jump_type, - target_panel_id, - source_field_id, - content, - `checked`, - `attach_params`, - copy_from, - copy_id - ) SELECT - uuid() AS id, - plj_copy.t_id, - link_type, - jump_type, - target_panel_id, - source_field_id, - content, - `checked`, - `attach_params`, - id AS copy_from, - #{copyId} - FROM - panel_link_jump_info - inner JOIN ( - SELECT - id AS t_id, - copy_from AS s_id - FROM - panel_link_jump - WHERE - copy_id = #{copyId} - ) plj_copy ON panel_link_jump_info.link_jump_id = plj_copy.s_id + INSERT INTO panel_link_jump_info (id, + link_jump_id, + link_type, + jump_type, + target_panel_id, + source_field_id, + content, + `checked`, + `attach_params`, + copy_from, + copy_id) + SELECT uuid() AS id, + plj_copy.t_id, + link_type, + jump_type, + target_panel_id, + source_field_id, + content, + `checked`, + `attach_params`, + id AS copy_from, + #{copyId} + FROM panel_link_jump_info + inner JOIN (SELECT id AS t_id, + copy_from AS s_id + FROM panel_link_jump + WHERE copy_id = #{copyId}) plj_copy ON panel_link_jump_info.link_jump_id = plj_copy.s_id - - INSERT INTO panel_link_jump_target_view_info ( - target_id, - link_jump_info_id, - target_view_id, - target_field_id, - copy_from, - copy_id - ) SELECT - uuid() AS id, - plji_copy.t_id AS link_jump_info_id, - target_view_id, - target_field_id, - copy_from, - #{copyId} AS copy_id - FROM - panel_link_jump_target_view_info - inner JOIN ( - SELECT - id AS t_id, - copy_from AS s_id - FROM - panel_link_jump_info - WHERE - copy_id = #{copyId} - ) plji_copy ON panel_link_jump_target_view_info.link_jump_info_id = plji_copy.s_id + + INSERT INTO panel_link_jump_target_view_info (target_id, + link_jump_info_id, + target_view_id, + target_field_id, + copy_from, + copy_id) + SELECT uuid() AS id, + plji_copy.t_id AS link_jump_info_id, + target_view_id, + target_field_id, + copy_from, + #{copyId} AS copy_id + FROM panel_link_jump_target_view_info + inner JOIN (SELECT id AS t_id, + copy_from AS s_id + FROM panel_link_jump_info + WHERE copy_id = #{copyId}) plji_copy + ON panel_link_jump_target_view_info.link_jump_info_id = plji_copy.s_id diff --git a/backend/src/main/java/io/dataease/plugins/config/PluginRunner.java b/backend/src/main/java/io/dataease/plugins/config/PluginRunner.java index db6abc5044..6fa4b9267c 100644 --- a/backend/src/main/java/io/dataease/plugins/config/PluginRunner.java +++ b/backend/src/main/java/io/dataease/plugins/config/PluginRunner.java @@ -6,6 +6,7 @@ import io.dataease.plugins.common.base.domain.MyPlugin; import io.dataease.service.sys.PluginService; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.ObjectUtils; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.ApplicationArguments; @@ -53,7 +54,7 @@ public class PluginRunner implements ApplicationRunner { MyPlugin plugin = discardPlugins.get(i); pluginService.uninstall(plugin.getPluginId()); } - }catch (Exception e) { + } catch (Exception e) { LogUtil.error(e.getMessage(), e); } @@ -73,10 +74,17 @@ public class PluginRunner implements ApplicationRunner { String jarPath = jarFile.getAbsolutePath(); + if (!StringUtils.equals("default", store) && !jarFile.exists()) { + version = "1.0-SNAPSHOT"; + path = pluginDir + store + "/" + moduleName + "-" + version + ".jar"; + plugin.setVersion(version); + jarFile = new File(path); + jarPath = jarFile.getAbsolutePath(); + } try { if (jarFile.exists()) { pluginService.loadJar(jarPath, plugin); - }else { + } else { LogUtil.error("插件路径不存在 {} ", jarPath); } } catch (Exception e) { diff --git a/backend/src/main/java/io/dataease/provider/query/ck/CKQueryProvider.java b/backend/src/main/java/io/dataease/provider/query/ck/CKQueryProvider.java index 2b8e0b1008..29681e692f 100644 --- a/backend/src/main/java/io/dataease/provider/query/ck/CKQueryProvider.java +++ b/backend/src/main/java/io/dataease/provider/query/ck/CKQueryProvider.java @@ -820,6 +820,14 @@ public class CKQueryProvider extends QueryProvider { return tmpSql; } + public String getTotalCount(boolean isTable, String sql, Datasource ds) { + if(isTable){ + return "SELECT COUNT(*) from " + String.format(CKConstants.KEYWORD_TABLE, sql); + }else { + return "SELECT COUNT(*) from ( " + sql + " ) DE_COUNT_TEMP"; + } + } + @Override public String createRawQuerySQL(String table, List fields, Datasource ds) { String[] array = fields.stream().map(f -> { @@ -831,12 +839,12 @@ public class CKQueryProvider extends QueryProvider { } return stringBuilder.toString(); }).toArray(String[]::new); - return MessageFormat.format("SELECT {0} FROM {1}", StringUtils.join(array, ","), table); + return MessageFormat.format("SELECT {0} FROM {1} LIMIT DE_OFFSET, DE_PAGE_SIZE ", StringUtils.join(array, ","), table); } @Override public String createRawQuerySQLAsTmp(String sql, List fields) { - return createRawQuerySQL(" (" + sqlFix(sql) + ") AS tmp ", fields, null); + return createRawQuerySQL(" (" + sqlFix(sql) + ") AS DE_TEMP LIMIT DE_OFFSET, DE_PAGE_SIZE ", fields, null); } @Override diff --git a/backend/src/main/java/io/dataease/provider/query/db2/Db2QueryProvider.java b/backend/src/main/java/io/dataease/provider/query/db2/Db2QueryProvider.java index e1cdf780f5..64d7ca3f5f 100644 --- a/backend/src/main/java/io/dataease/provider/query/db2/Db2QueryProvider.java +++ b/backend/src/main/java/io/dataease/provider/query/db2/Db2QueryProvider.java @@ -808,6 +808,17 @@ public class Db2QueryProvider extends QueryProvider { return tmpSql; } + + public String getTotalCount(boolean isTable, String sql, Datasource ds) { + if(isTable){ + String schema = new Gson().fromJson(ds.getConfiguration(), JdbcConfiguration.class).getSchema(); + schema = String.format(Db2Constants.KEYWORD_TABLE, schema); + return "SELECT COUNT(*) from " + schema + "." + String.format(Db2Constants.KEYWORD_TABLE, sql); + }else { + return "SELECT COUNT(*) from ( " + sql + " ) DE_COUNT_TEMP"; + } + } + @Override public String createRawQuerySQL(String table, List fields, Datasource ds) { String[] array = fields.stream().map(f -> { @@ -817,15 +828,15 @@ public class Db2QueryProvider extends QueryProvider { }).toArray(String[]::new); if (ds != null) { Db2Configuration db2Configuration = new Gson().fromJson(ds.getConfiguration(), Db2Configuration.class); - return MessageFormat.format("SELECT {0} FROM {1}", StringUtils.join(array, ","), db2Configuration.getSchema() + ".\"" + table + "\""); + return MessageFormat.format("SELECT {0} FROM {1} LIMIT DE_OFFSET, DE_PAGE_SIZE ", StringUtils.join(array, ","), db2Configuration.getSchema() + String.format(Db2Constants.KEYWORD_TABLE, table)); } else { - return MessageFormat.format("SELECT {0} FROM {1}", StringUtils.join(array, ","), table); + return MessageFormat.format("SELECT {0} FROM {1} LIMIT DE_OFFSET, DE_PAGE_SIZE ", StringUtils.join(array, ","), table); } } @Override public String createRawQuerySQLAsTmp(String sql, List fields) { - return createRawQuerySQL(" (" + sqlFix(sql) + ") AS de_tmp ", fields, null); + return createRawQuerySQL(" (" + sqlFix(sql) + ") AS de_tmp LIMIT DE_OFFSET, DE_PAGE_SIZE ", fields, null); } @Override diff --git a/backend/src/main/java/io/dataease/provider/query/doris/DorisQueryProvider.java b/backend/src/main/java/io/dataease/provider/query/doris/DorisQueryProvider.java index c051fbdda4..9ac6b663de 100644 --- a/backend/src/main/java/io/dataease/provider/query/doris/DorisQueryProvider.java +++ b/backend/src/main/java/io/dataease/provider/query/doris/DorisQueryProvider.java @@ -1,11 +1,31 @@ package io.dataease.provider.query.doris; +import io.dataease.plugins.common.base.domain.ChartViewWithBLOBs; +import io.dataease.plugins.common.base.domain.Datasource; +import io.dataease.plugins.common.dto.chart.ChartFieldCustomFilterDTO; +import io.dataease.plugins.common.dto.chart.ChartViewFieldDTO; +import io.dataease.plugins.common.request.chart.ChartExtFilterRequest; +import io.dataease.plugins.common.request.permission.DataSetRowPermissionsTreeDTO; +import io.dataease.plugins.datasource.entity.PageInfo; import io.dataease.provider.query.mysql.MysqlQueryProvider; import org.springframework.stereotype.Service; +import java.util.List; @Service("dorisQueryProvider") public class DorisQueryProvider extends MysqlQueryProvider { + public String getSQLWithPage(boolean isTable, String sql, List xAxis, List fieldCustomFilter, List rowPermissionsTree, List extFilterRequestList, Datasource ds, ChartViewWithBLOBs view, PageInfo pageInfo) { + if(isTable){ + return getSQLTableInfo(sql, xAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, ds, view); + }else { + return getSQLAsTmpTableInfo(sql, xAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, ds, view); + } + } + + public String getResultCount(boolean isTable, String sql, List xAxis, List fieldCustomFilter, List rowPermissionsTree, List extFilterRequestList, Datasource ds, ChartViewWithBLOBs view) { + return null; + } + } diff --git a/backend/src/main/java/io/dataease/provider/query/hive/HiveQueryProvider.java b/backend/src/main/java/io/dataease/provider/query/hive/HiveQueryProvider.java index 2329aaf5c1..023e9e32b0 100644 --- a/backend/src/main/java/io/dataease/provider/query/hive/HiveQueryProvider.java +++ b/backend/src/main/java/io/dataease/provider/query/hive/HiveQueryProvider.java @@ -770,6 +770,14 @@ public class HiveQueryProvider extends QueryProvider { return tmpSql; } + public String getTotalCount(boolean isTable, String sql, Datasource ds) { + if(isTable){ + return "SELECT COUNT(*) from " + String.format(HiveConstants.KEYWORD_TABLE, sql); + }else { + return "SELECT COUNT(*) from ( " + sql + " ) DE_COUNT_TEMP"; + } + } + @Override public String createRawQuerySQL(String table, List fields, Datasource ds) { String[] array = fields.stream().map(f -> { @@ -781,12 +789,12 @@ public class HiveQueryProvider extends QueryProvider { } return stringBuilder.toString(); }).toArray(String[]::new); - return MessageFormat.format("SELECT {0} FROM {1}", StringUtils.join(array, ","), table); + return MessageFormat.format("SELECT {0} FROM {1} LIMIT DE_OFFSET, DE_PAGE_SIZE ", StringUtils.join(array, ","), table); } @Override public String createRawQuerySQLAsTmp(String sql, List fields) { - return createRawQuerySQL(" (" + sqlFix(sql) + ") AS tmp ", fields, null); + return createRawQuerySQL(" (" + sqlFix(sql) + ") AS DE_TEMP LIMIT DE_OFFSET, DE_PAGE_SIZE ", fields, null); } @Override diff --git a/backend/src/main/java/io/dataease/provider/query/impala/ImpalaQueryProvider.java b/backend/src/main/java/io/dataease/provider/query/impala/ImpalaQueryProvider.java index 2e33fc8d93..a5e9c49d74 100644 --- a/backend/src/main/java/io/dataease/provider/query/impala/ImpalaQueryProvider.java +++ b/backend/src/main/java/io/dataease/provider/query/impala/ImpalaQueryProvider.java @@ -768,6 +768,14 @@ public class ImpalaQueryProvider extends QueryProvider { return tmpSql; } + public String getTotalCount(boolean isTable, String sql, Datasource ds) { + if(isTable){ + return "SELECT COUNT(*) from " + String.format(ImpalaConstants.KEYWORD_TABLE, sql); + }else { + return "SELECT COUNT(*) from ( " + sql + " ) DE_COUNT_TEMP"; + } + } + @Override public String createRawQuerySQL(String table, List fields, Datasource ds) { String[] array = fields.stream().map(f -> { @@ -779,12 +787,12 @@ public class ImpalaQueryProvider extends QueryProvider { } return stringBuilder.toString(); }).toArray(String[]::new); - return MessageFormat.format("SELECT {0} FROM {1}", StringUtils.join(array, ","), table); + return MessageFormat.format("SELECT {0} FROM {1} LIMIT DE_PAGE_SIZE OFFSET DE_OFFSET ", StringUtils.join(array, ","), table); } @Override public String createRawQuerySQLAsTmp(String sql, List fields) { - return createRawQuerySQL(" (" + sqlFix(sql) + ") AS tmp ", fields, null); + return createRawQuerySQL(" (" + sqlFix(sql) + ") AS DE_TEMP LIMIT DE_PAGE_SIZE OFFSET DE_OFFSET ", fields, null); } @Override diff --git a/backend/src/main/java/io/dataease/provider/query/mysql/MysqlQueryProvider.java b/backend/src/main/java/io/dataease/provider/query/mysql/MysqlQueryProvider.java index be8b8414c5..3a4bd7d406 100644 --- a/backend/src/main/java/io/dataease/provider/query/mysql/MysqlQueryProvider.java +++ b/backend/src/main/java/io/dataease/provider/query/mysql/MysqlQueryProvider.java @@ -808,12 +808,12 @@ public class MysqlQueryProvider extends QueryProvider { } return stringBuilder.toString(); }).toArray(String[]::new); - return MessageFormat.format("SELECT {0} FROM {1}", StringUtils.join(array, ","), table); + return MessageFormat.format("SELECT {0} FROM {1} LIMIT DE_OFFSET, DE_PAGE_SIZE ", StringUtils.join(array, ","), table); } @Override public String createRawQuerySQLAsTmp(String sql, List fields) { - return createRawQuerySQL(" (" + sqlFix(sql) + ") AS tmp ", fields, null); + return createRawQuerySQL(" (" + sqlFix(sql) + ") AS DE_TEMP LIMIT DE_OFFSET, DE_PAGE_SIZE ", fields, null); } public String transTreeItem(SQLObj tableObj, DatasetRowPermissionsTreeItem item) { @@ -1346,4 +1346,5 @@ public class MysqlQueryProvider extends QueryProvider { "{\"dateformat\": \"%Y%m%d %H:%i:%S\"}\n" + "]", Dateformat.class); } + } diff --git a/backend/src/main/java/io/dataease/provider/query/oracle/OracleQueryProvider.java b/backend/src/main/java/io/dataease/provider/query/oracle/OracleQueryProvider.java index 6cdf6d874c..11c5fd238b 100644 --- a/backend/src/main/java/io/dataease/provider/query/oracle/OracleQueryProvider.java +++ b/backend/src/main/java/io/dataease/provider/query/oracle/OracleQueryProvider.java @@ -860,25 +860,94 @@ public class OracleQueryProvider extends QueryProvider { return tmpSql; } + public String getTotalCount(boolean isTable, String sql, Datasource ds) { + if (isTable) { + String schema = new Gson().fromJson(ds.getConfiguration(), OracleConfiguration.class).getSchema(); + schema = String.format(OracleConstants.KEYWORD_TABLE, schema); + return "SELECT COUNT(*) from " + schema + "." + String.format(OracleConstants.KEYWORD_TABLE, sql); + } else { + return "SELECT COUNT(*) from ( " + sql + " ) DE_COUNT_TEMP"; + } + } + @Override public String createRawQuerySQL(String table, List fields, Datasource ds) { - String[] array = fields.stream().map(f -> { - StringBuilder stringBuilder = new StringBuilder(); - stringBuilder.append(" \"").append(f.getOriginName()).append("\""); - return stringBuilder.toString(); - }).toArray(String[]::new); - OracleConfiguration oracleConfiguration = new Gson().fromJson(ds.getConfiguration(), OracleConfiguration.class); - return MessageFormat.format("SELECT {0} FROM {1}", StringUtils.join(array, ","), oracleConfiguration.getSchema() + ".\"" + table + "\""); + List xAxis = new ArrayList<>(); + ChartViewFieldDTO chartViewFieldDTO = new ChartViewFieldDTO(); + chartViewFieldDTO.setOriginName("ROWNUM"); + xAxis.add(chartViewFieldDTO); + fields.forEach(datasetTableField -> { + ChartViewFieldDTO f = new ChartViewFieldDTO(); + f.setOriginName(datasetTableField.getOriginName()); + f.setDeType(0); + xAxis.add(f); + }); + + List fieldCustomFilter = new ArrayList<>(); + ChartFieldCustomFilterDTO chartFieldCustomFilterDTO = new ChartFieldCustomFilterDTO(); + DatasetTableField datasetTableField = new DatasetTableField(); + datasetTableField.setOriginName("ROWNUM"); + datasetTableField.setDeType(0); + chartFieldCustomFilterDTO.setField(datasetTableField); + + List filterItemDTOS = new ArrayList<>(); + ChartCustomFilterItemDTO itemDTO = new ChartCustomFilterItemDTO(); + itemDTO.setTerm("le"); + itemDTO.setValue("DE_ALL"); + filterItemDTOS.add(itemDTO); + chartFieldCustomFilterDTO.setFilter(filterItemDTOS); + fieldCustomFilter.add(chartFieldCustomFilterDTO); + + + SQLObj tableObj = SQLObj.builder() + .tableName((table.startsWith("(") && table.endsWith(")")) ? table : String.format(OracleConstants.KEYWORD_TABLE, table)) + .tableAlias(String.format(OracleConstants.ALIAS_FIX, String.format(TABLE_ALIAS_PREFIX, 0))) + .build(); + setSchema(tableObj, ds); + List xFields = new ArrayList<>(); + if (CollectionUtils.isNotEmpty(xAxis)) { + for (int i = 0; i < xAxis.size(); i++) { + ChartViewFieldDTO x = xAxis.get(i); + if (x.getOriginName().equalsIgnoreCase("ROWNUM")) { + xFields.add(SQLObj.builder() + .fieldName(x.getOriginName()) + .fieldAlias("DE_ROWNUM") + .build()); + continue; + } + String originField = String.format(OracleConstants.KEYWORD_FIX, tableObj.getTableAlias(), x.getOriginName()); + String fieldAlias = String.format(OracleConstants.KEYWORD_TABLE, x.getOriginName()); + xFields.add(getXFields(x, originField, fieldAlias)); + } + } + + String customWheres = transCustomFilterList(tableObj, fieldCustomFilter); + + List wheres = new ArrayList<>(); + if (customWheres != null) wheres.add(customWheres); + + STGroup stg = new STGroupFile(SQLConstants.SQL_TEMPLATE); + ST st_sql = stg.getInstanceOf("previewSql"); + st_sql.add("isGroup", false); + if (CollectionUtils.isNotEmpty(xFields)) st_sql.add("groups", xFields); + if (CollectionUtils.isNotEmpty(wheres)) st_sql.add("filters", wheres); + if (ObjectUtils.isNotEmpty(tableObj)) st_sql.add("table", tableObj); + String sql = st_sql.render(); + + ST st = stg.getInstanceOf("previewSql"); + st.add("isGroup", false); + SQLObj tableSQL = SQLObj.builder() + .tableName(String.format(OracleConstants.BRACKETS, sql)) + .tableAlias(String.format(TABLE_ALIAS_PREFIX, 1)) + .build(); + if (ObjectUtils.isNotEmpty(tableSQL)) st.add("table", tableSQL); + + return "SELECT * FROM (" + sqlFix(st.render()) + ") DE_RESULT_TMP " + " WHERE DE_ROWNUM >= DE_OFFSET"; } @Override public String createRawQuerySQLAsTmp(String sql, List fields) { - String[] array = fields.stream().map(f -> { - StringBuilder stringBuilder = new StringBuilder(); - stringBuilder.append(" \"").append(f.getOriginName()).append("\""); - return stringBuilder.toString(); - }).toArray(String[]::new); - return MessageFormat.format("SELECT {0} FROM {1}", StringUtils.join(array, ","), " (" + sqlFix(sql) + ") DE_TMP "); + return createRawQuerySQL("(" + sqlFix(sql) + ")", fields, null); } @Override diff --git a/backend/src/main/java/io/dataease/provider/query/pg/PgQueryProvider.java b/backend/src/main/java/io/dataease/provider/query/pg/PgQueryProvider.java index 469f9a1dc4..4c7320ca93 100644 --- a/backend/src/main/java/io/dataease/provider/query/pg/PgQueryProvider.java +++ b/backend/src/main/java/io/dataease/provider/query/pg/PgQueryProvider.java @@ -800,6 +800,16 @@ public class PgQueryProvider extends QueryProvider { return tmpSql; } + public String getTotalCount(boolean isTable, String sql, Datasource ds) { + if(isTable){ + String schema = new Gson().fromJson(ds.getConfiguration(), JdbcConfiguration.class).getSchema(); + String tableWithSchema = String.format(SqlServerSQLConstants.KEYWORD_TABLE, schema) + "." + String.format(SqlServerSQLConstants.KEYWORD_TABLE, sql); + return "SELECT COUNT(*) from " + String.format(PgConstants.KEYWORD_TABLE, tableWithSchema); + }else { + return "SELECT COUNT(*) from ( " + sql + " ) DE_COUNT_TEMP"; + } + } + @Override public String createRawQuerySQL(String table, List fields, Datasource ds) { String[] array = fields.stream().map(f -> { @@ -810,15 +820,15 @@ public class PgQueryProvider extends QueryProvider { if (ds != null) { String schema = new Gson().fromJson(ds.getConfiguration(), JdbcConfiguration.class).getSchema(); String tableWithSchema = String.format(SqlServerSQLConstants.KEYWORD_TABLE, schema) + "." + String.format(SqlServerSQLConstants.KEYWORD_TABLE, table); - return MessageFormat.format("SELECT {0} FROM {1} ", StringUtils.join(array, ","), tableWithSchema); + return MessageFormat.format("SELECT {0} FROM {1} LIMIT DE_PAGE_SIZE OFFSET DE_OFFSET ", StringUtils.join(array, ","), tableWithSchema); } else { - return MessageFormat.format("SELECT {0} FROM {1} ", StringUtils.join(array, ","), table); + return MessageFormat.format("SELECT {0} FROM {1} LIMIT DE_PAGE_SIZE OFFSET DE_OFFSET ", StringUtils.join(array, ","), table); } } @Override public String createRawQuerySQLAsTmp(String sql, List fields) { - return createRawQuerySQL(" (" + sqlFix(sql) + ") AS tmp ", fields, null); + return createRawQuerySQL(" (" + sqlFix(sql) + ") AS DE_TEMP LIMIT DE_PAGE_SIZE OFFSET DE_OFFSET ", fields, null); } @Override diff --git a/backend/src/main/java/io/dataease/provider/query/redshift/RedshiftQueryProvider.java b/backend/src/main/java/io/dataease/provider/query/redshift/RedshiftQueryProvider.java index 3b447866d4..a0a5e7cd21 100644 --- a/backend/src/main/java/io/dataease/provider/query/redshift/RedshiftQueryProvider.java +++ b/backend/src/main/java/io/dataease/provider/query/redshift/RedshiftQueryProvider.java @@ -807,6 +807,16 @@ public class RedshiftQueryProvider extends QueryProvider { return tmpSql; } + public String getTotalCount(boolean isTable, String sql, Datasource ds) { + if(isTable){ + String schema = new Gson().fromJson(ds.getConfiguration(), JdbcConfiguration.class).getSchema(); + String tableWithSchema = String.format(SqlServerSQLConstants.KEYWORD_TABLE, schema) + "." + String.format(SqlServerSQLConstants.KEYWORD_TABLE, sql); + return "SELECT COUNT(*) from " + String.format(ImpalaConstants.KEYWORD_TABLE, tableWithSchema); + }else { + return "SELECT COUNT(*) from ( " + sql + " ) DE_COUNT_TEMP"; + } + } + @Override public String createRawQuerySQL(String table, List fields, Datasource ds) { String[] array = fields.stream().map(f -> { @@ -817,15 +827,15 @@ public class RedshiftQueryProvider extends QueryProvider { if (ds != null) { String schema = new Gson().fromJson(ds.getConfiguration(), JdbcConfiguration.class).getSchema(); String tableWithSchema = String.format(SqlServerSQLConstants.KEYWORD_TABLE, schema) + "." + String.format(SqlServerSQLConstants.KEYWORD_TABLE, table); - return MessageFormat.format("SELECT {0} FROM {1} ", StringUtils.join(array, ","), tableWithSchema); + return MessageFormat.format("SELECT {0} FROM {1} LIMIT DE_PAGE_SIZE OFFSET DE_OFFSET ", StringUtils.join(array, ","), tableWithSchema); } else { - return MessageFormat.format("SELECT {0} FROM {1} ", StringUtils.join(array, ","), table); + return MessageFormat.format("SELECT {0} FROM {1} LIMIT DE_PAGE_SIZE OFFSET DE_OFFSET ", StringUtils.join(array, ","), table); } } @Override public String createRawQuerySQLAsTmp(String sql, List fields) { - return createRawQuerySQL(" (" + sqlFix(sql) + ") AS tmp ", fields, null); + return createRawQuerySQL(" (" + sqlFix(sql) + ") AS DE_TEMP LIMIT DE_PAGE_SIZE OFFSET DE_OFFSET ", fields, null); } @Override diff --git a/backend/src/main/java/io/dataease/service/authModel/VAuthModelService.java b/backend/src/main/java/io/dataease/service/authModel/VAuthModelService.java index 62522a193a..5273a13743 100644 --- a/backend/src/main/java/io/dataease/service/authModel/VAuthModelService.java +++ b/backend/src/main/java/io/dataease/service/authModel/VAuthModelService.java @@ -9,6 +9,7 @@ import org.apache.commons.collections4.CollectionUtils; import org.springframework.stereotype.Service; import javax.annotation.Resource; +import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.stream.Collectors; @@ -27,7 +28,9 @@ public class VAuthModelService { public List queryAuthModel(VAuthModelRequest request) { request.setUserId(String.valueOf(AuthUtils.getUser().getUserId())); List result = extVAuthModelMapper.queryAuthModel(request); - + if(CollectionUtils.isEmpty(result)){ + return new ArrayList<>(); + } if (request.getPrivileges() != null) { result = filterPrivileges(request, result); } diff --git a/backend/src/main/java/io/dataease/service/chart/ChartViewService.java b/backend/src/main/java/io/dataease/service/chart/ChartViewService.java index 593e285603..d06d88f47f 100644 --- a/backend/src/main/java/io/dataease/service/chart/ChartViewService.java +++ b/backend/src/main/java/io/dataease/service/chart/ChartViewService.java @@ -927,7 +927,9 @@ public class ChartViewService { PageInfo pageInfo = new PageInfo(); pageInfo.setGoPage(chartExtRequest.getGoPage()); if (StringUtils.equalsIgnoreCase(view.getResultMode(), "custom")) { - pageInfo.setPageSize(Math.min(view.getResultCount() - (chartExtRequest.getGoPage() - 1) * chartExtRequest.getPageSize(), chartExtRequest.getPageSize())); + if (StringUtils.equalsIgnoreCase(view.getType(), "table-info") && table.getMode() == 0) { + pageInfo.setPageSize(Math.min(view.getResultCount() - (chartExtRequest.getGoPage() - 1) * chartExtRequest.getPageSize(), chartExtRequest.getPageSize())); + } } else { pageInfo.setPageSize(chartExtRequest.getPageSize()); } diff --git a/backend/src/main/java/io/dataease/service/dataset/DataSetTableService.java b/backend/src/main/java/io/dataease/service/dataset/DataSetTableService.java index 30001e2f5b..006ec809a9 100644 --- a/backend/src/main/java/io/dataease/service/dataset/DataSetTableService.java +++ b/backend/src/main/java/io/dataease/service/dataset/DataSetTableService.java @@ -1116,6 +1116,9 @@ public class DataSetTableService { if (dsType.equals(DatasourceTypes.oracle.getType())) { subSelect.setAlias(new Alias(fromItem.getAlias().toString(), false)); } else { + if(fromItem.getAlias() == null){ + throw new Exception("Failed to parse sql, Every derived table must have its own alias!"); + } subSelect.setAlias(new Alias(fromItem.getAlias().toString())); } plainSelect.setFromItem(subSelect); @@ -2818,7 +2821,7 @@ public class DataSetTableService { boolean hasSubBinaryExpression = false; try { BinaryExpression leftBinaryExpression = (BinaryExpression) expr.getLeftExpression(); - hasSubBinaryExpression = leftBinaryExpression.getLeftExpression() instanceof BinaryExpression; + hasSubBinaryExpression = leftBinaryExpression.getLeftExpression() instanceof Expression; } catch (Exception e) { e.printStackTrace(); } diff --git a/backend/src/main/java/io/dataease/service/dataset/ExtractDataService.java b/backend/src/main/java/io/dataease/service/dataset/ExtractDataService.java index adff409cb7..73f1c37050 100644 --- a/backend/src/main/java/io/dataease/service/dataset/ExtractDataService.java +++ b/backend/src/main/java/io/dataease/service/dataset/ExtractDataService.java @@ -96,6 +96,7 @@ public class ExtractDataService { @Resource private KettleService kettleService; + private static final String lastUpdateTime = "${__last_update_time__}"; private static final String currentUpdateTime = "${__current_update_time__}"; private static final String separator = "|DE|"; @@ -104,6 +105,9 @@ public class ExtractDataService { @Value("${kettle.files.keep:false}") private boolean kettleFilesKeep; + @Value("${extract.page.size:50000}") + private Long extractPageSize; + private static final String shellScript = "result=`curl --location-trusted -u %s:%s -H \"label:%s\" -H \"column_separator:%s\" -H \"columns:%s\" -H \"merge_type: %s\" -T %s -XPUT http://%s:%s/api/%s/%s/_stream_load`\n" + "if [ $? -eq 0 ] ; then\n" + @@ -433,7 +437,23 @@ public class ExtractDataService { extractApiData(datasetTable, datasource, datasetTableFields, extractType); return; } - extractDataByKettle(datasetTable, datasource, datasetTableFields, extractType, selectSQL); + Map sql = getSelectSQL(extractType, datasetTable, datasource, datasetTableFields, selectSQL); + if (StringUtils.isNotEmpty(sql.get("totalSql"))) { + DatasourceRequest datasourceRequest = new DatasourceRequest(); + datasourceRequest.setDatasource(datasource); + Provider datasourceProvider = ProviderFactory.getProvider(datasource.getType()); + datasourceRequest.setQuery(sql.get("totalSql")); + List tmpData = datasourceProvider.getData(datasourceRequest); + Long totalItems = CollectionUtils.isEmpty(tmpData) ? 0 : Long.valueOf(tmpData.get(0)[0]); + Long totalPage = (totalItems / extractPageSize) + (totalItems % extractPageSize > 0 ? 1 : 0); + for (Long i = 0L; i < totalPage; i++) { + Long offset = i * extractPageSize; + Long all = offset + extractPageSize; + extractDataByKettle(datasetTable, datasource, datasetTableFields, extractType, sql.get("selectSQL").replace("DE_OFFSET", offset.toString()).replace("DE_PAGE_SIZE", extractPageSize.toString()).replace("DE_ALL", all.toString())); + } + } else { + extractDataByKettle(datasetTable, datasource, datasetTableFields, extractType, selectSQL); + } } private void extractApiData(DatasetTable datasetTable, Datasource datasource, List datasetTableFields, String extractType) throws Exception { @@ -923,7 +943,6 @@ public class ExtractDataService { } } transMeta.addDatabase(dataMeta); - selectSQL = getSelectSQL(extractType, datasetTable, datasource, datasetTableFields, selectSQL); inputSteps = inputStep(transMeta, selectSQL, mysqlConfiguration); udjcStep = udjc(datasetTableFields, DatasourceTypes.mysql, mysqlConfiguration); break; @@ -931,7 +950,6 @@ public class ExtractDataService { SqlServerConfiguration sqlServerConfiguration = new Gson().fromJson(datasource.getConfiguration(), SqlServerConfiguration.class); dataMeta = new DatabaseMeta("db", "MSSQLNATIVE", "Native", sqlServerConfiguration.getHost().trim(), sqlServerConfiguration.getDataBase(), sqlServerConfiguration.getPort().toString(), sqlServerConfiguration.getUsername(), sqlServerConfiguration.getPassword()); transMeta.addDatabase(dataMeta); - selectSQL = getSelectSQL(extractType, datasetTable, datasource, datasetTableFields, selectSQL); inputSteps = inputStep(transMeta, selectSQL, sqlServerConfiguration); udjcStep = udjc(datasetTableFields, DatasourceTypes.sqlServer, sqlServerConfiguration); break; @@ -939,7 +957,6 @@ public class ExtractDataService { PgConfiguration pgConfiguration = new Gson().fromJson(datasource.getConfiguration(), PgConfiguration.class); dataMeta = new DatabaseMeta("db", "POSTGRESQL", "Native", pgConfiguration.getHost().trim(), pgConfiguration.getDataBase(), pgConfiguration.getPort().toString(), pgConfiguration.getUsername(), pgConfiguration.getPassword()); transMeta.addDatabase(dataMeta); - selectSQL = getSelectSQL(extractType, datasetTable, datasource, datasetTableFields, selectSQL); inputSteps = inputStep(transMeta, selectSQL, pgConfiguration); udjcStep = udjc(datasetTableFields, DatasourceTypes.pg, pgConfiguration); break; @@ -952,7 +969,6 @@ public class ExtractDataService { dataMeta = new DatabaseMeta("db", "ORACLE", "Native", oracleConfiguration.getHost().trim(), oracleConfiguration.getDataBase(), oracleConfiguration.getPort().toString(), oracleConfiguration.getUsername(), oracleConfiguration.getPassword()); } transMeta.addDatabase(dataMeta); - selectSQL = getSelectSQL(extractType, datasetTable, datasource, datasetTableFields, selectSQL); inputSteps = inputStep(transMeta, selectSQL, oracleConfiguration); udjcStep = udjc(datasetTableFields, DatasourceTypes.oracle, oracleConfiguration); break; @@ -961,7 +977,6 @@ public class ExtractDataService { dataMeta = new DatabaseMeta("db", "ORACLE", "Native", chConfiguration.getHost().trim(), chConfiguration.getDataBase().trim(), chConfiguration.getPort().toString(), chConfiguration.getUsername(), chConfiguration.getPassword()); dataMeta.setDatabaseType("Clickhouse"); transMeta.addDatabase(dataMeta); - selectSQL = getSelectSQL(extractType, datasetTable, datasource, datasetTableFields, selectSQL); inputSteps = inputStep(transMeta, selectSQL, chConfiguration); udjcStep = udjc(datasetTableFields, DatasourceTypes.ck, chConfiguration); break; @@ -970,7 +985,6 @@ public class ExtractDataService { dataMeta = new DatabaseMeta("db", "DB2", "Native", db2Configuration.getHost().trim(), db2Configuration.getDataBase().trim(), db2Configuration.getPort().toString(), db2Configuration.getUsername(), db2Configuration.getPassword()); dataMeta.setDatabaseType("DB2"); transMeta.addDatabase(dataMeta); - selectSQL = getSelectSQL(extractType, datasetTable, datasource, datasetTableFields, selectSQL); inputSteps = inputStep(transMeta, selectSQL, db2Configuration); udjcStep = udjc(datasetTableFields, DatasourceTypes.db2, db2Configuration); break; @@ -1019,11 +1033,13 @@ public class ExtractDataService { FileUtils.writeStringToFile(file, transXml, "UTF-8"); } - private String getSelectSQL(String extractType, DatasetTable datasetTable, Datasource datasource, List datasetTableFields, String selectSQL) { + private Map getSelectSQL(String extractType, DatasetTable datasetTable, Datasource datasource, List datasetTableFields, String selectSQL) { + Map sql = new HashMap<>(); if (extractType.equalsIgnoreCase("all_scope") && datasetTable.getType().equalsIgnoreCase(DatasetType.DB.name())) { String tableName = new Gson().fromJson(datasetTable.getInfo(), DataTableInfoDTO.class).getTable(); QueryProvider qp = ProviderFactory.getQueryProvider(datasource.getType()); - selectSQL = qp.createRawQuerySQL(tableName, datasetTableFields, datasource); + sql.put("selectSQL", qp.createRawQuerySQL(tableName, datasetTableFields, datasource)); + sql.put("totalSql", qp.getTotalCount(true, tableName, datasource)); } if (extractType.equalsIgnoreCase("all_scope") && datasetTable.getType().equalsIgnoreCase(DatasetType.SQL.name())) { @@ -1033,13 +1049,17 @@ public class ExtractDataService { selectSQL = new String(java.util.Base64.getDecoder().decode(selectSQL)); } QueryProvider qp = ProviderFactory.getQueryProvider(datasource.getType()); - selectSQL = qp.createRawQuerySQLAsTmp(selectSQL, datasetTableFields); + sql.put("totalSql", qp.getTotalCount(false, selectSQL, datasource)); + sql.put("selectSQL", qp.createRawQuerySQLAsTmp(selectSQL, datasetTableFields)); } + if (!extractType.equalsIgnoreCase("all_scope")) { QueryProvider qp = ProviderFactory.getQueryProvider(datasource.getType()); - selectSQL = qp.createRawQuerySQLAsTmp(selectSQL, datasetTableFields); + sql.put("totalSql", qp.getTotalCount(false, selectSQL, datasource)); + sql.put("selectSQL", qp.createRawQuerySQLAsTmp(selectSQL, datasetTableFields)); } - return selectSQL; + + return sql; } private List inputStep(TransMeta transMeta, String selectSQL, JdbcConfiguration jdbcConfiguration) { diff --git a/backend/src/main/java/io/dataease/service/panel/PanelGroupService.java b/backend/src/main/java/io/dataease/service/panel/PanelGroupService.java index 947073c9dd..61a92a9220 100644 --- a/backend/src/main/java/io/dataease/service/panel/PanelGroupService.java +++ b/backend/src/main/java/io/dataease/service/panel/PanelGroupService.java @@ -1,10 +1,12 @@ package io.dataease.service.panel; +import cn.hutool.core.util.ArrayUtil; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; import io.dataease.auth.annotation.DeCleaner; +import io.dataease.auth.api.dto.CurrentUserDto; import io.dataease.commons.constants.*; import io.dataease.commons.utils.*; import io.dataease.controller.request.authModel.VAuthModelRequest; @@ -41,6 +43,7 @@ import org.apache.commons.lang3.StringUtils; import org.apache.poi.hssf.usermodel.HSSFClientAnchor; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.ss.usermodel.*; +import org.apache.poi.ss.util.CellRangeAddress; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.pentaho.di.core.util.UUIDUtil; import org.slf4j.Logger; @@ -151,6 +154,17 @@ public class PanelGroupService { return TreeUtils.mergeTree(panelGroupDTOList, "default_panel"); } + public List list() { + CurrentUserDto user = AuthUtils.getUser(); + if (user.getIsAdmin()) { + PanelGroupExample example = new PanelGroupExample(); + example.setOrderByClause("name"); + example.createCriteria().andNodeTypeEqualTo("panel"); + return panelGroupMapper.selectByExample(example); + } + return extPanelGroupMapper.listPanelByUser(user.getUserId()); + } + @DeCleaner(value = DePermissionType.PANEL, key = "pid") public String save(PanelGroupRequest request) { checkPanelName(request.getName(), request.getPid(), PanelConstants.OPT_TYPE_INSERT, null, request.getNodeType()); @@ -630,13 +644,15 @@ public class PanelGroupService { OutputStream outputStream = response.getOutputStream(); try { String snapshot = request.getSnapshot(); - List details = request.getDetails(); + List details = request.getDetails(); Integer[] excelTypes = request.getExcelTypes(); details.add(0, request.getHeader()); + Workbook wb = new XSSFWorkbook(); //明细sheet Sheet detailsSheet = wb.createSheet("数据"); + //给单元格设置样式 CellStyle cellStyle = wb.createCellStyle(); Font font = wb.createFont(); @@ -651,30 +667,104 @@ public class PanelGroupService { //设置单元格填充样式(使用纯色背景颜色填充) cellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND); - if (CollectionUtils.isNotEmpty(details)) { - for (int i = 0; i < details.size(); i++) { - Row row = detailsSheet.createRow(i); - String[] rowData = details.get(i); + + Boolean mergeHead = false; + ViewDetailField[] detailFields = request.getDetailFields(); + if (ArrayUtil.isNotEmpty(detailFields)) { + cellStyle.setBorderTop(BorderStyle.THIN); + cellStyle.setBorderRight(BorderStyle.THIN); + cellStyle.setBorderBottom(BorderStyle.THIN); + cellStyle.setBorderLeft(BorderStyle.THIN); + String[] detailField = Arrays.stream(detailFields).map(field -> field.getName()).collect(Collectors.toList()).toArray(new String[detailFields.length]); + Object[] header = request.getHeader(); + Row row = detailsSheet.createRow(0); + int headLen = header.length; + int detailFieldLen = detailField.length; + for (int i = 0; i < headLen; i++) { + Cell cell = row.createCell(i); + cell.setCellValue(header[i].toString()); + if (i < headLen - 1) { + CellRangeAddress cellRangeAddress = new CellRangeAddress(0, 1, i, i); + detailsSheet.addMergedRegion(cellRangeAddress); + } else { + for (int j = i + 1; j < detailFieldLen + i; j++) { + row.createCell(j).setCellStyle(cellStyle); + } + CellRangeAddress cellRangeAddress = new CellRangeAddress(0, 0, i, i + detailFieldLen - 1); + detailsSheet.addMergedRegion(cellRangeAddress); + } + cell.setCellStyle(cellStyle); + detailsSheet.setColumnWidth(i, 255 * 20); + } + + Row detailRow = detailsSheet.createRow(1); + for (int i = 0; i < headLen - 1; i++) { + Cell cell = detailRow.createCell(i); + cell.setCellStyle(cellStyle); + } + for (int i = 0; i < detailFieldLen; i++) { + int colIndex = headLen - 1 + i; + Cell cell = detailRow.createCell(colIndex); + cell.setCellValue(detailField[i]); + cell.setCellStyle(cellStyle); + detailsSheet.setColumnWidth(colIndex, 255 * 20); + } + details.add(1, detailField); + mergeHead = true; + } + if (CollectionUtils.isNotEmpty(details) && (!mergeHead || details.size() > 2)) { + int realDetailRowIndex = 2; + for (int i = (mergeHead ? 2 : 0); i < details.size(); i++) { + Row row = detailsSheet.createRow(realDetailRowIndex > 2 ? realDetailRowIndex : i); + Object[] rowData = details.get(i); if (rowData != null) { for (int j = 0; j < rowData.length; j++) { + Object cellValObj = rowData[j]; + if (mergeHead && j == rowData.length - 1 && (cellValObj.getClass().isArray() || cellValObj instanceof ArrayList)) { + Object[] detailRowArray = ((List) cellValObj).toArray(new Object[((List) cellValObj).size()]); + int detailRowArrayLen = detailRowArray.length; + int temlJ = j; + while (detailRowArrayLen > 1 && temlJ-- > 0) { + CellRangeAddress cellRangeAddress = new CellRangeAddress(realDetailRowIndex, realDetailRowIndex + detailRowArrayLen - 1, temlJ, temlJ); + detailsSheet.addMergedRegion(cellRangeAddress); + } + + for (int k = 0; k < detailRowArrayLen; k++) { + List detailRows = (List) detailRowArray[k]; + Row curRow = row; + if (k > 0) { + curRow = detailsSheet.createRow(realDetailRowIndex + k); + } + + for (int l = 0; l < detailRows.size(); l++) { + Object col = detailRows.get(l); + Cell cell = curRow.createCell(j + l); + cell.setCellValue(col.toString()); + } + } + realDetailRowIndex += detailRowArrayLen; + break; + } + Cell cell = row.createCell(j); if (i == 0) {// 头部 - cell.setCellValue(rowData[j]); + cell.setCellValue(cellValObj.toString()); cell.setCellStyle(cellStyle); //设置列的宽度 detailsSheet.setColumnWidth(j, 255 * 20); } else { // with DataType - if ((excelTypes[j] == DeTypeConstants.DE_INT || excelTypes[j] == DeTypeConstants.DE_FLOAT) && StringUtils.isNotEmpty(rowData[j])) { + if ((excelTypes[j] == DeTypeConstants.DE_INT || excelTypes[j] == DeTypeConstants.DE_FLOAT) && StringUtils.isNotEmpty(cellValObj.toString())) { try { - cell.setCellValue(Double.valueOf(rowData[j])); + cell.setCellValue(Double.valueOf(cellValObj.toString())); } catch (Exception e) { LogUtil.warn("export excel data transform error"); } } else { - cell.setCellValue(rowData[j]); + cell.setCellValue(cellValObj.toString()); } } + } } } diff --git a/backend/src/main/java/io/dataease/service/sys/PluginService.java b/backend/src/main/java/io/dataease/service/sys/PluginService.java index 9dd9f5ccd6..2f22d0d619 100644 --- a/backend/src/main/java/io/dataease/service/sys/PluginService.java +++ b/backend/src/main/java/io/dataease/service/sys/PluginService.java @@ -227,7 +227,7 @@ public class PluginService { LogUtil.error(msg); DEException.throwException(msg); } - deleteJarFile(myPlugin); + myPlugin = deleteJarFile(myPlugin); CacheUtils.removeAll(AuthConstants.USER_CACHE_NAME); CacheUtils.removeAll(AuthConstants.USER_ROLE_CACHE_NAME); CacheUtils.removeAll(AuthConstants.USER_PERMISSION_CACHE_NAME); @@ -258,18 +258,26 @@ public class PluginService { return true; } - private void deleteJarFile(MyPlugin plugin) { + private MyPlugin deleteJarFile(MyPlugin plugin) { String version = plugin.getVersion(); String moduleName = plugin.getModuleName(); String fileName = moduleName + "-" + version + ".jar"; String path = pluginDir + plugin.getStore() + "/" + fileName; File jarFile = new File(path); + if (!StringUtils.equals("default", plugin.getStore()) && !jarFile.exists()) { + version = "1.0-SNAPSHOT"; + fileName = moduleName + "-" + version + ".jar"; + path = pluginDir + plugin.getStore() + "/" + fileName; + jarFile = new File(path); + plugin.setVersion(version); + } FileUtil.del(jarFile); if (plugin.getCategory().equalsIgnoreCase("datasource")) { File driverFile = new File(pluginDir + plugin.getStore() + "/" + plugin.getDsType() + "Driver"); FileUtil.del(driverFile); } + return plugin; } /** diff --git a/frontend/src/assets/datasource/db2.jpg b/frontend/src/assets/datasource/db2.jpg index 691083d883..1eb9869bb5 100644 Binary files a/frontend/src/assets/datasource/db2.jpg and b/frontend/src/assets/datasource/db2.jpg differ diff --git a/frontend/src/assets/datasource/hive.jpg b/frontend/src/assets/datasource/hive.jpg index 8f1410ec90..60e5cfe130 100644 Binary files a/frontend/src/assets/datasource/hive.jpg and b/frontend/src/assets/datasource/hive.jpg differ diff --git a/frontend/src/assets/datasource/impala.jpg b/frontend/src/assets/datasource/impala.jpg index 0c4d5cee8c..170f258d45 100644 Binary files a/frontend/src/assets/datasource/impala.jpg and b/frontend/src/assets/datasource/impala.jpg differ diff --git a/frontend/src/components/canvas/components/editor/PreviewEject.vue b/frontend/src/components/canvas/components/editor/PreviewEject.vue index e53a938d25..f3d81c4dc4 100644 --- a/frontend/src/components/canvas/components/editor/PreviewEject.vue +++ b/frontend/src/components/canvas/components/editor/PreviewEject.vue @@ -139,6 +139,10 @@ export default { sourceFieldId: jumpParam.sourceFieldId, targetPanelId: this.panelId } + //透视表中的其他维度数据数据都进行匹配 + if (jumpParam.sourceType && jumpParam.sourceType === 'table-pivot') { + jumpRequestParam.targetPanelId = null + } try { // 刷新跳转目标仪表板联动信息 queryTargetPanelJumpInfo(jumpRequestParam).then(rsp => { diff --git a/frontend/src/components/canvas/customComponent/UserView.vue b/frontend/src/components/canvas/customComponent/UserView.vue index c21d6d056b..b840daff45 100644 --- a/frontend/src/components/canvas/customComponent/UserView.vue +++ b/frontend/src/components/canvas/customComponent/UserView.vue @@ -936,7 +936,7 @@ export default { // 如果有名称name 获取和name匹配的dimension 否则倒序取最后一个能匹配的 if (param.name) { param.dimensionList.forEach(dimensionItem => { - if (dimensionItem.value === param.name) { + if (dimensionItem.id === param.name) { dimension = dimensionItem sourceInfo = param.viewId + '#' + dimension.id jumpInfo = this.nowPanelJumpInfo[sourceInfo] diff --git a/frontend/src/components/canvas/customComponent/UserViewDialog.vue b/frontend/src/components/canvas/customComponent/UserViewDialog.vue index 58740b44e8..a61588c35e 100644 --- a/frontend/src/components/canvas/customComponent/UserViewDialog.vue +++ b/frontend/src/components/canvas/customComponent/UserViewDialog.vue @@ -250,8 +250,32 @@ export default { const excelHeader = JSON.parse(JSON.stringify(this.chart.data.fields)).map(item => item.name) const excelTypes = JSON.parse(JSON.stringify(this.chart.data.fields)).map(item => item.deType) const excelHeaderKeys = JSON.parse(JSON.stringify(this.chart.data.fields)).map(item => item.dataeaseName) - const excelData = JSON.parse(JSON.stringify(this.chart.data.tableRow)).map(item => excelHeaderKeys.map(i => item[i])) + let excelData = JSON.parse(JSON.stringify(this.chart.data.tableRow)).map(item => excelHeaderKeys.map(i => item[i])) const excelName = this.chart.name + let detailFields = [] + if (this.chart.data.detailFields?.length) { + detailFields = this.chart.data.detailFields.map(item => { + const temp = { + name: item.name, + deType: item.deType, + dataeaseName: item.dataeaseName + } + return temp + }) + excelData = JSON.parse(JSON.stringify(this.chart.data.tableRow)).map(item => { + const temp = excelHeaderKeys.map(i => { + if (i === 'detail' && !item[i] && Array.isArray(item['details'])) { + const arr = item['details'] + if (arr?.length) { + return arr.map(ele => detailFields.map(field => ele[field.dataeaseName])) + } + return null + } + return item[i] + }) + return temp + }) + } const request = { viewId: this.chart.id, viewName: excelName, @@ -260,7 +284,8 @@ export default { excelTypes: excelTypes, snapshot: snapshot, snapshotWidth: width, - snapshotHeight: height + snapshotHeight: height, + detailFields } let method = innerExportDetails const token = this.$store.getters.token || getToken() diff --git a/frontend/src/components/deDrag/index.vue b/frontend/src/components/deDrag/index.vue index 18d983d94d..2591f61ad6 100644 --- a/frontend/src/components/deDrag/index.vue +++ b/frontend/src/components/deDrag/index.vue @@ -66,7 +66,7 @@ @mousedown.stop.prevent="handleDown(handlei, $event)" @touchstart.stop.prevent="handleTouchDown(handlei, $event)" > - +
- +
@@ -2170,31 +2170,31 @@ export default { } .de-drag-top { - left: 0; - top: 0; + left: 1px; + top: 1px; height: 12px; - width: 100%; + width: calc(100% - 2px); } .de-drag-right { - right: 0; - top: 0; + right: 1px; + top: 1px; width: 16px; - height: 100%; + height: calc(100% - 30px); } .de-drag-bottom { - left: 0; - bottom: 0; + left: 1px; + bottom: 1px; height: 12px; - width: 100%; + width: calc(100% - 2px); } .de-drag-left { - left: 0; - top: 0; + left: 1px; + top: 1px; width: 16px; - height: 100%; + height: calc(100% - 2px); } diff --git a/frontend/src/views/chart/chart/chart.js b/frontend/src/views/chart/chart/chart.js index 19dc72e6dc..47101d2a47 100644 --- a/frontend/src/views/chart/chart/chart.js +++ b/frontend/src/views/chart/chart/chart.js @@ -908,7 +908,14 @@ export const BASE_MAP = { }, itemStyle: { + normal: { + }, + emphasis: { + label: { + show: false + } + } } }, series: [ diff --git a/frontend/src/views/chart/chart/common/common_antv.js b/frontend/src/views/chart/chart/common/common_antv.js index 32a1e2f091..21f4ea5abd 100644 --- a/frontend/src/views/chart/chart/common/common_antv.js +++ b/frontend/src/views/chart/chart/common/common_antv.js @@ -153,7 +153,7 @@ export function getLabel(chart) { // label value formatter if (chart.type && chart.type !== 'waterfall') { label.formatter = function(param) { - let yAxis, extStack + let yAxis, extStack, xaxisExt let res = param.value try { yAxis = JSON.parse(chart.yaxis) @@ -165,11 +165,16 @@ export function getLabel(chart) { } catch (e) { extStack = JSON.parse(JSON.stringify(chart.extStack)) } + try { + xaxisExt = JSON.parse(chart.xaxisExt) + } catch (e) { + xaxisExt = JSON.parse(JSON.stringify(chart.xaxisExt)) + } - if (equalsAny(chart.type, 'bar-stack', 'line-stack', + if (equalsAny(chart.type, 'line', 'bar-stack', 'line-stack', 'bar-stack-horizontal', 'percentage-bar-stack', 'percentage-bar-stack-horizontal')) { let f - if (extStack && extStack.length > 0) { + if (extStack?.length > 0 || xaxisExt?.length > 0) { f = yAxis[0] } else { for (let i = 0; i < yAxis.length; i++) { @@ -371,7 +376,7 @@ export function getTooltip(chart) { } else { res = param.value } - obj.value = res + obj.value = res === null ? '' : res return obj } } diff --git a/frontend/src/views/chart/chart/formatter.js b/frontend/src/views/chart/chart/formatter.js index 9c3be428e3..5a51c89dda 100644 --- a/frontend/src/views/chart/chart/formatter.js +++ b/frontend/src/views/chart/chart/formatter.js @@ -23,6 +23,9 @@ export const formatterType = [ ] export function valueFormatter(value, formatter) { + if (value === null || value === undefined) { + return null + } // 1.unit 2.decimal 3.thousand separator and suffix let result if (formatter.type === 'auto') { diff --git a/frontend/src/views/chart/chart/map/map.js b/frontend/src/views/chart/chart/map/map.js index 3c695c80f7..7645d6c1f1 100644 --- a/frontend/src/views/chart/chart/map/map.js +++ b/frontend/src/views/chart/chart/map/map.js @@ -61,9 +61,8 @@ export function baseMapOption(chart_option, chart, themeStyle, curAreaCode, seri if (customAttr.color) { const colorValue = customAttr.color.value isGradient = isGradientValue(colorValue) - // chart_option.color = customAttr.color.colors if (customAttr.color.areaBorderColor) { - chart_option.series[0].itemStyle.normal.borderColor = customAttr.color.areaBorderColor + chart_option.geo.itemStyle.normal.borderColor = customAttr.color.areaBorderColor } } // tooltip @@ -94,8 +93,8 @@ export function baseMapOption(chart_option, chart, themeStyle, curAreaCode, seri // label if (customAttr.label) { const text = customAttr.label.formatter - chart_option.series[0].label = customAttr.label - chart_option.series[0].label.formatter = params => { + chart_option.geo.label = customAttr.label + chart_option.geo.label.formatter = params => { const a = params.seriesName const b = params.name const c = params.value ? params.value : '' @@ -103,13 +102,14 @@ export function baseMapOption(chart_option, chart, themeStyle, curAreaCode, seri } chart_option.series[0].labelLine = customAttr.label.labelLine if (customAttr.label.bgColor) { - chart_option.series[0].label.backgroundColor = customAttr.label.bgColor + chart_option.geo.label.backgroundColor = customAttr.label.bgColor } if (customAttr.label.showShadow) { - chart_option.series[0].label.shadowBlur = 2 - chart_option.series[0].label.showdowColor = customAttr.label.shadowColor + chart_option.geo.label.shadowBlur = 2 + chart_option.geo.label.showdowColor = customAttr.label.shadowColor } - chart_option.series[0].itemStyle.emphasis.label.show = customAttr.label.show + chart_option.geo.itemStyle.emphasis.label.show = customAttr.label.show + delete chart_option.geo.label.formatter } const valueArr = chart.data.series[seriesIndex].data // visualMap @@ -231,9 +231,7 @@ export function baseMapOption(chart_option, chart, themeStyle, curAreaCode, seri return con?.color || '#b02a02' } }, - encode: { - tooltip: 2 - }, + silent: true, data: markData } diff --git a/frontend/src/views/chart/chart/table/table-info.js b/frontend/src/views/chart/chart/table/table-info.js index 46dabf1ed4..321f6398d0 100644 --- a/frontend/src/views/chart/chart/table/table-info.js +++ b/frontend/src/views/chart/chart/table/table-info.js @@ -32,6 +32,21 @@ export function baseTableInfo(s2, container, chart, action, tableData, pageInfo) const drillFilters = JSON.parse(JSON.stringify(chart.drillFilters)) const drillExp = drillFilters[drillFilters.length - 1].datasetTableField + // 记录下钻起始字段的index + let xAxis = [] + try { + xAxis = JSON.parse(chart.xaxis) + } catch (err) { + xAxis = JSON.parse(JSON.stringify(chart.xaxis)) + } + let index = 0 + for (let i = 0; i < xAxis.length; i++) { + if (xAxis[i].id === drillFilters[0].fieldId) { + index = i + break + } + } + // 移除所有下钻字段 const removeField = [] for (let i = 0; i < chart.drillFilters.length; i++) { @@ -78,6 +93,11 @@ export function baseTableInfo(s2, container, chart, action, tableData, pageInfo) } } }) + + // 修正下钻字段的index,获取下钻位置元素添加到index位置,并删除 + const ele = columns[columns.length - 1] + columns.splice(index, 0, ele) + columns.splice(columns.length - 1, 1) } else { fields.forEach(ele => { const f = getCurrentField(chart.xaxis, ele) @@ -190,6 +210,21 @@ export function baseTableNormal(s2, container, chart, action, tableData) { const drillFilters = JSON.parse(JSON.stringify(chart.drillFilters)) const drillExp = drillFilters[drillFilters.length - 1].datasetTableField + // 记录下钻起始字段的index + let xAxis + try { + xAxis = JSON.parse(chart.xaxis) + } catch (err) { + xAxis = JSON.parse(JSON.stringify(chart.xaxis)) + } + let index = 0 + for (let i = 0; i < xAxis.length; i++) { + if (xAxis[i].id === drillFilters[0].fieldId) { + index = i + break + } + } + // 移除所有下钻字段 const removeField = [] for (let i = 0; i < chart.drillFilters.length; i++) { @@ -230,6 +265,17 @@ export function baseTableNormal(s2, container, chart, action, tableData) { } } }) + + // 修正下钻字段的index,获取下钻位置元素添加到index位置,并删除 + let yAxis + try { + yAxis = JSON.parse(chart.yaxis) + } catch (err) { + yAxis = JSON.parse(JSON.stringify(chart.yaxis)) + } + const ele = columns[columns.length - 1 - yAxis.length] + columns.splice(index, 0, ele) + columns.splice(columns.length - 1 - yAxis.length, 1) } else { fields.forEach(ele => { const f = getCurrentField(chart.yaxis, ele) @@ -301,7 +347,7 @@ export function baseTableNormal(s2, container, chart, action, tableData) { return s2 } -export function baseTablePivot(s2, container, chart, action, tableData) { +export function baseTablePivot(s2, container, chart, action, headerAction, tableData) { const containerDom = document.getElementById(container) // row and column @@ -476,6 +522,8 @@ export function baseTablePivot(s2, container, chart, action, tableData) { // click s2.on(S2Event.DATA_CELL_CLICK, action) + s2.on(S2Event.ROW_CELL_CLICK, headerAction) + s2.on(S2Event.COL_CELL_CLICK, headerAction) // theme const customTheme = getCustomTheme(chart) diff --git a/frontend/src/views/chart/chart/util.js b/frontend/src/views/chart/chart/util.js index 5808b3f900..cec78c5011 100644 --- a/frontend/src/views/chart/chart/util.js +++ b/frontend/src/views/chart/chart/util.js @@ -3186,7 +3186,7 @@ export const TYPE_CONFIGS = [ 'show', 'fontSize', 'color', - 'formatter', + 'label-bg', 'label-show-shadow', 'label-shadow-color' diff --git a/frontend/src/views/chart/components/ChartComponent.vue b/frontend/src/views/chart/components/ChartComponent.vue index 5b5c9f6fd4..6b5057a14f 100644 --- a/frontend/src/views/chart/components/ChartComponent.vue +++ b/frontend/src/views/chart/components/ChartComponent.vue @@ -332,6 +332,13 @@ export default { }) return } + if (this.canvasStyleData.panel.themeColor === 'dark') { + chart_option.legend['pageIconColor'] = '#ffffff' + chart_option.legend['pageIconInactiveColor'] = '#8c8c8c' + } else { + chart_option.legend['pageIconColor'] = '#000000' + chart_option.legend['pageIconInactiveColor'] = '#8c8c8c' + } this.myEcharts(chart_option) this.$nextTick(() => (this.linkageActive())) }, diff --git a/frontend/src/views/chart/components/ChartComponentG2.vue b/frontend/src/views/chart/components/ChartComponentG2.vue index 5c1a727b62..650a73cf27 100644 --- a/frontend/src/views/chart/components/ChartComponentG2.vue +++ b/frontend/src/views/chart/components/ChartComponentG2.vue @@ -58,6 +58,7 @@ import { DEFAULT_TITLE_STYLE } from '@/views/chart/chart/chart' import { baseMixOptionAntV } from '@/views/chart/chart/mix/mix_antv' import ChartTitleUpdate from './ChartTitleUpdate.vue' import { equalsAny } from '@/utils/StringUtils' +import { mapState } from 'vuex' export default { name: 'ChartComponentG2', @@ -140,7 +141,10 @@ export default { chartInfo() { const { id, title } = this.chart return { id, title } - } + }, + ...mapState([ + 'canvasStyleData' + ]) }, watch: { chart: { @@ -280,6 +284,24 @@ export default { if (this.myChart && chart.type !== 'liquid' && this.searchCount > 0) { this.myChart.options.animation = false } + if (this.myChart.options.legend) { + let pageNavigatorInactiveFill, pageNavigatorFill + if (this.canvasStyleData.panel.themeColor === 'dark') { + pageNavigatorFill = '#ffffff' + pageNavigatorInactiveFill = '#8c8c8c' + } else { + pageNavigatorFill = '#000000' + pageNavigatorInactiveFill = '#8c8c8c' + } + this.myChart.options.legend['pageNavigator'] = { + marker: { + style: { + inactiveFill: pageNavigatorInactiveFill, // 不能点击的颜色 + fill: pageNavigatorFill // 正常的颜色 + } + } + } + } if (this.antVRenderStatus) { this.myChart.render() diff --git a/frontend/src/views/chart/components/ChartComponentS2.vue b/frontend/src/views/chart/components/ChartComponentS2.vue index ce21906be8..2bb2f650b6 100644 --- a/frontend/src/views/chart/components/ChartComponentS2.vue +++ b/frontend/src/views/chart/components/ChartComponentS2.vue @@ -67,8 +67,8 @@ > {{ $t('chart.total') }} {{ - (chart.datasetMode === 0 && !not_support_page_dataset.includes(chart.datasourceType)) ? chart.totalItems : ((chart.data && chart.data.tableRow) ? chart.data.tableRow.length : 0) - }} + (chart.datasetMode === 0 && !not_support_page_dataset.includes(chart.datasourceType)) ? chart.totalItems : ((chart.data && chart.data.tableRow) ? chart.data.tableRow.length : 0) + }} {{ $t('chart.items') }} { + pre[next['dataeaseName']] = next['id'] + return pre + }, {}) + const dimensionList = [] + for (const key in rowData) { + if (nameIdMap[key]) { + dimensionList.push({ id: nameIdMap[key], value: rowData[key] }) + } + } + this.antVActionPost(dimensionList, nameIdMap[meta.field] || 'null') + }, setBackGroundBorder() { if (this.chart.customStyle) { const customStyle = JSON.parse(this.chart.customStyle) diff --git a/frontend/src/views/chart/components/dragItem/DetailItem.vue b/frontend/src/views/chart/components/dragItem/DetailItem.vue index 879da8c748..39ce7e0d51 100644 --- a/frontend/src/views/chart/components/dragItem/DetailItem.vue +++ b/frontend/src/views/chart/components/dragItem/DetailItem.vue @@ -1,8 +1,8 @@ @@ -487,9 +490,7 @@ export default { 'panelViewDetailsInfo' ]) }, - watch: { - - }, + watch: {}, created() { }, mounted() { @@ -509,7 +510,7 @@ export default { checkAllAxisStr = chartDetails.xaxis + chartDetails.xaxisExt + yaxisNew + chartDetails.yaxisExt + chartDetails.drillFields checkJumpStr = checkAllAxisStr } else if (chartDetails.type === 'table-pivot') { - checkJumpStr = chartDetails.yaxis + chartDetails.yaxisExt + chartDetails.drillFields + checkJumpStr = checkAllAxisStr } else if (chartDetails.type === 'table-info') { checkJumpStr = chartDetails.xaxis + chartDetails.drillFields } else { @@ -657,7 +658,10 @@ export default { pos2.line = pos1.line pos2.ch = pos1.ch this.$refs.myCm.codemirror.replaceRange(param, pos2) - this.$refs.myCm.codemirror.markText(pos2, { line: pos2.line, ch: param.length + pos2.ch }, { atomic: true, selectRight: true }) + this.$refs.myCm.codemirror.markText(pos2, { line: pos2.line, ch: param.length + pos2.ch }, { + atomic: true, + selectRight: true + }) }, matchToAuto() { if (!this.name2Auto.length) return @@ -665,7 +669,10 @@ export default { const search = this.$refs.myCm.codemirror.getSearchCursor(ele, { line: 0, ch: 0 }) if (search.find()) { const { from, to } = search.pos - this.$refs.myCm.codemirror.markText({ line: from.line, ch: from.ch - 1 }, { line: to.line, ch: to.ch + 1 }, { atomic: true, selectRight: true }) + this.$refs.myCm.codemirror.markText({ line: from.line, ch: from.ch - 1 }, { + line: to.line, + ch: to.ch + 1 + }, { atomic: true, selectRight: true }) } }) }, @@ -696,41 +703,46 @@ export default { diff --git a/frontend/src/views/system/datasource/DsAppForm.vue b/frontend/src/views/system/datasource/DsAppForm.vue index 31202e98a1..581d5b5eac 100644 --- a/frontend/src/views/system/datasource/DsAppForm.vue +++ b/frontend/src/views/system/datasource/DsAppForm.vue @@ -800,7 +800,7 @@ export default { data.request = JSON.stringify(data.request) this.loading = true this.disabledNext = true - checkApiDatasource(data).then(res => { + checkApiDatasource({'data': Base64.encode(JSON.stringify(data))}).then(res => { this.loading = false this.disabledNext = false this.apiItem.status = 'Success' @@ -858,7 +858,7 @@ export default { const data = JSON.parse(JSON.stringify(this.apiItem)) data.request = JSON.stringify(data.request) this.loading = true - checkApiDatasource(data).then(res => { + checkApiDatasource({'data': Base64.encode(JSON.stringify(data))}).then(res => { this.loading = false this.$success(i18n.t('commons.success')) this.apiItem.fields = res.data.fields diff --git a/frontend/src/views/system/datasource/DsConfiguration.vue b/frontend/src/views/system/datasource/DsConfiguration.vue index 322f95911b..397bbffd7c 100644 --- a/frontend/src/views/system/datasource/DsConfiguration.vue +++ b/frontend/src/views/system/datasource/DsConfiguration.vue @@ -734,6 +734,7 @@ import { checkApiDatasource, getSchema } from '@/api/system/datasource' import ApiHttpRequestForm from '@/views/system/datasource/ApiHttpRequestForm' import dePwd from '@/components/deCustomCm/DePwd.vue' import msgCfm from '@/components/msgCfm' +import { Base64 } from 'js-base64' export default { name: 'DsConfiguration', components: { @@ -1069,10 +1070,10 @@ export default { } this.$refs.apiItemBasicInfo.validate((valid) => { if (valid) { - const data = JSON.parse(JSON.stringify(this.apiItem)) + const data = Base64.encode(JSON.stringify(this.apiItem)) this.loading = true this.disabledNext = true - checkApiDatasource(data) + checkApiDatasource({'data': data}) .then((res) => { this.loading = false this.disabledNext = false diff --git a/frontend/src/views/system/datasource/DsFormContent.vue b/frontend/src/views/system/datasource/DsFormContent.vue index 98a9e70ca1..8bfc71907f 100644 --- a/frontend/src/views/system/datasource/DsFormContent.vue +++ b/frontend/src/views/system/datasource/DsFormContent.vue @@ -1000,7 +1000,7 @@ export default { method = this.formType === 'add' ? appApply : appEdit } if ( - this.formType === 'modify' && + this.formType === 'modify' && this.$route.query.showModel !== 'copy' && this.originConfiguration !== form.configuration ) { if (repeat && !isAppMarket) { diff --git a/frontend/src/views/system/datasource/DsTree.vue b/frontend/src/views/system/datasource/DsTree.vue index 44f4ddc3fc..876c047492 100644 --- a/frontend/src/views/system/datasource/DsTree.vue +++ b/frontend/src/views/system/datasource/DsTree.vue @@ -174,7 +174,10 @@ {{ $t('chart.edit') }} - + {{ $t('commons.copy') }} @@ -899,4 +902,9 @@ export default { margin-left: 0; } } +.de-copy-icon { + cursor: pointer; + margin-right: 5px; + color: var(--deTextSecondary, #646a73); +} diff --git a/frontend/src/views/system/plugin/index.vue b/frontend/src/views/system/plugin/index.vue index ec1a8c165c..88d169b7c2 100644 --- a/frontend/src/views/system/plugin/index.vue +++ b/frontend/src/views/system/plugin/index.vue @@ -228,7 +228,7 @@ export default { ] } pluginLists(0, 0, param).then((response) => { - this.data = response.data.listObject + this.data = response.data.listObject.filter(item => item.pluginId > 1) this.data.forEach((ele) => { if (ele.cost) { ele.cost = ele.cost.toLocaleString() @@ -283,10 +283,10 @@ export default { this.handlerConfirm(options) }, btnDisabled(row) { - return row.pluginId < 4 + return row.store === 'default' }, updateDisabled(row) { - return row.pluginId === 1 + return row.store === 'default' } } }