| @@ -1,5 +1,6 @@ | |||||
| package com.iformall.config; | package com.iformall.config; | ||||
| import com.fasterxml.jackson.annotation.JsonInclude; | |||||
| import com.fasterxml.jackson.databind.DeserializationConfig; | import com.fasterxml.jackson.databind.DeserializationConfig; | ||||
| import com.fasterxml.jackson.databind.DeserializationFeature; | import com.fasterxml.jackson.databind.DeserializationFeature; | ||||
| import com.fasterxml.jackson.databind.ObjectMapper; | import com.fasterxml.jackson.databind.ObjectMapper; | ||||
| @@ -9,6 +10,7 @@ import org.springframework.context.annotation.Configuration; | |||||
| import org.springframework.http.converter.HttpMessageConverter; | import org.springframework.http.converter.HttpMessageConverter; | ||||
| import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; | import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; | ||||
| import org.springframework.web.servlet.config.annotation.EnableWebMvc; | import org.springframework.web.servlet.config.annotation.EnableWebMvc; | ||||
| import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; | |||||
| import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; | ||||
| import java.math.BigDecimal; | import java.math.BigDecimal; | ||||
| @@ -19,6 +21,17 @@ import java.util.List; | |||||
| @Configuration | @Configuration | ||||
| @EnableWebMvc | @EnableWebMvc | ||||
| public class WebConfig implements WebMvcConfigurer { | public class WebConfig implements WebMvcConfigurer { | ||||
| @Override | |||||
| public void addResourceHandlers(ResourceHandlerRegistry registry) { | |||||
| registry.addResourceHandler("swagger-ui.html") | |||||
| .addResourceLocations("classpath:/META-INF/resources/"); | |||||
| registry.addResourceHandler("/webjars/**") | |||||
| .addResourceLocations("classpath:/META-INF/resources/webjars/"); | |||||
| //registry.addResourceHandler("/app/**").addResourceLocations("classpath:/app/"); | |||||
| } | |||||
| @Override | @Override | ||||
| public void configureMessageConverters(List<HttpMessageConverter<?>> converters) { | public void configureMessageConverters(List<HttpMessageConverter<?>> converters) { | ||||
| MappingJackson2HttpMessageConverter jackson2HttpMessageConverter = new MappingJackson2HttpMessageConverter(); | MappingJackson2HttpMessageConverter jackson2HttpMessageConverter = new MappingJackson2HttpMessageConverter(); | ||||
| @@ -26,6 +39,9 @@ public class WebConfig implements WebMvcConfigurer { | |||||
| ObjectMapper objectMapper = new ObjectMapper(); | ObjectMapper objectMapper = new ObjectMapper(); | ||||
| SimpleModule simpleModule = new SimpleModule(); | SimpleModule simpleModule = new SimpleModule(); | ||||
| //不显示为null的字段 | |||||
| objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); | |||||
| DeserializationConfig dc = objectMapper.getDeserializationConfig(); | DeserializationConfig dc = objectMapper.getDeserializationConfig(); | ||||
| // 设置反序列化日期格式、忽略不存在get、set的属性 | // 设置反序列化日期格式、忽略不存在get、set的属性 | ||||
| objectMapper.setConfig( | objectMapper.setConfig( | ||||
| @@ -28,7 +28,7 @@ public class WxOrderController extends BaseController { | |||||
| @ApiImplicitParams({ | @ApiImplicitParams({ | ||||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | ||||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true), | @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true), | ||||
| @ApiImplicitParam(name = "status", value = "订单状态:-1全部;0-已下单/待付款;1-已支付;2-已取消(限定时间内未付款);3-未退款/待退款;4-已退款;5-退款失败", defaultValue = "0", required = false, dataType = "Integer") | |||||
| @ApiImplicitParam(name = "status", value = "订单状态:-1全部;0-已下单/待付款;1-已支付;2-已取消(限定时间内未付款);3-未退款/待退款;4-已退款;5-退款失败", defaultValue = "0", required = false, dataType = "int") | |||||
| }) | }) | ||||
| public ResultData list(@ModelAttribute WxOrder wxOrder, Integer pageNum, Integer pageSize) { | public ResultData list(@ModelAttribute WxOrder wxOrder, Integer pageNum, Integer pageSize) { | ||||
| if (null == wxOrder) wxOrder = new WxOrder(); | if (null == wxOrder) wxOrder = new WxOrder(); | ||||
| @@ -1,5 +1,6 @@ | |||||
| package com.iformall.config; | package com.iformall.config; | ||||
| import com.fasterxml.jackson.annotation.JsonInclude; | |||||
| import com.fasterxml.jackson.databind.DeserializationConfig; | import com.fasterxml.jackson.databind.DeserializationConfig; | ||||
| import com.fasterxml.jackson.databind.DeserializationFeature; | import com.fasterxml.jackson.databind.DeserializationFeature; | ||||
| import com.fasterxml.jackson.databind.ObjectMapper; | import com.fasterxml.jackson.databind.ObjectMapper; | ||||
| @@ -63,6 +64,10 @@ public class WebMvcConfig implements WebMvcConfigurer { | |||||
| //ObjectMapper 是Jackson库的主要类。它提供一些功能将转换成Java对象匹配JSON结构,反之亦然 | //ObjectMapper 是Jackson库的主要类。它提供一些功能将转换成Java对象匹配JSON结构,反之亦然 | ||||
| ObjectMapper objectMapper = new ObjectMapper(); | ObjectMapper objectMapper = new ObjectMapper(); | ||||
| SimpleModule simpleModule = new SimpleModule(); | SimpleModule simpleModule = new SimpleModule(); | ||||
| //不显示为null的字段 | |||||
| objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); | |||||
| DeserializationConfig dc = objectMapper.getDeserializationConfig(); | DeserializationConfig dc = objectMapper.getDeserializationConfig(); | ||||
| // 设置反序列化日期格式、忽略不存在get、set的属性 | // 设置反序列化日期格式、忽略不存在get、set的属性 | ||||
| objectMapper.setConfig( | objectMapper.setConfig( | ||||
| @@ -1,5 +1,6 @@ | |||||
| package com.iformall.config; | package com.iformall.config; | ||||
| import com.fasterxml.jackson.annotation.JsonInclude; | |||||
| import com.fasterxml.jackson.databind.DeserializationConfig; | import com.fasterxml.jackson.databind.DeserializationConfig; | ||||
| import com.fasterxml.jackson.databind.DeserializationFeature; | import com.fasterxml.jackson.databind.DeserializationFeature; | ||||
| import com.fasterxml.jackson.databind.ObjectMapper; | import com.fasterxml.jackson.databind.ObjectMapper; | ||||
| @@ -63,6 +64,10 @@ public class WebMvcConfig implements WebMvcConfigurer { | |||||
| //ObjectMapper 是Jackson库的主要类。它提供一些功能将转换成Java对象匹配JSON结构,反之亦然 | //ObjectMapper 是Jackson库的主要类。它提供一些功能将转换成Java对象匹配JSON结构,反之亦然 | ||||
| ObjectMapper objectMapper = new ObjectMapper(); | ObjectMapper objectMapper = new ObjectMapper(); | ||||
| SimpleModule simpleModule = new SimpleModule(); | SimpleModule simpleModule = new SimpleModule(); | ||||
| //不显示为null的字段 | |||||
| objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); | |||||
| DeserializationConfig dc = objectMapper.getDeserializationConfig(); | DeserializationConfig dc = objectMapper.getDeserializationConfig(); | ||||
| // 设置反序列化日期格式、忽略不存在get、set的属性 | // 设置反序列化日期格式、忽略不存在get、set的属性 | ||||
| objectMapper.setConfig( | objectMapper.setConfig( | ||||