<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//oos.juyouhx.com//DTD Mapper 3.0//EN" "http://oss.juyouhx.com/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.scpyun.platform.standard.jilinsscgsdp.newgridlevel" name="网格">
    <!--    <sql id="communityLevelInfo">-->
    <!--        AND company_code IN (-->
    <!--        SELECT `code`-->
    <!--        FROM sys_office-->
    <!--        WHERE del_flag = '0'-->
    <!--        AND system REGEXP 'grid'-->
    <!--        AND `name` NOT LIKE '%测试%'-->
    <!--        AND `name` NOT LIKE '%客服%'-->
    <!--        AND `level` = #{level}-->
    <!--        )-->
    <!--    </sql>-->
    <select id="getCompanyInfoById" parameterType="map" resultType="map">
        SELECT
        a.*,
        (SELECT id FROM sys_user WHERE company_id = a.id ORDER BY create_date ASC LIMIT 1) sysUserId,
        'true' as hasChild
        FROM
        sys_office a
        WHERE
        a.id = #{id}
    </select>
    <select id="findAreaList" parameterType="map" resultType="map">
        SELECT
        *,
        'true' as hasChild
        FROM
        sys_office
        WHERE
        del_flag = '0'
        AND grade = '3'
        <if test="id != null and id != ''">
            AND parent_id = #{id}
        </if>
        and fax is null
    </select>
    <select id="findStreetList" parameterType="map" resultType="map">
        SELECT
        *,
        'true' as hasChild
        FROM
        sys_office
        WHERE
        del_flag = '0'
        AND grade = '4'
        <if test="id != null and id != ''">
            AND parent_id = #{id}
        </if>
        <if test="_user.company_grade == '3'.toString()">
            AND parent_id = #{_user.company_id}
        </if>
        and fax is null
    </select>
    <select id="findCommunityList" parameterType="map" resultType="map">
        SELECT
        *,
        'true' as hasChild
        FROM
        sys_office
        WHERE
        del_flag = '0'
        AND grade = '5'
        <if test="id != null and id != ''">
            AND parent_id = #{id}
        </if>
        <if test="_user.company_grade == '3'.toString()">
            AND parent_ids like concat('%',#{_user.company_id},'%')
        </if>
        <if test="_user.company_grade == '4'.toString()">
            AND parent_id = #{_user.company_id}
        </if>
        and fax is null
    </select>
    
        <select id="findJLCityList" parameterType="map" resultType="map">
        SELECT
        *,
        'true' as hasChild
        FROM
        sys_office
        WHERE
        del_flag = '0'
        AND grade = '3'
        <if test="id != null and id != ''">
            AND parent_id = #{id}
        </if>
        and fax is null
    </select>
    <select id="findJLAreaList" parameterType="map" resultType="map">
        SELECT
        *,
        'true' as hasChild
        FROM
        sys_office
        WHERE
        del_flag = '0'
        AND grade = '4'
        <if test="id != null and id != ''">
            AND parent_id = #{id}
        </if>
        <if test="_user.company_grade == '3'.toString()">
            AND parent_id = #{_user.company_id}
        </if>
        and fax is null
    </select>
    <select id="findJLStreetList" parameterType="map" resultType="map">
        SELECT
        *,
        'true' as hasChild
        FROM
        sys_office
        WHERE
        del_flag = '0'
        AND grade = '5'
        <if test="id != null and id != ''">
            AND parent_id = #{id}
        </if>
        <if test="_user.company_grade == '3'.toString()">
            AND parent_ids like concat('%',#{_user.company_id},'%')
        </if>
        <if test="_user.company_grade == '4'.toString()">
            AND parent_id = #{_user.company_id}
        </if>
        and fax is null
    </select>
    
    <select id="findJLCommunityList" parameterType="map" resultType="map">
        SELECT
        *,
        'true' as hasChild
        FROM
        sys_office
        WHERE
        del_flag = '0'
        AND grade = '6'
        <if test="id != null and id != ''">
            AND parent_id = #{id}
        </if>
        <if test="_user.company_grade == '3'.toString()">
            AND parent_ids like concat('%',#{_user.company_id},'%')
        </if>
        <if test="_user.company_grade == '4'.toString()">
            AND parent_ids like concat('%',#{_user.company_id},'%')
        </if>
        <if test="_user.company_grade == '5'.toString()">
            AND parent_id = #{_user.company_id}
        </if>
        and fax is null
    </select>
    
    <select id="findSnsList" parameterType="map" resultType="map">
        SELECT
        *,
        'true' as hasChild
        FROM
        sys_office
        WHERE
        del_flag = '0'
        AND grade = '6'
        <if test="id != null and id != ''">
            AND parent_id = #{id}
        </if>
        <if test="_user.company_grade == '3'.toString() or _user.company_grade == '4'.toString()">
            AND parent_ids like concat('%',#{_user.company_id},'%')
        </if>
        <if test="_user.company_grade == '5'.toString()">
            AND parent_id = #{_user.company_id}
        </if>
    </select>
    <select id="findResidentialList" parameterType="map" resultType="map">
        SELECT
        a.id,
        a.name,
        a.address,
        a.measure,
        a.grade,
        a.csc_mapjson,
        a.csc_mapjson_ht,
        a.area_id,
        a.street_id,
        a.community_id,
        a.garden_id,
        a.create_by,
        a.create_time,
        a.update_by,
        a.update_time,
        a.map_type,
        a.manager,
        a.binding,
        a.del_flag,
        a.parent_ids,
        a.company_code,
        'true' as hasChild,
        a.szdwbb,
        a.szdzbbb,
        a.type,
        a.qh_code
<!--        (select cast(AES_DECRYPT(FROM_BASE64(cardno),'*#id#') as char) from jl_grid_divide_auth where a.id = level_id-->
<!--        and grade = '5.5' and operate_type = 'user') as cardno,-->
<!--        (select uuid from jl_grid_divide_auth where a.id = level_id and grade = '5.5' and operate_type = 'user') as-->
<!--        auth_uuid-->
        FROM
        jl_grid_residential a
        WHERE
<!--        a.community_id = #{id}-->
        a.garden_id = #{id}
    </select>
    <select id="findGardenList" parameterType="map" resultType="map">
        SELECT
        *,
        'true' as hasChild
        FROM
        jl_grid_garden
        WHERE
        community_id = #{id}
    </select>
    <select id="findGardenCommunityByIdList" parameterType="map" resultType="map">
        SELECT
        *,
        'true' as hasChild
        FROM
        jl_grid_garden
        WHERE
        community_id = #{id}
    </select>
    <select id="findBuildingResidentialList" parameterType="map" resultType="map">
        SELECT
        *,
        'true' as hasChild
        FROM
        jl_grid_building a
        WHERE
        a.garden_id = #{id}
<!--        a.residential_id = #{id}-->
    </select>
    <select id="findBuildingList" parameterType="map" resultType="map">
        SELECT
        *,
        'true' as hasChild
        FROM
        jl_grid_building a
        WHERE
        a.residential_id = #{id}
    </select>
    <select id="findUnitList" parameterType="map" resultType="map">
        SELECT
        *
        FROM
        jl_grid_unit a
        WHERE
        a.building_id = #{id}
    </select>
    <select id="findFloorList" parameterType="map" resultType="map">
        SELECT
        id,
        `name`,
        sort,
        grade,
        csc_mapjson,
        parent_ids,
        company_code,
        area_id,
        street_id,
        community_id,
        residential_id,
        garden_id,
        building_id,
        unit_id,
        del_flag,
        create_by,
        create_time,
        update_by,
        update_time,
        map_type
        FROM
        jl_grid_floor
        WHERE
        unit_id = #{id}
        ORDER BY sort
    </select>
    <select id="findDoorplateList" parameterType="map" resultType="map">
        SELECT
        a.id,
        a.`name`,
        a.sort,
        a.grade,
        a.csc_mapjson,
        a.parent_ids,
        a.company_code,
        a.area_id,
        a.street_id,
        a.community_id,
        a.residential_id,
        a.garden_id,
        a.building_id,
        a.unit_id,
        a.floor_id,
        a.del_flag,
        a.create_by,
        a.create_time,
        a.update_by,
        a.update_time,
        a.map_type,
        a.num,
        a.people_num,
        a.jz_num,
        'true' as doorplateShow,
        ( SELECT remarks FROM jl_grid_doorplate_special WHERE a.id = doorplate_id ) AS remarks
        FROM
        jl_grid_doorplate a
        WHERE
        a.floor_id = #{floor_id}
        ORDER BY a.sort
    </select>
    <select id="findResidentialByMapList" parameterType="map" resultType="map">
        SELECT
        IF((select id from jl_grid_divide_auth where grade = '5.5' AND cardno = #{_user.cardno_y} AND level_id = a.id
        LIMIT 1) is NULL , 0 ,1) as auth_result,
        a.id,
        a.name,
        a.address,
        a.measure,
        a.grade,
        a.csc_mapjson,
        a.csc_mapjson_ht,
        a.area_id,
        a.street_id,
        a.community_id,
        a.create_by,
        a.create_time,
        a.update_by,
        a.update_time,
        a.map_type,
        a.manager,
        a.binding,
        a.del_flag,
        a.parent_ids,
        a.company_code,
        a.szdwbb,
        a.szdzbbb,
        a.type
        FROM
        jl_grid_residential a
        <where>
            <if test="grade == '3'.toString()">
                AND a.area_id = #{id}
            </if>
            <if test="grade == '4'.toString()">
                AND a.street_id = #{id}
            </if>
            <if test="grade == '5'.toString()">
                AND a.community_id = #{id}
            </if>
            <if test="grade == '5.5'.toString()">
                AND a.id = #{id}
            </if>
        </where>
    </select>
    <select id="findGardenByMapList" parameterType="map" resultType="map">
        SELECT
        <!--IF((select id from jl_grid_divide_auth where grade = '6' AND cardno = #{_user.cardno_y} AND level_id = a.id LIMIT 1) is NULL , 0 ,1) as auth_result,-->
        a.id,
        a.name,
        a.grade,
        a.csc_mapjson,
        a.csc_mapjson_ht,
        a.parent_ids,
        a.company_code,
        a.area_id,
        a.street_id,
        a.community_id,
        a.residential_id,
        a.del_flag,
        a.create_by,
        a.create_time,
        a.update_by,
        a.update_time,
        a.map_type,
        a.manager,
        a.binding
        <!--(select name from jl_grid_residential where id = a.residential_id) as residential_name-->
        FROM
        jl_grid_garden a
        WHERE
        a.map_type = 'Amap'
        <if test="grade == '4'.toString()">
            AND a.area_id = #{id}
        </if>
        <if test="grade == '5'.toString()">
            AND a.street_id = #{id}
        </if>
        <if test="grade == '6'.toString()">
            AND a.community_id = #{id}
        </if>
        <if test="grade == '7'.toString()">
            AND a.id = #{id}
        </if>
    </select>
    <select id="findBuildingByMapList" parameterType="map" resultType="map">
        SELECT
        <!--IF((select id from jl_grid_divide_auth where grade = '7' AND cardno = #{_user.cardno_y} AND level_id = a.id LIMIT 1) is NULL , 0 ,1) as auth_result,-->
        a.id,
        a.brand,
        a.name,
        a.grade,
        a.csc_mapjson,
        a.csc_mapjson_ht,
        a.parent_ids,
        a.company_code,
        a.area_id,
        a.street_id,
        a.community_id,
        a.residential_id,
        a.garden_id,
        a.del_flag,
        a.create_by,
        a.create_time,
        a.update_by,
        a.update_time,
        a.map_type,
        a.manager,
        (select name from jl_grid_garden where id = a.garden_id) as garden_name
        <!--(select name from jl_grid_residential where id = a.residential_id) as residential_name-->
        FROM
        jl_grid_building a
        <where>
            <if test="grade == '4'.toString()">
                AND a.area_id = #{id}
            </if>
            <if test="grade == '5'.toString()">
                AND a.street_id = #{id}
            </if>
            <if test="grade == '6'.toString()">
                AND a.community_id = #{id}
            </if>
            <if test="grade == '7'.toString()">
                AND a.garden_id = #{id}
            </if>
            <if test="grade == '8'.toString()">
                AND a.id = #{id}
            </if>
        </where>
    </select>
    <select id="getResidentialInfoByID" parameterType="map" resultType="map">
        SELECT
        ( SELECT name FROM sys_office WHERE id = a.area_id ) as area_name,
        ( SELECT name FROM sys_office WHERE id = a.street_id ) as street_name,
        ( SELECT name FROM sys_office WHERE id = a.community_id ) as community_name,
        a.id,
        a.`name`,
        a.address,
        a.measure,
        a.grade,
        a.csc_mapjson,
        a.csc_mapjson_ht,
        a.area_id,
        a.street_id,
        a.community_id,
        a.create_by,
        a.create_time,
        a.update_by,
        a.update_time,
        a.map_type,
        a.manager,
        a.binding,
        a.del_flag,
        a.parent_ids,
        a.company_code,
        a.szdwbb,
        a.szdzbbb,
        a.type
        FROM
        jl_grid_residential a
        WHERE
        a.id = #{id}
    </select>
    <select id="getGardenInfoByID" parameterType="map" resultType="map">
        SELECT
        ( SELECT name FROM sys_office WHERE id = a.area_id ) AS area_name,
        ( SELECT name FROM sys_office WHERE id = a.street_id ) AS street_name,
        ( SELECT name FROM sys_office WHERE id = a.community_id ) AS community_name,
        <!--( SELECT name FROM jl_grid_residential WHERE id = residential_id ) AS residential_name,-->
        a.id,
        a.`name`,
        a.grade,
        a.csc_mapjson,
        a.csc_mapjson_ht,
        a.parent_ids,
        a.company_code,
        a.area_id,
        a.street_id,
        a.community_id,
        a.residential_id,
        a.del_flag,
        a.create_by,
        a.create_time,
        a.update_by,
        a.update_time,
        a.map_type,
        a.manager,
        a.binding
        FROM
        jl_grid_garden a
        WHERE
        id = #{id}
    </select>
    <select id="getBuildingInfoByID" parameterType="map" resultType="map">
        SELECT
        id,
        brand,
        `name`,
        grade,
        csc_mapjson,
        csc_mapjson_ht,
        parent_ids,
        company_code,
        area_id,
        street_id,
        community_id,
        residential_id,
        garden_id,
        del_flag,
        create_by,
        create_time,
        update_by,
        update_time,
        map_type,
        manager,
        build_type
        FROM
        jl_grid_building
        WHERE
        id = #{id}
    </select>
    <select id="findResidentialForCommunityList" parameterType="map" resultType="map" expose="true">
        SELECT
        id,
        `name`,
        address,
        measure,
        grade,
        csc_mapjson,
        csc_mapjson_ht,
        area_id,
        street_id,
        community_id,
        create_by,
        create_time,
        update_by,
        update_time,
        map_type,
        manager,
        binding,
        del_flag,
        parent_ids,
        company_code,
        'true' as hasChild,
        szdwbb,
        szdzbbb,
        type
        FROM
        jl_grid_residential
        WHERE
        1 = 1
        <choose>
            <when test="_user.company_grade == '3'.toString()">
                and area_id = #{_user.company_id}
            </when>
            <when test="_user.company_grade == '4'.toString()">
                and street_id = #{_user.company_id}
            </when>
            <otherwise>
                and community_id = #{_user.company_id}
            </otherwise>
        </choose>
        <if test="id != null and id != ''">
            AND id != #{id}
        </if>
    </select>
    <select id="findGardenForCommunityList" parameterType="map" resultType="map">
        SELECT
        id,
        `name`,
        grade,
        csc_mapjson,
        csc_mapjson_ht,
        parent_ids,
        company_code,
        area_id,
        street_id,
        community_id,
        residential_id,
        del_flag,
        create_by,
        create_time,
        update_by,
        update_time,
        map_type,
        manager,
        binding
        FROM
        jl_grid_garden
        WHERE
        1 = 1
        <choose>
            <when test="_user.company_grade == '4'.toString()">
                and area_id = #{_user.company_id}
            </when>
            <otherwise>
                and community_id = #{_user.company_id}
            </otherwise>
        </choose>
        AND
        community_id = #{community_id}
        <if test="id != null and id != ''">
            AND id != #{id}
        </if>
    </select>
    <select id="findGardenCommunityList" parameterType="map" resultType="map" expose="true">
        SELECT
        a.id,
        a.`name`,
        a.grade,
        a.csc_mapjson,
        a.company_code,
        a.area_id,
        a.street_id,
        a.community_id,
        a.residential_id,
        a.del_flag,
        a.create_by,
        a.create_time,
        a.update_by,
        a.update_time,
        a.map_type,
        a.manager,
        a.manager_tel,
        a.binding,
        a.parent_ids
        FROM
        jl_grid_garden a
        WHERE
        a.community_id = #{_user.company_id}
    </select>
    <select id="findResidentialCommunityList" parameterType="map" resultType="map" expose="true">
        SELECT
        a.id,
        a.`name`,
        a.address,
        a.measure,
        a.grade,
        a.csc_mapjson,
        a.area_id,
        a.street_id,
        a.community_id,
        a.create_by,
        a.create_time,
        a.update_by,
        a.update_time,
        a.map_type,
        a.manager,
        a.binding,
        a.del_flag,
        a.parent_ids,
        a.company_code,
        a.szdwbb,
        a.szdzbbb,
        a.type
        FROM
        jl_grid_residential a
        WHERE
        a.community_id = #{_user.company_id}
    </select>
    <select id="findGardenStreetList" parameterType="map" resultType="map" expose="true">
        SELECT
        a.id,
        a.`name`,
        a.grade,
        a.csc_mapjson,
        a.company_code,
        a.area_id,
        a.street_id,
        a.community_id,
        a.residential_id,
        a.del_flag,
        a.create_by,
        a.create_time,
        a.update_by,
        a.update_time,
        a.map_type,
        a.manager,
        a.manager_tel,
        a.binding,
        a.parent_ids
        FROM
        jl_grid_garden a
        WHERE
        a.street_id = #{_user.company_id}
    </select>
    <select id="findResidentialStreetList" parameterType="map" resultType="map" expose="true">
        SELECT
        a.id,
        a.`name`,
        a.address,
        a.measure,
        a.grade,
        a.csc_mapjson,
        a.area_id,
        a.street_id,
        a.community_id,
        a.create_by,
        a.create_time,
        a.update_by,
        a.update_time,
        a.map_type,
        a.manager,
        a.binding,
        a.del_flag,
        a.parent_ids,
        a.company_code,
        a.szdwbb,
        a.szdzbbb,
        a.type
        FROM
        jl_grid_residential a
        WHERE
        a.street_id = #{_user.company_id}
    </select>
    <select id="findBuildingLabelByMapList" parameterType="map" resultType="map">
        SELECT
        a.building_id,
        b.second_level_id,
        COUNT( 1 ) as num
        FROM
        jl_grid_user a
        LEFT JOIN jl_grid_user_focusgroup b ON a.cardno = b.cardno
        <where>
            <if test="grade == '3'.toString()">
                AND a.area_id = #{id}
            </if>
            <if test="grade == '4'.toString()">
                AND a.street_id = #{id}
            </if>
            <if test="grade == '5'.toString()">
                AND a.community_id = #{id}
            </if>
            <if test="grade == '5.5'.toString()">
                AND a.residential_id = #{id}
            </if>
            <if test="grade == '6'.toString()">
                AND a.garden_id = #{id}
            </if>
            <if test="grade == '7'.toString()">
                AND a.building_id = #{id}
            </if>
            AND b.second_level_id IN ( 'L0096-1663309358771', 'L0096-1663309405956' )
        </where>
        GROUP BY
        a.building_id,
        b.second_level_id
    </select>
    <select id="findCommunitySchoolList" parameterType="map" resultType="map">
        SELECT
        a.id,
        a.`name`,
        a.community_id,
        a.people_num,
        a.create_by,
        a.create_time,
        a.type
        FROM
        jl_grid_school a
        WHERE
        a.community_id = #{_user.company_id}
    </select>
    <update id="updateSchoolInfo" parameterType="map">
        UPDATE jl_grid_school
        SET
        name = #{name},
        people_num = #{people_num},
        type = #{type}
        WHERE
        id = #{id}
    </update>
    <insert id="createSchoolInfo" parameterType="map">
        INSERT INTO jl_grid_school(
        id,
        `name`,
        community_id,
        people_num,
        create_by,
        create_time,
        type
        )VALUES(
        uuid(),
        #{name},
        #{_user.company_id},
        #{people_num},
        #{_user.company_id},
        now(),
        #{type}
        )
    </insert>
    <delete id="deleteSchoolInfo" parameterType="map">
        DELETE FROM jl_grid_school WHERE id = #{id}
    </delete>
    <select id="findSchoolInfoTJList" parameterType="page" resultType="map">
        select *
        from (
        SELECT
        <!--            a.id,-->
        <!--            a.`name`,-->
        <!--            a.people_num,-->
        <!--            a.create_by,-->
        <!--            a.create_time,-->
        <!--            a.type,-->
        d.id AS area_id,
        d.`name` AS area_name,
        c.id AS street_id,
        c.`name` AS street_name,
        a.community_id,
        b.`name` AS community_name,
        SUM( people_num ) as people_num
        <!--            a.type-->
        FROM
        jl_grid_school a
        LEFT JOIN sys_office b ON a.community_id = b.id
        LEFT JOIN sys_office c ON b.parent_id = c.id
        LEFT JOIN sys_office d ON c.parent_id = d.id
        <where>
            <if test="params._user.company_grade == '2'.toString()">
                1 = 1
            </if>
            <if test="params._user.company_grade == '3'.toString()">
                d.id = #{params._user.company_id}
            </if>
            <if test="params._user.company_grade == '4'.toString()">
                c.id = #{params._user.company_id}
            </if>
            <if test="params.area_id != null and params.area_id != ''">
                AND d.id = #{params.area_id}
            </if>
            <if test="params.street_id != null and params.street_id != ''">
                AND c.id = #{params.street_id}
            </if>
            <if test="params.community_id != null and params.community_id != ''">
                AND a.community_id = #{params.community_id}
            </if>
        </where>
        GROUP BY
        a.community_id
        <!--        a.type-->
        ORDER BY
        d.sort
        ) aaa
    </select>

    <select id="findMerchantByCity" parameterType="com.scpyun.platform.jilinsscgsdp.bean.vo.ReqMssoVo"
            resultType="com.scpyun.platform.jilinsscgsdp.bean.vo.ResMssoVo">
        select id,name, csc_mapjson_ht cscMapjsonHt from jl_grid_merchant
        <where>
            <if test="grade == '3'.toString()">
                area_id in (select id from sys_office where parent_id = #{id});
            </if>
            <if test="grade == '4'.toString()">
                street_id in (select id from sys_office where parent_id = #{id});
            </if>
            <if test="grade == '5'.toString()">
                community_id in (select id from sys_office where parent_id = #{id});
            </if>
            <if test="grade == '6'.toString()">
                community_id = #{id}
            </if>
            <if test="grade == '7'.toString()">
                garden_id = #{id}
            </if>
        </where>


    </select>

    <select id="findSocietyByCity" parameterType="com.scpyun.platform.jilinsscgsdp.bean.vo.ReqMssoVo"
            resultType="com.scpyun.platform.jilinsscgsdp.bean.vo.ResMssoVo">
        select id,name, csc_mapjson_ht cscMapjsonHt from jl_grid_society
        <where>
            <if test="grade == '3'.toString()">
                area_id in (select id from sys_office where parent_id = #{id});
            </if>
            <if test="grade == '4'.toString()">
                street_id in (select id from sys_office where parent_id = #{id});
            </if>
            <if test="grade == '5'.toString()">
                community_id in (select id from sys_office where parent_id = #{id});
            </if>
            <if test="grade == '6'.toString()">
                community_id = #{id}
            </if>
            <if test="grade == '7'.toString()">
                garden_id = #{id}
            </if>
        </where>
    </select>
    <select id="findSubstanceByCity" parameterType="com.scpyun.platform.jilinsscgsdp.bean.vo.ReqMssoVo"
            resultType="com.scpyun.platform.jilinsscgsdp.bean.vo.ResMssoVo">
        select id,name, csc_mapjson_ht cscMapjsonHt from jl_grid_substance
        <where>
            <if test="grade == '3'.toString()">
                area_id in (select id from sys_office where parent_id = #{id});
            </if>
            <if test="grade == '4'.toString()">
                street_id in (select id from sys_office where parent_id = #{id});
            </if>
            <if test="grade == '5'.toString()">
                community_id in (select id from sys_office where parent_id = #{id});
            </if>
            <if test="grade == '6'.toString()">
                community_id = #{id}
            </if>
            <if test="grade == '7'.toString()">
                garden_id = #{id}
            </if>
        </where>

    </select>
    <select id="findOrgByCity" parameterType="com.scpyun.platform.jilinsscgsdp.bean.vo.ReqMssoVo"
            resultType="com.scpyun.platform.jilinsscgsdp.bean.vo.ResMssoVo">
        select id,org_name name, csc_mapjson_ht cscMapjsonHt from jl_grid_org
        <where>
            <if test="grade == '3'.toString()">
                area_id in (select id from sys_office where parent_id = #{id});
            </if>
            <if test="grade == '4'.toString()">
                street_id in (select id from sys_office where parent_id = #{id});
            </if>
            <if test="grade == '5'.toString()">
                community_id in (select id from sys_office where parent_id = #{id});
            </if>
            <if test="grade == '6'.toString()">
                community_id = #{id}
            </if>
            <if test="grade == '7'.toString()">
                garden_id = #{id}
            </if>
        </where>
    </select>


</mapper>