<?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.gree.mall.manager.commonmapper.CustomWebsitMapper">

    <select id="queryById" resultType="java.lang.String">
        select websit_number
        from (
                 select t1.id,
                        t1.parent_id,
                        t1.websit_number,
                        if(find_in_set(parent_id, @pids) > 0, @pids := concat(@pids, ',', id), -1) as ischild
                 from (
                          select id, parent_id,websit_number
                          from admin_websit
                          ORDER BY id ASC) t1,
                      (select @pids :=#{id}) t2
             ) t3
        where ischild != -1 or id = #{id}
    </select>


</mapper>