drone-service/drone-fw/src/main/java/org/sxkj/fw/area/service/impl/FwAreaDivideServiceImpl.java
@@ -41,6 +41,7 @@ import org.sxkj.fw.area.vo.FwAreaDivideVO; import org.sxkj.fw.area.vo.FwDefenseSceneVO; import org.sxkj.fw.device.entity.FwDeviceEntity; import org.sxkj.fw.device.mapper.FwDeviceMapper; import org.sxkj.fw.device.service.IFwDeviceService; import org.sxkj.system.cache.SysCache; @@ -58,6 +59,7 @@ public class FwAreaDivideServiceImpl extends BaseServiceImpl<FwAreaDivideMapper, FwAreaDivideEntity> implements IFwAreaDivideService { private final IFwAreaDivideExtService fwAreaDivideExtService; private final FwDeviceMapper fwDeviceMapper; @Override public IPage<FwAreaDivideVO> selectFwAreaDividePage(IPage<FwAreaDivideVO> page, FwAreaDivideDTO fwAreaDivide) { @@ -410,16 +412,15 @@ // 判断区域是否绑定到场景中 boolean isBindScene = baseMapper.checkAreaBindScene(fwAreaDivide.getId()); if (isBindScene) { IFwDeviceService fwDeviceService = SpringUtil.getBean(IFwDeviceService.class); // 启用新增的设备 if (!addedDeviceIds.isEmpty()) { fwDeviceService.update(Wrappers.<FwDeviceEntity>lambdaUpdate() .set(FwDeviceEntity::getIsEnabled, 1) .in(FwDeviceEntity::getId, addedDeviceIds)); List<Long> addedIds = parseIdList(String.join(",", addedDeviceIds)); fwDeviceMapper.batchUpdateIsEnabled(addedIds, 1); } // 禁用删除的设备 if (!removedDeviceIds.isEmpty()) { fwDeviceService.update(Wrappers.<FwDeviceEntity>lambdaUpdate() .set(FwDeviceEntity::getIsEnabled, 0) .in(FwDeviceEntity::getId, removedDeviceIds)); List<Long> removedIds = parseIdList(String.join(",", removedDeviceIds)); fwDeviceMapper.batchUpdateIsEnabled(removedIds, 0); } } } drone-service/drone-fw/src/main/java/org/sxkj/fw/device/mapper/FwDeviceMapper.java
@@ -138,4 +138,13 @@ * @return */ List<DeviceStatisticsVO> getDeviceStatistics(FwDeviceDTO fwDeviceDTO); /** * 批量更新设备启用状态 * * @param deviceIds 设备ID列表 * @param isEnabled 启用状态:0-禁用,1-启用 * @return 影响行数 */ int batchUpdateIsEnabled(@Param("deviceIds") List<Long> deviceIds, @Param("isEnabled") Integer isEnabled); } drone-service/drone-fw/src/main/java/org/sxkj/fw/device/mapper/FwDeviceMapper.xml
@@ -55,10 +55,10 @@ and device_type::text = #{param2.deviceType}::text </if> <if test="param2.deviceModel != null and param2.deviceModel != ''"> and device_model = #{param2.deviceModel} and device_model::text = #{param2.deviceModel}::text </if> <if test="param2.deviceSpecification != null and param2.deviceSpecification != ''"> and device_specification = #{param2.deviceSpecification} and device_specification::text = #{param2.deviceSpecification}::text </if> <if test="param2.effectiveRangeKmIsNotNull != null and param2.effectiveRangeKmIsNotNull == 1"> and effective_range_km is not null @@ -68,13 +68,13 @@ and (effective_range_km is null or effective_range_km = 0) </if> <if test="param2.manufacturer != null and param2.manufacturer != ''"> and manufacturer = #{param2.manufacturer} and manufacturer::text = #{param2.manufacturer}::text </if> <if test="param2.source != null and param2.source != ''"> and source = #{param2.source} and source::text = #{param2.source}::text </if> <if test="param2.belongDept != null and param2.belongDept != ''"> and belong_dept = #{param2.belongDept} and belong_dept::text = #{param2.belongDept}::text </if> <if test="param2.deviceStatusList != null and param2.deviceStatusList != ''"> and status::text in @@ -97,10 +97,9 @@ #{deptId}::text </foreach> <if test="param2.currentDeptId != null and param2.currentDeptId != '' "> or id in ( SELECT device_id FROM ja_fw_device_per_share WHERE loan_to_dept_id = #{param2.currentDeptId}::bigint or id::text in ( SELECT device_id::text FROM ja_fw_device_per_share WHERE loan_to_dept_id = #{param2.currentDeptId}::bigint AND is_deleted = 0 ) </if> @@ -816,4 +815,15 @@ d.final_outbound_area </select> <!-- 批量更新设备启用状态 --> <update id="batchUpdateIsEnabled"> UPDATE ja_fw_device SET is_enabled = #{isEnabled} WHERE id IN <foreach collection="deviceIds" item="id" open="(" separator="," close=")"> #{id}::bigint </foreach> AND is_deleted = 0 </update> </mapper>