package com.weiwojc.mapper;
|
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.weiwojc.model.entity.User;
|
import org.apache.ibatis.annotations.*;
|
|
@Mapper
|
public interface UserMapper extends BaseMapper<User> {
|
|
@Select("SELECT * FROM user WHERE username = #{username} AND is_deleted = 0")
|
User findByUsername(String username);
|
|
@Select("SELECT * FROM user WHERE user_id = #{userId} AND is_deleted = 0")
|
User findById(Long userId);
|
|
@Update("UPDATE user SET last_login = #{lastLogin} WHERE user_id = #{userId}")
|
int updateLastLogin(@Param("userId") Long userId, @Param("lastLogin") java.time.LocalDateTime lastLogin);
|
|
@Update("UPDATE user SET login_attempts = #{attempts}, locked_until = #{lockedUntil} WHERE user_id = #{userId}")
|
int updateLoginAttempts(@Param("userId") Long userId,
|
@Param("attempts") Integer attempts,
|
@Param("lockedUntil") java.time.LocalDateTime lockedUntil);
|
|
@Update("UPDATE user SET login_attempts = 0, locked_until = null WHERE username = #{username}")
|
int resetLoginAttempts(String username);
|
}
|