/// <summary> /// 根据时间和设备ID获取设备预案 /// </summary> /// <param name="query"></param> /// <returns></returns> public List <DevicePlanAndTimeConfig> QueryDevicePlanByDeviceIdAndTime(DevicePlanQuery query) { try { string sql = IBatisHelper.GetRuntimeSql(mapContext, "QueryDevicePlanByDeviceIdAndTime", query); return(mapContext.QueryForList <DevicePlanAndTimeConfig>("QueryDevicePlanByDeviceIdAndTime", query).ToList()); } catch (Exception ex) { throw ex; } }
/// <summary> /// 楼内图表、楼宇表、区域表的联表查询 /// </summary> /// <returns></returns> public List <FloorBuildingAreaInfoCustom> GetAllFloorBuildingArea() { try { string sql = IBatisHelper.GetRuntimeSql(this.mapContext, "GetFloorAreaInfo11", 1); //获取SQL语句 List <FloorBuildingAreaInfoCustom> floorBuildingAreaList = mapContext.QueryForList <FloorBuildingAreaInfoCustom>("GetFloorAreaInfo11", 1).ToList(); return(floorBuildingAreaList); } catch (Exception ex) { throw ex; } }
/// <summary> /// 分页查询 /// </summary> /// <param name="query"></param> /// <param name="pageNumber"></param> /// <param name="pageSize"></param> /// <param name="totalNumber"></param> /// <returns></returns> public List <ServVideoInfoModel> GetEntities(ServVideoInfoQuery query, int pageNumber, int pageSize, out int totalNumber) { try { string sql = IBatisHelper.GetRuntimeSql(this.mapContext, "QueryVideoDownloadCount", query); totalNumber = mapContext.QueryForObject <int>("QueryVideoDownloadCount", query); List <ServVideoInfoModel> list = mapContext.QueryForList <ServVideoInfoModel>("VideoInfoPage", query).ToList(); return(list); } catch (Exception ex) { throw ex; } }
/// <summary> /// 分页带条件id查询权限 /// </summary> /// <param name="query"></param> /// <param name="total"></param> /// <returns></returns> public List <ServPurviewInfoModel> GetPurviewInfoPageById(ServPurviewInfoQuery query, out int total) { try { string sql = IBatisHelper.GetRuntimeSql(this.mapContext, "GetPurviewInfoPageCount", query); total = mapContext.QueryForObject <int>("GetPurviewInfoPageCount", query); string sql1 = IBatisHelper.GetRuntimeSql(this.mapContext, "GetPurviewInfoPageById", query); return(mapContext.QueryForList <ServPurviewInfoModel>("GetPurviewInfoPageById", query).ToList()); } catch (Exception ex) { throw ex; } }
/// <summary> /// 查询园区,添加园区时候根据园区的名称和名字对园区进行验证 李昕 /// </summary> /// <param name="query"></param> /// <returns></returns> public BaseRegionConfigModel GetQueryRegionConfig(BaseRegionConfigQuery query) { BaseRegionConfigModel baseRegionConfigModel = new BaseRegionConfigModel(); try { string sql = IBatisHelper.GetRuntimeSql(this.mapContext, "GetQueryRegionConfig", query);//获取SQL语句 baseRegionConfigModel = mapContext.QueryForList <BaseRegionConfigModel>("GetQueryRegionConfig", query).ToList().FirstOrDefault(); } catch (Exception) { throw; } return(baseRegionConfigModel); }
/// <summary> /// 按条件查询 /// </summary> /// <param name="query"></param> /// <returns></returns> public List <BaseMapConfigModel> GetMapConfigByQuery(BaseMapConfigQuery query) { List <BaseMapConfigModel> list = new List <BaseMapConfigModel>(); try { string sql = IBatisHelper.GetRuntimeSql(this.mapContext, "GetQueryMapConfig", query);//获取SQL语句 list = mapContext.QueryForList <BaseMapConfigModel>("GetQueryMapConfig", query).ToList(); } catch (Exception ex) { throw ex; } return(list); }
/// <summary> /// 分页查询 /// </summary> /// <param name="query"></param> /// <param name="pageSize">当前页数</param> /// <param name="pageNumber">每页显示行数</param> /// <param name="totalNumber">总数</param> /// <returns></returns> public List <ServPlanRecordModel> GetEntities(ServPlanRecordQuery query, int pageNumber, int pageSize, out int totalNumber) { try { string sql = IBatisHelper.GetRuntimeSql(this.mapContext, "PlanRecordCount", query); totalNumber = mapContext.QueryForObject <int>("PlanRecordCount", query); query.pageSize = pageSize; query.pageNumber = pageNumber; string sql1 = IBatisHelper.GetRuntimeSql(this.mapContext, "PlanRecordPage", query); List <ServPlanRecordModel> list = mapContext.QueryForList <ServPlanRecordModel>("PlanRecordPage", query).ToList(); return(list); } catch (Exception ex) { throw ex; } }
/// <summary> /// 查看事件类型,事发园区,预案类型,开始时间与结束时间相同的预案 /// </summary> /// <param name="eventPlanId"></param> /// <param name="eventTypeId">事件类型</param> /// <param name="regionId">事发园区</param> /// <param name="planTime">开始时间</param> /// <param name="executionCycle">周期</param> /// <param name="endTime">结束时间</param> /// <returns></returns> public List <EventPlanInfo> CheckPlanTimeOccupied(int eventPlanId, int eventTypeId, int regionId, string planTime, string executionCycle, string endTime) { try { EventPlanInfo eventPlanInfo = new EventPlanInfo(); List <EventPlanInfo> eventPlanInfoList = new List <EventPlanInfo>(); eventPlanInfo.event_type = eventTypeId; eventPlanInfo.region_Id = regionId; eventPlanInfo.start_time = planTime; eventPlanInfo.id = eventPlanId; eventPlanInfo.end_time = endTime; eventPlanInfo.execution_cycle = executionCycle; eventPlanInfo.type = (int)RelateType.事件预案; eventPlanInfo.plan_status = (int)PlanStatus.废止; if (endTime == "") { if (eventPlanId == -1) { string sql = IBatisHelper.GetRuntimeSql(this.mapContext, "IsEventPlanTimeOccupied", eventPlanInfo); eventPlanInfoList = mapContext.QueryForList <EventPlanInfo>("IsEventPlanTimeOccupied", eventPlanInfo).ToList(); } else { eventPlanInfoList = mapContext.QueryForList <EventPlanInfo>("UpdateEventPlanTimeOccupied", eventPlanInfo).ToList(); } } else { if (eventPlanId == -1) { eventPlanInfoList = mapContext.QueryForList <EventPlanInfo>("IsTimeSlotOccupy", eventPlanInfo).ToList(); } else { eventPlanInfoList = mapContext.QueryForList <EventPlanInfo>("UpdateIsTimeSlotOccupy", eventPlanInfo).ToList(); } } return(eventPlanInfoList); } catch (Exception ex) { throw ex; } }
/// <summary> /// 查看时间是否被占用 /// </summary> /// <param name="deviceId"></param> /// <param name="planTime"></param> /// <returns></returns> public List <DevicePlanModel> IsCheckTimeOccupied(int devicePlanId, int deviceId, string planTime, string executionCycle, string endTime) { try { DevicePlanModel devicePlanInfo = new DevicePlanModel(); List <DevicePlanModel> devicePlanInfoList = new List <DevicePlanModel>(); devicePlanInfo.device_id = deviceId; devicePlanInfo.start_time = planTime; devicePlanInfo.id = devicePlanId; devicePlanInfo.end_time = endTime; devicePlanInfo.execution_cycle = executionCycle; devicePlanInfo.type = (int)RelateType.设备预案; devicePlanInfo.plan_status = (int)PlanStatus.废止; if (endTime == "") { if (devicePlanId == -1) { string sql = IBatisHelper.GetRuntimeSql(this.mapContext, "IsTimeOccupied", devicePlanInfo); devicePlanInfoList = mapContext.QueryForList <DevicePlanModel>("IsTimeOccupied", devicePlanInfo).ToList(); } else { devicePlanInfoList = mapContext.QueryForList <DevicePlanModel>("UpdateIsTimeOccupied", devicePlanInfo).ToList(); } } else { if (devicePlanId == -1) { devicePlanInfoList = mapContext.QueryForList <DevicePlanModel>("IsVerificationTimeOccupy", devicePlanInfo).ToList(); } else { devicePlanInfoList = mapContext.QueryForList <DevicePlanModel>("UpdateVerificationTimeOccupy", devicePlanInfo).ToList(); } } return(devicePlanInfoList); } catch (Exception ex) { throw ex; } }
/// <summary> /// 修改预案信息 /// </summary> /// <param name="devicePlanRelationInfoModel"></param> /// <returns></returns> public bool UpdateDevicePlan(DevicePlanRelationInfoModel devicePlanRelationInfoModel) { mapContext.BeginTransaction(System.Data.IsolationLevel.ReadUncommitted);//创建事务 try { bool result = false; //修改预案信息.Insert string sql = IBatisHelper.GetRuntimeSql(this.mapContext, "UpdatePartDevicePlanById", devicePlanRelationInfoModel.entity); int planId = (int)mapContext.Update("UpdatePartDevicePlanById", devicePlanRelationInfoModel.entity); if (planId > 0) { int executionTimeId = (int)mapContext.Delete("DeleteServExecutionTime", devicePlanRelationInfoModel.servExecutionTime); if (executionTimeId > 0) { ServPlanHandleItemModel servPlanHandleItemModel = new ServPlanHandleItemModel(); servPlanHandleItemModel.plan_id = devicePlanRelationInfoModel.entity.id; servPlanHandleItemModel.plan_type = (int)PlanType.设备预案; List <ServPlanHandleItemModel> PlanHandleItem = mapContext.QueryForList <ServPlanHandleItemModel>("GetPlanHandleItemByPlanId", servPlanHandleItemModel).ToList(); for (int a = 0; a < PlanHandleItem.Count(); a++) { if (PlanHandleItem[a].item_type == (int)DevicePlanDefaultOptions.通知其他负责人 && PlanHandleItem[a].confirm_type == (int)PlanHandleTime.确警前) { //删除默认处置项中的通知其他责任人信息 result = DeleteRelatedInfo("DeletePlanPersonByHandleId", "DeletePlanHandleItemById", PlanHandleItem[a].id); if (result == false) { break; } } else if (PlanHandleItem[a].item_type == (int)DevicePlanConfirmOptions.通知其他负责人 && PlanHandleItem[a].confirm_type == (int)PlanHandleTime.确警后) { //删除确警后处置项中的通知其他责任人信息 result = DeleteRelatedInfo("DeletePlanPersonByHandleId", "DeletePlanHandleItemById", PlanHandleItem[a].id); if (result == false) { break; } } else if (PlanHandleItem[a].item_type == (int)DevicePlanDefaultOptions.关联摄像头 && PlanHandleItem[a].confirm_type == (int)PlanHandleTime.确警前) { //删除默认处置项中的摄像头信息 result = DeleteRelatedInfo("DeletePlanHandleItemCameraHandleId", "DeletePlanHandleItemById", PlanHandleItem[a].id); if (result == false) { break; } } else { //删除处置项 result = DeleteRelatedInfo("", "DeletePlanHandleItemById", PlanHandleItem[a].id); if (result == false) { break; } } } //添加关联信息 result = AddRelatedInfo(devicePlanRelationInfoModel.entity.id, devicePlanRelationInfoModel); } else { mapContext.RollBackTransaction(); result = false; } } else { mapContext.RollBackTransaction(); result = false; } if (result == true) { mapContext.CommitTransaction();//提交事务 return(result); } else { mapContext.RollBackTransaction();//事务回滚 return(result); } } catch (Exception ex) { mapContext.RollBackTransaction(); throw ex; } finally { //mapContext.CommitTransaction(); } }