package com.test.mapper;

import com.test.bean.User;
import org.apache.ibatis.annotations.*;

@Mapper
public interface UserMapper {
    @Insert("insert into user_info(username, gender, id_number, phone, create_time, update_time) VALUE (#{username}, #{gender},#{idNumber}, #{phone}, #{createTime}, #{updateTime})")
    boolean addUser(User user);


    @Select("select * from user_info where phone = #{phone}")
    User getUserByPhone(String phone);

    @Update("update user_info set username = #{username}, gender = #{gender}, id_number = #{idNumber}, phone = #{phone}, update_time = #{updateTime} where user_id = #{userId}")
    boolean updateUser(User user);


    @Select("select * from user_info where user_id = #{userId}")
    User getUserById(Integer userId);

    @Delete("delete from user_info where user_id = #{id}")
    boolean deleteUser(Integer id);
}
