<resultMap id="treeDataMap" type="com.irobotics.wms.admin.vo.ResourceTreeVO" extends="BaseResultMap">
<result column="resource_name" property="label"/>
<!--子集-->
<collection property="children" ofType="com.irobotics.wms.admin.vo.ResourceTreeVO" select="selectTreePage"
column="{pid=id}">
</collection>
</resultMap>
<sql id="selectColumns">
select
id,
pid,
resource_name,
resource_code,
request_method,
uri,
is_visibled,
is_skipped,
resource_type,
modified,
created
from admin_resource
</sql>
<select id="selectTreePage" resultMap="treeDataMap">
<include refid="selectColumns"/>
<where>
<if test="searchKey != null and searchKey != ''">
resource_name like concat('%',#{searchKey},'%') or resource_code like concat('%',#{searchKey},'%')
</if>
<if test="pid != null">
and pid = #{pid}
</if>
</where>
order by created desc
</select>