mirror of
https://gitee.com/freshday/radar.git
synced 2026-03-22 12:47:16 +08:00
fix: update time when login.
feihu wang
This commit is contained in:
@@ -72,6 +72,7 @@ public class SysLoginApiController {
|
||||
}));
|
||||
ret.getData().put("x-auth-token", token);
|
||||
ret.setSuccess(true);
|
||||
userService.updateLastLoginTime(users.get(0));
|
||||
} else {
|
||||
ret.setMsg("用户名和密码错误!");
|
||||
}
|
||||
|
||||
@@ -12,4 +12,6 @@ public interface UserDal {
|
||||
List<UserPO> list(String name, String pass);
|
||||
|
||||
Integer insert(UserPO userPO);
|
||||
|
||||
Integer update(UserPO userPO);
|
||||
}
|
||||
|
||||
@@ -59,4 +59,9 @@ public class UserDalImpl implements UserDal {
|
||||
return integer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer update(UserPO userPO) {
|
||||
return userMapper.updateByPrimaryKeySelective(userPO);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -9,6 +9,8 @@ import com.pgmmers.radar.model.UserPO;
|
||||
import com.pgmmers.radar.service.admin.UserService;
|
||||
import com.pgmmers.radar.service.common.CommonResult;
|
||||
import com.pgmmers.radar.vo.admin.UserVO;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -60,4 +62,12 @@ public class UserServiceImpl implements UserService {
|
||||
Integer integer = userDal.insert(userPO);
|
||||
return integer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateLastLoginTime(UserVO user) {
|
||||
UserPO userPO = new UserPO();
|
||||
userPO.setId(user.getId());
|
||||
userPO.setUpdateTime(new Date());
|
||||
userDal.update(userPO);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,4 +17,6 @@ public interface UserService {
|
||||
UserVO getByUserName(String userName);
|
||||
|
||||
Integer insert(UserVO userVO);
|
||||
|
||||
void updateLastLoginTime(UserVO user);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user