mirror of https://gitee.com/stylefeng/roses
【7.6.0】【sys】更新记录用户登录信息
parent
04be0ee058
commit
6b38362cc7
|
@ -97,6 +97,14 @@ public interface SysUserServiceApi {
|
|||
* @author fengshuonan
|
||||
* @since 2023/6/17 21:56
|
||||
*/
|
||||
UserValidateDTO getUserValidateDTO(String account);
|
||||
UserValidateDTO getUserLoginValidateDTO(String account);
|
||||
|
||||
/**
|
||||
* 更新用户的登录ip和最后登录时间
|
||||
*
|
||||
* @author fengshuonan
|
||||
* @since 2023/6/17 22:46
|
||||
*/
|
||||
void updateUserLoginInfo(Long userId, String ip);
|
||||
|
||||
}
|
||||
|
|
|
@ -19,10 +19,12 @@ import cn.stylefeng.roses.kernel.sys.modular.user.service.SysUserOrgService;
|
|||
import cn.stylefeng.roses.kernel.sys.modular.user.service.SysUserRoleService;
|
||||
import cn.stylefeng.roses.kernel.sys.modular.user.service.SysUserService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
@ -178,7 +180,7 @@ public class UserIntegrationService implements SysUserServiceApi {
|
|||
}
|
||||
|
||||
@Override
|
||||
public UserValidateDTO getUserValidateDTO(String account) {
|
||||
public UserValidateDTO getUserLoginValidateDTO(String account) {
|
||||
LambdaQueryWrapper<SysUser> sysUserLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
sysUserLambdaQueryWrapper.eq(SysUser::getAccount, account);
|
||||
sysUserLambdaQueryWrapper.select(SysUser::getPassword, SysUser::getStatusFlag, SysUser::getUserId);
|
||||
|
@ -191,4 +193,18 @@ public class UserIntegrationService implements SysUserServiceApi {
|
|||
return new UserValidateDTO(sysUserServiceOne.getUserId(), sysUserServiceOne.getPassword(), sysUserServiceOne.getStatusFlag());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateUserLoginInfo(Long userId, String ip) {
|
||||
|
||||
if (ObjectUtil.isEmpty(userId) || ObjectUtil.isEmpty(ip)) {
|
||||
return;
|
||||
}
|
||||
|
||||
LambdaUpdateWrapper<SysUser> sysUserLambdaUpdateWrapper = new LambdaUpdateWrapper<>();
|
||||
sysUserLambdaUpdateWrapper.eq(SysUser::getUserId, userId);
|
||||
sysUserLambdaUpdateWrapper.set(SysUser::getLastLoginTime, new Date());
|
||||
sysUserLambdaUpdateWrapper.set(SysUser::getLastLoginIp, ip);
|
||||
this.sysUserService.update(sysUserLambdaUpdateWrapper);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue