diff --git a/blade-service/blade-user/src/main/java/org/springblade/system/user/controller/UserController.java b/blade-service/blade-user/src/main/java/org/springblade/system/user/controller/UserController.java index 26222133..cbaacbc2 100644 --- a/blade-service/blade-user/src/main/java/org/springblade/system/user/controller/UserController.java +++ b/blade-service/blade-user/src/main/java/org/springblade/system/user/controller/UserController.java @@ -104,7 +104,7 @@ public class UserController { @PreAuth(RoleConstant.HAS_ROLE_ADMIN) @CacheEvict(cacheNames = {USER_CACHE}, allEntries = true) public R update(@Valid @RequestBody User user) { - return R.status(userService.submit(user)); + return R.status(userService.updateUser(user)); } /** diff --git a/blade-service/blade-user/src/main/java/org/springblade/system/user/service/IUserService.java b/blade-service/blade-user/src/main/java/org/springblade/system/user/service/IUserService.java index b915ad59..e1f5bf82 100644 --- a/blade-service/blade-user/src/main/java/org/springblade/system/user/service/IUserService.java +++ b/blade-service/blade-user/src/main/java/org/springblade/system/user/service/IUserService.java @@ -30,12 +30,21 @@ import org.springblade.system.user.entity.UserInfo; public interface IUserService extends BaseService { /** - * 新增或修改用户 + * 新增用户 + * * @param user * @return */ boolean submit(User user); + /** + * 修改用户 + * + * @param user + * @return + */ + boolean updateUser(User user); + /** * 自定义分页 * diff --git a/blade-service/blade-user/src/main/java/org/springblade/system/user/service/impl/UserServiceImpl.java b/blade-service/blade-user/src/main/java/org/springblade/system/user/service/impl/UserServiceImpl.java index 369e8ddc..9fada1f9 100644 --- a/blade-service/blade-user/src/main/java/org/springblade/system/user/service/impl/UserServiceImpl.java +++ b/blade-service/blade-user/src/main/java/org/springblade/system/user/service/impl/UserServiceImpl.java @@ -53,7 +53,13 @@ public class UserServiceImpl extends BaseServiceImpl implement if (cnt > 0 && Func.isEmpty(user.getId())) { throw new ApiException("当前用户已存在!"); } - return saveOrUpdate(user); + return save(user); + } + + @Override + public boolean updateUser(User user) { + user.setPassword(null); + return updateById(user); } @Override