[後端] 修改更新使用者設備api

This commit is contained in:
dev02 2023-10-17 11:17:21 +08:00
parent 7c86b10f66
commit 7e5a8a7426
2 changed files with 41 additions and 13 deletions

View File

@ -596,26 +596,53 @@ namespace FrontendWebApi.ApiControllers
}
else
{
await backendRepository.ExecuteSql($"delete from role_auth where role_guid = '{post.SelectedRoleId}' and AuthCode like '%PF%'");
if (post.SaveCheckAuth.Count > 0)
if (post.Type.Equals("1"))
{
foreach (var item in post.SaveCheckAuth)
await backendRepository.ExecuteSql($"delete from role_auth where role_guid = '{post.SelectedRoleId}' and AuthCode like '%PF%'");
if (post.SaveCheckAuth.Count > 0)
{
#region
foreach (var item in post.SaveCheckAuth)
{
Dictionary<string, object> roleAuth = new Dictionary<string, object>();
roleAuth = new Dictionary<string, object>()
{
{ "@role_guid", post.SelectedRoleId},
{ "@AuthCode", item},
{ "@created_by", myUser.userinfo_guid}
};
#region
{
Dictionary<string, object> roleAuth = new Dictionary<string, object>();
roleAuth = new Dictionary<string, object>()
{
{ "@role_guid", post.SelectedRoleId},
{ "@AuthCode", item},
{ "@created_by", myUser.userinfo_guid}
};
await backendRepository.AddOneByCustomTable(roleAuth, "role_auth");
await backendRepository.AddOneByCustomTable(roleAuth, "role_auth");
}
#endregion
}
#endregion
}
}
else if (post.Type.Equals("2"))
{
await backendRepository.ExecuteSql($"delete from role_auth where role_guid = '{post.SelectedRoleId}' and AuthCode like 'F%'");
if (post.SaveCheckAuth.Count > 0)
{
foreach (var item in post.SaveCheckAuth)
{
#region
{
Dictionary<string, object> roleAuth = new Dictionary<string, object>();
roleAuth = new Dictionary<string, object>()
{
{ "@role_guid", post.SelectedRoleId},
{ "@AuthCode", item},
{ "@created_by", myUser.userinfo_guid}
};
await backendRepository.AddOneByCustomTable(roleAuth, "role_auth");
}
#endregion
}
}
}
apiResult.Code = "0000";
apiResult.Msg = "儲存成功";
}

View File

@ -147,6 +147,7 @@ namespace FrontendWebApi.Models
{
public string SelectedRoleId { get; set; }
public List<string> SaveCheckAuth { get; set; }
public string Type { get; set; }
//public FrontEndCheckAuth BackEndCheckAuth { get; set; }
}