瀏覽代碼

update 优化 getLoginId 增加必要参数空校验

疯狂的狮子li 2 年之前
父節點
當前提交
5d367b7bf8
共有 1 個文件被更改,包括 6 次插入0 次删除
  1. 6 0
      ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/LoginUser.java

+ 6 - 0
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/LoginUser.java

@@ -105,6 +105,12 @@ public class LoginUser implements Serializable {
      * 获取登录id
      */
     public String getLoginId() {
+        if (userType == null) {
+            throw new IllegalArgumentException("用户类型不能为空");
+        }
+        if (userId == null) {
+            throw new IllegalArgumentException("用户ID不能为空");
+        }
         return userType + LoginHelper.JOIN_CODE + userId;
     }