吉安感知网项目-后端
linwei
2026-02-06 6e43ac3b06f272925a87f4193ad238acc9f32f49
mysql调整成pgsql
9 files modified
156 ■■■■ changed files
drone-service/drone-fw/src/main/java/org/sxkj/fw/area/mapper/FwAreaDivideMapper.xml 58 ●●●● patch | view | raw | blame | history
drone-service/drone-fw/src/main/java/org/sxkj/fw/area/mapper/FwDefenseSceneManageMapper.xml 6 ●●●● patch | view | raw | blame | history
drone-service/drone-fw/src/main/java/org/sxkj/fw/area/mapper/FwDefenseSceneMapper.xml 6 ●●●● patch | view | raw | blame | history
drone-service/drone-fw/src/main/java/org/sxkj/fw/area/mapper/FwDefenseZoneMapper.xml 4 ●●●● patch | view | raw | blame | history
drone-service/drone-fw/src/main/java/org/sxkj/fw/detection/mapper/FwEffectEvalMapper.xml 8 ●●●● patch | view | raw | blame | history
drone-service/drone-fw/src/main/java/org/sxkj/fw/detection/mapper/FwTaskScheduleMapper.xml 2 ●●● patch | view | raw | blame | history
drone-service/drone-fw/src/main/java/org/sxkj/fw/device/mapper/FwDeviceMapper.xml 18 ●●●● patch | view | raw | blame | history
drone-service/drone-fw/src/main/java/org/sxkj/fw/record/mapper/FwDroneAlarmRecordMapper.xml 23 ●●●●● patch | view | raw | blame | history
drone-service/drone-system/src/main/java/org/sxkj/system/mapper/RoleMapper.xml 31 ●●●● patch | view | raw | blame | history
drone-service/drone-fw/src/main/java/org/sxkj/fw/area/mapper/FwAreaDivideMapper.xml
@@ -79,7 +79,7 @@
            <if test="param2.areaTypeKeyList != null and param2.areaTypeKeyList.size > 0">
                and (
                    <foreach collection="param2.areaTypeKeyList" item="key" separator=" or ">
                        find_in_set(#{key}, ad.area_type_keys)
                        #{key} = ANY(string_to_array(ad.area_type_keys, ','))
                    </foreach>
                )
            </if>
@@ -116,7 +116,7 @@
                    where ds.is_deleted = 0
                      and ds.area_divide_ids is not null
                      and ds.area_divide_ids != ''
                      and find_in_set(ad.id, replace(ds.area_divide_ids, ' ', ''))
                      and ad.id = ANY(string_to_array(replace(ds.area_divide_ids, ' ', ''), ',')::bigint[])
                )
            </if>
            <if test="isSetSceneManage != null and isSetSceneManage == 1 and flyTime != null">
@@ -127,7 +127,7 @@
                    where ds.is_deleted = 0
                      and ds.area_divide_ids is not null
                      and ds.area_divide_ids != ''
                      and find_in_set(ad.id, replace(ds.area_divide_ids, ' ', ''))
                      and ad.id = ANY(string_to_array(replace(ds.area_divide_ids, ' ', ''), ',')::bigint[])
                      and (dsm.effective_date_start is null or dsm.effective_date_start &lt;= #{flyTime})
                      and (dsm.effective_date_end is null or dsm.effective_date_end &gt;= #{flyTime})
                )
@@ -140,7 +140,7 @@
                        where ds.is_deleted = 0
                          and ds.area_divide_ids is not null
                          and ds.area_divide_ids != ''
                          and find_in_set(ad.id, replace(ds.area_divide_ids, ' ', ''))
                          and ad.id = ANY(string_to_array(replace(ds.area_divide_ids, ' ', ''), ',')::bigint[])
                    )
                    <if test="sceneId != null">
                        or exists (
@@ -150,7 +150,7 @@
                              and ds.id = #{sceneId}
                              and ds.area_divide_ids is not null
                              and ds.area_divide_ids != ''
                              and find_in_set(ad.id, replace(ds.area_divide_ids, ' ', ''))
                              and ad.id = ANY(string_to_array(replace(ds.area_divide_ids, ' ', ''), ',')::bigint[])
                        )
                    </if>
                )
