吉安感知网项目-后端
linwei
2026-02-02 970567fcffdb6710288357a0d18fb66bc29d074e
设备统计优化
3 files modified
29 ■■■■ changed files
drone-service/drone-fw/src/main/java/org/sxkj/fw/device/mapper/FwDeviceMapper.java 4 ●●●● patch | view | raw | blame | history
drone-service/drone-fw/src/main/java/org/sxkj/fw/device/mapper/FwDeviceMapper.xml 20 ●●●●● patch | view | raw | blame | history
drone-service/drone-fw/src/main/java/org/sxkj/fw/device/service/impl/FwDeviceServiceImpl.java 5 ●●●●● patch | view | raw | blame | history
drone-service/drone-fw/src/main/java/org/sxkj/fw/device/mapper/FwDeviceMapper.java
@@ -85,13 +85,13 @@
     * 设备统计 - 按类型统计
     * @return 统计数据
     */
    List<DeviceTypeStatisticsVO> getDeviceTypeStatistics(List<Long> deptList);
    List<DeviceTypeStatisticsVO> getDeviceTypeStatistics(List<Long> deptList,String currentDeptId);
    /**
     * 设备出库去向统计
     * @return 统计数据
     */
    List<DeviceStatisticsVO> getDeviceOutStatistics(String effectiveRangeKmIsNotNull,List<Long> deptList);
    List<DeviceStatisticsVO> getDeviceOutStatistics(String effectiveRangeKmIsNotNull,List<Long> deptList,String currentDeptId);
    /**
     * 设备生产厂商统计
drone-service/drone-fw/src/main/java/org/sxkj/fw/device/mapper/FwDeviceMapper.xml
@@ -311,10 +311,18 @@
                blade_dict_biz b ON (a.device_type = b.dict_key AND b.code = 'deviceType' AND b.parent_id != 0)
        where a.is_deleted = 0
        <if test="deptList != null and deptList.size > 0">
            and a.create_dept in
            and ( a.create_dept in
            <foreach collection="deptList" item="deptId" open="(" separator="," close=")">
                #{deptId}
            </foreach>
            <!-- <if test="currentDeptId != null and currentDeptId != '' "> -->
            <!--     or a.id in ( -->
            <!--     SELECT device_id FROM ja_fw_device_per_share -->
            <!--     WHERE loan_to_dept_id = #{currentDeptId} -->
            <!--     AND is_deleted = 0 -->
            <!--     ) -->
            <!-- </if> -->
            )
        </if>
        group by a.device_type,b.dict_value
    </select>
@@ -338,10 +346,18 @@
            and (d.effective_range_km is null or d.effective_range_km = 0)
        </if>
        <if test="deptList != null and deptList.size > 0">
            and d.create_dept in
            and ( d.create_dept in
            <foreach collection="deptList" item="deptId" open="(" separator="," close=")">
                #{deptId}
            </foreach>
            <if test="currentDeptId != null and currentDeptId != '' ">
                or d.id in (
                SELECT device_id FROM ja_fw_device_per_share
                WHERE loan_to_dept_id = #{currentDeptId}
                AND is_deleted = 0
                )
            </if>
            )
        </if>
        GROUP BY
            d.final_outbound_area
drone-service/drone-fw/src/main/java/org/sxkj/fw/device/service/impl/FwDeviceServiceImpl.java
@@ -143,14 +143,15 @@
    public List<DeviceTypeStatisticsVO> getDeviceTypeStatistics() {
        // 统计范围限定在当前部门及下级部门
        List<Long> deptList = SysCache.getDeptChildIds(Long.valueOf(AuthUtil.getDeptId()));
        return baseMapper.getDeviceTypeStatistics(deptList);
        List<DeviceTypeStatisticsVO> deviceTypeStatistics = baseMapper.getDeviceTypeStatistics(deptList, AuthUtil.getDeptId());
        return deviceTypeStatistics;
    }
    @Override
    public List<DeviceStatisticsVO> getDeviceOutStatistics(String effectiveRangeKmIsNotNull) {
        // 统计范围限定在当前部门及下级部门
        List<Long> deptList = SysCache.getDeptChildIds(Long.valueOf(AuthUtil.getDeptId()));
        return baseMapper.getDeviceOutStatistics(effectiveRangeKmIsNotNull, deptList);
        return baseMapper.getDeviceOutStatistics(effectiveRangeKmIsNotNull, deptList, AuthUtil.getDeptId());
    }
    @Override