refactor(common-excel): 支持字典自动转换

This commit is contained in:
冷冷 2024-09-01 14:11:01 +08:00
parent b0ff258970
commit 883fc77011
4 changed files with 23 additions and 1 deletions

View File

@ -61,5 +61,9 @@
<artifactId>spring-webmvc</artifactId> <artifactId>spring-webmvc</artifactId>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-commons</artifactId>
</dependency>
</dependencies> </dependencies>
</project> </project>

View File

@ -17,6 +17,8 @@
package com.pig4cloud.pig.common.core.config; package com.pig4cloud.pig.common.core.config;
import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate; import org.springframework.web.client.RestTemplate;
@ -27,7 +29,13 @@ import org.springframework.web.client.RestTemplate;
@AutoConfiguration @AutoConfiguration
public class RestTemplateConfiguration { public class RestTemplateConfiguration {
/**
* 动态 REST 模板
* @return {@link RestTemplate }
*/
@Bean @Bean
@LoadBalanced
@ConditionalOnProperty(value = "spring.cloud.nacos.discovery.enabled", havingValue = "true", matchIfMissing = true)
public RestTemplate restTemplate() { public RestTemplate restTemplate() {
return new RestTemplate(); return new RestTemplate();
} }

View File

@ -16,6 +16,16 @@ import org.springframework.web.client.RestTemplate;
@AutoConfiguration @AutoConfiguration
public class ExcelAutoConfiguration { public class ExcelAutoConfiguration {
/**
* REST 模板
* @return {@link RestTemplate }
*/
@Bean
@ConditionalOnMissingBean
public RestTemplate restTemplate() {
return new RestTemplate();
}
/** /**
* dict 数据提供程序 * dict 数据提供程序
* @param restTemplate REST 模板 * @param restTemplate REST 模板

View File

@ -96,7 +96,7 @@ public class UserExcelVO implements Serializable {
* 锁定标记 * 锁定标记
*/ */
@ExcelProperty("锁定标记,0:正常,9:已锁定") @ExcelProperty("锁定标记,0:正常,9:已锁定")
@DictTypeProperty("lock_flagX") @DictTypeProperty("lock_flag")
private String lockFlag; private String lockFlag;
/** /**