mirror of https://gitee.com/stylefeng/roses
【7.2.4】增加乐观锁字段自动填充
parent
f502a152c9
commit
bc123c35d8
|
@ -68,4 +68,9 @@ public interface DbFieldConstants {
|
||||||
*/
|
*/
|
||||||
String STATUS_FLAG = "statusFlag";
|
String STATUS_FLAG = "statusFlag";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 乐观锁版本,从0开始
|
||||||
|
*/
|
||||||
|
String VERSION_FLAG = "versionFlag";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,6 +61,10 @@ public class CustomMetaObjectHandler implements MetaObjectHandler {
|
||||||
|
|
||||||
// 设置状态字段 默认1-启用
|
// 设置状态字段 默认1-启用
|
||||||
setValue(metaObject, STATUS_FLAG, StatusEnum.ENABLE.getCode());
|
setValue(metaObject, STATUS_FLAG, StatusEnum.ENABLE.getCode());
|
||||||
|
|
||||||
|
// 设置乐观锁字段,从0开始
|
||||||
|
setValue(metaObject, VERSION_FLAG, 0L);
|
||||||
|
|
||||||
} catch (ReflectionException e) {
|
} catch (ReflectionException e) {
|
||||||
log.warn("CustomMetaObjectHandler处理过程中无相关字段,不做处理");
|
log.warn("CustomMetaObjectHandler处理过程中无相关字段,不做处理");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue