<?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.xpx.mapper.UserMapper">

    <resultMap id="jurisdiction" type="users">
        <id property="username" column="username"></id>
        <result property="userpwd" column="userpwd"></result>
        <association property="roles" javaType="roles">
            <id property="roleid" column="roleid"></id>
            <result property="rolename" column="rolename"></result>
        </association>
        <collection property="menus" ofType="menus">
            <id property="menuid" column="menuid"></id>
            <result property="menuname" column="menuname"></result>
            <result property="menuurl" column="menuurl"></result>
            <result property="fatherid" column="fatherid"></result>
        </collection>
    </resultMap>
    <select id="selUserByName" parameterType="java.lang.String" resultMap="jurisdiction">
        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>