Browse Source

修改全局字段验证规则bug

= 8 years ago
parent
commit
cb988704ee

+ 2 - 0
mybatis-plus/src/main/java/com/baomidou/mybatisplus/toolkit/TableFieldInfo.java

@@ -76,6 +76,7 @@ public class TableFieldInfo {
 		this.setColumn(column);
 		this.property = property;
 		this.el = property;
+		this.fieldStrategy = MybatisConfiguration.FIELD_STRATEGY;
 	}
 
 	public TableFieldInfo(String column) {
@@ -83,6 +84,7 @@ public class TableFieldInfo {
 		this.setColumn(column);
 		this.property = column;
 		this.el = column;
+		this.fieldStrategy = MybatisConfiguration.FIELD_STRATEGY;
 	}
 
 	public boolean isRelated() {

+ 3 - 0
mybatis-plus/src/test/resources/wiki/spring-config.md

@@ -35,6 +35,9 @@
     <!-- 全局表为下划线命名设置 true
     <property name="dbColumnUnderline" value="true" />
     -->
+    <!-- 全局字段验证 0、ignored  1、not null 2、not empty
+    <property name="fieldStrategy" value="2" />
+    -->
 </bean>
 
 <!-- 加载 mapper.xml 接口 配置文件 -->