feat:联调bug修改

master
汤全昆 2025-09-04 10:45:25 +08:00
parent 32f6eae269
commit fa1c50d84c
2 changed files with 18 additions and 3 deletions

View File

@ -1,9 +1,15 @@
package com.unisinsight.project.config; package com.unisinsight.project.config;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; 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.util.List;
@Configuration @Configuration
public class WebMvcConfig implements WebMvcConfigurer { public class WebMvcConfig implements WebMvcConfigurer {
@ -11,4 +17,16 @@ public class WebMvcConfig implements WebMvcConfigurer {
WebMvcConfigurer.super.addResourceHandlers(registry); WebMvcConfigurer.super.addResourceHandlers(registry);
registry.addResourceHandler("/api/vdi/file/down/**").addResourceLocations("file:/var/lib/vdi/test/"); registry.addResourceHandler("/api/vdi/file/down/**").addResourceLocations("file:/var/lib/vdi/test/");
} }
@Override
public void extendMessageConverters(List<HttpMessageConverter<?>> converters) {
// 找到Jackson消息转换器并配置命名策略
converters.stream()
.filter(converter -> converter instanceof MappingJackson2HttpMessageConverter)
.map(converter -> (MappingJackson2HttpMessageConverter) converter)
.forEach(converter -> {
ObjectMapper objectMapper = converter.getObjectMapper();
objectMapper.setPropertyNamingStrategy(PropertyNamingStrategies.SNAKE_CASE);
});
}
} }

View File

@ -34,7 +34,6 @@ public class StoragePool {
*/ */
@TableField("pool_name") @TableField("pool_name")
@ApiModelProperty(value = "存储池名称") @ApiModelProperty(value = "存储池名称")
@JsonProperty("pool_name")
private String poolName; private String poolName;
/** /**
@ -63,7 +62,6 @@ public class StoragePool {
*/ */
@TableField("create_time") @TableField("create_time")
@ApiModelProperty(value = "创建时间") @ApiModelProperty(value = "创建时间")
@JsonProperty("create_time")
private Date createTime; private Date createTime;
/** /**
@ -71,7 +69,6 @@ public class StoragePool {
*/ */
@TableField("update_time") @TableField("update_time")
@ApiModelProperty(value = "更新时间") @ApiModelProperty(value = "更新时间")
@JsonProperty("update_time")
private Date updateTime; private Date updateTime;
/** /**