Merge branch 'master' of https://gitea.mjm-staging.developers-homelab.net/BIMS/BIMS
This commit is contained in:
commit
ece10e2d19
18188
Backend/App_Data/BIMS_Mitsubishi_v01.ndm2
Normal file
18188
Backend/App_Data/BIMS_Mitsubishi_v01.ndm2
Normal file
File diff suppressed because it is too large
Load Diff
@ -49,25 +49,25 @@ namespace Backend.Controllers
|
||||
bm.*,
|
||||
b.full_name AS bFull_name,
|
||||
b.priority AS bPriority,
|
||||
ms.full_name AS mFull_name,
|
||||
ms.priority AS mPriority,
|
||||
ss.full_name AS sFull_name,
|
||||
ss.priority AS sPriority
|
||||
mv.system_key AS mFull_name,
|
||||
mv.system_priority AS mPriority,
|
||||
sv.system_key AS sFull_name,
|
||||
sv.system_priority AS sPriority
|
||||
FROM building_menu bm
|
||||
LEFT JOIN building b ON bm.building_guid = b.building_guid AND b.deleted = 0
|
||||
LEFT JOIN main_system ms ON bm.main_system_guid = ms.main_system_guid AND ms.deleted = 0
|
||||
LEFT JOIN sub_system ss ON bm.sub_system_guid = ss.sub_system_guid AND ss.deleted = 0";
|
||||
LEFT JOIN building b ON bm.building_tag = b.building_tag AND b.deleted = 0
|
||||
LEFT JOIN variable mv ON bm.main_system_tag = mv.system_value AND mv.deleted = 0
|
||||
LEFT JOIN variable sv ON bm.sub_system_tag = sv.system_value AND sv.deleted = 0";
|
||||
|
||||
if (!string.IsNullOrEmpty(filter))
|
||||
{
|
||||
sql += $@" WHERE (
|
||||
b.full_name LIKE CONCAT('%', @Filter, '%')
|
||||
OR ms.full_name LIKE CONCAT('%', @Filter, '%')
|
||||
OR ss.full_name LIKE CONCAT('%', @Filter, '%')
|
||||
OR mv.system_key LIKE CONCAT('%', @Filter, '%')
|
||||
OR sv.system_key LIKE CONCAT('%', @Filter, '%')
|
||||
)";
|
||||
}
|
||||
|
||||
sql += $@" ORDER BY b.priority, ms.priority, ss.priority, ss.created_at DESC";
|
||||
sql += $@" ORDER BY b.priority, mv.system_priority, sv.system_priority, sv.created_at DESC";
|
||||
|
||||
var buildingMenuRawDatas = await backendRepository.GetAllAsync<BuildingMenuRawData>(sql, new { Filter = filter });
|
||||
|
||||
@ -79,12 +79,13 @@ namespace Backend.Controllers
|
||||
f.floor_map_name,
|
||||
f.priority AS fPriority
|
||||
FROM sub_system_floor ssf
|
||||
LEFT JOIN floor f ON ssf.floor_guid = f.floor_guid AND f.deleted = 0
|
||||
LEFT JOIN floor f ON ssf.floor_tag = f.full_name AND ssf.building_tag = f.building_tag AND f.deleted = 0
|
||||
WHERE ssf.deleted = 0
|
||||
ORDER BY f.priority, f.created_at";
|
||||
ORDER BY f.priority, f.created_at
|
||||
";
|
||||
var subSystemFloorRawDatas = await backendRepository.GetAllAsync<SubSystemFloorRawData>(sub_sql);
|
||||
|
||||
var buildingMenu_Group_Building_guid = buildingMenuRawDatas.GroupBy(x => x.Building_guid).ToList();
|
||||
var buildingMenu_Group_Building_guid = buildingMenuRawDatas.GroupBy(x => x.building_tag).ToList();
|
||||
|
||||
List<BuildingCollapse> buildingCollapses = new List<BuildingCollapse>();
|
||||
foreach (var buildingMenus_Building_guid in buildingMenu_Group_Building_guid)
|
||||
@ -95,7 +96,7 @@ namespace Backend.Controllers
|
||||
buildingCollapse.Full_name = buildingMenus_Building_guid.First().bFull_name;
|
||||
buildingCollapse.Main_systems = new List<Main_system>();
|
||||
|
||||
var buildingMenus_Group_Main_system_guid = buildingMenus_Building_guid.GroupBy(x => x.Main_system_guid).ToList();
|
||||
var buildingMenus_Group_Main_system_guid = buildingMenus_Building_guid.GroupBy(x => x.main_system_tag).ToList();
|
||||
|
||||
foreach (var buildingMenus_Main_system_guid in buildingMenus_Group_Main_system_guid)
|
||||
{
|
||||
@ -104,7 +105,7 @@ namespace Backend.Controllers
|
||||
main_System.Full_name = buildingMenus_Main_system_guid.First().mFull_name;
|
||||
main_System.Sub_systems = new List<Sub_system>();
|
||||
|
||||
var buildingMenus_Group_Sub_system_guid = buildingMenus_Main_system_guid.GroupBy(x => x.Sub_system_guid).ToList();
|
||||
var buildingMenus_Group_Sub_system_guid = buildingMenus_Main_system_guid.GroupBy(x => x.sub_system_tag).ToList();
|
||||
|
||||
foreach (var buildingMenus_Sub_system_guid in buildingMenus_Group_Sub_system_guid)
|
||||
{
|
||||
@ -113,9 +114,9 @@ namespace Backend.Controllers
|
||||
sub_System.Full_name = buildingMenus_Sub_system_guid.First().sFull_name;
|
||||
sub_System.Floors = new List<Floor>();
|
||||
|
||||
var floorRawDatas = subSystemFloorRawDatas.Where(x => x.Building_guid == buildingCollapse.Building_guid
|
||||
&& x.Main_system_guid == main_System.Main_system_guid
|
||||
&& x.Sub_system_guid == sub_System.Sub_system_guid).ToList();
|
||||
var floorRawDatas = subSystemFloorRawDatas.Where(x => x.building_tag == buildingCollapse.Building_guid
|
||||
&& x.main_system_tag == main_System.Main_system_guid
|
||||
&& x.sub_system_tag == sub_System.Sub_system_guid).ToList();
|
||||
|
||||
foreach (var floorRawData in floorRawDatas)
|
||||
{
|
||||
@ -165,10 +166,10 @@ namespace Backend.Controllers
|
||||
|
||||
var sql = $@"SELECT
|
||||
d.*,
|
||||
d.full_name AS Device_full_name,
|
||||
d.device_last_name AS Device_full_name,
|
||||
b.full_name AS Building_full_name,
|
||||
ms.full_name AS Main_system_full_name,
|
||||
ss.full_name AS Sub_system_full_name,
|
||||
mv.system_key AS Main_system_full_name,
|
||||
sv.system_key AS Sub_system_full_name,
|
||||
f.full_name AS Floor_full_name,
|
||||
dk.device_image,
|
||||
CONCAT('{baseURL}', '{deviceKindFilePath}', dk.device_image) AS device_image_url,
|
||||
@ -187,23 +188,18 @@ namespace Backend.Controllers
|
||||
FROM (
|
||||
SELECT *
|
||||
FROM device d
|
||||
WHERE
|
||||
d.building_guid = @Building_guid
|
||||
AND d.main_system_guid = @Main_system_guid
|
||||
AND d.sub_system_guid = @Sub_system_guid
|
||||
AND d.floor_guid = @Floor_guid
|
||||
WHERE d.device_building_tag = @building_tag
|
||||
AND d.device_system_tag = @main_system_tag
|
||||
AND d.device_name_tag = @sub_system_tag
|
||||
AND d.device_floor_tag = @floor_tag
|
||||
AND d.deleted = 0
|
||||
) d
|
||||
JOIN building b ON d.building_guid = b.building_guid
|
||||
JOIN main_system ms ON d.main_system_guid = ms.main_system_guid
|
||||
JOIN sub_system ss ON d.sub_system_guid = ss.sub_system_guid
|
||||
JOIN floor f ON d.floor_guid = f.floor_guid
|
||||
LEFT JOIN device_kind dk ON dk.device_building_tag = d.device_building_tag
|
||||
AND dk.device_system_tag = d.device_system_tag
|
||||
-- AND dk.device_floor_tag = d.device_floor_tag
|
||||
AND dk.device_name_tag = d.device_name_tag
|
||||
ORDER BY d.priority ASC, d.device_number ASC
|
||||
";
|
||||
JOIN building b ON d.device_building_tag = b.building_tag
|
||||
JOIN variable mv ON d.device_system_tag = mv.system_value AND mv.system_type = @main_system_type
|
||||
JOIN variable sv ON d.device_name_tag = sv.system_value AND sv.system_type = @sub_system_type
|
||||
JOIN floor f ON d.device_floor_tag = f.full_name AND d.device_building_tag = f.building_tag
|
||||
LEFT JOIN device_kind dk ON dk.device_building_tag = d.device_building_tag AND dk.device_system_tag = d.device_system_tag AND dk.device_name_tag = d.device_name_tag
|
||||
ORDER BY d.priority ASC, d.device_number ASC";
|
||||
|
||||
var devices = await backendRepository.GetAllAsync<Device>(sql, post);
|
||||
|
||||
@ -963,9 +959,9 @@ namespace Backend.Controllers
|
||||
SELECT *
|
||||
FROM device d
|
||||
WHERE
|
||||
d.building_guid = @Building_guid
|
||||
AND d.main_system_guid = @Main_system_guid
|
||||
AND d.sub_system_guid = @Sub_system_guid
|
||||
d.device_building_tag = @building_tag
|
||||
AND d.device_system_tag = @main_system_tag
|
||||
AND d.device_name_tag = @sub_system_tag
|
||||
-- AND d.floor_guid = @Floor_guid
|
||||
AND d.deleted = 0
|
||||
) d
|
||||
@ -976,8 +972,7 @@ namespace Backend.Controllers
|
||||
LEFT JOIN device_kind dk ON dd.device_building_tag = dk.device_building_tag
|
||||
AND dd.device_system_tag = dk.device_system_tag
|
||||
-- AND dd.device_floor_tag = dk.device_floor_tag
|
||||
AND dd.device_name_tag = dk.device_name_tag
|
||||
";
|
||||
AND dd.device_name_tag = dk.device_name_tag";
|
||||
|
||||
var deviceKinds = await backendRepository.GetAllAsync<DeviceKind>(sql, post);
|
||||
|
||||
@ -1348,17 +1343,15 @@ namespace Backend.Controllers
|
||||
SELECT *
|
||||
FROM device d
|
||||
WHERE
|
||||
d.building_guid = @Building_guid
|
||||
AND d.main_system_guid = @Main_system_guid
|
||||
AND d.sub_system_guid = @Sub_system_guid
|
||||
AND d.floor_guid = @Floor_guid
|
||||
d.device_building_tag = @building_tag
|
||||
AND d.device_system_tag = @main_system_tag
|
||||
AND d.device_name_tag = @sub_system_tag
|
||||
AND d.device_floor_tag = @floor_tag
|
||||
AND d.deleted = 0
|
||||
) d
|
||||
GROUP BY d.device_building_tag,
|
||||
d.device_name_tag) dd
|
||||
GROUP BY d.device_building_tag, d.device_name_tag) dd
|
||||
LEFT JOIN device_master dm ON dd.device_building_tag = dm.device_building_tag
|
||||
AND dd.device_name_tag = dm.device_name_tag
|
||||
";
|
||||
AND dd.device_name_tag = dm.device_name_tag";
|
||||
|
||||
var deviceMasters = await backendRepository.GetAllAsync<DeviceMaster>(sql, post);
|
||||
|
||||
|
@ -7,13 +7,13 @@ namespace Backend.Models
|
||||
{
|
||||
public class BuildingMenuRawData
|
||||
{
|
||||
public string Building_guid { get; set; }
|
||||
public string building_tag { get; set; }
|
||||
public string bFull_name { get; set; }
|
||||
public int bPriority { get; set; }
|
||||
public string Main_system_guid { get; set; }
|
||||
public string main_system_tag { get; set; }
|
||||
public string mFull_name { get; set; }
|
||||
public int mPriority { get; set; }
|
||||
public string Sub_system_guid { get; set; }
|
||||
public string sub_system_tag { get; set; }
|
||||
public string sFull_name { get; set; }
|
||||
public int sPriority { get; set; }
|
||||
}
|
||||
@ -56,10 +56,10 @@ namespace Backend.Models
|
||||
|
||||
public class SubSystemFloorRawData
|
||||
{
|
||||
public string Sub_system_floor_guid { get; set; }
|
||||
public string Building_guid { get; set; }
|
||||
public string Main_system_guid { get; set; }
|
||||
public string Sub_system_guid { get; set; }
|
||||
public string id { get; set; }
|
||||
public string building_tag { get; set; }
|
||||
public string main_system_tag { get; set; }
|
||||
public string sub_system_tag { get; set; }
|
||||
public string Floor_guid { get; set; }
|
||||
public string fFull_name { get; set; }
|
||||
public string InitMapName { get; set; }
|
||||
|
@ -8,10 +8,10 @@ namespace Backend.Models
|
||||
{
|
||||
public class PostDeviceFilter
|
||||
{
|
||||
public string Building_guid { get; set; }
|
||||
public string Main_system_guid { get; set; }
|
||||
public string Sub_system_guid { get; set; }
|
||||
public string Floor_guid { get; set; }
|
||||
public string building_tag { get; set; }
|
||||
public string device_system_tag { get; set; }
|
||||
public string device_name_tag { get; set; }
|
||||
public string device_floor_tag { get; set; }
|
||||
}
|
||||
|
||||
public class PostDeviceInfoAdd
|
||||
|
Loading…
Reference in New Issue
Block a user