diff --git a/Backend/Controllers/SystemCategoryController.cs b/Backend/Controllers/SystemCategoryController.cs index 1c3bac6..3361f66 100644 --- a/Backend/Controllers/SystemCategoryController.cs +++ b/Backend/Controllers/SystemCategoryController.cs @@ -5,6 +5,7 @@ using Repository.BackendRepository.Interface; using System; using System.Collections.Generic; using System.Linq; +using System.Text; using System.Threading.Tasks; namespace Backend.Controllers @@ -354,6 +355,19 @@ namespace Backend.Controllers }; await backendRepository.AddOneByCustomTable(systemSubDic, "variable"); + var systemId = await backendRepository.GetOneAsync($@"select id from variable where system_value = '{post.system_value}' and deleted = 0 and system_parent_id = '{post.system_parent_id}' and system_type = '{sub_system_type}'"); + var buildings = await backendRepository.GetAllAsync($@"select building_tag from building where deleted = 0"); + var authCode = await backendRepository.GetOneAsync($@"select max(cast(SUBSTRING(authcode, 2) AS UNSIGNED)) from auth_page where authcode like 'F%'"); + var parentSystemName = await backendRepository.GetOneAsync($@"select system_key from variable where id = {post.system_parent_id}"); + StringBuilder sb = new StringBuilder(); + foreach (var b in buildings) + { + sb.Append($@" insert into auth_page(AuthCode, AuthType, MainName, SubName, building_tag, ShowView, created_at) + values ('F{++authCode}', '1', '{parentSystemName}', '{post.System_key}', '{b}', '{systemId}', Now());"); + } + + await backendRepository.ExecuteSql(sb.ToString()); + apiResult.Code = "0000"; apiResult.Msg = "新增成功"; } @@ -477,6 +491,7 @@ namespace Backend.Controllers await backendRepository.DeleteOne(id, "variable", "id"); + await backendRepository.ExecuteSql($@"delete from auth_page where AuthCode like 'F%' and AuthType = 1 and ShowView = '{id}'"); apiResult.Code = "0000"; apiResult.Msg = "刪除成功"; } diff --git a/FrontendWebApi/ApiControllers/BuildController.cs b/FrontendWebApi/ApiControllers/BuildController.cs index ddf30b2..aa5a779 100644 --- a/FrontendWebApi/ApiControllers/BuildController.cs +++ b/FrontendWebApi/ApiControllers/BuildController.cs @@ -180,8 +180,8 @@ namespace FrontendWebApi.ApiControllers v2.system_key subfull_name, v2.system_priority subpriority from building_menu me - left join variable v1 on me.main_system_tag = v1.system_value and v1.deleted = 0 and v1.system_type = 'device_system_category_layer2' - left join variable v2 on me.sub_system_tag = v2.system_value and v2.deleted = 0 and v2.system_type = 'device_system_category_layer3' + join variable v1 on me.main_system_tag = v1.system_value and v1.deleted = 0 and v1.system_type = 'device_system_category_layer2' + join variable v2 on me.sub_system_tag = v2.system_value and v2.deleted = 0 and v2.system_type = 'device_system_category_layer3' inner join ( SELECT ap.building_tag, @@ -192,7 +192,7 @@ namespace FrontendWebApi.ApiControllers FROM role_auth ra WHERE ra.role_guid = (SELECT ui.role_guid from userinfo ui where account = @Account) ) ra - left join auth_page ap on ra.AuthCode = ap.AuthCode + join auth_page ap on ra.AuthCode = ap.AuthCode where ap.AuthType = 1 ) shower on shower.building_tag = me.building_tag and shower.ShowView = v2.id join building b on b.building_tag = me.building_tag and b.deleted = 0 and shower.building_tag = b.building_tag @@ -201,7 +201,7 @@ namespace FrontendWebApi.ApiControllers var floorsql = await backendRepository.GetAllAsync(@" select * from (select * from sub_system_floor ssf where ssf.deleted = 0 and ssf.status = 0 and ssf.is_link = 1) a - left join floor on floor.full_name = a.floor_tag order by floor.priority;"); + join floor on floor.full_name = a.floor_tag order by floor.priority;"); var common = await backendRepository.GetAllAsync($@"select ap.building_tag Name,ap.ShowView Value from auth_page ap left join role_auth ra on ra.AuthCode = ap.AuthCode