@@ -163,13 +163,13 @@
                      and ds.id = #{sceneId}
                      and ds.area_divide_ids is not null
                      and ds.area_divide_ids != ''
                      and find_in_set(ad.id, replace(ds.area_divide_ids, ' ', ''))
                      and ad.id = ANY(string_to_array(replace(ds.area_divide_ids, ' ', ''), ',')::bigint[])
                )
            </if>
            <if test="areaTypeKeyList != null and areaTypeKeyList.size > 0">
                and (
                    <foreach collection="areaTypeKeyList" item="key" separator=" or ">
                        find_in_set(#{key}, ad.area_type_keys)
                        #{key} = ANY(string_to_array(ad.area_type_keys, ','))
                    </foreach>
                )
            </if>
@@ -189,7 +189,7 @@
            <if test="deviceIds != null and deviceIds.size > 0">
                and (
                    <foreach collection="deviceIds" item="deviceId" separator=" or ">
                        find_in_set(#{deviceId}, replace(ad.device_ids, ' ', ''))
                        #{deviceId} = ANY(string_to_array(replace(ad.device_ids, ' ', ''), ',')::bigint[])
                    </foreach>
                )
            </if>
@@ -209,7 +209,7 @@
            <if test="areaIds != null and areaIds.size > 0">
                and (
                    <foreach collection="areaIds" item="areaId" separator=" or ">
                        find_in_set(#{areaId}, replace(ds.area_divide_ids, ' ', ''))
                        #{areaId} = ANY(string_to_array(replace(ds.area_divide_ids, ' ', ''), ',')::bigint[])
                    </foreach>
                )
            </if>
@@ -223,7 +223,7 @@
            ad.is_deleted = 0
            and ad.device_ids is not null
            and ad.device_ids != ''
            and find_in_set(#{deviceId}, replace(ad.device_ids, ' ', ''))
            and #{deviceId} = ANY(string_to_array(replace(ad.device_ids, ' ', ''), ',')::bigint[])
        </where>
    </select>
@@ -262,18 +262,18 @@
            ad.area_name,
            ad.area_type_keys,
            (
                select group_concat(distinct ds.scene_name)
                select string_agg(distinct ds.scene_name, ',')
                from ja_fw_defense_scene ds
                join ja_fw_defense_scene_manage dsm on dsm.defense_scene_id = ds.id and dsm.is_deleted = 0
                where ds.is_deleted = 0
                  and find_in_set(ad.id, ds.area_divide_ids)
                  and ad.id = ANY(string_to_array(replace(ds.area_divide_ids, ' ', ''), ',')::bigint[])
            ) as scene_name,
            (
                select group_concat(distinct ds.scene_type)
                select string_agg(distinct ds.scene_type, ',')
                from ja_fw_defense_scene ds
                join ja_fw_defense_scene_manage dsm on dsm.defense_scene_id = ds.id and dsm.is_deleted = 0
                where ds.is_deleted = 0
                  and find_in_set(ad.id, ds.area_divide_ids)
                  and ad.id = ANY(string_to_array(replace(ds.area_divide_ids, ' ', ''), ',')::bigint[])
            ) as scene_type,
            case
                when ad.device_ids is null or trim(ad.device_ids) = '' then 0
@@ -286,7 +286,7 @@
                    from ja_fw_drone_alarm_record ar
                    join ja_fw_device d on d.id = ar.device_id and d.is_deleted = 0
                    where ar.is_deleted = 0
                      and find_in_set(d.id, replace(ad.device_ids, ' ', ''))
                      and d.id = ANY(string_to_array(replace(ad.device_ids, ' ', ''), ',')::bigint[])
                )
            end as alarm_count,
            case
@@ -296,7 +296,7 @@
                    from ja_fw_effect_eval ee
                    join ja_fw_device d on d.id = ee.device_id and d.is_deleted = 0
                    where ee.is_deleted = 0
                      and find_in_set(d.id, replace(ad.device_ids, ' ', ''))
                      and d.id = ANY(string_to_array(replace(ad.device_ids, ' ', ''), ',')::bigint[])
                )
            end as counter_count,
            case
@@ -307,7 +307,7 @@
                    join ja_fw_device d on d.id = ee.device_id and d.is_deleted = 0
                    where ee.is_deleted = 0
                      and ee.counter_effect = '1'
                      and find_in_set(d.id, replace(ad.device_ids, ' ', ''))
                      and d.id = ANY(string_to_array(replace(ad.device_ids, ' ', ''), ',')::bigint[])
                )
            end as counter_success_count
            from ja_fw_area_divide ad
@@ -318,7 +318,7 @@
                    from ja_fw_defense_scene ds
                    join ja_fw_defense_scene_manage dsm on dsm.defense_scene_id = ds.id and dsm.is_deleted = 0
                    where ds.is_deleted = 0
                      and find_in_set(ad.id, ds.area_divide_ids)
                      and ad.id = ANY(string_to_array(replace(ds.area_divide_ids, ' ', ''), ',')::bigint[])
                )
                <if test="param2.id != null and param2.id != ''">
                    and ad.id = #{param2.id}
