package org.jeecg.modules.userLogin.service.impl;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.jeecg.modules.userLogin.mapper.UserLoginMapper;
import org.jeecg.modules.userLogin.entity.UserLogin;
import org.jeecg.modules.userLogin.service.IUserLoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import java.util.Date;
import java.util.List;

/**
 * @Description: user_login
 * @Author: jeecg-boot
 * @Date:   2025-01-21
 * @Version: V1.0
 */
@Service
public class UserLoginServiceImpl extends ServiceImpl<UserLoginMapper, UserLogin> implements IUserLoginService {

    @Autowired
    private UserLoginMapper userLoginMapper;
    @Override
    public List<UserLogin> getUserLoginsByRegistrationTime(Date oneHourAgo) {
        // 使用 QueryWrapper 构建查询条件
        QueryWrapper<UserLogin> queryWrapper = new QueryWrapper<>();

        // 确保查询条件：createdAt >= oneHourAgo
        queryWrapper.ge("created_at", oneHourAgo);  // 这里查询创建时间大于等于一小时前的时间

        // 返回查询结果
        return userLoginMapper.selectList(queryWrapper);
    }

}
