feat: 新需求功能代码提交。
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
package org.dromara.common.json.handler;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.text.DecimalFormat;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.databind.JsonSerializer;
|
||||
import com.fasterxml.jackson.databind.SerializerProvider;
|
||||
|
||||
/**
|
||||
* Double 类型格式化序列化器
|
||||
* 保留两位小数
|
||||
*
|
||||
* @author intc
|
||||
*/
|
||||
public class DoubleSerializer extends JsonSerializer<Double> {
|
||||
|
||||
private static final DecimalFormat DECIMAL_FORMAT = new DecimalFormat("0.00");
|
||||
|
||||
@Override
|
||||
public void serialize(Double value, JsonGenerator gen, SerializerProvider serializers) throws IOException {
|
||||
if (value == null) {
|
||||
gen.writeNull();
|
||||
} else {
|
||||
gen.writeNumber(DECIMAL_FORMAT.format(value));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -41,7 +41,6 @@
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-jsqlparser</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- sql性能分析插件 -->
|
||||
<dependency>
|
||||
<groupId>p6spy</groupId>
|
||||
|
||||
Reference in New Issue
Block a user