forked from github/dataease
Merge pull request #4995 from dataease/pr@dev@fixextratdata
Merge branch 'dev' of github.com:dataease/dataease into dev
This commit is contained in:
commit
045a4aaefe
@ -9,6 +9,7 @@ import java.util.Map;
|
|||||||
@Data
|
@Data
|
||||||
public class ApiDefinitionRequest {
|
public class ApiDefinitionRequest {
|
||||||
private List<Map<String, String>> headers = new ArrayList<>();
|
private List<Map<String, String>> headers = new ArrayList<>();
|
||||||
|
private List<Map<String, String>> arguments = new ArrayList<>();
|
||||||
private JSONObject body = new JSONObject();
|
private JSONObject body = new JSONObject();
|
||||||
private AuthManager authManager = new AuthManager();
|
private AuthManager authManager = new AuthManager();
|
||||||
|
|
||||||
|
@ -28,6 +28,7 @@ import org.springframework.stereotype.Service;
|
|||||||
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.net.URLEncoder;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@ -145,6 +146,15 @@ public class ApiProvider extends Provider {
|
|||||||
|
|
||||||
switch (apiDefinition.getMethod()) {
|
switch (apiDefinition.getMethod()) {
|
||||||
case "GET":
|
case "GET":
|
||||||
|
List<String> params = new ArrayList<>();
|
||||||
|
for (Map<String, String> argument : apiDefinition.getRequest().getArguments()) {
|
||||||
|
if(StringUtils.isNotEmpty(argument.get("name")) && StringUtils.isNotEmpty(argument.get("value"))){
|
||||||
|
params.add(argument.get("name") + "=" + URLEncoder.encode(argument.get("value")));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(CollectionUtils.isNotEmpty(params)){
|
||||||
|
apiDefinition.setUrl(apiDefinition.getUrl() + "?" + StringUtils.join(params, "&"));
|
||||||
|
}
|
||||||
response = HttpClientUtil.get(apiDefinition.getUrl().trim(), httpClientConfig);
|
response = HttpClientUtil.get(apiDefinition.getUrl().trim(), httpClientConfig);
|
||||||
break;
|
break;
|
||||||
case "POST":
|
case "POST":
|
||||||
|
@ -94,7 +94,11 @@ public class JdbcProvider extends DefaultJdbcProvider {
|
|||||||
tableNamePattern = String.format(MySQLConstants.KEYWORD_TABLE, tableNamePattern);
|
tableNamePattern = String.format(MySQLConstants.KEYWORD_TABLE, tableNamePattern);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ResultSet resultSet = databaseMetaData.getColumns(null, "%", tableNamePattern, "%");
|
String schemaPattern = "%";
|
||||||
|
if (datasourceRequest.getDatasource().getType().equalsIgnoreCase(DatasourceTypes.oracle.name())) {
|
||||||
|
schemaPattern = databaseMetaData.getUserName();
|
||||||
|
}
|
||||||
|
ResultSet resultSet = databaseMetaData.getColumns(null, schemaPattern, tableNamePattern, "%");
|
||||||
while (resultSet.next()) {
|
while (resultSet.next()) {
|
||||||
String tableName = resultSet.getString("TABLE_NAME");
|
String tableName = resultSet.getString("TABLE_NAME");
|
||||||
String database;
|
String database;
|
||||||
|
@ -1151,7 +1151,7 @@ public class CKQueryProvider extends QueryProvider {
|
|||||||
whereName = String.format(CKConstants.formatDateTime, String.format(CKConstants.toDateTime, cast), format);
|
whereName = String.format(CKConstants.formatDateTime, String.format(CKConstants.toDateTime, cast), format);
|
||||||
}
|
}
|
||||||
if (field.getDeExtractType() == 1) {
|
if (field.getDeExtractType() == 1) {
|
||||||
whereName = String.format(CKConstants.formatDateTime, originName, format);
|
whereName = originName;
|
||||||
}
|
}
|
||||||
} else if (field.getDeType() == 2 || field.getDeType() == 3) {
|
} else if (field.getDeType() == 2 || field.getDeType() == 3) {
|
||||||
if (field.getDeExtractType() == 0 || field.getDeExtractType() == 5) {
|
if (field.getDeExtractType() == 0 || field.getDeExtractType() == 5) {
|
||||||
|
@ -1926,6 +1926,8 @@ export default {
|
|||||||
jsonpath_info: 'Please fill in JsonPath',
|
jsonpath_info: 'Please fill in JsonPath',
|
||||||
req_param: 'Request parameters',
|
req_param: 'Request parameters',
|
||||||
headers: 'Request header',
|
headers: 'Request header',
|
||||||
|
query_param: "QUERY param",
|
||||||
|
query_info: "Follow in the address bar? The following parameters, such as: updateAPI? id=112",
|
||||||
key: 'Key',
|
key: 'Key',
|
||||||
value: 'Value',
|
value: 'Value',
|
||||||
data_path: 'Extract data',
|
data_path: 'Extract data',
|
||||||
|
@ -1920,6 +1920,8 @@ export default {
|
|||||||
jsonpath_info: '請輸入JsonPath',
|
jsonpath_info: '請輸入JsonPath',
|
||||||
req_param: '請求參數',
|
req_param: '請求參數',
|
||||||
headers: '請求頭',
|
headers: '請求頭',
|
||||||
|
query_param: "QUERY參數",
|
||||||
|
query_info: "地址欄中跟在?後面的參數,如:updateapi? id=112",
|
||||||
key: '鍵',
|
key: '鍵',
|
||||||
value: '值',
|
value: '值',
|
||||||
data_path: '提取數據',
|
data_path: '提取數據',
|
||||||
|
@ -1936,6 +1936,8 @@ export default {
|
|||||||
jsonpath_info: '请填入JsonPath',
|
jsonpath_info: '请填入JsonPath',
|
||||||
req_param: '请求参数',
|
req_param: '请求参数',
|
||||||
headers: '请求头',
|
headers: '请求头',
|
||||||
|
query_param: "QUERY參數",
|
||||||
|
query_info: "地址栏中跟在?后面的参数,如: updateapi?id=112",
|
||||||
key: '键',
|
key: '键',
|
||||||
value: '值',
|
value: '值',
|
||||||
data_path: '提取数据',
|
data_path: '提取数据',
|
||||||
|
@ -36,6 +36,27 @@
|
|||||||
/>
|
/>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
|
|
||||||
|
<!--query 参数-->
|
||||||
|
<el-tab-pane :label="$t('datasource.query_param')" name="parameters">
|
||||||
|
<el-tooltip class="item-tabs" effect="dark" :content="$t('datasource.query_info')"
|
||||||
|
placement="top-start" slot="label">
|
||||||
|
<span>{{ $t('datasource.query_param') }}
|
||||||
|
<div class="el-step__icon is-text ms-api-col ms-header" v-if="request.arguments.length>1">
|
||||||
|
<div class="el-step__icon-inner">{{ request.arguments.length - 1 }}</div>
|
||||||
|
</div>
|
||||||
|
</span>
|
||||||
|
</el-tooltip>
|
||||||
|
<api-variable
|
||||||
|
@editScenarioAdvance="editScenarioAdvance"
|
||||||
|
:scenario-definition="scenarioDefinition"
|
||||||
|
:with-mor-setting="true"
|
||||||
|
:is-read-only="isReadOnly"
|
||||||
|
:isShowEnable="isShowEnable"
|
||||||
|
:parameters="request.arguments"
|
||||||
|
v-if="activeName === 'parameters'"
|
||||||
|
/>
|
||||||
|
</el-tab-pane>
|
||||||
|
|
||||||
<!--请求体-->
|
<!--请求体-->
|
||||||
<el-tab-pane
|
<el-tab-pane
|
||||||
v-if="isBodyShow"
|
v-if="isBodyShow"
|
||||||
@ -78,6 +99,7 @@
|
|||||||
<script>
|
<script>
|
||||||
import ApiKeyValue from '@/views/system/datasource/ApiKeyValue'
|
import ApiKeyValue from '@/views/system/datasource/ApiKeyValue'
|
||||||
import ApiBody from '@/views/system/datasource/ApiBody'
|
import ApiBody from '@/views/system/datasource/ApiBody'
|
||||||
|
import ApiVariable from '@/views/system/datasource/ApiVariable.vue'
|
||||||
import ApiAuthConfig from '@/views/system/datasource/ApiAuthConfig'
|
import ApiAuthConfig from '@/views/system/datasource/ApiAuthConfig'
|
||||||
import { Body, KeyValue } from '@/views/system/datasource/ApiTestModel'
|
import { Body, KeyValue } from '@/views/system/datasource/ApiTestModel'
|
||||||
import Convert from '@/views/system/datasource/convert'
|
import Convert from '@/views/system/datasource/convert'
|
||||||
@ -87,7 +109,8 @@ export default {
|
|||||||
components: {
|
components: {
|
||||||
ApiAuthConfig,
|
ApiAuthConfig,
|
||||||
ApiBody,
|
ApiBody,
|
||||||
ApiKeyValue
|
ApiKeyValue,
|
||||||
|
ApiVariable
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
method: String,
|
method: String,
|
||||||
|
@ -993,6 +993,7 @@ export default {
|
|||||||
method: 'GET',
|
method: 'GET',
|
||||||
request: {
|
request: {
|
||||||
headers: [{}],
|
headers: [{}],
|
||||||
|
arguments: [],
|
||||||
body: {
|
body: {
|
||||||
type: '',
|
type: '',
|
||||||
raw: '',
|
raw: '',
|
||||||
@ -1009,6 +1010,7 @@ export default {
|
|||||||
dataPath: '',
|
dataPath: '',
|
||||||
request: {
|
request: {
|
||||||
headers: [],
|
headers: [],
|
||||||
|
arguments: [],
|
||||||
body: {
|
body: {
|
||||||
type: '',
|
type: '',
|
||||||
raw: '',
|
raw: '',
|
||||||
|
Loading…
Reference in New Issue
Block a user