package top.lejings.demo.mapper;

import org.apache.ibatis.annotations.*;
import top.lejings.demo.pojo.Users;

@Mapper
public interface UsersMapper {
    @Select("select * from Users where username=#{username} and password=#{password}")
    Users getByUsernameAndPassword(Users users) ;

    @Select("select username,password from users where email=#{email}")
    Users findPassword(String email);

    @Select("select * from users where email=#{email}")
    Users findById(Users users);

    @Insert("INSERT INTO users (username, email, password) VALUES (#{username}, #{email}, #{password})")
    void registered(Users users);

    @Update("UPDATE users SET username = #{username},password = #{password} where user_id = #{user_id}")
    void revise(Users users);

    @Delete("DELETE FROM users WHERE user_id = #{userId}")
    void logout(Integer userId);

}