@@ -331,7 +331,7 @@
                        select 1
                        from ja_fw_defense_scene ds
                        where ds.is_deleted = 0
                          and find_in_set(ad.id, ds.area_divide_ids)
                          and ad.id = ANY(string_to_array(replace(ds.area_divide_ids, ' ', ''), ',')::bigint[])
                          and ds.scene_type = #{param2.sceneType}
                    )
                </if>
@@ -341,7 +341,7 @@
                <if test="param2.areaTypeKeyList != null and param2.areaTypeKeyList.size > 0">
                    and (
                        <foreach collection="param2.areaTypeKeyList" item="key" separator=" or ">
                            find_in_set(#{key}, ad.area_type_keys)
                            #{key} = ANY(string_to_array(ad.area_type_keys, ','))
                        </foreach>
                    )
                </if>
@@ -378,16 +378,16 @@
        ad.area_name,
        ad.area_type_keys,
        (
            select group_concat(distinct ds.scene_name)
            select string_agg(distinct ds.scene_name, ',')
            from ja_fw_defense_scene ds
                where ds.is_deleted = 0
                  and find_in_set(ad.id, ds.area_divide_ids)
                  and ad.id = ANY(string_to_array(replace(ds.area_divide_ids, ' ', ''), ',')::bigint[])
            ) as scene_name,
            (
                select group_concat(distinct ds.scene_type)
                select string_agg(distinct ds.scene_type, ',')
                from ja_fw_defense_scene ds
                where ds.is_deleted = 0
                  and find_in_set(ad.id, ds.area_divide_ids)
                  and ad.id = ANY(string_to_array(replace(ds.area_divide_ids, ' ', ''), ',')::bigint[])
            ) as scene_type,
            case
                when ad.device_ids is null or trim(ad.device_ids) = '' then 0
@@ -400,7 +400,7 @@
                    from ja_fw_drone_alarm_record ar
                    join ja_fw_device d on d.id = ar.device_id and d.is_deleted = 0
                    where ar.is_deleted = 0
                      and find_in_set(d.id, replace(ad.device_ids, ' ', ''))
                      and d.id = ANY(string_to_array(replace(ad.device_ids, ' ', ''), ',')::bigint[])
                )
            end as alarm_count,
            case
@@ -410,7 +410,7 @@
                    from ja_fw_effect_eval ee
                    join ja_fw_device d on d.id = ee.device_id and d.is_deleted = 0
                    where ee.is_deleted = 0
                      and find_in_set(d.id, replace(ad.device_ids, ' ', ''))
                      and d.id = ANY(string_to_array(replace(ad.device_ids, ' ', ''), ',')::bigint[])
                )
            end as counter_count,
            case
@@ -421,7 +421,7 @@
                    join ja_fw_device d on d.id = ee.device_id and d.is_deleted = 0
                    where ee.is_deleted = 0
                      and ee.counter_effect = 'success'
                      and find_in_set(d.id, replace(ad.device_ids, ' ', ''))
                      and d.id = ANY(string_to_array(replace(ad.device_ids, ' ', ''), ',')::bigint[])
                )
            end as counter_success_count
            from ja_fw_area_divide ad
@@ -490,7 +490,7 @@
                </if>
                GROUP BY
                    d.id
        ) dd on find_in_set(dd.id, ad.device_ids)
        ) dd on dd.id = ANY(string_to_array(ad.device_ids, ',')::bigint[])
    </select>
    <select id="checkAreaBindScene" resultType="java.lang.Boolean">
