修改區東樓api
This commit is contained in:
		
							parent
							
								
									0ac8b0a81f
								
							
						
					
					
						commit
						d46e6ec094
					
				@ -96,22 +96,18 @@ namespace FrontendWebApi.ApiControllers
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /// <summary>
 | 
					        /// <summary>
 | 
				
			||||||
        /// 大樓列表
 | 
					        /// 地區列表
 | 
				
			||||||
        /// </summary>
 | 
					        /// </summary>
 | 
				
			||||||
        /// <returns></returns>
 | 
					        /// <returns></returns>
 | 
				
			||||||
        [HttpPost]
 | 
					        [HttpPost]
 | 
				
			||||||
        public async Task<ApiResult<List<BuildingList>>> BuiList()
 | 
					        public async Task<ApiResult<List<BuildingList>>> AreaList()
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            ApiResult<List<BuildingList>> apiResult = new ApiResult<List<BuildingList>>();
 | 
					            ApiResult<List<BuildingList>> apiResult = new ApiResult<List<BuildingList>>();
 | 
				
			||||||
            List<BuildingList> bl = new List<BuildingList>();
 | 
					            List<BuildingList> bl = new List<BuildingList>();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            try
 | 
					            try
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                var sqlString = @$"select d.device_area_tag, d.device_building_tag, d.device_floor_tag, CONCAT(case when d.device_area_tag='TPE' then '台北市' else '新北市' end, b.full_name, d.device_floor_tag) as full_name
 | 
					                var sqlString = @$"select system_key as area_name, system_value as device_area_tag from variable where deleted = 0 and system_type = 'area'";
 | 
				
			||||||
                                   from device d
 | 
					 | 
				
			||||||
                                   join building b on d.device_building_tag = b.building_tag
 | 
					 | 
				
			||||||
                                   where d.deleted = 0
 | 
					 | 
				
			||||||
                                   group by d.device_area_tag, d.device_building_tag, d.device_floor_tag, b.full_name";
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
                bl = await backendRepository.GetAllAsync<BuildingList>(sqlString);
 | 
					                bl = await backendRepository.GetAllAsync<BuildingList>(sqlString);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -128,6 +124,71 @@ namespace FrontendWebApi.ApiControllers
 | 
				
			|||||||
            return apiResult;
 | 
					            return apiResult;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        /// <summary>
 | 
				
			||||||
 | 
					        /// 大樓列表
 | 
				
			||||||
 | 
					        /// </summary>
 | 
				
			||||||
 | 
					        /// <returns></returns>
 | 
				
			||||||
 | 
					        [HttpPost]
 | 
				
			||||||
 | 
					        public async Task<ApiResult<List<BuildingList>>> BuiList([FromBody] BuildingList b)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            ApiResult<List<BuildingList>> apiResult = new ApiResult<List<BuildingList>>();
 | 
				
			||||||
 | 
					            List<BuildingList> bl = new List<BuildingList>();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            try
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                var sqlString = @$"select d.device_building_tag, b.full_name as building_name
 | 
				
			||||||
 | 
					                                   from device d
 | 
				
			||||||
 | 
					                                   join building b on d.device_building_tag = b.building_tag
 | 
				
			||||||
 | 
					                                   where d.deleted = 0 and d.device_area_tag = @device_area_tag
 | 
				
			||||||
 | 
					                                   group by b.building_name, d.device_building_tag";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                bl = await backendRepository.GetAllAsync<BuildingList>(sqlString, new { @device_area_tag = b.device_area_tag });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                apiResult.Code = "0000";
 | 
				
			||||||
 | 
					                apiResult.Data = bl;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            catch (Exception exception)
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                apiResult.Code = "9999";
 | 
				
			||||||
 | 
					                apiResult.Msg = "系統內部錯誤,請聯絡管理者。";
 | 
				
			||||||
 | 
					                Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            return apiResult;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        /// <summary>
 | 
				
			||||||
 | 
					        /// 大樓列表
 | 
				
			||||||
 | 
					        /// </summary>
 | 
				
			||||||
 | 
					        /// <returns></returns>
 | 
				
			||||||
 | 
					        [HttpPost]
 | 
				
			||||||
 | 
					        public async Task<ApiResult<List<BuildingList>>> FloList([FromBody] BuildingList b)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            ApiResult<List<BuildingList>> apiResult = new ApiResult<List<BuildingList>>();
 | 
				
			||||||
 | 
					            List<BuildingList> bl = new List<BuildingList>();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            try
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                var sqlString = @$"select d.device_floor_tag
 | 
				
			||||||
 | 
					                                   from device d
 | 
				
			||||||
 | 
					                                   where d.deleted = 0 and d.device_area_tag = @device_area_tag and d.device_building_tag = @device_building_tag
 | 
				
			||||||
 | 
					                                   group by d.device_floor_tag";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                bl = await backendRepository.GetAllAsync<BuildingList>(sqlString, new { @device_area_tag = b.device_area_tag, @device_building_tag = b.device_building_tag });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                apiResult.Code = "0000";
 | 
				
			||||||
 | 
					                apiResult.Data = bl;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            catch (Exception exception)
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                apiResult.Code = "9999";
 | 
				
			||||||
 | 
					                apiResult.Msg = "系統內部錯誤,請聯絡管理者。";
 | 
				
			||||||
 | 
					                Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            return apiResult;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /// <summary>
 | 
					        /// <summary>
 | 
				
			||||||
        /// 設備列表
 | 
					        /// 設備列表
 | 
				
			||||||
        /// </summary>
 | 
					        /// </summary>
 | 
				
			||||||
@ -141,9 +202,9 @@ namespace FrontendWebApi.ApiControllers
 | 
				
			|||||||
            try
 | 
					            try
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                var sqlString = @$"select device_number, concat(device_floor_tag, ' ', device_last_name, ' ', device_serial_tag) as device_name
 | 
					                var sqlString = @$"select device_number, concat(device_floor_tag, ' ', device_last_name, ' ', device_serial_tag) as device_name
 | 
				
			||||||
                                   from device where deleted = 0 and device_building_tag = @device_building_tag and device_floor_tag = @device_floor_tag";
 | 
					                                   from device where deleted = 0 and device_area_tag = @device_area_tag and device_building_tag = @device_building_tag and device_floor_tag = @device_floor_tag";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                var param = new { @device_building_tag = bl.device_building_tag, @device_floor_tag = bl.device_floor_tag };
 | 
					                var param = new { @device_building_tag = bl.device_building_tag, @device_floor_tag = bl.device_floor_tag, @device_area_tag = bl.device_area_tag };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                d = await backendRepository.GetAllAsync<Device>(sqlString, param);
 | 
					                d = await backendRepository.GetAllAsync<Device>(sqlString, param);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user