luxiaotao1123
2024-06-21 569d2b6bc754b037ade5b4205a4d1cdb8339b26b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package com.zy.ptc.kernel.system.service.impl;
 
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zy.ptc.common.utils.IpTools;
import com.zy.ptc.kernel.system.entity.UserLogin;
import com.zy.ptc.kernel.system.mapper.UserLoginMapper;
import com.zy.ptc.kernel.system.service.UserLoginService;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
 
import javax.servlet.http.HttpServletRequest;
 
@Service("userLoginService")
public class UserLoginServiceImpl extends ServiceImpl<UserLoginMapper, UserLogin> implements UserLoginService {
 
    @Async
    @Override
    public void saveAsync(Long userId, String token, Integer type, Long hostId, String memo, HttpServletRequest request) {
        if (userId == null) {
            return;
        }
        UserLogin userLogin = new UserLogin();
        userLogin.setUserId(userId);
        userLogin.setToken(token);
        userLogin.setType(type);
        userLogin.setIp(IpTools.gainRealIp(request));
        userLogin.setMemo(memo);
        baseMapper.insert(userLogin);
    }
 
}