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
|
||||
public class ApiDefinitionRequest {
|
||||
private List<Map<String, String>> headers = new ArrayList<>();
|
||||
private List<Map<String, String>> arguments = new ArrayList<>();
|
||||
private JSONObject body = new JSONObject();
|
||||
private AuthManager authManager = new AuthManager();
|
||||
|
||||
|
@ -28,6 +28,7 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@ -145,6 +146,15 @@ public class ApiProvider extends Provider {
|
||||
|
||||
switch (apiDefinition.getMethod()) {
|
||||
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);
|
||||
break;
|
||||
case "POST":
|
||||
|
@ -94,7 +94,11 @@ public class JdbcProvider extends DefaultJdbcProvider {
|
||||
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()) {
|
||||
String tableName = resultSet.getString("TABLE_NAME");
|
||||
String database;
|
||||
|
@ -1151,7 +1151,7 @@ public class CKQueryProvider extends QueryProvider {
|
||||
whereName = String.format(CKConstants.formatDateTime, String.format(CKConstants.toDateTime, cast), format);
|
||||
}
|
||||
if (field.getDeExtractType() == 1) {
|
||||
whereName = String.format(CKConstants.formatDateTime, originName, format);
|
||||
whereName = originName;
|
||||
}
|
||||
} else if (field.getDeType() == 2 || field.getDeType() == 3) {
|
||||
if (field.getDeExtractType() == 0 || field.getDeExtractType() == 5) {
|
||||
|
@ -1926,6 +1926,8 @@ export default {
|
||||
jsonpath_info: 'Please fill in JsonPath',
|
||||
req_param: 'Request parameters',
|
||||
headers: 'Request header',
|
||||
query_param: "QUERY param",
|
||||
query_info: "Follow in the address bar? The following parameters, such as: updateAPI? id=112",
|
||||
key: 'Key',
|
||||
value: 'Value',
|
||||
data_path: 'Extract data',
|
||||
|
@ -1920,6 +1920,8 @@ export default {
|
||||
jsonpath_info: '請輸入JsonPath',
|
||||
req_param: '請求參數',
|
||||
headers: '請求頭',
|
||||
query_param: "QUERY參數",
|
||||
query_info: "地址欄中跟在?後面的參數,如:updateapi? id=112",
|
||||
key: '鍵',
|
||||
value: '值',
|
||||
data_path: '提取數據',
|
||||
|
@ -1936,6 +1936,8 @@ export default {
|
||||
jsonpath_info: '请填入JsonPath',
|
||||
req_param: '请求参数',
|
||||
headers: '请求头',
|
||||
query_param: "QUERY參數",
|
||||
query_info: "地址栏中跟在?后面的参数,如: updateapi?id=112",
|
||||
key: '键',
|
||||
value: '值',
|
||||
data_path: '提取数据',
|
||||
|
@ -36,6 +36,27 @@
|
||||
/>
|
||||
</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
|
||||
v-if="isBodyShow"
|
||||
@ -78,6 +99,7 @@
|
||||
<script>
|
||||
import ApiKeyValue from '@/views/system/datasource/ApiKeyValue'
|
||||
import ApiBody from '@/views/system/datasource/ApiBody'
|
||||
import ApiVariable from '@/views/system/datasource/ApiVariable.vue'
|
||||
import ApiAuthConfig from '@/views/system/datasource/ApiAuthConfig'
|
||||
import { Body, KeyValue } from '@/views/system/datasource/ApiTestModel'
|
||||
import Convert from '@/views/system/datasource/convert'
|
||||
@ -87,7 +109,8 @@ export default {
|
||||
components: {
|
||||
ApiAuthConfig,
|
||||
ApiBody,
|
||||
ApiKeyValue
|
||||
ApiKeyValue,
|
||||
ApiVariable
|
||||
},
|
||||
props: {
|
||||
method: String,
|
||||
|
@ -993,6 +993,7 @@ export default {
|
||||
method: 'GET',
|
||||
request: {
|
||||
headers: [{}],
|
||||
arguments: [],
|
||||
body: {
|
||||
type: '',
|
||||
raw: '',
|
||||
@ -1009,6 +1010,7 @@ export default {
|
||||
dataPath: '',
|
||||
request: {
|
||||
headers: [],
|
||||
arguments: [],
|
||||
body: {
|
||||
type: '',
|
||||
raw: '',
|
||||
|
Loading…
Reference in New Issue
Block a user