吉安感知网项目-后端
linwei
2026-04-22 de09889cb97fcd7e9ae3236d3cb0d9f2f752e439
drone-service/drone-system/src/main/java/org/sxkj/system/mapper/DeptMapper.xml
@@ -146,14 +146,14 @@
        blade_dept
        where is_deleted = 0
        <if test="deptId!=null and deptId!=''">
            and (id = #{deptId} or ancestors like concat('%',#{deptId},'%'))
            and (id = #{deptId}::bigint or ancestors like concat('%',#{deptId},'%'))
        </if>
    </select>
    <!--自定义详情查询-根据系统配置id-->
    <select id="getDetailBySysConfigId" resultType="org.sxkj.system.vo.DeptVO">
        select bd.* from blade_dept bd
        left join sys_config sc on sc.dept_id = bd.id::VARCHAR and sc.is_deleted = 0
        left join sys_config sc on sc.dept_id::VARCHAR = bd.id::VARCHAR and sc.is_deleted = 0
        where bd.is_deleted = 0
        and sc.id = #{dept.sysConfigId}
    </select>
@@ -163,10 +163,10 @@
        select
        bd.*,sc.id as sysConfigId,sc.name as sysName
        from blade_dept bd
        left join sys_config sc on sc.dept_id = bd.id::VARCHAR and sc.is_deleted = 0
        left join sys_config sc on sc.dept_id::VARCHAR = bd.id::VARCHAR and sc.is_deleted = 0
        where bd.is_deleted = 0
        and (
        bd.id = #{deptId}
        bd.id = #{deptId}::bigint
        or bd.ancestors like concat('%',#{deptId},'%')
        )
    </select>
@@ -176,10 +176,12 @@
        select
        bd.*,sc.name as sysName
        from blade_dept bd
        left join sys_config sc on sc.dept_id = bd.id::VARCHAR and sc.is_deleted = 0
        left join sys_config sc
            on sc.dept_id::VARCHAR = bd.id::VARCHAR
            and sc.is_deleted = 0
        where bd.is_deleted = 0
        and (
        bd.id = #{deptId}
        bd.id = #{deptId}::bigint
        or bd.ancestors like concat('%',#{deptId},'%')
        )
        and bd.dept_category = 1
@@ -195,10 +197,10 @@
        bd.sort
        FROM
        blade_dept bd
        left join manage_device_per_share ddps on ddps.loan_to_dept_id = bd.id::VARCHAR
        left join manage_device_per_share ddps on ddps.loan_to_dept_id::VARCHAR = bd.id::VARCHAR
        where bd.is_deleted = 0
        and bd.id != #{deptId}
        and ifnull(device_sn,'') != #{deviceSn}
        and COALESCE(device_sn,'') != #{deviceSn}
        and bd.id not in (
            -- 排除当前部门的所有上级部门
            select parent_dept.id
@@ -247,8 +249,8 @@
        SELECT
        CONCAT(p.name, ' ', c.name, ' ', r.name) AS full_region_name
        FROM blade_region r
        LEFT JOIN blade_region c ON r.parent_code = c.code::VARCHAR  <!-- 市级 -->
        LEFT JOIN blade_region p ON c.parent_code = p.code::VARCHAR  <!-- 省级 -->
        LEFT JOIN blade_region c ON r.parent_code::VARCHAR = c.code::VARCHAR  <!-- 市级 -->
        LEFT JOIN blade_region p ON c.parent_code::VARCHAR = p.code::VARCHAR  <!-- 省级 -->
        WHERE r.code = #{areaCode}
    </select>
    <select id="getSingleRegionName" resultType="string">
@@ -294,7 +296,7 @@
            and bd.area_code like concat(concat('%', #{param2.areaCode}),'%')
        </if>
        <if test="param2.deptCode!=null and param2.deptCode!=''">
            and bd.dept_code = #{param2.deptCode}
            and bd.dept_code like concat(concat('%', #{param2.deptCode}),'%')
        </if>
            ORDER BY bd.create_time DESC
    </select>