-
Notifications
You must be signed in to change notification settings - Fork 5.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request !316 from xingyu/feature/vue3
- Loading branch information
Showing
37 changed files
with
2,593 additions
and
2,261 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
...-web/src/main/java/cn/iocoder/yudao/framework/jackson/core/databind/NumberSerializer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package cn.iocoder.yudao.framework.jackson.core.databind; | ||
|
||
import com.fasterxml.jackson.core.JsonGenerator; | ||
import com.fasterxml.jackson.databind.SerializerProvider; | ||
import com.fasterxml.jackson.databind.annotation.JacksonStdImpl; | ||
|
||
import java.io.IOException; | ||
/** | ||
* Long序列化规则 | ||
* <p> | ||
* 会将超长long值转换为string | ||
*/ | ||
@JacksonStdImpl | ||
public class NumberSerializer extends com.fasterxml.jackson.databind.ser.std.NumberSerializer { | ||
private static final long MAX_SAFE_INTEGER = 9007199254740991L; | ||
private static final long MIN_SAFE_INTEGER = -9007199254740991L; | ||
|
||
public static final NumberSerializer INSTANCE = new NumberSerializer(Number.class); | ||
public NumberSerializer(Class<? extends Number> rawType) { | ||
super(rawType); | ||
} | ||
@Override | ||
public void serialize(Number value, JsonGenerator gen, SerializerProvider serializers) throws IOException { | ||
// 超出范围 序列化位字符串 | ||
if (value.longValue() > MIN_SAFE_INTEGER && value.longValue() < MAX_SAFE_INTEGER) { | ||
super.serialize(value, gen, serializers); | ||
} else { | ||
gen.writeString(value.toString()); | ||
} | ||
} | ||
} |
Oops, something went wrong.