|
@@ -1,4 +1,4 @@
|
|
|
-package com.gxzc.zen.orm
|
|
|
+package com.gxzc.zen.orm.config
|
|
|
|
|
|
import com.baomidou.mybatisplus.mapper.MetaObjectHandler
|
|
|
import com.gxzc.zen.umps.util.SSOUtil
|
|
@@ -9,6 +9,7 @@ import java.util.*
|
|
|
|
|
|
/**
|
|
|
* 公共字段自动填充
|
|
|
+ * 多线程 + WebSocket 下不适用
|
|
|
* @author NorthLan
|
|
|
* @date 2018/1/31
|
|
|
* @url https://noahlan.com
|
|
@@ -21,9 +22,8 @@ class CustomMetaObjectHandler : MetaObjectHandler() {
|
|
|
|
|
|
override fun insertFill(metaObject: MetaObject?) {
|
|
|
try {
|
|
|
- val curUser = SSOUtil.getCurAccount()
|
|
|
- logger.trace("公共字段自动填充: insertFill $curUser")
|
|
|
if (getFieldValByName("createBy", metaObject) == null) {
|
|
|
+ val curUser = SSOUtil.getCurAccount()
|
|
|
setFieldValByName("createBy", curUser, metaObject)
|
|
|
}
|
|
|
if (getFieldValByName("createTime", metaObject) == null) {
|
|
@@ -36,9 +36,10 @@ class CustomMetaObjectHandler : MetaObjectHandler() {
|
|
|
|
|
|
override fun updateFill(metaObject: MetaObject?) {
|
|
|
try {
|
|
|
- val curUser = SSOUtil.getCurAccount()
|
|
|
- logger.trace("公共字段自动填充: updateFill $curUser")
|
|
|
- setFieldValByName("updateBy", curUser, metaObject)
|
|
|
+ if (getFieldValByName("updateBy", metaObject) == null) {
|
|
|
+ val curUser = SSOUtil.getCurAccount()
|
|
|
+ setFieldValByName("updateBy", curUser, metaObject)
|
|
|
+ }
|
|
|
setFieldValByName("updateTime", Date(), metaObject)
|
|
|
} catch (e: Throwable) {
|
|
|
logger.warn("updateFill error, cause: ", e)
|