[後端] 新增小類流程auth_page, 修改getmenu left join 改爲join
This commit is contained in:
parent
3b19c94246
commit
477b8d5eaa
@ -5,6 +5,7 @@ using Repository.BackendRepository.Interface;
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Backend.Controllers
|
namespace Backend.Controllers
|
||||||
@ -354,6 +355,19 @@ namespace Backend.Controllers
|
|||||||
};
|
};
|
||||||
await backendRepository.AddOneByCustomTable(systemSubDic, "variable");
|
await backendRepository.AddOneByCustomTable(systemSubDic, "variable");
|
||||||
|
|
||||||
|
var systemId = await backendRepository.GetOneAsync<int>($@"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<string>($@"select building_tag from building where deleted = 0");
|
||||||
|
var authCode = await backendRepository.GetOneAsync<int>($@"select max(cast(SUBSTRING(authcode, 2) AS UNSIGNED)) from auth_page where authcode like 'F%'");
|
||||||
|
var parentSystemName = await backendRepository.GetOneAsync<string>($@"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.Code = "0000";
|
||||||
apiResult.Msg = "新增成功";
|
apiResult.Msg = "新增成功";
|
||||||
}
|
}
|
||||||
@ -477,6 +491,7 @@ namespace Backend.Controllers
|
|||||||
|
|
||||||
await backendRepository.DeleteOne(id, "variable", "id");
|
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.Code = "0000";
|
||||||
apiResult.Msg = "刪除成功";
|
apiResult.Msg = "刪除成功";
|
||||||
}
|
}
|
||||||
|
@ -180,8 +180,8 @@ namespace FrontendWebApi.ApiControllers
|
|||||||
v2.system_key subfull_name,
|
v2.system_key subfull_name,
|
||||||
v2.system_priority subpriority
|
v2.system_priority subpriority
|
||||||
from building_menu me
|
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'
|
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 v2 on me.sub_system_tag = v2.system_value and v2.deleted = 0 and v2.system_type = 'device_system_category_layer3'
|
||||||
inner join (
|
inner join (
|
||||||
SELECT
|
SELECT
|
||||||
ap.building_tag,
|
ap.building_tag,
|
||||||
@ -192,7 +192,7 @@ namespace FrontendWebApi.ApiControllers
|
|||||||
FROM role_auth ra
|
FROM role_auth ra
|
||||||
WHERE ra.role_guid = (SELECT ui.role_guid from userinfo ui where account = @Account)
|
WHERE ra.role_guid = (SELECT ui.role_guid from userinfo ui where account = @Account)
|
||||||
) ra
|
) ra
|
||||||
left join auth_page ap on ra.AuthCode = ap.AuthCode
|
join auth_page ap on ra.AuthCode = ap.AuthCode
|
||||||
where ap.AuthType = 1
|
where ap.AuthType = 1
|
||||||
) shower on shower.building_tag = me.building_tag and shower.ShowView = v2.id
|
) 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
|
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<Floorsql>(@"
|
var floorsql = await backendRepository.GetAllAsync<Floorsql>(@"
|
||||||
select * from (select * from sub_system_floor ssf where ssf.deleted = 0 and ssf.status = 0 and ssf.is_link = 1) a
|
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<KeyValue>($@"select ap.building_tag Name,ap.ShowView Value from auth_page ap
|
var common = await backendRepository.GetAllAsync<KeyValue>($@"select ap.building_tag Name,ap.ShowView Value from auth_page ap
|
||||||
left join role_auth ra on ra.AuthCode = ap.AuthCode
|
left join role_auth ra on ra.AuthCode = ap.AuthCode
|
||||||
|
Loading…
Reference in New Issue
Block a user