修改device列表, 樓層排序

This commit is contained in:
dev02 2022-11-17 14:52:07 +08:00
parent e867495d77
commit 13edf2e3d9
2 changed files with 10 additions and 7 deletions

View File

@ -96,7 +96,7 @@ namespace FrontendWebApi.ApiControllers
try try
{ {
var sqlString = $@"select building_tag, full_name from building where deleted = 0"; var sqlString = $@"select building_tag, full_name from building where deleted = 0 order by priority";
var bl = await backendRepository.GetAllAsync<BuildList>(sqlString); var bl = await backendRepository.GetAllAsync<BuildList>(sqlString);
apiResult.Code = "0000"; apiResult.Code = "0000";
@ -132,7 +132,7 @@ namespace FrontendWebApi.ApiControllers
try try
{ {
var sqlString = $@"select full_name as floor_tag from floor where deleted = 0 and building_tag = @building_tag"; var sqlString = $@"select full_name as floor_tag from floor where deleted = 0 and building_tag = @building_tag order by priority";
var param = new { @building_tag = fd.building_tag }; var param = new { @building_tag = fd.building_tag };
var fl = await backendRepository.GetAllAsync<FloorList>(sqlString, param); var fl = await backendRepository.GetAllAsync<FloorList>(sqlString, param);
@ -182,10 +182,11 @@ namespace FrontendWebApi.ApiControllers
foreach (var f in fl) foreach (var f in fl)
{ {
List<DeviceLists> dl = new List<DeviceLists>(); List<DeviceLists> dl = new List<DeviceLists>();
sqlString = $@"select d.device_guid, d.full_name, d.status, d.device_coordinate, dm.device_master_icon,d.device_number sqlString = $@"select d.device_guid, d.full_name, d.device_coordinate, dk.device_image, d.device_number, dk.device_normal_flashing, dk.device_close_flashing, dk.device_error_flashing
from device d from device d
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_kind dk on d.device_building_tag = dk.device_building_tag and d.device_system_tag = dk.device_system_tag
where d.deleted = 0 and d.device_system_tag = @main_system_tag and d.device_building_tag = @building_tag and d.device_floor_tag = ifnull(@floor_tag, d.device_floor_tag)"; and d.device_name_tag = dk.device_name_tag
where d.deleted = 0 and d.device_system_tag = @sub_system_tag and d.device_building_tag = @building_tag and d.device_floor_tag = ifnull(@floor_tag, d.device_floor_tag)";
var dlParam = new { @main_system_tag = fd.main_system_tag, @building_tag = fd.building_tag, @floor_tag = fd.floor_tag }; var dlParam = new { @main_system_tag = fd.main_system_tag, @building_tag = fd.building_tag, @floor_tag = fd.floor_tag };
dl = await backendRepository.GetAllAsync<DeviceLists>(sqlString, dlParam); dl = await backendRepository.GetAllAsync<DeviceLists>(sqlString, dlParam);
f.device_list = dl; f.device_list = dl;
@ -551,7 +552,6 @@ namespace FrontendWebApi.ApiControllers
return Ok(apiResult); return Ok(apiResult);
} }
return Ok(apiResult); return Ok(apiResult);
} }
} }
} }

View File

@ -48,7 +48,10 @@ namespace FrontendWebApi.Models
return name[status]; return name[status];
} }
} }
public string device_master_icon { get; set; } public string device_image { get; set; }
public string device_normal_flashing { get; set; }
public string device_close_flashing { get; set; }
public string device_error_flashing { get; set; }
} }
public class DeviceBaseInfo public class DeviceBaseInfo