<?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.gz.mapper.system.ArchivesTreeMapper">

    <select id="selectParentByCode" resultType="com.gz.dto.system.ArchivesTreeDTO"
            parameterType="string">
        select * from tab_archives_tree where id = (select parent_id from tab_archives_tree where code = #{code})
    </select>

    <select id="selectAllByRole" resultType="com.gz.dto.system.ArchivesTreeDTO">
        SELECT
            tat.*
        FROM
            tab_menu_role mr
                Left Join tab_archives_tree tat on mr.menu_id = tat.id
        WHERE
            mr.role_type = 1
          AND mr.role_id = #{roleId}
<!--        group by tat.code-->
        order by tat.sort
    </select>
</mapper>
