refactor: 歷史訊息 左端選單判斷

This commit is contained in:
史萬澤 2023-02-09 16:10:16 +08:00
parent c96f184847
commit 393a2d38d0
2 changed files with 11 additions and 3 deletions

View File

@ -198,13 +198,15 @@ namespace FrontendWebApi.ApiControllers
{
var dbsub = await frontendRepository.GetAllAsync<HistoryDBMainSub>(
@$"select distinct v1.system_key main_name, v1.system_value main_system_tag, v2.system_key sub_name, v2.system_value sub_system_tag, v1.system_priority, v2.system_priority,
d.device_number, d.full_name as device_full_name, d.device_serial_tag
d.device_number, d.full_name as device_full_name, d.device_serial_tag ,di.is_show_history device_item_is_show_hsitory
from role_auth a
join auth_page b on a.AuthCode = b.AuthCode
join userinfo c on c.role_guid = a.role_guid
join variable v2 on b.ShowView = v2.id and v2.system_type = @sub_system_type
join variable v1 on v1.id = v2.system_parent_id and v1.system_type = @main_system_type
join device d on v1.system_value = d.device_system_tag and v2.system_value = d.device_name_tag and d.deleted = 0 and d.visible = 1
join device_item di on d.device_system_tag=di.device_system_tag and d.device_name_tag=di.device_name_tag
and di.is_link = 1
where c.account = @account
order by v1.system_priority, v2.system_priority", new { @account = myUser.account, @sub_system_type = sub_system_type, @main_system_type = main_system_type });
var dbbuilding = await frontendRepository.GetAllAsync<History_Build>(
@ -231,7 +233,7 @@ namespace FrontendWebApi.ApiControllers
History_Sub_system history_Sub_System = new History_Sub_system();
history_Sub_System.full_name = sub.Select(x => x.sub_name).FirstOrDefault();
history_Sub_System.sub_system_tag = sub.Select(x => x.sub_system_tag).FirstOrDefault();
history_Sub_System.is_show_history = sub.Select(x => x.device_item_is_show_hsitory).FirstOrDefault();
var devices = dbsub.Where(x => x.main_system_tag == main.Select(m => m.main_system_tag).FirstOrDefault() && x.sub_system_tag == sub.Select(x => x.sub_system_tag).FirstOrDefault() && x.device_number != null).ToList();
history_Sub_System.device = devices.Count > 0 ? new List<Device>() : null;
@ -244,8 +246,12 @@ namespace FrontendWebApi.ApiControllers
history_Sub_System.device.Add(device);
}
if (history_Sub_System.is_show_history==1)
{
history_Main_System.History_Sub_systems.Add(history_Sub_System);
}
}
apiResult.Data.history_Main_Systems.Add(history_Main_System);
}
apiResult.Data.history_Builds = dbbuilding;

View File

@ -78,6 +78,7 @@ namespace FrontendWebApi.Models
public string device_item_points { get; set; }
public string device_item_unit { get; set; }
public byte device_item_is_show { get; set; }
public byte device_item_is_show_hsitory { get; set; }
public byte device_item_is_show_riserDiagram { get; set; }
public byte device_item_is_controll { get; set; }
public byte device_item_is_bool { get; set; }
@ -126,6 +127,7 @@ namespace FrontendWebApi.Models
}
public class History_Sub_system
{
public byte is_show_history { get; set; }
public string sub_system_tag { get; set; }
public string full_name { get; set; }
public string device_normal_color { get; set; }