Skip to content

Commit

Permalink
Merge pull request #190 from github-ganyu/master
Browse files Browse the repository at this point in the history
Optimize some code
  • Loading branch information
TommyLemon authored Jan 12, 2021
2 parents 90f4088 + 1530864 commit 18a60a9
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
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

0 comments on commit 18a60a9

Please sign in to comment.