Merge branch 'dev' into pr@dev_st_fix

This commit is contained in:
dataeaseShu 2023-07-12 11:06:48 +08:00
commit 63676d5e50
14 changed files with 66 additions and 51 deletions

View File

@ -3,6 +3,7 @@ package io.dataease.controller.panel;
import com.github.pagehelper.Page; import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.xiaoymin.knife4j.annotations.ApiSupport; import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import io.dataease.auth.annotation.SqlInjectValidator;
import io.dataease.commons.utils.PageUtils; import io.dataease.commons.utils.PageUtils;
import io.dataease.commons.utils.Pager; import io.dataease.commons.utils.Pager;
import io.dataease.controller.handler.annotation.I18n; import io.dataease.controller.handler.annotation.I18n;
@ -35,6 +36,7 @@ public class AppLogController {
@ApiImplicitParam(paramType = "path", name = "pageSize", value = "页容量", required = true, dataType = "Integer"), @ApiImplicitParam(paramType = "path", name = "pageSize", value = "页容量", required = true, dataType = "Integer"),
@ApiImplicitParam(name = "request", value = "查询条件", required = true) @ApiImplicitParam(name = "request", value = "查询条件", required = true)
}) })
@SqlInjectValidator(value = {"apply_time"})
public Pager<List<AppLogGridDTO>> logGrid(@PathVariable int goPage, @PathVariable int pageSize, public Pager<List<AppLogGridDTO>> logGrid(@PathVariable int goPage, @PathVariable int pageSize,
@RequestBody KeyGridRequest request) { @RequestBody KeyGridRequest request) {
Page<Object> page = PageHelper.startPage(goPage, pageSize, true); Page<Object> page = PageHelper.startPage(goPage, pageSize, true);

View File

@ -10,7 +10,7 @@ import java.util.List;
public interface ExtDataSourceMapper { public interface ExtDataSourceMapper {
List<DatasourceDTO> query(GridExample example); // List<DatasourceDTO> query(GridExample example);
List<DatasourceDTO> queryUnion(DatasourceUnionRequest request); List<DatasourceDTO> queryUnion(DatasourceUnionRequest request);

View File

@ -61,7 +61,7 @@
dataset_table_field.origin_name, dataset_table_field.origin_name,
dataset_table_field.`name`, dataset_table_field.`name`,
dataset_table_field.de_type dataset_table_field.de_type
from dataset_table_field where table_id = #{table_id} from dataset_table_field where dataset_table_field.group_type = 'd' and table_id = #{table_id}
</select> </select>
<select id="queryTableFieldWithViewId" resultMap="TableFieldMap"> <select id="queryTableFieldWithViewId" resultMap="TableFieldMap">

View File

@ -781,7 +781,7 @@ public class JdbcProvider extends DefaultJdbcProvider {
case StarRocks: case StarRocks:
MysqlConfiguration mysqlConfiguration = new Gson().fromJson(datasource.getConfiguration(), MysqlConfiguration.class); MysqlConfiguration mysqlConfiguration = new Gson().fromJson(datasource.getConfiguration(), MysqlConfiguration.class);
mysqlConfiguration.getJdbc(); mysqlConfiguration.getJdbc();
if(!mysqlConfiguration.getDataBase().matches("^[0-9a-zA-Z_-]{1,}$")){ if(!mysqlConfiguration.getDataBase().matches("^[0-9a-zA-Z_.-]{1,}$")){
throw new Exception("Invalid database name"); throw new Exception("Invalid database name");
} }
break; break;
@ -796,7 +796,7 @@ public class JdbcProvider extends DefaultJdbcProvider {
break; break;
case sqlServer: case sqlServer:
SqlServerConfiguration sqlServerConfiguration = new Gson().fromJson(datasource.getConfiguration(), SqlServerConfiguration.class); SqlServerConfiguration sqlServerConfiguration = new Gson().fromJson(datasource.getConfiguration(), SqlServerConfiguration.class);
if(!sqlServerConfiguration.getDataBase().matches("^[0-9a-zA-Z_]{1,}$")){ if(!sqlServerConfiguration.getDataBase().matches("^[0-9a-zA-Z_.-]{1,}$")){
throw new Exception("Invalid database name"); throw new Exception("Invalid database name");
} }
break; break;

View File

@ -1077,16 +1077,16 @@ public class DorisQueryProvider extends QueryProvider {
String format = transDateFormat(request.getDateStyle(), request.getDatePattern()); String format = transDateFormat(request.getDateStyle(), request.getDatePattern());
if (field.getDeExtractType() == 0 || field.getDeExtractType() == 5 || field.getDeExtractType() == 1) { if (field.getDeExtractType() == 0 || field.getDeExtractType() == 5 || field.getDeExtractType() == 1) {
String date = String.format(MySQLConstants.STR_TO_DATE, originName, StringUtils.isNotEmpty(field.getDateFormat()) ? field.getDateFormat() : MysqlConstants.DEFAULT_DATE_FORMAT); String date = String.format(MySQLConstants.STR_TO_DATE, originName, StringUtils.isNotEmpty(field.getDateFormat()) ? field.getDateFormat() : MysqlConstants.DEFAULT_DATE_FORMAT);
if(request.getOperator().equals("between")){ if (request.getOperator().equals("between")) {
whereName = date; whereName = date;
}else { } else {
whereName = String.format(MySQLConstants.DATE_FORMAT, date, format); whereName = String.format(MySQLConstants.DATE_FORMAT, date, format);
} }
} }
if (field.getDeExtractType() == 2 || field.getDeExtractType() == 3 || field.getDeExtractType() == 4) { if (field.getDeExtractType() == 2 || field.getDeExtractType() == 3 || field.getDeExtractType() == 4) {
if(request.getOperator().equals("between")){ if (request.getOperator().equals("between")) {
whereName = originName; whereName = originName;
}else { } else {
String cast = String.format(MySQLConstants.CAST, originName, MySQLConstants.DEFAULT_INT_FORMAT) + "/1000"; String cast = String.format(MySQLConstants.CAST, originName, MySQLConstants.DEFAULT_INT_FORMAT) + "/1000";
whereName = String.format(DorisConstants.FROM_UNIXTIME, cast, format); whereName = String.format(DorisConstants.FROM_UNIXTIME, cast, format);
} }

View File

@ -1095,7 +1095,10 @@ public class ImpalaQueryProvider extends QueryProvider {
whereName = "upper(" + whereName + ")"; whereName = "upper(" + whereName + ")";
} else if (StringUtils.containsIgnoreCase(request.getOperator(), "between")) { } else if (StringUtils.containsIgnoreCase(request.getOperator(), "between")) {
if (request.getDatasetTableField().getDeType() == DeTypeConstants.DE_TIME) { if (request.getDatasetTableField().getDeType() == DeTypeConstants.DE_TIME) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
if(request.getDatasetTableField().getDeExtractType() == DeTypeConstants.DE_TIME){
simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
}
String startTime = simpleDateFormat.format(new Date(Long.parseLong(value.get(0)))); String startTime = simpleDateFormat.format(new Date(Long.parseLong(value.get(0))));
String endTime = simpleDateFormat.format(new Date(Long.parseLong(value.get(1)))); String endTime = simpleDateFormat.format(new Date(Long.parseLong(value.get(1))));
whereValue = String.format(ImpalaConstants.WHERE_BETWEEN, startTime, endTime); whereValue = String.format(ImpalaConstants.WHERE_BETWEEN, startTime, endTime);

View File

@ -6,30 +6,28 @@ import com.google.gson.JsonObject;
import com.google.gson.JsonParser; import com.google.gson.JsonParser;
import com.google.gson.reflect.TypeToken; import com.google.gson.reflect.TypeToken;
import io.dataease.auth.annotation.DeCleaner; import io.dataease.auth.annotation.DeCleaner;
import io.dataease.commons.constants.RedisConstants;
import io.dataease.commons.utils.BeanUtils;
import io.dataease.controller.sys.response.BasicInfo;
import io.dataease.dto.TaskInstance;
import io.dataease.ext.ExtDataSourceMapper;
import io.dataease.ext.ExtTaskInstanceMapper;
import io.dataease.ext.UtilMapper;
import io.dataease.ext.query.GridExample;
import io.dataease.commons.constants.DePermissionType; import io.dataease.commons.constants.DePermissionType;
import io.dataease.commons.constants.RedisConstants;
import io.dataease.commons.constants.SysAuthConstants; import io.dataease.commons.constants.SysAuthConstants;
import io.dataease.commons.exception.DEException; import io.dataease.commons.exception.DEException;
import io.dataease.commons.model.AuthURD; import io.dataease.commons.model.AuthURD;
import io.dataease.commons.utils.AuthUtils; import io.dataease.commons.utils.AuthUtils;
import io.dataease.commons.utils.BeanUtils;
import io.dataease.commons.utils.CommonThreadPool; import io.dataease.commons.utils.CommonThreadPool;
import io.dataease.commons.utils.LogUtil; import io.dataease.commons.utils.LogUtil;
import io.dataease.controller.ResultHolder; import io.dataease.controller.ResultHolder;
import io.dataease.controller.datasource.request.UpdataDsRequest; import io.dataease.controller.datasource.request.UpdataDsRequest;
import io.dataease.controller.request.DatasourceUnionRequest; import io.dataease.controller.request.DatasourceUnionRequest;
import io.dataease.controller.request.datasource.ApiDefinition; import io.dataease.controller.request.datasource.ApiDefinition;
import io.dataease.controller.sys.base.BaseGridRequest; import io.dataease.controller.sys.response.BasicInfo;
import io.dataease.controller.sys.base.ConditionEntity;
import io.dataease.dto.DatasourceDTO; import io.dataease.dto.DatasourceDTO;
import io.dataease.dto.TaskInstance;
import io.dataease.dto.dataset.DataTableInfoDTO; import io.dataease.dto.dataset.DataTableInfoDTO;
import io.dataease.dto.datasource.*; import io.dataease.dto.datasource.DBTableDTO;
import io.dataease.dto.datasource.MysqlConfiguration;
import io.dataease.ext.ExtDataSourceMapper;
import io.dataease.ext.ExtTaskInstanceMapper;
import io.dataease.ext.UtilMapper;
import io.dataease.i18n.Translator; import io.dataease.i18n.Translator;
import io.dataease.plugins.common.base.domain.*; import io.dataease.plugins.common.base.domain.*;
import io.dataease.plugins.common.base.mapper.DatasetTableMapper; import io.dataease.plugins.common.base.mapper.DatasetTableMapper;
@ -163,7 +161,7 @@ public class DatasourceService {
List<DatasourceDTO> datasourceDTOS = extDataSourceMapper.queryUnion(request); List<DatasourceDTO> datasourceDTOS = extDataSourceMapper.queryUnion(request);
datasourceDTOS.forEach(this::datasourceTrans); datasourceDTOS.forEach(this::datasourceTrans);
if (StringUtils.isBlank(request.getSort())) { if (StringUtils.isBlank(request.getSort())) {
datasourceDTOS.sort((o1,o2) -> { datasourceDTOS.sort((o1, o2) -> {
int tmp = StringUtils.compareIgnoreCase(o1.getTypeDesc(), o2.getTypeDesc()); int tmp = StringUtils.compareIgnoreCase(o1.getTypeDesc(), o2.getTypeDesc());
if (tmp == 0) { if (tmp == 0) {
tmp = StringUtils.compareIgnoreCase(o1.getName(), o2.getName()); tmp = StringUtils.compareIgnoreCase(o1.getName(), o2.getName());
@ -247,19 +245,6 @@ public class DatasourceService {
return result; return result;
} }
public List<DatasourceDTO> gridQuery(BaseGridRequest request) {
//如果没有查询条件增加一个默认的条件
if (CollectionUtils.isEmpty(request.getConditions())) {
ConditionEntity conditionEntity = new ConditionEntity();
conditionEntity.setField("1");
conditionEntity.setOperator("eq");
conditionEntity.setValue("1");
request.setConditions(Collections.singletonList(conditionEntity));
}
GridExample gridExample = request.convertExample();
gridExample.setExtendCondition(String.valueOf(AuthUtils.getUser().getUserId()));
return extDataSourceMapper.query(gridExample);
}
@DeCleaner(DePermissionType.DATASOURCE) @DeCleaner(DePermissionType.DATASOURCE)
public ResultHolder deleteDatasource(String datasourceId) throws Exception { public ResultHolder deleteDatasource(String datasourceId) throws Exception {
@ -301,11 +286,12 @@ public class DatasourceService {
DatasetTableExample datasetTableExample = new DatasetTableExample(); DatasetTableExample datasetTableExample = new DatasetTableExample();
datasetTableExample.createCriteria().andDataSourceIdEqualTo(id); datasetTableExample.createCriteria().andDataSourceIdEqualTo(id);
List<DatasetTable> datasetTables = datasetTableMapper.selectByExample(datasetTableExample); List<DatasetTable> datasetTables = datasetTableMapper.selectByExample(datasetTableExample);
List<ApiDefinition> apiDefinitionList = new Gson().fromJson(datasource.getConfiguration(), new TypeToken<List<ApiDefinition>>() {}.getType()); List<ApiDefinition> apiDefinitionList = new Gson().fromJson(datasource.getConfiguration(), new TypeToken<List<ApiDefinition>>() {
}.getType());
apiDefinitionList.forEach(apiDefinition -> { apiDefinitionList.forEach(apiDefinition -> {
if(apiDefinition.isReName()){ if (apiDefinition.isReName()) {
datasetTables.forEach(datasetTable -> { datasetTables.forEach(datasetTable -> {
if(new Gson().fromJson(datasetTable.getInfo(), DataTableInfoDTO.class).getTable().equals(apiDefinition.getOrgName())){ if (new Gson().fromJson(datasetTable.getInfo(), DataTableInfoDTO.class).getTable().equals(apiDefinition.getOrgName())) {
DatasetTable record = new DatasetTable(); DatasetTable record = new DatasetTable();
DataTableInfoDTO dataTableInfoDTO = new DataTableInfoDTO(); DataTableInfoDTO dataTableInfoDTO = new DataTableInfoDTO();
dataTableInfoDTO.setTable(apiDefinition.getName()); dataTableInfoDTO.setTable(apiDefinition.getName());
@ -650,7 +636,7 @@ public class DatasourceService {
public void updateDemoDs() { public void updateDemoDs() {
Datasource datasource = datasourceMapper.selectByPrimaryKey("76026997-94f9-4a35-96ca-151084638969"); Datasource datasource = datasourceMapper.selectByPrimaryKey("76026997-94f9-4a35-96ca-151084638969");
if(datasource == null){ if (datasource == null) {
return; return;
} }
MysqlConfiguration mysqlConfiguration = new Gson().fromJson(datasource.getConfiguration(), MysqlConfiguration.class); MysqlConfiguration mysqlConfiguration = new Gson().fromJson(datasource.getConfiguration(), MysqlConfiguration.class);

View File

@ -159,7 +159,8 @@ export default {
computed: { computed: {
chart() { chart() {
if (this.config.propValue?.viewId) { if (this.config.propValue?.viewId) {
return JSON.parse(this.panelViewDetailsInfo[this.config.propValue.viewId]) const viewInfo = this.panelViewDetailsInfo[this.config.propValue.viewId];
return viewInfo?JSON.parse(viewInfo):null
} }
return null return null
}, },

View File

@ -171,23 +171,19 @@ export default {
return this.targetLinkageInfo[this.curLinkageView.propValue.viewId] return this.targetLinkageInfo[this.curLinkageView.propValue.viewId]
}, },
...mapState([ ...mapState([
'menuTop',
'menuLeft',
'menuShow',
'curComponent',
'componentData',
'canvasStyleData',
'linkageSettingStatus',
'targetLinkageInfo', 'targetLinkageInfo',
'curLinkageView' 'curLinkageView'
]) ])
}, },
mounted() { mounted() {
const _this = this
// //
checkSameDataSet(this.curLinkageView.propValue.viewId, this.element.propValue.viewId).then(res => { checkSameDataSet(this.curLinkageView.propValue.viewId, this.element.propValue.viewId).then(res => {
if (res.data === 'YES' && this.linkageInfo.linkageFields.length === 0) { if (res.data === 'YES' && this.linkageInfo.linkageFields.length === 0) {
this.sourceLinkageInfo.targetViewFields.forEach(item => { this.sourceLinkageInfo.targetViewFields.forEach(item => {
this.addLinkageField(item.id, item.id) _this.$nextTick(() => {
this.addLinkageField(item.id, item.id)
})
}) })
} }
}) })

View File

@ -429,7 +429,10 @@ export function getCacheTree(treeName) {
} }
export function exportExcelDownload(chart, snapshot, width, height, loadingWrapper, callBack) { export function exportExcelDownload(chart, snapshot, width, height, loadingWrapper, callBack) {
if (!chart.data?.data?.length) { if (chart.render === 'antv' && !chart.data?.data?.length) {
return
}
if (chart.type === 'echarts' && !(chart.data?.series?.length && chart.data?.series[0].data?.length)) {
return return
} }
const fields = JSON.parse(JSON.stringify(chart.data.fields)) const fields = JSON.parse(JSON.stringify(chart.data.fields))

View File

@ -117,6 +117,13 @@ export default {
value: 'ge', value: 'ge',
label: this.$t('chart.filter_ge') label: this.$t('chart.filter_ge')
}] }]
},
{
label: '',
options: [{
value: 'not_null',
label: this.$t('chart.filter_not_null')
}]
}], }],
logic: '' logic: ''
} }

View File

@ -194,6 +194,13 @@ export default {
value: 'ge', value: 'ge',
label: this.$t('chart.filter_ge') label: this.$t('chart.filter_ge')
}] }]
},
{
label: '',
options: [{
value: 'not_null',
label: this.$t('chart.filter_not_null')
}]
} }
], ],
valueOptions: [ valueOptions: [
@ -226,6 +233,13 @@ export default {
value: 'ge', value: 'ge',
label: this.$t('chart.filter_ge') label: this.$t('chart.filter_ge')
}] }]
},
{
label: '',
options: [{
value: 'not_null',
label: this.$t('chart.filter_not_null')
}]
} }
], ],
options: [], options: [],

View File

@ -81,7 +81,7 @@ export default {
props: {}, props: {},
data() { data() {
return { return {
maxHeight: 2000, maxHeight: 10000,
maxTop: 20000 maxTop: 20000
} }
}, },

View File

@ -670,7 +670,10 @@ export default {
if (this.editPanel.optType === 'toDefaultPanel') { if (this.editPanel.optType === 'toDefaultPanel') {
this.defaultTree(false) this.defaultTree(false)
} }
updateCacheTree(this.editPanel.optType, 'panel-main-tree', panelInfo, this.tData)
updateCacheTree(this.editPanel.optType,
panelInfo.panelType === 'system' ? 'panel-default-tree' : 'panel-main-tree', panelInfo,
panelInfo.panelType === 'system' ? this.defaultData : this.tData)
if (this.editPanel.optType === 'rename' && panelInfo.id === this.$store.state.panel.panelInfo.id) { if (this.editPanel.optType === 'rename' && panelInfo.id === this.$store.state.panel.panelInfo.id) {
this.$store.state.panel.panelInfo.name = panelInfo.name this.$store.state.panel.panelInfo.name = panelInfo.name
} }
@ -850,7 +853,7 @@ export default {
delete(data) { delete(data) {
const params = { const params = {
title: data.nodeType === 'folder'?'commons.delete_this_folder':'commons.delete_this_dashboard', title: data.nodeType === 'folder' ? 'commons.delete_this_folder' : 'commons.delete_this_dashboard',
type: 'danger', type: 'danger',
cb: () => { cb: () => {
delGroup(data.id).then((response) => { delGroup(data.id).then((response) => {