Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize some code #190

Merged
merged 2 commits into from
Jan 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion APIJSONORM/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.74</version>
<version>1.2.75</version>
</dependency>
</dependencies>

Expand Down
8 changes: 2 additions & 6 deletions APIJSONORM/src/main/java/apijson/orm/AbstractParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -709,12 +709,8 @@ public JSONObject getStructure(@NotNull String table, String method, String tag,

if (result != null) { // 加快下次查询,查到值的话组合情况其实是有限的,不属于恶意请求
if (versionedMap == null) {
versionedMap = new TreeMap<>(new Comparator<Integer>() {

@Override
public int compare(Integer o1, Integer o2) {
return o2 == null ? -1 : o2.compareTo(o1); // 降序
}
versionedMap = new TreeMap<>((o1, o2) -> {
return o2 == null ? -1 : o2.compareTo(o1); // 降序
});
}

Expand Down
16 changes: 10 additions & 6 deletions APIJSONORM/src/main/java/apijson/orm/Logic.java
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,16 @@ public static int getType(char logicChar) {
public static int getType(String logicChar) {
int type = -1;
if (logicChar != null && logicChar.length() == 1) {
if ("|".equals(logicChar)) {
type = 0;
} else if ("&".equals(logicChar)) {
type = 1;
} else if ("!".equals(logicChar)) {
type = 2;
switch (logicChar) {
case "|":
type = 0;
break;
case "&":
type = 1;
break;
case "!":
type = 2;
break;
}
}
return type;
Expand Down