fix issue #I80UEX 完善人员可以选择直接上级和部门负责人

This commit is contained in:
wintel 2023-12-23 15:42:50 +08:00
parent c4b1f2d3c6
commit 51155a7790
11 changed files with 398 additions and 394 deletions

View File

@ -59,7 +59,7 @@ namespace OpenAuth.App
get { return _strategy.Resources; }
}
public List<SysOrg> Orgs
public List<OrgView> Orgs
{
get { return _strategy.Orgs; }
}

View File

@ -23,13 +23,14 @@ using OpenAuth.App.Response;
using OpenAuth.Repository;
using OpenAuth.Repository.Domain;
using OpenAuth.Repository.Interface;
using SqlSugar;
namespace OpenAuth.App
{
/// <summary>
/// 普通用户授权策略
/// </summary>
public class NormalAuthStrategy :BaseStringApp<User,OpenAuthDBContext>, IAuthStrategy
public class NormalAuthStrategy : SqlSugarBaseApp<User>, IAuthStrategy
{
protected User _user;
@ -40,34 +41,12 @@ namespace OpenAuth.App
public List<ModuleView> Modules
{
get {
var moduleIds = UnitWork.Find<Relevance>(
var moduleIds = SugarClient.Queryable<Relevance>().Where(
u =>
(u.Key == Define.ROLEMODULE && _userRoleIds.Contains(u.FirstId))).Select(u => u.SecondId);
var modules = (from module in UnitWork.Find<Module>(u =>moduleIds.Contains(u.Id))
select new ModuleView
{
SortNo = module.SortNo,
Name = module.Name,
Code = module.Code,
CascadeId = module.CascadeId,
Id = module.Id,
IconName = module.IconName,
Url = module.Url,
ParentId = module.ParentId,
ParentName = module.ParentName,
IsSys = module.IsSys,
Status = module.Status
}).ToList();
var usermoduleelements = ModuleElements;
foreach (var module in modules)
{
module.Elements =usermoduleelements.Where(u => u.ModuleId == module.Id).ToList();
}
return modules;
(u.Key == Define.ROLEMODULE && _userRoleIds.Contains(u.FirstId))).Select(u => u.SecondId).ToList();
return SugarClient.Queryable<ModuleView>().Where(m =>moduleIds.Contains(m.Id)).Includes(x=>x.Elements).ToList();
}
}
@ -75,37 +54,43 @@ namespace OpenAuth.App
{
get
{
var elementIds = UnitWork.Find<Relevance>(
var elementIds = SugarClient.Queryable<Relevance>().Where(
u =>
(u.Key == Define.ROLEELEMENT && _userRoleIds.Contains(u.FirstId))).Select(u => u.SecondId);
var usermoduleelements = UnitWork.Find<ModuleElement>(u => elementIds.Contains(u.Id));
(u.Key == Define.ROLEELEMENT && _userRoleIds.Contains(u.FirstId))).Select(u => u.SecondId).ToList();
var usermoduleelements = SugarClient.Queryable<ModuleElement>().Where(u => elementIds.Contains(u.Id));
return usermoduleelements.ToList();
}
}
public List<Role> Roles
{
get { return UnitWork.Find<Role>(u => _userRoleIds.Contains(u.Id)).ToList(); }
get { return SugarClient.Queryable<Role>().Where(u => _userRoleIds.Contains(u.Id)).ToList(); }
}
public List<Resource> Resources
{
get
{
var resourceIds = UnitWork.Find<Relevance>(
var resourceIds = SugarClient.Queryable<Relevance>().Where(
u =>
(u.Key == Define.ROLERESOURCE && _userRoleIds.Contains(u.FirstId))).Select(u => u.SecondId);
return UnitWork.Find<Resource>(u => resourceIds.Contains(u.Id)).ToList();
(u.Key == Define.ROLERESOURCE && _userRoleIds.Contains(u.FirstId))).Select(u => u.SecondId).ToList();
return SugarClient.Queryable<Resource>().Where(u => resourceIds.Contains(u.Id)).ToList();
}
}
public List<SysOrg> Orgs
public List<OrgView> Orgs
{
get
{
var orgids = UnitWork.Find<Relevance>(
u =>u.FirstId == _user.Id && u.Key == Define.USERORG).Select(u => u.SecondId);
return UnitWork.Find<SysOrg>(u => orgids.Contains(u.Id)).ToList();
var orgids = SugarClient.Queryable<Relevance>().Where(
u =>u.FirstId == _user.Id && u.Key == Define.USERORG).Select(u => u.SecondId).ToList();
return SugarClient.Queryable<SysOrg>().Where(org =>orgids.Contains(org.Id))
.LeftJoin<User>((org, user) => org.ChairmanId ==user.Id)
.Select((org,user)=>new OrgView
{
Id = org.Id.SelectAll(),
ChairmanName = user.Name
}).ToList();
}
}
@ -115,16 +100,18 @@ namespace OpenAuth.App
set
{
_user = value;
_userRoleIds = UnitWork.Find<Relevance>(u => u.FirstId == _user.Id && u.Key == Define.USERROLE).Select(u => u.SecondId).ToList();
_userRoleIds = SugarClient.Queryable<Relevance>().Where(u => u.FirstId == _user.Id && u.Key == Define.USERROLE)
.Select(u => u.SecondId).ToList();
}
}
public List<BuilderTableColumn> GetTableColumns(string moduleCode)
{
var allprops = UnitWork.Find<BuilderTableColumn>(u => u.TableName.ToLower() == moduleCode.ToLower());
var allprops = SugarClient.Queryable<BuilderTableColumn>()
.Where(u => u.TableName.ToLower() == moduleCode.ToLower());
//如果是子表,直接返回所有字段
var builderTable = UnitWork.FirstOrDefault<BuilderTable>(u => u.TableName.ToLower() == moduleCode.ToLower());
var builderTable = SugarClient.Queryable<BuilderTable>().First(u => u.TableName.ToLower() == moduleCode.ToLower());
if (builderTable == null)
{
throw new Exception($"代码生成器中找不到{moduleCode.ToLower()}的定义");
@ -136,15 +123,15 @@ namespace OpenAuth.App
}
//如果是系统模块直接返回所有字段。防止开发者把模块配置成系统模块还在外层调用loginContext.GetProperties("xxxx");
bool? isSysModule = UnitWork.FirstOrDefault<Module>(u => u.Code == moduleCode)?.IsSys;
bool? isSysModule = SugarClient.Queryable<Module>().First(u => u.Code == moduleCode)?.IsSys;
if (isSysModule!= null && isSysModule.Value)
{
return allprops.ToList();
}
var props =UnitWork.Find<Relevance>(u =>
var props =SugarClient.Queryable<Relevance>().Where(u =>
u.Key == Define.ROLEDATAPROPERTY && _userRoleIds.Contains(u.FirstId) && u.SecondId == moduleCode)
.Select(u => u.ThirdId);
.Select(u => u.ThirdId).ToList();
return allprops.Where(u => props.Contains(u.ColumnName)).ToList();
}
@ -154,22 +141,22 @@ namespace OpenAuth.App
var allprops = _dbExtension.GetTableColumnsFromDb(moduleCode);
//如果是系统模块直接返回所有字段。防止开发者把模块配置成系统模块还在外层调用loginContext.GetProperties("xxxx");
bool? isSysModule = UnitWork.FirstOrDefault<Module>(u => u.Code == moduleCode)?.IsSys;
bool? isSysModule = SugarClient.Queryable<Module>().First(u => u.Code == moduleCode)?.IsSys;
if (isSysModule!= null && isSysModule.Value)
{
return allprops.ToList();
}
var props =UnitWork.Find<Relevance>(u =>
var props =SugarClient.Queryable<Relevance>().Where(u =>
u.Key == Define.ROLEDATAPROPERTY && _userRoleIds.Contains(u.FirstId) && u.SecondId == moduleCode)
.Select(u => u.ThirdId);
.Select(u => u.ThirdId).ToList();
return allprops.Where(u => props.Contains(u.ColumnName)).ToList();
}
//用户角色
public NormalAuthStrategy(IUnitWork<OpenAuthDBContext> unitWork, IRepository<User,OpenAuthDBContext> repository, DbExtension dbExtension) : base(unitWork, repository,null)
public NormalAuthStrategy(ISqlSugarClient client,DbExtension dbExtension) : base(client, null)
{
_dbExtension = dbExtension;
}

View File

@ -22,6 +22,7 @@ using OpenAuth.App.Response;
using OpenAuth.Repository;
using OpenAuth.Repository.Domain;
using OpenAuth.Repository.Interface;
using SqlSugar;
namespace OpenAuth.App
{
@ -30,57 +31,43 @@ namespace OpenAuth.App
/// <para>超级管理员权限</para>
/// <para>超级管理员使用guid.empty为ID可以根据需要修改</para>
/// </summary>
public class SystemAuthStrategy : BaseStringApp<User,OpenAuthDBContext>, IAuthStrategy
public class SystemAuthStrategy : SqlSugarBaseApp<User>, IAuthStrategy
{
protected User _user;
private DbExtension _dbExtension;
public List<ModuleView> Modules
{
get {
var modules = (from module in UnitWork.Find<Module>(null)
select new ModuleView
{
SortNo = module.SortNo,
Name = module.Name,
Id = module.Id,
CascadeId = module.CascadeId,
Code = module.Code,
IconName = module.IconName,
Url = module.Url,
ParentId = module.ParentId,
ParentName = module.ParentName,
IsSys = module.IsSys,
Status = module.Status
}).ToList();
foreach (var module in modules)
{
module.Elements = UnitWork.Find<ModuleElement>(u => u.ModuleId == module.Id).ToList();
}
return modules;
get
{
return SugarClient.Queryable<ModuleView>().Includes(x=>x.Elements).ToList();
}
}
public List<Role> Roles
{
get { return UnitWork.Find<Role>(null).ToList(); }
get { return SugarClient.Queryable<Role>().ToList(); }
}
public List<ModuleElement> ModuleElements
{
get { return UnitWork.Find<ModuleElement>(null).ToList(); }
get { return SugarClient.Queryable<ModuleElement>().ToList(); }
}
public List<Resource> Resources
{
get { return UnitWork.Find<Resource>(null).ToList(); }
get { return SugarClient.Queryable<Resource>().ToList(); }
}
public List<SysOrg> Orgs
public List<OrgView> Orgs
{
get { return UnitWork.Find<SysOrg>(null).ToList(); }
get { return SugarClient.Queryable<SysOrg>()
.LeftJoin<User>((org, user) => org.ChairmanId ==user.Id)
.Select((org,user)=>new OrgView
{
Id = org.Id.SelectAll(),
ChairmanName = user.Name
}).ToList(); }
}
public User User
@ -95,7 +82,7 @@ namespace OpenAuth.App
public List<BuilderTableColumn> GetTableColumns(string moduleCode)
{
return UnitWork.Find<BuilderTableColumn>(u => u.TableName.ToLower() == moduleCode.ToLower()).ToList();
return SugarClient.Queryable<BuilderTableColumn>().Where(u => u.TableName.ToLower() == moduleCode.ToLower()).ToList();
}
public List<BuilderTableColumn> GetTableColumnsFromDb(string moduleCode)
@ -104,7 +91,7 @@ namespace OpenAuth.App
}
public SystemAuthStrategy(IUnitWork<OpenAuthDBContext> unitWork, IRepository<User,OpenAuthDBContext> repository, DbExtension dbExtension) : base(unitWork, repository, null)
public SystemAuthStrategy(ISqlSugarClient client,DbExtension dbExtension) : base(client, null)
{
_dbExtension = dbExtension;
_user = new User

View File

@ -33,7 +33,7 @@ namespace OpenAuth.App
List<Resource> Resources { get; }
List<SysOrg> Orgs { get; }
List<OrgView> Orgs { get; }
User User
{

View File

@ -1,9 +1,11 @@
using System.Collections.Generic;
using Infrastructure;
using OpenAuth.Repository.Domain;
using SqlSugar;
namespace OpenAuth.App.Response
{
[SugarTable("Module")]
public class ModuleView
{
/// <summary>
@ -52,10 +54,7 @@ namespace OpenAuth.App.Response
/// 当前状态0正常-1隐藏不在导航列表中显示
/// </summary>
public int Status { get; set; }
public bool Checked { get; set; }
/// <summary>
/// 排序号
/// </summary>
@ -68,6 +67,7 @@ namespace OpenAuth.App.Response
/// <summary>
/// 模块中的元素
/// </summary>
[Navigate(NavigateType.OneToMany, nameof(ModuleElement.ModuleId),nameof(Id))]
public List<ModuleElement> Elements { get; set; }
public static implicit operator ModuleView(Module module)

View File

@ -0,0 +1,13 @@
using System.ComponentModel;
using OpenAuth.Repository.Domain;
namespace OpenAuth.App.Response;
public class OrgView: SysOrg
{
/// <summary>
/// 负责人
/// </summary>
[Description("负责人")]
public string ChairmanName { get; set; }
}

View File

@ -50,7 +50,10 @@ namespace OpenAuth.App.Response
/// </summary>
public string ParentId { get; set; }
/// <summary>
/// 直接上级
/// </summary>
public string ParentName { get; set; }
/// <summary>
/// 创建时间

View File

@ -40,7 +40,10 @@ namespace OpenAuth.App
{
query = UnitWork.Find<User>(u => u.Name.Contains(request.key) || u.Account.Contains(request.key));
}
var userOrgs = from user in query
var userOrgs = from user in query
join user2 in UnitWork.Find<User>(null)
on user.ParentId equals user2.Id into tempuser
from u in tempuser.DefaultIfEmpty()
join relevance in UnitWork.Find<Relevance>(u => u.Key == "UserOrg")
on user.Id equals relevance.FirstId into temp
from r in temp.DefaultIfEmpty()
@ -60,6 +63,7 @@ namespace OpenAuth.App
user.TypeId,
user.TypeName,
user.ParentId,
ParentName = u.Name, //直属上级
r.Key,
r.SecondId,
OrgId = o.Id,
@ -86,6 +90,7 @@ namespace OpenAuth.App
Id = u.First().Id,
Account = u.Key,
Name = u.First().Name,
ParentName = u.First().ParentName,
Sex = u.First().Sex,
Status = u.First().Status,
ParentId = u.First().ParentId,
@ -114,6 +119,9 @@ namespace OpenAuth.App
query = UnitWork.Find<User>(u => u.Name.Contains(request.key) || u.Account.Contains(request.key));
}
var userOrgs = from user in query
join user2 in UnitWork.Find<User>(null)
on user.ParentId equals user2.Id into tempuser
from u in tempuser.DefaultIfEmpty()
join relevance in UnitWork.Find<Relevance>(u => u.Key == "UserOrg")
on user.Id equals relevance.FirstId into temp
from r in temp.DefaultIfEmpty()
@ -132,6 +140,8 @@ namespace OpenAuth.App
user.CreateTime,
user.TypeId,
user.TypeName,
user.ParentId,
ParentName = u.Name, //直属上级
r.Key,
r.SecondId,
OrgId = o.Id,
@ -151,6 +161,8 @@ namespace OpenAuth.App
Status = u.First().Status,
CreateTime = u.First().CreateTime,
CreateUser = u.First().CreateId,
ParentName = u.First().ParentName,
ParentId = u.First().ParentId,
OrganizationIds = string.Join(",", u.Select(x=>x.OrgId))
,Organizations = string.Join(",", u.Select(x=>x.OrgName))
});

View File

@ -1,196 +1,196 @@
// ***********************************************************************
// Assembly : OpenAuth.Mvc
// Author : 李玉宝
// Created : 06-08-2018
//
// Last Modified By : 李玉宝
// Last Modified On : 07-04-2018
// ***********************************************************************
// <copyright file="UserSessionController.cs" company="OpenAuth.Mvc">
// Copyright (c) http://www.openauth.net.cn. All rights reserved.
// </copyright>
// <summary>
// 获取登录用户的全部信息
// 所有和当前登录用户相关的操作都在这里
// </summary>
// ***********************************************************************
using System;
using System.Collections.Generic;
using System.Linq;
using Infrastructure;
using Infrastructure.Helpers;
using Microsoft.EntityFrameworkCore.Metadata.Internal;
using OpenAuth.App;
using OpenAuth.App.Interface;
using OpenAuth.App.Response;
using OpenAuth.Repository.Domain;
namespace OpenAuth.Mvc.Controllers
{
public class UserSessionController : BaseController
{
private readonly AuthStrategyContext _authStrategyContext;
public UserSessionController(IAuth authUtil) : base(authUtil)
{
_authStrategyContext = _authUtil.GetCurrentUser();
}
/// <summary>
/// 获取用户资料
/// </summary>
/// <returns></returns>
public string GetUserProfile()
{
var resp = new Response<UserView>();
try
{
resp.Result = _authStrategyContext.User.MapTo<UserView>();
}
catch (Exception e)
{
resp.Code = 500;
resp.Message = e.Message;
}
return JsonHelper.Instance.Serialize(resp);
}
public string GetUserName()
{
return _authUtil.GetUserName();
}
/// <summary>
/// 获取登录用户可访问的所有模块,及模块的操作菜单
/// </summary>
public string GetModulesTree()
{
var moduleTree = _authStrategyContext.Modules.GenerateTree(u => u.Id, u => u.ParentId);
return JsonHelper.Instance.Serialize(moduleTree);
}
/// <summary>
/// datatable结构的模块列表
/// </summary>
/// <param name="pId"></param>
/// <returns></returns>
public string GetModulesTable(string pId)
{
string cascadeId = ".0.";
if (!string.IsNullOrEmpty(pId))
{
var obj = _authStrategyContext.Modules.SingleOrDefault(u => u.Id == pId);
if (obj == null)
throw new Exception("未能找到指定对象信息");
cascadeId = obj.CascadeId;
}
var query = _authStrategyContext.Modules.Where(u => u.CascadeId.Contains(cascadeId));
return JsonHelper.Instance.Serialize(new TableData
{
data = query.ToList(),
count = query.Count(),
});
}
/// <summary>
/// 获取用户可访问的模块列表
/// </summary>
public string GetModules()
{
var resp = new Response<List<ModuleView>>();
try
{
resp.Result = _authStrategyContext.Modules;
}
catch (Exception e)
{
resp.Code = 500;
resp.Message = e.Message;
}
return JsonHelper.Instance.Serialize(resp);
}
/// <summary>
/// 获取登录用户可访问的所有部门
/// <para>用于树状结构</para>
/// </summary>
public string GetOrgs()
{
var resp = new Response<List<SysOrg>>();
try
{
resp.Result = _authStrategyContext.Orgs;
}
catch (Exception e)
{
resp.Code = 500;
resp.Message = e.Message;
}
return JsonHelper.Instance.Serialize(resp);
}
/// <summary>
/// 获取当前登录用户可访问的字段
/// </summary>
/// <param name="moduleCode">模块的Code如Category</param>
/// <returns></returns>
public string GetProperties(string moduleCode)
{
try
{
if (string.IsNullOrEmpty(moduleCode))
{
throw new Exception("模块标识为空,不能分配可见字段");
}
var list = _authStrategyContext.GetTableColumns(moduleCode);
return JsonHelper.Instance.Serialize(new TableData
{
data = list,
count = list.Count(),
});
}
catch (Exception ex)
{
return JsonHelper.Instance.Serialize(new TableData
{
msg =ex.Message,
code = 500,
});
}
}
/// <summary>
/// 加载机构的全部下级机构
/// </summary>
/// <param name="orgId">机构ID</param>
/// <returns></returns>
public string GetSubOrgs(string orgId)
{
string cascadeId = ".0.";
if (!string.IsNullOrEmpty(orgId))
{
var org = _authStrategyContext.Orgs.SingleOrDefault(u => u.Id == orgId);
if (org == null)
{
return JsonHelper.Instance.Serialize(new TableData
{
msg ="未找到指定的节点",
code = 500,
});
}
cascadeId = org.CascadeId;
}
var query = _authStrategyContext.Orgs.Where(u => u.CascadeId.Contains(cascadeId));
return JsonHelper.Instance.Serialize(new TableData
{
data = query.ToList(),
count = query.Count(),
});
}
}
// ***********************************************************************
// Assembly : OpenAuth.Mvc
// Author : 李玉宝
// Created : 06-08-2018
//
// Last Modified By : 李玉宝
// Last Modified On : 07-04-2018
// ***********************************************************************
// <copyright file="UserSessionController.cs" company="OpenAuth.Mvc">
// Copyright (c) http://www.openauth.net.cn. All rights reserved.
// </copyright>
// <summary>
// 获取登录用户的全部信息
// 所有和当前登录用户相关的操作都在这里
// </summary>
// ***********************************************************************
using System;
using System.Collections.Generic;
using System.Linq;
using Infrastructure;
using Infrastructure.Helpers;
using Microsoft.EntityFrameworkCore.Metadata.Internal;
using OpenAuth.App;
using OpenAuth.App.Interface;
using OpenAuth.App.Response;
using OpenAuth.Repository.Domain;
namespace OpenAuth.Mvc.Controllers
{
public class UserSessionController : BaseController
{
private readonly AuthStrategyContext _authStrategyContext;
public UserSessionController(IAuth authUtil) : base(authUtil)
{
_authStrategyContext = _authUtil.GetCurrentUser();
}
/// <summary>
/// 获取用户资料
/// </summary>
/// <returns></returns>
public string GetUserProfile()
{
var resp = new Response<UserView>();
try
{
resp.Result = _authStrategyContext.User.MapTo<UserView>();
}
catch (Exception e)
{
resp.Code = 500;
resp.Message = e.Message;
}
return JsonHelper.Instance.Serialize(resp);
}
public string GetUserName()
{
return _authUtil.GetUserName();
}
/// <summary>
/// 获取登录用户可访问的所有模块,及模块的操作菜单
/// </summary>
public string GetModulesTree()
{
var moduleTree = _authStrategyContext.Modules.GenerateTree(u => u.Id, u => u.ParentId);
return JsonHelper.Instance.Serialize(moduleTree);
}
/// <summary>
/// datatable结构的模块列表
/// </summary>
/// <param name="pId"></param>
/// <returns></returns>
public string GetModulesTable(string pId)
{
string cascadeId = ".0.";
if (!string.IsNullOrEmpty(pId))
{
var obj = _authStrategyContext.Modules.SingleOrDefault(u => u.Id == pId);
if (obj == null)
throw new Exception("未能找到指定对象信息");
cascadeId = obj.CascadeId;
}
var query = _authStrategyContext.Modules.Where(u => u.CascadeId.Contains(cascadeId));
return JsonHelper.Instance.Serialize(new TableData
{
data = query.ToList(),
count = query.Count(),
});
}
/// <summary>
/// 获取用户可访问的模块列表
/// </summary>
public string GetModules()
{
var resp = new Response<List<ModuleView>>();
try
{
resp.Result = _authStrategyContext.Modules;
}
catch (Exception e)
{
resp.Code = 500;
resp.Message = e.Message;
}
return JsonHelper.Instance.Serialize(resp);
}
/// <summary>
/// 获取登录用户可访问的所有部门
/// <para>用于树状结构</para>
/// </summary>
public string GetOrgs()
{
var resp = new Response<List<OrgView>>();
try
{
resp.Result = _authStrategyContext.Orgs;
}
catch (Exception e)
{
resp.Code = 500;
resp.Message = e.Message;
}
return JsonHelper.Instance.Serialize(resp);
}
/// <summary>
/// 获取当前登录用户可访问的字段
/// </summary>
/// <param name="moduleCode">模块的Code如Category</param>
/// <returns></returns>
public string GetProperties(string moduleCode)
{
try
{
if (string.IsNullOrEmpty(moduleCode))
{
throw new Exception("模块标识为空,不能分配可见字段");
}
var list = _authStrategyContext.GetTableColumns(moduleCode);
return JsonHelper.Instance.Serialize(new TableData
{
data = list,
count = list.Count(),
});
}
catch (Exception ex)
{
return JsonHelper.Instance.Serialize(new TableData
{
msg =ex.Message,
code = 500,
});
}
}
/// <summary>
/// 加载机构的全部下级机构
/// </summary>
/// <param name="orgId">机构ID</param>
/// <returns></returns>
public string GetSubOrgs(string orgId)
{
string cascadeId = ".0.";
if (!string.IsNullOrEmpty(orgId))
{
var org = _authStrategyContext.Orgs.SingleOrDefault(u => u.Id == orgId);
if (org == null)
{
return JsonHelper.Instance.Serialize(new TableData
{
msg ="未找到指定的节点",
code = 500,
});
}
cascadeId = org.CascadeId;
}
var query = _authStrategyContext.Orgs.Where(u => u.CascadeId.Contains(cascadeId));
return JsonHelper.Instance.Serialize(new TableData
{
data = query.ToList(),
count = query.Count(),
});
}
}
}

View File

@ -1,110 +1,112 @@
//------------------------------------------------------------------------------
// <autogenerated>
// This code was generated by a CodeSmith Template.
//
// DO NOT MODIFY contents of this file. Changes to this
// file will be lost if the code is regenerated.
// Author:Yubao Li
// </autogenerated>
//------------------------------------------------------------------------------
using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations.Schema;
using OpenAuth.Repository.Core;
namespace OpenAuth.Repository.Domain
{
/// <summary>
/// 组织表
/// </summary>
[Table("Org")]
public partial class SysOrg : TreeEntity
{
public SysOrg()
{
this.CascadeId= string.Empty;
this.Name= string.Empty;
this.HotKey= string.Empty;
this.ParentName= string.Empty;
this.IconName= string.Empty;
this.Status= 0;
this.BizCode= string.Empty;
this.CustomCode= string.Empty;
this.CreateTime= DateTime.Now;
this.CreateId= 0;
this.SortNo= 0;
this.ParentId= null;
this.TypeName= string.Empty;
this.TypeId= string.Empty;
}
/// <summary>
/// 热键
/// </summary>
[Description("热键")]
public string HotKey { get; set; }
/// <summary>
/// 是否叶子节点
/// </summary>
[Description("是否叶子节点")]
public bool IsLeaf { get; set; }
/// <summary>
/// 是否自动展开
/// </summary>
[Description("是否自动展开")]
public bool IsAutoExpand { get; set; }
/// <summary>
/// 节点图标文件名称
/// </summary>
[Description("节点图标文件名称")]
public string IconName { get; set; }
/// <summary>
/// 当前状态
/// </summary>
[Description("当前状态")]
public int Status { get; set; }
/// <summary>
/// 业务对照码
/// </summary>
[Description("业务对照码")]
public string BizCode { get; set; }
/// <summary>
/// 自定义扩展码
/// </summary>
[Description("自定义扩展码")]
public string CustomCode { get; set; }
/// <summary>
/// 创建时间
/// </summary>
[Description("创建时间")]
public System.DateTime CreateTime { get; set; }
/// <summary>
/// 创建人ID
/// </summary>
[Description("创建人ID")]
public int CreateId { get; set; }
/// <summary>
/// 排序号
/// </summary>
[Description("排序号")]
public int SortNo { get; set; }
/// <summary>
/// 分类名称
/// </summary>
[Description("分类名称")]
public string TypeName { get; set; }
/// <summary>
/// 分类ID
/// </summary>
[Description("分类ID")]
public string TypeId { get; set; }
/// <summary>
/// 负责人ID
/// </summary>
[Description("负责人ID")]
public string ChairmanId { get; set; }
}
//------------------------------------------------------------------------------
// <autogenerated>
// This code was generated by a CodeSmith Template.
//
// DO NOT MODIFY contents of this file. Changes to this
// file will be lost if the code is regenerated.
// Author:Yubao Li
// </autogenerated>
//------------------------------------------------------------------------------
using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations.Schema;
using OpenAuth.Repository.Core;
using SqlSugar;
namespace OpenAuth.Repository.Domain
{
/// <summary>
/// 组织表
/// </summary>
[Table("Org")]
[SugarTable("Org")]
public partial class SysOrg : TreeEntity
{
public SysOrg()
{
this.CascadeId= string.Empty;
this.Name= string.Empty;
this.HotKey= string.Empty;
this.ParentName= string.Empty;
this.IconName= string.Empty;
this.Status= 0;
this.BizCode= string.Empty;
this.CustomCode= string.Empty;
this.CreateTime= DateTime.Now;
this.CreateId= 0;
this.SortNo= 0;
this.ParentId= null;
this.TypeName= string.Empty;
this.TypeId= string.Empty;
}
/// <summary>
/// 热键
/// </summary>
[Description("热键")]
public string HotKey { get; set; }
/// <summary>
/// 是否叶子节点
/// </summary>
[Description("是否叶子节点")]
public bool IsLeaf { get; set; }
/// <summary>
/// 是否自动展开
/// </summary>
[Description("是否自动展开")]
public bool IsAutoExpand { get; set; }
/// <summary>
/// 节点图标文件名称
/// </summary>
[Description("节点图标文件名称")]
public string IconName { get; set; }
/// <summary>
/// 当前状态
/// </summary>
[Description("当前状态")]
public int Status { get; set; }
/// <summary>
/// 业务对照码
/// </summary>
[Description("业务对照码")]
public string BizCode { get; set; }
/// <summary>
/// 自定义扩展码
/// </summary>
[Description("自定义扩展码")]
public string CustomCode { get; set; }
/// <summary>
/// 创建时间
/// </summary>
[Description("创建时间")]
public System.DateTime CreateTime { get; set; }
/// <summary>
/// 创建人ID
/// </summary>
[Description("创建人ID")]
public int CreateId { get; set; }
/// <summary>
/// 排序号
/// </summary>
[Description("排序号")]
public int SortNo { get; set; }
/// <summary>
/// 分类名称
/// </summary>
[Description("分类名称")]
public string TypeName { get; set; }
/// <summary>
/// 分类ID
/// </summary>
[Description("分类ID")]
public string TypeId { get; set; }
/// <summary>
/// 负责人ID
/// </summary>
[Description("负责人ID")]
public string ChairmanId { get; set; }
}
}

View File

@ -146,9 +146,9 @@ namespace OpenAuth.WebApi.Controllers
/// 获取登录用户的所有可访问的组织信息
/// </summary>
[HttpGet]
public Response<List<SysOrg>> GetOrgs()
public Response<List<OrgView>> GetOrgs()
{
var result = new Response<List<SysOrg>>();
var result = new Response<List<OrgView>>();
try
{
result.Result = _authStrategyContext.Orgs;