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 add(User user) {
   if (nameExists(user.getName())) {
     throw new IllegalArgumentException(String.format("User %s 已经存在", user.getName()));
   }
   Date time = new Date();
   user.setCreateTime(time);
   user.setUpdateTime(time);
   this.userDao.insertSelective(user);
 }
Exemplo n.º 3
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);
 }