mirror of
https://gitee.com/mybatis-flex/mybatis-flex.git
synced 2025-12-07 17:18:24 +08:00
1、update docs, 补充打印sql相关文档。
2、bug fix,修复com.mybatisflex.core.table.TableInfo类中initVersionValueIfNecessary方法和initLogicDeleteValueIfNecessary方法抛出argument type mismatch异常的问题。
This commit is contained in:
parent
c7cb9e881f
commit
61b7c638fa
@ -47,6 +47,13 @@ public class MyBatisFlexConfiguration {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## 注意
|
||||||
|
在执行以下语句之后执行的sql才会被打印。如果你发现你有些sql没有打印,则需要自行检查sql执行与以下语句执行的先后顺序。
|
||||||
|
```
|
||||||
|
AuditManager.setAuditEnable(true);
|
||||||
|
AuditManager.setMessageCollector(collector);
|
||||||
|
```
|
||||||
|
|
||||||
## p6spy 方案
|
## p6spy 方案
|
||||||
|
|
||||||
我们可以把数据源配置为 p6spy 数据源,使用 p6spy 的 SQL 输出功能进行 SQL 打印。更多文档参考 p6spy 官方文档:
|
我们可以把数据源配置为 p6spy 数据源,使用 p6spy 的 SQL 输出功能进行 SQL 打印。更多文档参考 p6spy 官方文档:
|
||||||
|
|||||||
@ -653,7 +653,13 @@ public class TableInfo {
|
|||||||
MetaObject metaObject = EntityMetaObject.forObject(entityObject, reflectorFactory);
|
MetaObject metaObject = EntityMetaObject.forObject(entityObject, reflectorFactory);
|
||||||
Object columnValue = getPropertyValue(metaObject, columnInfoMapping.get(versionColumn).property);
|
Object columnValue = getPropertyValue(metaObject, columnInfoMapping.get(versionColumn).property);
|
||||||
if (columnValue == null) {
|
if (columnValue == null) {
|
||||||
metaObject.setValue(columnInfoMapping.get(versionColumn).property, 0);
|
String name = columnInfoMapping.get(versionColumn).property;
|
||||||
|
Class<?> clazz = metaObject.getSetterType(name);
|
||||||
|
if (clazz.isAssignableFrom(Long.class)) {
|
||||||
|
metaObject.setValue(name, 0L);
|
||||||
|
} else if (clazz.isAssignableFrom(Integer.class)) {
|
||||||
|
metaObject.setValue(name, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -693,7 +699,13 @@ public class TableInfo {
|
|||||||
MetaObject metaObject = EntityMetaObject.forObject(entityObject, reflectorFactory);
|
MetaObject metaObject = EntityMetaObject.forObject(entityObject, reflectorFactory);
|
||||||
Object columnValue = getPropertyValue(metaObject, columnInfoMapping.get(logicDeleteColumn).property);
|
Object columnValue = getPropertyValue(metaObject, columnInfoMapping.get(logicDeleteColumn).property);
|
||||||
if (columnValue == null) {
|
if (columnValue == null) {
|
||||||
metaObject.setValue(columnInfoMapping.get(logicDeleteColumn).property, 0);
|
String name = columnInfoMapping.get(logicDeleteColumn).property;
|
||||||
|
Class<?> clazz = metaObject.getSetterType(name);
|
||||||
|
if (clazz.isAssignableFrom(Integer.class)) {
|
||||||
|
metaObject.setValue(name, 0);
|
||||||
|
} else if (clazz.isAssignableFrom(Boolean.class)) {
|
||||||
|
metaObject.setValue(name, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user