Exemplo n.º 1
0
 public void resetPassword(long userId) {
   User user = this.userDao.selectByPrimaryKey(userId);
   User record = new User();
   record.setId(userId);
   record.setUpdateTime(new Date());
   record.setPassword(PasswordEncoder.encode(user.getName()));
   this.userDao.updateByPrimaryKeySelective(record);
 }
Exemplo n.º 2
0
 public void regenToken(long userId) {
   User user = this.userDao.selectByPrimaryKey(userId);
   if (user == null) {
     throw new IllegalArgumentException(String.format("UserId(%s) 不存在存在", userId));
   }
   User record = new User();
   record.setId(userId);
   record.setToken(UUID.randomUUID().toString());
   record.setUpdateTime(new Date());
   this.userDao.updateByPrimaryKeySelective(record);
 }