get บรรจุ ตามตำแหน่ง
This commit is contained in:
parent
85bc0fd359
commit
c9e36b1792
6 changed files with 10505 additions and 18 deletions
10389
BMA.EHR.Infrastructure/Migrations/20230706073204_Update table profile add keycloakId.Designer.cs
generated
Normal file
10389
BMA.EHR.Infrastructure/Migrations/20230706073204_Update table profile add keycloakId.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,30 @@
|
|||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace BMA.EHR.Infrastructure.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class UpdatetableprofileaddkeycloakId : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "KeycloakId",
|
||||
table: "Profiles",
|
||||
type: "char(36)",
|
||||
nullable: true,
|
||||
collation: "ascii_general_ci");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "KeycloakId",
|
||||
table: "Profiles");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -425,6 +425,9 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
b.Property<bool>("IsVerified")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<Guid?>("KeycloakId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<string>("LastName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
|
|
|
|||
|
|
@ -210,5 +210,33 @@ namespace BMA.EHR.Application.Repositories
|
|||
}
|
||||
|
||||
#endregion
|
||||
public List<Guid> GetAllIdByRoot(Guid? id)
|
||||
{
|
||||
try
|
||||
{
|
||||
var ret = new List<Guid>();
|
||||
if(id == null)
|
||||
return ret;
|
||||
|
||||
var oc = _context.Organizations.FirstOrDefault(x => x.Id == id);
|
||||
if (oc != null)
|
||||
ret.Add(oc.Id);
|
||||
|
||||
var child = _context.Organizations.AsQueryable().Where(x => x.Parent != null && x.Parent.Id == id).ToList();
|
||||
if (child.Any())
|
||||
{
|
||||
foreach (var item in child)
|
||||
{
|
||||
ret.AddRange(GetAllIdByRoot(item.Id));
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue