| | |
| | | /** |
| | | * VO 数据翻译 Utils |
| | | * |
| | | * @author 芋道源码 |
| | | * @author 超级管理员 |
| | | */ |
| | | public class TranslateUtils { |
| | | |
| | |
| | | * @return 翻译结果 |
| | | */ |
| | | public static <T extends VO> List<T> translate(List<T> data) { |
| | | if (CollUtil.isNotEmpty((data))) { |
| | | // transService 由 TranslateConfig 在 easy-trans 可用时注入; |
| | | // Spring Boot 4 下 easy-trans 自动配置被禁用(见各 profile 的 spring.autoconfigure.exclude), |
| | | // 此时 transService 为 null。翻译只是增强展示,缺失时直接返回原数据, |
| | | // 不能让导出类接口因为翻译组件不可用而抛 NPE 变成 500。 |
| | | if (transService != null && CollUtil.isNotEmpty((data))) { |
| | | transService.transBatch(data); |
| | | } |
| | | return data; |