<?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.rongwei.bscommon.sys.dao.FsFileNavigationDao">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.bsentity.domain.FsFileNavigationDo">
        <id column="ID" property="id" />
        <result column="TENANTID" property="tenantid" />
        <result column="ROPTION" property="roption" />
        <result column="DELETED" property="deleted" />
        <result column="REMARK" property="remark" />
        <result column="CREATEDATE" property="createdate" />
        <result column="CREATEUSERID" property="createuserid" />
        <result column="CREATEUSERNAME" property="createusername" />
        <result column="MODIFYDATE" property="modifydate" />
        <result column="MODIFYUSERID" property="modifyuserid" />
        <result column="MODIFYUSERNAME" property="modifyusername" />
        <result column="PID" property="pid" />
        <result column="NODENAME" property="nodename" />
        <result column="FULLPID" property="fullpid" />
        <result column="TREECODE" property="treecode" />
        <result column="LEVEL" property="level" />
        <result column="SORT" property="sort" />
    </resultMap>
    <select id="getAllByNodeName" resultType="com.bsentity.domain.FsFileNavigationDo">
        with RECURSIVE cte as
           (
               select a.id, a.NODENAME from fs_file_navigation a where NODENAME = 'quality_system'
               union all
               select k.id, k.NODENAME from fs_file_navigation k inner join cte c on c.id = k.pid
           )
        select id, NODENAME from cte;
    </select>

</mapper>