@@ -499,7 +499,7 @@
        from ja_fw_defense_scene_manage dsm
        left join ja_fw_defense_scene ds on ds.id = dsm.defense_scene_id and ds.is_deleted = 0
        where ds.is_deleted = 0
        and find_in_set(#{areaId}, ds.area_divide_ids)
        and #{areaId} = ANY(string_to_array(replace(ds.area_divide_ids, ' ', ''), ',')::bigint[])
        and dsm.is_deleted = 0
    </select>
drone-service/drone-fw/src/main/java/org/sxkj/fw/area/mapper/FwDefenseSceneManageMapper.xml
@@ -84,7 +84,7 @@
                ad.device_ids
            FROM ja_fw_defense_scene_manage dsm
            LEFT JOIN ja_fw_defense_scene ds ON ds.id = dsm.defense_scene_id AND ds.is_deleted = 0
            LEFT JOIN ja_fw_area_divide ad ON FIND_IN_SET(ad.id, ds.area_divide_ids) > 0 AND ad.is_deleted = 0
            LEFT JOIN ja_fw_area_divide ad ON ad.id = ANY(string_to_array(ds.area_divide_ids, ',')::bigint[]) AND ad.is_deleted = 0
            WHERE dsm.id = #{id}
        ) ad ON CHAR_LENGTH(ad.device_ids) - CHAR_LENGTH(REPLACE(ad.device_ids, ',', '')) >= numbers.n - 1
        WHERE ad.device_ids IS NOT NULL AND ad.device_ids != ''
@@ -96,7 +96,7 @@
        ds.scene_name as defense_scene_name
        from ja_fw_defense_scene_manage dsm
        left join ja_fw_defense_scene ds on ds.id = dsm.defense_scene_id and ds.is_deleted = 0
        left join ja_fw_area_divide ad on FIND_IN_SET(ad.id, ds.area_divide_ids) > 0 and ad.is_deleted = 0
        left join ja_fw_area_divide ad on ad.id = ANY(string_to_array(ds.area_divide_ids, ',')::bigint[]) and ad.is_deleted = 0
        inner join (
                SELECT
                    d.id
@@ -119,7 +119,7 @@
                </if>
                GROUP BY
                d.id
            ) dd on find_in_set(dd.id, ad.device_ids)
            ) dd on dd.id = ANY(string_to_array(ad.device_ids, ',')::bigint[])
        <where>
            dsm.is_deleted = 0
        </where>
drone-service/drone-fw/src/main/java/org/sxkj/fw/area/mapper/FwDefenseSceneMapper.xml
@@ -89,7 +89,7 @@
                        where dz.is_deleted = 0
                          and dz.defense_scene_ids is not null
                          and dz.defense_scene_ids != ''
                          and find_in_set(ds.id, dz.defense_scene_ids)
                          and ds.id = ANY(string_to_array(dz.defense_scene_ids, ',')::bigint[])
                    )
                    <if test="zoneId != null">
                        or exists (
@@ -99,7 +99,7 @@
                              and dz.id = #{zoneId}
                              and dz.defense_scene_ids is not null
                              and dz.defense_scene_ids != ''
                              and find_in_set(ds.id, dz.defense_scene_ids)
                              and ds.id = ANY(string_to_array(dz.defense_scene_ids, ',')::bigint[])
                        )
                    </if>
                )
