diff --git a/README.md b/README.md index 309bf58..06f54b5 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ com.github.yzcheng90 autofull-spring-boot-starter - 1.4.1 + 1.4.2 ``` diff --git a/autofull-spring-boot-starter-example/pom.xml b/autofull-spring-boot-starter-example/pom.xml index dcf2da4..7efa586 100644 --- a/autofull-spring-boot-starter-example/pom.xml +++ b/autofull-spring-boot-starter-example/pom.xml @@ -46,7 +46,7 @@ com.github.yzcheng90 autofull-spring-boot-starter - 1.4.1 + 1.4.2 diff --git a/autofull-spring-boot-starter/pom.xml b/autofull-spring-boot-starter/pom.xml index e188f92..140016c 100644 --- a/autofull-spring-boot-starter/pom.xml +++ b/autofull-spring-boot-starter/pom.xml @@ -5,7 +5,7 @@ com.github.yzcheng90 autofull-spring-boot-starter - 1.4.1 + 1.4.2 https://github.com/yzcheng90/zhjg-common-autofull autofull-spring-boot-starter 一个填充字段属性框架 diff --git a/autofull-spring-boot-starter/src/main/java/com/suke/zhjg/common/autofull/entity/ConfigProperties.java b/autofull-spring-boot-starter/src/main/java/com/suke/zhjg/common/autofull/entity/ConfigProperties.java index d7aa8ed..5e53e7d 100644 --- a/autofull-spring-boot-starter/src/main/java/com/suke/zhjg/common/autofull/entity/ConfigProperties.java +++ b/autofull-spring-boot-starter/src/main/java/com/suke/zhjg/common/autofull/entity/ConfigProperties.java @@ -14,27 +14,46 @@ @ConfigurationProperties(prefix = "autofull") public class ConfigProperties { - // 是否显示日志 + /** + * 是否显示日志 + **/ @Setter @Getter public boolean showLog = true; - // 最大填充层级 + /** + * 字段规则 + * true :默认使用驼峰 支持通过mybatis-plus.configuration.map-underscore-to-camel-case 配置 + * false :自定义 实体类中写的是什么就是什么不会自动转换 + **/ + @Setter + @Getter + public boolean fieldRule = true; + + /** + * 最大填充层级 + **/ @Setter @Getter public int maxLevel = 1; - // 当前层级 + /** + * 当前层级 + **/ @Setter @Getter public int currLevel = 0; - // 加密分隔标志 + /** + * 加密分隔标志 + **/ @Setter @Getter public String encryptFlag = "@autofull@"; - // 加密密钥 16位 + /** + * 加密密钥 16位 + **/ @Setter @Getter public String encryptKeys = "abcdefg123456789"; diff --git a/autofull-spring-boot-starter/src/main/java/com/suke/zhjg/common/autofull/handler/DefaultHandler.java b/autofull-spring-boot-starter/src/main/java/com/suke/zhjg/common/autofull/handler/DefaultHandler.java index b66abb5..772617a 100644 --- a/autofull-spring-boot-starter/src/main/java/com/suke/zhjg/common/autofull/handler/DefaultHandler.java +++ b/autofull-spring-boot-starter/src/main/java/com/suke/zhjg/common/autofull/handler/DefaultHandler.java @@ -121,16 +121,21 @@ public Class getClassType(Field field) { } public String getConditionField(String field) { - MybatisPlusProperties bean = ApplicationContextRegister.getApplicationContext().getBean(MybatisPlusProperties.class); - MybatisConfiguration configuration = bean.getConfiguration(); - if (configuration == null || configuration.isMapUnderscoreToCamelCase()) { - if (field.contains("_")) { - return FieldCaseUtil.toCamelCase(field); + boolean fieldRule = configProperties.isFieldRule(); + if (fieldRule) { + MybatisPlusProperties bean = ApplicationContextRegister.getApplicationContext().getBean(MybatisPlusProperties.class); + MybatisConfiguration configuration = bean.getConfiguration(); + if (configuration == null || configuration.isMapUnderscoreToCamelCase()) { + if (field.contains("_")) { + return FieldCaseUtil.toCamelCase(field); + } else { + return FieldCaseUtil.toUnderScoreCase(field); + } } else { return FieldCaseUtil.toUnderScoreCase(field); } - }else { - return FieldCaseUtil.toUnderScoreCase(field); + } else { + return field; } } diff --git a/doc/update.md b/doc/update.md index 70111f7..bf7cbbd 100644 --- a/doc/update.md +++ b/doc/update.md @@ -1,5 +1,16 @@ ### 功能 > +>v1.4.2 +>- 新增字段规则配置 +```yaml +# autofull 配置 +autofull: + # 字段规则 + # true :默认使用驼峰 支持通过mybatis-plus.configuration.map-underscore-to-camel-case 配置 + # false :自定义 实体类中写的是什么就是什么不会自动转换 + fieldRule: true +``` +> >v1.4.1 >- 新增使用@AutoFullOssUrl时bucketName 可以不用 >