@@ -169,7 +169,7 @@ public void update(UserReq req, Long id) {
169169 DisEnableStatusEnum newStatus = req .getStatus ();
170170 CheckUtils .throwIf (DisEnableStatusEnum .DISABLE .equals (newStatus ) && ObjectUtil .equal (id , UserContextHolder
171171 .getUserId ()), "不允许禁用当前用户" );
172- UserDO oldUser = super .getById (id );
172+ UserDO oldUser = this .getById (id );
173173 if (Boolean .TRUE .equals (oldUser .getIsSystem ())) {
174174 CheckUtils .throwIfEqual (DisEnableStatusEnum .DISABLE , newStatus , "[{}] 是系统内置用户,不允许禁用" , oldUser
175175 .getNickname ());
@@ -370,7 +370,7 @@ public UserImportResp importUser(UserImportReq req) {
370370
371371 @ Override
372372 public void resetPassword (UserPasswordResetReq req , Long id ) {
373- super .getById (id );
373+ this .getById (id );
374374 baseMapper .lambdaUpdate ()
375375 .set (UserDO ::getPassword , req .getNewPassword ())
376376 .set (UserDO ::getPwdResetTime , LocalDateTime .now ())
@@ -380,7 +380,7 @@ public void resetPassword(UserPasswordResetReq req, Long id) {
380380
381381 @ Override
382382 public void updateRole (UserRoleUpdateReq updateReq , Long id ) {
383- super .getById (id );
383+ this .getById (id );
384384 List <Long > roleIds = updateReq .getRoleIds ();
385385 // 保存用户和角色关联
386386 userRoleService .assignRolesToUser (roleIds , id );
@@ -389,7 +389,7 @@ public void updateRole(UserRoleUpdateReq updateReq, Long id) {
389389 }
390390
391391 @ Override
392- public String updateAvatar (MultipartFile avatarFile , Long id ) throws IOException {
392+ public String updateAvatar (MultipartFile avatarFile , Long id ) {
393393 String avatarImageType = FileNameUtil .extName (avatarFile .getOriginalFilename ());
394394 CheckUtils .throwIf (!StrUtil .equalsAnyIgnoreCase (avatarImageType , avatarSupportSuffix ), "头像仅支持 {} 格式的图片" , String
395395 .join (StringConstants .CHINESE_COMMA , avatarSupportSuffix ));
@@ -731,4 +731,16 @@ private void updateContext(Long id) {
731731 UserContextHolder .setContext (userContext );
732732 }
733733 }
734+
735+ /**
736+ * 根据 ID 获取用户信息(数据权限)
737+ *
738+ * @param id ID
739+ * @return 用户信息
740+ */
741+ private UserDO getById (Long id ) {
742+ UserDO user = baseMapper .lambdaQuery ().eq (UserDO ::getId , id ).one ();
743+ CheckUtils .throwIfNull (user , "用户不存在" );
744+ return user ;
745+ }
734746}
0 commit comments