From 477b8d5eaa947552397d9ec8940dc119bf0c68b2 Mon Sep 17 00:00:00 2001 From: dev02 Date: Thu, 5 Oct 2023 12:33:34 +0800 Subject: [PATCH] =?UTF-8?q?[=E5=BE=8C=E7=AB=AF]=20=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E5=B0=8F=E9=A1=9E=E6=B5=81=E7=A8=8Bauth=5Fpage,=20=E4=BF=AE?= =?UTF-8?q?=E6=94=B9getmenu=20left=20join=20=E6=94=B9=E7=88=B2join?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Backend/Controllers/SystemCategoryController.cs | 15 +++++++++++++++ FrontendWebApi/ApiControllers/BuildController.cs | 8 ++++---- 2 files changed, 19 insertions(+), 4 deletions(-) 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