diff --git a/src/main/java/com/xkrs/dao/SysUserDao.java b/src/main/java/com/xkrs/dao/SysUserDao.java index 1e8b6e2..87b2028 100644 --- a/src/main/java/com/xkrs/dao/SysUserDao.java +++ b/src/main/java/com/xkrs/dao/SysUserDao.java @@ -71,20 +71,14 @@ public interface SysUserDao extends JpaRepository, JpaSpeci void updatePassword(Long userId, String newPassword); /** - * 根据id查询用户的信息 - */ - @Query(value = "select * from sys_user where id = ?", nativeQuery = true) - SysUserEntity selectByUserId(Long userId); - - /** - * 记录用户登录次数 + * 修改用户登录次数 */ @Query(value = "update sys_user set login_num = ?2 where id = ?1", nativeQuery = true) @Modifying(clearAutomatically = true) void updateLoginNum(Long userId, Integer loginNum); /** - * 修改登陆时间 + * 修改最后登录时间 */ @Query(value = "update sys_user set login_last_time = ?2 where id = ?1", nativeQuery = true) @Modifying(clearAutomatically = true) diff --git a/src/main/java/com/xkrs/service/impl/SysUserServiceImpl.java b/src/main/java/com/xkrs/service/impl/SysUserServiceImpl.java index 5a26599..95713f3 100644 --- a/src/main/java/com/xkrs/service/impl/SysUserServiceImpl.java +++ b/src/main/java/com/xkrs/service/impl/SysUserServiceImpl.java @@ -275,7 +275,7 @@ public class SysUserServiceImpl implements SysUserService { if (!newPassword.equals(confirmPassword)) { return outputEncapsulationObject(PromptMessageEnum.PROCESS_FAIL, "两次密码输入不一致", locale); } - SysUserEntity sysUserEntity = sysUserDao.selectByUserId(userId); + SysUserEntity sysUserEntity = sysUserDao.findById(userId).get(); String newAfterPassword = encry256(newPassword + sysUserEntity.getSalt()); sysUserDao.updatePassword(userId, newAfterPassword); return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "密码修改成功", locale);