|
@@ -7,8 +7,10 @@ package org.eco.vip.orm.listener;
|
|
|
|
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
+import cn.hutool.http.HttpStatus;
|
|
|
import com.mybatisflex.annotation.InsertListener;
|
|
|
import org.eco.vip.orm.domain.BaseEntity;
|
|
|
+import org.eco.vip.orm.exception.BusinessException;
|
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
@@ -25,7 +27,7 @@ public class EntityInsertListener implements InsertListener {
|
|
|
try {
|
|
|
if (ObjectUtil.isNotNull(entity) && (entity instanceof BaseEntity baseEntity)) {
|
|
|
// Long loginUserId = LoginHelper.getUserId();
|
|
|
- Long loginUserId = 1L;
|
|
|
+ String loginUserId = "1";
|
|
|
Date createTime = ObjectUtil.isNotNull(baseEntity.getCreateTime())
|
|
|
? baseEntity.getCreateTime() : new Date();
|
|
|
if (ObjectUtil.isNull(baseEntity.getCreateBy())) {
|
|
@@ -38,7 +40,7 @@ public class EntityInsertListener implements InsertListener {
|
|
|
baseEntity.setUpdateTime(createTime);
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
-// throw new BusinessException("全局插入数据监听器注入异常 => " + e.getMessage(), HttpStatus.HTTP_UNAUTHORIZED);
|
|
|
+ throw new BusinessException("全局插入数据监听器注入异常 => " + e.getMessage(), HttpStatus.HTTP_UNAUTHORIZED);
|
|
|
}
|
|
|
}
|
|
|
}
|