package com.luozhihui.project.mapper;
//引入sql insert方法
import com.luozhihui.project.entity.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

public interface UserRegMapper {
    // 将得到的信息插入mysql数据库
    @Insert("insert into `user`(`Phone`,`UserName`,`PassWord`,`IdCard`,`DriverLicense`) VALUES(#{Phone},#{UserName},#{PassWord},#{IdCard},#{DriverLicense})")
    @Transactional
    void save(User user);

    @Select("select `code` from  `user` where `phone`=#{phone}")
    List<String> findByCode(@Param("phone") String phone);

    //通过手机号查找验证码
    @Select("select * from  `user` where `phone`=#{phone}")
    User findByPhone(@Param("phone") String phone);

    //通过手机号删除验证码

    void deleteCode(String phone);
}
