<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">

<!-- 实现哪个Dao -->
<mapper namespace="com.wyz.demo.dao.UserRepository">

    <insert id="addUser" parameterType="com.wyz.demo.po.UserPO">
        insert into `user` (username,password,phone) values (#{username},#{password}, #{phone})
    </insert>

    <select id="getUserByUsername" resultType="com.wyz.demo.po.UserPO" parameterType="java.lang.String">
        select * from `user` where username = #{username}
    </select>

    <select id="getIdByUsername" resultType="int" parameterType="java.lang.String">
        select id from `user` where username = #{username}
    </select>

    <select id="getUsernameById" resultType="java.lang.String" parameterType="int">
        select username from `user` where id = #{id}
    </select>

    <select id="getUserById" resultType="com.wyz.demo.po.UserPO">
        select * from `user`where id = #{id}
    </select>


</mapper>