Gaokun Wang преди 1 месец
родител
ревизия
05c40866f6

+ 5 - 5
eco-common/com-orm/src/main/java/org/eco/vip/orm/domain/BaseEntity.java

@@ -29,7 +29,7 @@ public class BaseEntity implements Serializable, TransPojo {
      * 租户编号
      */
     @Column(tenantId = true)
-    private Long tenantId;
+    private String tenantId;
 
     /**
      * 乐观锁
@@ -39,12 +39,12 @@ public class BaseEntity implements Serializable, TransPojo {
     /**
      * 删除逻辑字段(1已删除,0存在)
      */
-    private Integer delFlag;
+    private String delFlag;
 
     /**
      * 状态(1有效,0失效)
      */
-    private Integer status;
+    private String status;
 
     /**
      * 备注
@@ -55,7 +55,7 @@ public class BaseEntity implements Serializable, TransPojo {
      * 创建者
      */
     @Trans(type = TransType.SIMPLE, targetClassName = "org.eco.vip.auth.domain.user.User", fields = "userName", ref = "createByName")
-    private Long createBy;
+    private String createBy;
 
     /**
      * 创建者
@@ -73,7 +73,7 @@ public class BaseEntity implements Serializable, TransPojo {
      * 更新者
      */
     @Trans(type = TransType.SIMPLE, targetClassName = "org.eco.vip.auth.domain.user.User", fields = "userName", ref = "updateByName")
-    private Long updateBy;
+    private String updateBy;
 
     /**
      * 更新者-姓名

+ 4 - 2
eco-common/com-orm/src/main/java/org/eco/vip/orm/listener/EntityInsertListener.java

@@ -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);
         }
     }
 }

+ 5 - 2
eco-common/com-orm/src/main/java/org/eco/vip/orm/listener/EntityUpdateListener.java

@@ -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.UpdateListener;
 import org.eco.vip.orm.domain.BaseEntity;
+import org.eco.vip.orm.exception.BusinessException;
 
 import java.util.Date;
 
@@ -23,14 +25,15 @@ public class EntityUpdateListener implements UpdateListener {
     public void onUpdate(Object entity) {
         try {
             if (ObjectUtil.isNotNull(entity) && (entity instanceof BaseEntity baseEntity)) {
-                Long loginUserId = 1L; //LoginHelper.getUserId()
+                //LoginHelper.getUserId()
+                String loginUserId = "1";
                 if (ObjectUtil.isNull(baseEntity.getUpdateBy())) {
                     baseEntity.setUpdateBy(loginUserId);
                 }
                 baseEntity.setUpdateTime(new Date());
             }
         } catch (Exception e) {
-//            throw new BusinessException("全局更新数据监听器注入异常 => " + e.getMessage(), HttpStatus.HTTP_UNAUTHORIZED);
+            throw new BusinessException("全局更新数据监听器注入异常 => " + e.getMessage(), HttpStatus.HTTP_UNAUTHORIZED);
         }
     }
 }