<?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="com.bjsxt.mapper.UsersMapper">
    <resultMap id="userMapper" type="com.bjsxt.pojo.Users">
        <id property="username" column="username" />
        <result property="userpwd" column="userpwd" />
        <association property="roles" javaType="com.bjsxt.pojo.Roles">
            <id property="roleid" column="roleid"/>
            <result property="rolename" column="rolename"/>
        </association>
        <collection property="menus" ofType="com.bjsxt.pojo.Menus">
            <id property="menuid" column="menuid"/>
            <result property="menuurl" column="menuurl" />
            <result property="fatherid" column="fatherid" />
        </collection>
    </resultMap>
    <select id="selectUserByName" parameterType="String" resultMap="userMapper">
        select * from users u,roles r ,roles_menus rm,menus m where u.role_id=r.roleid and r.roleid=rm.roles_id and rm.menus_id=m.menuid and u.username= #{username}
    </select>
</mapper>