修改 webApi api/getDevice
This commit is contained in:
		
							parent
							
								
									4e5ac55c2e
								
							
						
					
					
						commit
						cf377fa242
					
				@ -383,7 +383,7 @@ namespace FrontendWebApi.ApiControllers
 | 
			
		||||
                apiResult.Code = "5000";
 | 
			
		||||
                return BadRequest(apiResult);
 | 
			
		||||
            }
 | 
			
		||||
            if (post.building_guid == null)
 | 
			
		||||
            if (post.building_tag == null)
 | 
			
		||||
            {
 | 
			
		||||
                apiResult.Code = "9997";
 | 
			
		||||
                return Ok(apiResult);
 | 
			
		||||
@ -396,13 +396,13 @@ namespace FrontendWebApi.ApiControllers
 | 
			
		||||
                var disastersql = "";
 | 
			
		||||
                var layer3sql = "";
 | 
			
		||||
                var sWhere = "";
 | 
			
		||||
                if (!String.IsNullOrEmpty(post.main_system_guid))
 | 
			
		||||
                if (!String.IsNullOrEmpty(post.main_system_tag))
 | 
			
		||||
                {
 | 
			
		||||
                    main_system_guidsql = $" and d.main_system_guid = '{post.main_system_guid}'";
 | 
			
		||||
                    main_system_guidsql = $" and d.device_system_tag = '{post.main_system_tag}'";
 | 
			
		||||
                }
 | 
			
		||||
                if (!String.IsNullOrEmpty(post.sub_system_guid))
 | 
			
		||||
                if (!String.IsNullOrEmpty(post.sub_system_tag))
 | 
			
		||||
                {
 | 
			
		||||
                    sub_system_guidsql = $" and d.sub_system_guid = '{post.sub_system_guid}'";
 | 
			
		||||
                    sub_system_guidsql = $" and d.device_name_tag = '{post.sub_system_tag}'";
 | 
			
		||||
                }
 | 
			
		||||
                if (!String.IsNullOrEmpty(post.device_system_category_layer3))
 | 
			
		||||
                {
 | 
			
		||||
@ -417,13 +417,13 @@ namespace FrontendWebApi.ApiControllers
 | 
			
		||||
                if (!String.IsNullOrEmpty(post.show_cctv) && post.show_cctv == "1")
 | 
			
		||||
                {
 | 
			
		||||
                    var str_arr = new List<string>();
 | 
			
		||||
                    if (!String.IsNullOrEmpty(post.main_system_guid))
 | 
			
		||||
                    if (!String.IsNullOrEmpty(post.main_system_tag))
 | 
			
		||||
                    {
 | 
			
		||||
                        str_arr.Add($@"d.main_system_guid = '{post.main_system_guid}'");
 | 
			
		||||
                        str_arr.Add($@"d.device_system_tag = '{post.main_system_tag}'");
 | 
			
		||||
                    }
 | 
			
		||||
                    if (!String.IsNullOrEmpty(post.sub_system_guid))
 | 
			
		||||
                    if (!String.IsNullOrEmpty(post.sub_system_tag))
 | 
			
		||||
                    {
 | 
			
		||||
                        str_arr.Add($@"d.sub_system_guid = '{post.sub_system_guid}'");
 | 
			
		||||
                        str_arr.Add($@"d.device_name_tag = '{post.sub_system_tag}'");
 | 
			
		||||
                    }
 | 
			
		||||
                    if (!String.IsNullOrEmpty(post.device_system_category_layer3))
 | 
			
		||||
                    {
 | 
			
		||||
@ -495,12 +495,12 @@ namespace FrontendWebApi.ApiControllers
 | 
			
		||||
                                                            and d.device_name_tag = dk.device_name_tag
 | 
			
		||||
                                    left join device_master dm ON d.device_building_tag = dm.device_building_tag 
 | 
			
		||||
                                                              AND d.device_name_tag = dm.device_name_tag
 | 
			
		||||
                                    left join device_item di ON d.sub_system_guid = di.sub_system_guid 
 | 
			
		||||
                                    left join device_item di ON d.device_name_tag = di.device_name_tag 
 | 
			
		||||
                                                              AND di.deleted = 0 
 | 
			
		||||
                                                              AND di.is_show_riserDiagram = 1
 | 
			
		||||
                                    {disasterjoinsql}
 | 
			
		||||
                                    LEFT JOIN building_menu bm ON d.building_guid = bm.building_guid AND d.main_system_guid = bm.main_system_guid AND d.sub_system_guid = bm.sub_system_guid
 | 
			
		||||
                                    where d.deleted = 0 and d.building_guid = '{post.building_guid}' {sWhere}
 | 
			
		||||
                                    LEFT JOIN building_menu bm ON d.device_building_tag = bm.building_tag AND d.device_system_tag = bm.main_system_tag AND d.device_name_tag = bm.sub_system_tag
 | 
			
		||||
                                    where d.deleted = 0 and d.device_building_tag = '{post.building_tag}' {sWhere}
 | 
			
		||||
                                    order by d.priority ASC, d.device_number ASC";
 | 
			
		||||
 | 
			
		||||
                var devicelist = await backendRepository.GetAllAsync<DeviceFloor>(sql);
 | 
			
		||||
@ -521,9 +521,9 @@ namespace FrontendWebApi.ApiControllers
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                //抓出該設備所需要的顯示的即時資料(平面圖)
 | 
			
		||||
                var sql_tips = $@"SELECT di.* FROM device_item di WHERE di.deleted = 0 AND is_show = 1 AND sub_system_guid = @sub_system_guid";
 | 
			
		||||
                var sql_tips = $@"SELECT di.* FROM device_item di WHERE di.deleted = 0 AND is_show = 1 AND device_name_tag = @sub_system_tag";
 | 
			
		||||
 | 
			
		||||
                var device_item_floormap = await backendRepository.GetAllAsync<DeviceItem>(sql_tips, new { sub_system_guid = post.sub_system_guid });
 | 
			
		||||
                var device_item_floormap = await backendRepository.GetAllAsync<DeviceItem>(sql_tips, new { sub_system_tag = post.sub_system_tag });
 | 
			
		||||
 | 
			
		||||
                foreach (var device in devicelist)
 | 
			
		||||
                {
 | 
			
		||||
 | 
			
		||||
@ -62,9 +62,9 @@ namespace FrontendWebApi.Models
 | 
			
		||||
 | 
			
		||||
    public class GetSubPost
 | 
			
		||||
    {
 | 
			
		||||
        public string main_system_guid { get; set; }
 | 
			
		||||
        public string sub_system_guid { get; set; }
 | 
			
		||||
        public string building_guid { get; set; }
 | 
			
		||||
        public string main_system_tag { get; set; }
 | 
			
		||||
        public string sub_system_tag { get; set; }
 | 
			
		||||
        public string building_tag { get; set; }
 | 
			
		||||
        public string device_system_value { get; set; }
 | 
			
		||||
        public string device_system_category_layer3 { get; set; }
 | 
			
		||||
        public string show_cctv { get; set; }
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user