zhongrj
2024-04-30 2b599a5307883b9407ea9225c4e33fc28706f7a8
src/main/java/org/springblade/modules/system/mapper/RegionMapper.xml
@@ -335,6 +335,32 @@
            #{item}
        </foreach>
        )
    </select>
    <!--根据父编号查询所有的下级-->
    <select id="treeToCommunity" resultType="org.springblade.common.node.TreeStringNode">
        select
        br.code as id,
        br.parent_code as parentId,
        br.name as name,
        br.sort
        FROM blade_region br
        left join jczz_grid jg on br.village_code = jg.community_code and jg.is_deleted = 0 and br.region_level = 5
        where 1=1 and (br.ancestors like '%361102%' or br.code = '361102')
        <if test="isAdministrator==2">
            <choose>
                <when test="regionChildCodesList !=null and regionChildCodesList.size()>0">
                    and jg.community_code in
                    <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=",">
                        #{code}
                    </foreach>
                </when>
                <otherwise>
                    and jg.community_code in ('')
                </otherwise>
            </choose>
        </if>
    </select>
</mapper>