全面修改Id为Guid类型,为2.0版做准备

This commit is contained in:
yubaolee
2016-09-02 18:05:17 +08:00
parent a8fd59e247
commit 574f5f9e1f
327 changed files with 10071 additions and 18206 deletions

View File

@@ -28,7 +28,7 @@ namespace OpenAuth.App
/// </summary>
/// <param name="orgId">The org unique identifier.</param>
/// <returns>IEnumerable{Org}.</returns>
public IList<Org> LoadDirectChildren(int orgId)
public IList<Org> LoadDirectChildren(Guid orgId)
{
return _repository.Find(u => u.ParentId == orgId).ToList();
}
@@ -37,7 +37,7 @@ namespace OpenAuth.App
/// 得到部门的所有子部门
/// <para>如果orgId为0表示取得所有部门</para>
/// </summary>
public IList<Org> LoadAllChildren(int orgId)
public IList<Org> LoadAllChildren(Guid orgId)
{
return _repository.GetSubOrgs(orgId).ToList();
}
@@ -48,10 +48,10 @@ namespace OpenAuth.App
/// <param name="org">The org.</param>
/// <returns>System.Int32.</returns>
/// <exception cref="System.Exception">未能找到该组织的父节点信息</exception>
public int AddOrUpdate(Org org)
public Guid AddOrUpdate(Org org)
{
ChangeModuleCascade(org);
if (org.Id == 0)
if (org.Id == Guid.Empty)
{
_repository.Add(org);
}
@@ -66,7 +66,7 @@ namespace OpenAuth.App
/// <summary>
/// 删除指定ID的部门及其所有子部门
/// </summary>
public void DelOrg(int id)
public void DelOrg(Guid id)
{
var delOrg = _repository.FindSingle(u => u.Id == id);
if (delOrg == null) return;
@@ -80,7 +80,7 @@ namespace OpenAuth.App
/// TODO:这里会加载用户及用户角色的所有角色,“为用户分配角色”功能会给人一种混乱的感觉,但可以接受
/// </summary>
/// <param name="userId">The user unique identifier.</param>
public List<Org> LoadForUser(int userId)
public List<Org> LoadForUser(Guid userId)
{
//用户角色
var userRoleIds =
@@ -101,7 +101,7 @@ namespace OpenAuth.App
/// 加载特定角色的角色
/// </summary>
/// <param name="roleId">The role unique identifier.</param>
public List<Org> LoadForRole(int roleId)
public List<Org> LoadForRole(Guid roleId)
{
var moduleIds =
_relevanceRepository.Find(u => u.FirstId == roleId && u.Key == "RoleAccessedOrg")
@@ -125,7 +125,7 @@ namespace OpenAuth.App
if (currentCascadeId <= objCascadeId) currentCascadeId = objCascadeId + 1;
}
if (org.ParentId != 0)
if (org.ParentId != Guid.Empty)
{
var parentOrg = _repository.FindSingle(o => o.Id == org.ParentId);
if (parentOrg != null)