[WebApi]修正歷史資料查詢設備列表篩選條件,沒有對應點位就不會出現
This commit is contained in:
parent
b0a242a431
commit
ddb1db6da0
@ -516,9 +516,9 @@ namespace FrontendWebApi.ApiControllers
|
||||
|
||||
var wheres_str = string.Join(" AND ", wheres);
|
||||
|
||||
var sql = $@"SELECT
|
||||
var sql = $@"SELECT DISTINCT
|
||||
a.device_guid,
|
||||
b.full_name building_name,
|
||||
c.full_name building_name,
|
||||
v1.system_key main_name,
|
||||
v2.system_key sub_name,
|
||||
a.full_name device_name,
|
||||
@ -527,10 +527,14 @@ namespace FrontendWebApi.ApiControllers
|
||||
FROM device d
|
||||
WHERE {wheres_str}
|
||||
) a
|
||||
join building b on b.building_tag = a.device_building_tag
|
||||
join device_item b on b.device_system_tag = a.device_system_tag
|
||||
and b.device_building_tag COLLATE utf8mb4_unicode_ci = a.device_building_tag
|
||||
and b.device_name_tag COLLATE utf8mb4_unicode_ci = a.device_name_tag
|
||||
join building c on c.building_tag = a.device_building_tag
|
||||
join variable v1 on v1.system_value = a.device_system_tag and v1.deleted = 0 and v1.system_type = 'device_system_category_layer2'
|
||||
join variable v2 on v2.system_value = a.device_name_tag and v2.deleted = 0 and v2.system_type = 'device_system_category_layer3'
|
||||
order by b.priority,v1.system_priority,v2.system_priority,a.priority";
|
||||
where a.deleted = 0 and b.deleted = 0 and v2.deleted = 0 and v1.deleted = 0 and b.is_link = 1 and b.is_show_history = 1
|
||||
order by c.priority,v1.system_priority,v2.system_priority,a.priority";
|
||||
|
||||
var dbDevice = await backendRepository.GetAllAsync<History_GetDevice>(sql, new { builds = postDevice.SelectBuildings, floor_tag = postDevice.SelectFloors, syss = postDevice.SelectSub, device_name = postDevice.Device_name });
|
||||
apiResult.Data = dbDevice;
|
||||
@ -572,7 +576,7 @@ namespace FrontendWebApi.ApiControllers
|
||||
join variable v1 on v1.system_value = b.device_system_tag and v1.deleted = 0 and v1.system_type = 'device_system_category_layer2'
|
||||
join variable v2 on v2.system_value = b.device_name_tag and v2.deleted = 0 and v2.system_type = 'device_system_category_layer3'
|
||||
where a.deleted = 0 and b.deleted = 0 and v2.deleted = 0 and v1.deleted = 0
|
||||
and a.unit is not null and b.device_number in @Device_number and a.is_link = 1 and a.is_show_history = 1
|
||||
and b.device_number in @Device_number and a.is_link = 1 and a.is_show_history = 1
|
||||
order by c.priority,b.priority;"
|
||||
, new { Device_number = postDevice.select_data.Select(a => a.device_number).ToList() }
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user