|
@@ -5,7 +5,6 @@
|
|
|
*/
|
|
|
package com.aizuda.service.web;
|
|
|
|
|
|
-import com.aizuda.service.spring.SpringHelper;
|
|
|
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
|
|
|
import org.apache.ibatis.reflection.MetaObject;
|
|
|
import org.springframework.stereotype.Component;
|
|
@@ -17,7 +16,7 @@ public class AizudaMetaObjectHandler implements MetaObjectHandler {
|
|
|
|
|
|
@Override
|
|
|
public void insertFill(MetaObject metaObject) {
|
|
|
- UserSession userSession = this.getLoginInfoOrNull();
|
|
|
+ UserSession userSession = UserSession.getLoginInfo(true);
|
|
|
if (null != userSession) {
|
|
|
this.fillHasGetter(metaObject, "createId", userSession.getId());
|
|
|
this.fillHasGetter(metaObject, "createBy", userSession.getUsername());
|
|
@@ -27,17 +26,13 @@ public class AizudaMetaObjectHandler implements MetaObjectHandler {
|
|
|
|
|
|
@Override
|
|
|
public void updateFill(MetaObject metaObject) {
|
|
|
- UserSession userSession = this.getLoginInfoOrNull();
|
|
|
+ UserSession userSession = UserSession.getLoginInfo(true);
|
|
|
if (null != userSession) {
|
|
|
this.fillHasGetter(metaObject, "updateBy", userSession.getUsername());
|
|
|
}
|
|
|
this.fillHasGetter(metaObject, "updateTime", new Date());
|
|
|
}
|
|
|
|
|
|
- public static UserSession getLoginInfoOrNull() {
|
|
|
- return UserSession.getLoginInfo(SpringHelper.getCurrentRequest(), true);
|
|
|
- }
|
|
|
-
|
|
|
protected void fillHasGetter(MetaObject metaObject, String fieldName, Object fieldVal) {
|
|
|
if (metaObject.hasGetter(fieldName)) {
|
|
|
this.fillStrategy(metaObject, fieldName, fieldVal);
|