Skip to content

Commit 9675d9d

Browse files
committed
todo
1 parent 8a89b38 commit 9675d9d

File tree

7 files changed

+20
-18
lines changed

7 files changed

+20
-18
lines changed

pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
<groupId>com.codingapi.springboot</groupId>
1414
<artifactId>springboot-parent</artifactId>
15-
<version>2.1.5</version>
15+
<version>2.1.6</version>
1616

1717
<url>https://github.com/codingapi/springboot-framewrok</url>
1818
<name>springboot-parent</name>

springboot-starter-data-fast/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>springboot-parent</artifactId>
77
<groupId>com.codingapi.springboot</groupId>
8-
<version>2.1.5</version>
8+
<version>2.1.6</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111

springboot-starter-id-generator/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>springboot-parent</artifactId>
77
<groupId>com.codingapi.springboot</groupId>
8-
<version>2.1.5</version>
8+
<version>2.1.6</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111

springboot-starter-security-jwt/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<artifactId>springboot-parent</artifactId>
88
<groupId>com.codingapi.springboot</groupId>
9-
<version>2.1.5</version>
9+
<version>2.1.6</version>
1010
</parent>
1111

1212
<artifactId>springboot-starter-security-jwt</artifactId>

springboot-starter/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>com.codingapi.springboot</groupId>
77
<artifactId>springboot-parent</artifactId>
8-
<version>2.1.5</version>
8+
<version>2.1.6</version>
99
</parent>
1010
<artifactId>springboot-starter</artifactId>
1111

springboot-starter/src/main/java/com/codingapi/springboot/framework/rest/param/RestParam.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
public interface RestParam {
44

5-
default RestParamBuilder getParameters() {
5+
default RestParamBuilder toParameters() {
66
return RestParamBuilder.parser(this);
77
}
88

springboot-starter/src/main/java/com/codingapi/springboot/framework/rest/param/RestParamBuilder.java

+14-12
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,9 @@
22

33
import com.alibaba.fastjson.JSONObject;
44
import lombok.SneakyThrows;
5-
import org.springframework.beans.BeanUtils;
65
import org.springframework.util.LinkedMultiValueMap;
76
import org.springframework.util.MultiValueMap;
87

9-
import java.beans.PropertyDescriptor;
108
import java.net.URLEncoder;
119
import java.nio.charset.StandardCharsets;
1210

@@ -26,13 +24,17 @@ public static RestParamBuilder create() {
2624

2725
@SneakyThrows
2826
public static RestParamBuilder parser(Object obj) {
29-
PropertyDescriptor[] descriptors = BeanUtils.getPropertyDescriptors(obj.getClass());
3027
RestParamBuilder builder = create();
31-
for (PropertyDescriptor descriptor : descriptors) {
32-
String name = descriptor.getName();
33-
Object value = BeanUtils.getPropertyDescriptor(obj.getClass(), name);
34-
if (value != null) {
35-
builder.add(name, value);
28+
JSONObject object = (JSONObject) JSONObject.toJSON(obj);
29+
for (String key : object.keySet()) {
30+
Object value = object.getJSONObject(key);
31+
if(value!=null){
32+
builder.add(key, value);
33+
}else {
34+
value = object.getJSONArray(key);
35+
if (value != null) {
36+
builder.add(key, value);
37+
}
3638
}
3739
}
3840
return builder;
@@ -42,17 +44,17 @@ public JSONObject toJsonRequest() {
4244
return jsonBody;
4345
}
4446

45-
public MultiValueMap<String, String> toFormRequest() {
47+
public MultiValueMap<String, String> toFormRequest() {
4648
return mapBody;
4749
}
4850

4951
public RestParamBuilder add(String key, Object value) {
50-
return add(key, value,true);
52+
return add(key, value, true);
5153
}
5254

53-
public RestParamBuilder add(String key, Object value,boolean encode) {
55+
public RestParamBuilder add(String key, Object value, boolean encode) {
5456
String stringValue = value.toString();
55-
String encodeValue = encode? URLEncoder.encode(stringValue, StandardCharsets.UTF_8):value.toString();
57+
String encodeValue = encode ? URLEncoder.encode(stringValue, StandardCharsets.UTF_8) : value.toString();
5658
jsonBody.put(key, value);
5759
mapBody.add(key, encodeValue);
5860
return this;

0 commit comments

Comments
 (0)