@@ -107,7 +107,7 @@
            <if test="areaId != null and (filterSelected == null or filterSelected != 1)">
                and ds.area_divide_ids is not null
                and ds.area_divide_ids != ''
                and find_in_set(#{areaId}, replace(ds.area_divide_ids, ' ', ''))
                and #{areaId} = ANY(string_to_array(replace(ds.area_divide_ids, ' ', ''), ',')::bigint[])
            </if>
        </where>
    </select>
drone-service/drone-fw/src/main/java/org/sxkj/fw/area/mapper/FwDefenseZoneMapper.xml
@@ -91,11 +91,11 @@
            and dz.id = #{zoneId}
            and dz.defense_scene_ids is not null
            and dz.defense_scene_ids != ''
            and find_in_set(ds.id, replace(dz.defense_scene_ids, ' ', ''))
            and ds.id = ANY(string_to_array(replace(dz.defense_scene_ids, ' ', ''), ',')::bigint[])
        join ja_fw_area_divide ad on ad.is_deleted = 0
            and ds.area_divide_ids is not null
            and ds.area_divide_ids != ''
            and find_in_set(ad.id, replace(ds.area_divide_ids, ' ', ''))
            and ad.id = ANY(string_to_array(replace(ds.area_divide_ids, ' ', ''), ',')::bigint[])
        left join ja_fw_police_station ps on ps.id = ad.police_station_id and ps.is_deleted = 0
    </select>
drone-service/drone-fw/src/main/java/org/sxkj/fw/detection/mapper/FwEffectEvalMapper.xml
@@ -33,11 +33,11 @@
    <select id="selectFwEffectEvalPage" resultMap="fwEffectEvalResultMap">
        select
        ee.*,
        group_concat(distinct ad.area_name separator ',') as area_name,
        group_concat(distinct ds.scene_name separator ',') as scene_name
        string_agg(distinct ad.area_name, ',') as area_name,
        string_agg(distinct ds.scene_name, ',') as scene_name
        from ja_fw_effect_eval ee
        left join ja_fw_area_divide ad on find_in_set(ee.device_id, ad.device_ids) and ad.is_deleted = 0
        left join ja_fw_defense_scene ds on find_in_set(ad.id, ds.area_divide_ids) and ds.is_deleted = 0
        left join ja_fw_area_divide ad on ee.device_id = ANY(string_to_array(ad.device_ids, ',')::bigint[]) and ad.is_deleted = 0
        left join ja_fw_defense_scene ds on ad.id = ANY(string_to_array(replace(ds.area_divide_ids, ' ', ''), ',')::bigint[]) and ds.is_deleted = 0
        <where>
                ee.is_deleted = 0
            <if test="param2.deviceName != null and param2.deviceName != ''">
drone-service/drone-fw/src/main/java/org/sxkj/fw/detection/mapper/FwTaskScheduleMapper.xml
@@ -74,7 +74,7 @@
                ja_fw_defense_zone dz on dz.is_deleted = 0
            and dz.defense_scene_ids is not null
            and dz.defense_scene_ids != ''
            and find_in_set(dsm.id, replace(dz.defense_scene_ids, ' ', ''))
            and dsm.id = ANY(string_to_array(replace(dz.defense_scene_ids, ' ', ''), ',')::bigint[])
        <where>
            ts.is_deleted = 0
            <if test="param2.deviceName != null and param2.deviceName != ''">
drone-service/drone-fw/src/main/java/org/sxkj/fw/device/mapper/FwDeviceMapper.xml
@@ -128,7 +128,7 @@
                    </foreach>
                    and ad.device_ids is not null
                    and ad.device_ids != ''
                    and find_in_set(ja_fw_device.id, ad.device_ids)
                    and ja_fw_device.id = ANY(string_to_array(ad.device_ids, ',')::bigint[])
                        )
                    )
                </when>
@@ -143,7 +143,7 @@
                            and ad.id = #{areaId}
                            and ad.device_ids is not null
                            and ad.device_ids != ''
                            and find_in_set(ja_fw_device.id, ad.device_ids)
                            and ja_fw_device.id = ANY(string_to_array(ad.device_ids, ',')::bigint[])
                            )
                            or not exists (
                            select 1
@@ -151,7 +151,7 @@
                            where ad.is_deleted = 0
                            and ad.device_ids is not null
                            and ad.device_ids != ''
                            and find_in_set(ja_fw_device.id, ad.device_ids)
                            and ja_fw_device.id = ANY(string_to_array(ad.device_ids, ',')::bigint[])
                            and ad.id != #{areaId}
                            )
                        </when>
@@ -162,7 +162,7 @@
                            where ad.is_deleted = 0
                            and ad.device_ids is not null
                            and ad.device_ids != ''
                            and find_in_set(ja_fw_device.id, ad.device_ids)
                            and ja_fw_device.id = ANY(string_to_array(ad.device_ids, ',')::bigint[])
                            )
                        </otherwise>
                    </choose>
@@ -197,7 +197,7 @@
                                  and ad.id = #{query.areaId}
                                  and ad.device_ids is not null
                                  and ad.device_ids != ''
                                  and find_in_set(ja_fw_device.id, ad.device_ids)
                                  and ja_fw_device.id = ANY(string_to_array(ad.device_ids, ',')::bigint[])
                            )
                            or not exists (
                                select 1
@@ -205,7 +205,7 @@
                                where ad.is_deleted = 0
                                  and ad.device_ids is not null
                                  and ad.device_ids != ''
                                  and find_in_set(ja_fw_device.id, ad.device_ids)
                                  and ja_fw_device.id = ANY(string_to_array(ad.device_ids, ',')::bigint[])
                                  and ad.id != #{query.areaId}
                            )
                        </when>
