package cn.palmte.work.service;

import cn.palmte.work.model.LoginLog;
import cn.palmte.work.model.LoginLogRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

/**
 * @author xiongshiyan at 2021/8/24 , contact me with email yanshixiong@126.com or phone 15208384257
 */
@Service
public class LoginLogService {
    @Autowired
    private LoginLogRepository loginLogRepository;

    public void saveLog(String userName, int status, String statusDesc){
        LoginLog loginLog = new LoginLog();
        loginLog.setName(userName);
        loginLog.setStatus(status);
        loginLog.setStatusDesc(statusDesc);
        loginLog.setCreateTime(new Date());
        loginLogRepository.saveAndFlush(loginLog);
    }
}
