mirror of
https://gitee.com/zhijiantianya/yudao-cloud.git
synced 2025-12-30 09:22:27 +00:00
IdTypeEnvironmentPostProcessor.java.
代码优化 Signed-off-by: 墨轩 <8813596+mx990420@user.noreply.gitee.com>
This commit is contained in:
@@ -59,20 +59,16 @@ public class IdTypeEnvironmentPostProcessor implements EnvironmentPostProcessor
|
||||
}
|
||||
|
||||
public IdType getIdType(ConfigurableEnvironment environment) {
|
||||
// return environment.getProperty(ID_TYPE_KEY, IdType.class);
|
||||
String value = environment.getProperty(ID_TYPE_KEY);
|
||||
try {
|
||||
return StrUtil.isNotBlank(value) ? IdType.valueOf(value) : IdType.NONE;
|
||||
} catch (IllegalArgumentException ex) {
|
||||
log.error("无法解析 id-type 配置值:{}", value, ex);
|
||||
log.error("[getIdType][无法解析 id-type 配置值({})]", value, ex)
|
||||
return IdType.NONE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void setIdType(ConfigurableEnvironment environment, IdType idType) {
|
||||
// environment.getSystemProperties().put(ID_TYPE_KEY, idType);
|
||||
// log.info("[setIdType][修改 MyBatis Plus 的 idType 为({})]", idType);
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put(ID_TYPE_KEY, idType);
|
||||
environment.getPropertySources().addFirst(new MapPropertySource("mybatisPlusIdType", map));
|
||||
|
||||
Reference in New Issue
Block a user