소스 검색

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

疯狂的狮子li 4 년 전
부모
커밋
f888e66261
1개의 변경된 파일6개의 추가작업 그리고 0개의 파일을 삭제
  1. 6 0
      ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/model/LoginUser.java

+ 6 - 0
ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/model/LoginUser.java

@@ -109,6 +109,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 + CacheConstants.LOGINID_JOIN_CODE + userId;
     }