<?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">

<mapper namespace="org.example.mapper.YonghuMapper">
    
    <!-- 结果映射 -->
    <resultMap id="YonghuResultMap" type="Yonghu">
        <id property="id" column="id"/>
        <result property="username" column="username"/>
        <result property="password" column="password"/>
    </resultMap>
    
    <!-- 根据用户名查询用户 -->
    <select id="findByUsername" parameterType="string" resultMap="YonghuResultMap">
        SELECT id, username, password FROM yonghu WHERE username = #{username}
    </select>
    
</mapper>