@@ -216,7 +216,7 @@
                                where ad.is_deleted = 0
                                  and ad.device_ids is not null
                                  and ad.device_ids != ''
                                  and find_in_set(ja_fw_device.id, ad.device_ids)
                                  and ja_fw_device.id = ANY(string_to_array(ad.device_ids, ',')::bigint[])
                            )
                        </otherwise>
                    </choose>
@@ -532,10 +532,10 @@
        from
            ja_fw_device d
        left join ja_fw_area_divide ad
            on find_in_set(d.id, ad.device_ids) > 0
            on d.id = ANY(string_to_array(ad.device_ids, ',')::bigint[])
            and ad.is_deleted = 0
        left join ja_fw_defense_scene ds
            on find_in_set(ad.id, ds.area_divide_ids) > 0
            on ad.id = ANY(string_to_array(replace(ds.area_divide_ids, ' ', ''), ',')::bigint[])
            and ds.is_deleted = 0
        left join ja_fw_defense_scene_manage dsm
            on dsm.defense_scene_id = ds.id
drone-service/drone-fw/src/main/java/org/sxkj/fw/record/mapper/FwDroneAlarmRecordMapper.xml
@@ -40,16 +40,19 @@
            d.status deviceStatus,
            d.final_outbound_area,
            /* 1=已关注,0=未关注 */
            EXISTS (
                SELECT
                    1
                FROM
                    ja_fw_alarm_favorite f
                WHERE
                    f.alarm_record_id = dar.id
                AND  f.user_id = #{param2.currentUserId}   -- MyBatis 参数
                AND  f.is_deleted = 0
                ) AS favorited
            CASE
                WHEN EXISTS (
                    SELECT
                        1
                    FROM
                        ja_fw_alarm_favorite f
                    WHERE
                        f.alarm_record_id = dar.id
                    AND  f.user_id = #{param2.currentUserId}   -- MyBatis 参数
                    AND  f.is_deleted = 0
                    ) THEN 1
                ELSE 0
            END AS favorited
        from
            ja_fw_drone_alarm_record dar
        left join
drone-service/drone-system/src/main/java/org/sxkj/system/mapper/RoleMapper.xml
@@ -62,27 +62,28 @@
    <!--角色查询-->
    <select id="getRoleList" resultType="org.sxkj.system.entity.Role">
        WITH RECURSIVE role_hierarchy AS (
            SELECT id, parent_id, role_name, role_alias
            FROM blade_role
            WHERE id = #{roleParam.roleId} AND is_deleted = 0
            UNION ALL
            SELECT r.id, r.parent_id, r.role_name, r.role_alias
            FROM blade_role r
            JOIN role_hierarchy rh ON r.parent_id = rh.id
            WHERE r.is_deleted = 0
        )
        SELECT br.* FROM blade_role br
        inner join (
        SELECT * FROM
        (
        SELECT t1.*,IF( find_in_set( parent_id, @pids ) > 0, @pids := concat( @pids, ',', id ), 0 ) AS ischild FROM
        ( SELECT id, parent_id,role_name,role_alias FROM blade_role t where is_deleted =0 ORDER BY parent_id, id ) t1,
        ( SELECT @pids := #{roleParam.roleId} ) t2
        ) t3
        WHERE id != 1123598816738675201
        INNER JOIN role_hierarchy rh ON br.id = rh.id
        WHERE br.id != 1123598816738675201
        <if test="roleParam.roleName!=null and roleParam.roleName!=''">
            and role_name like concat('%',#{roleParam.roleName},'%')
            AND br.role_name LIKE concat('%',#{roleParam.roleName},'%')
        </if>
        <if test="roleParam.roleAlias!=null and roleParam.roleAlias!=''">
            and role_alias like concat('%',#{roleParam.roleAlias},'%')
            AND br.role_alias LIKE concat('%',#{roleParam.roleAlias},'%')
        </if>
        ) t4 on br.id = t4.id
        <if test="roleParam.isNowLevel==0">
            union all
            (
            SELECT * FROM blade_role where id = #{roleParam.roleId}
            )
            UNION ALL
            SELECT * FROM blade_role WHERE id = #{roleParam.roleId} AND is_deleted = 0
        </if>
    </select>