租户管理接口、修复审批重复问题、机构管理接口等
parent
68f0c3f333
commit
4a9c9dbe1e
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,51 @@
|
||||
namespace DS.WMS.Core.System.Dtos;
|
||||
|
||||
/// <summary>
|
||||
/// 机构树信息
|
||||
/// </summary>
|
||||
public class OrgTree
|
||||
{
|
||||
public string Title { get; set; }
|
||||
|
||||
public long? Value { get; set; }
|
||||
|
||||
public long? ParentId { get; set; }
|
||||
|
||||
public List<OrgTree> Children { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 无参构造函数
|
||||
/// </summary>
|
||||
public OrgTree()
|
||||
{
|
||||
Children = new List<OrgTree>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 有参构造函数
|
||||
/// </summary>
|
||||
/// <param name="id">子id</param>
|
||||
/// <param name="name">名称</param>
|
||||
/// <param name="parentId">父id</param>
|
||||
public OrgTree(long id, string name, long parentId)
|
||||
{
|
||||
this.Value = id;
|
||||
this.Title = name;
|
||||
this.ParentId = parentId;
|
||||
Children = new List<OrgTree>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 有参构造函数
|
||||
/// </summary>
|
||||
/// <param name="id">子id</param>
|
||||
/// <param name="name">名称</param>
|
||||
/// <param name="parent">父节点</param>
|
||||
public OrgTree(long id, string name, OrgTree parent)
|
||||
{
|
||||
this.Value = id;
|
||||
this.Title = name;
|
||||
this.ParentId = parent.Value;
|
||||
Children = new List<OrgTree>();
|
||||
}
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace DS.WMS.Core.System.Dtos;
|
||||
|
||||
/// <summary>
|
||||
/// 租户模块授权请求
|
||||
/// </summary>
|
||||
public class TenantPermissionReq
|
||||
{
|
||||
/// <summary>
|
||||
///租户Id
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "租户Id不能为空")]
|
||||
public long TenantId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 授权Ids
|
||||
/// </summary>
|
||||
public List<long> PermissionIds { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 模块授权列表
|
||||
/// </summary>
|
||||
public List<PermissionAuth> PermissionAuthList { get; set; }
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
namespace DS.WMS.Core.System.Dtos;
|
||||
|
||||
/// <summary>
|
||||
/// 租户权限树
|
||||
/// </summary>
|
||||
public class TenantPermissionTreeViewModel
|
||||
{
|
||||
public List<TenantPermissionTree> TreeData { get; set; }
|
||||
|
||||
public string[] Ids { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class TenantPermissionTree
|
||||
{
|
||||
public string Title { get; set; }
|
||||
|
||||
public long Key { get; set; }
|
||||
|
||||
|
||||
public List<TenantPermissionTree> Children { get; set; }
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
using DS.Module.Core;
|
||||
|
||||
namespace DS.WMS.Core.System.Dtos;
|
||||
/// <summary>
|
||||
/// 租户返回实体
|
||||
/// </summary>
|
||||
public class TenantRes
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 公司名称
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 拼音码
|
||||
/// </summary>
|
||||
public string PinYinCode { get; set; }= "";
|
||||
/// <summary>
|
||||
/// 公司地址
|
||||
/// </summary>
|
||||
public string Address { get; set; }= "";
|
||||
/// <summary>
|
||||
/// 租户管理员手机
|
||||
/// </summary>
|
||||
public string Phone { get; set; }
|
||||
/// <summary>
|
||||
/// 公司电话
|
||||
/// </summary>
|
||||
public string Tel { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 邮箱
|
||||
/// </summary>
|
||||
public string Email { get; set; }
|
||||
/// <summary>
|
||||
/// 企业法人
|
||||
/// </summary>
|
||||
public string Chief { get; set; }
|
||||
/// <summary>
|
||||
/// 企业税号
|
||||
/// </summary>
|
||||
public string TaxNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 租户类型 0-普通租户 1-系统租户
|
||||
/// </summary>
|
||||
public int? TenantType { get; set; } = 0;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 状态
|
||||
/// </summary>
|
||||
public StatusEnum? Status { get; set; } = StatusEnum.Enable;
|
||||
}
|
@ -0,0 +1,148 @@
|
||||
using DS.Module.Core;
|
||||
using DS.Module.Core.Extensions;
|
||||
using DS.WMS.Core.System.Entity;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using SqlSugar;
|
||||
using Xunit;
|
||||
|
||||
namespace Ds.WMS.Test;
|
||||
|
||||
public class TreeTest
|
||||
{
|
||||
private readonly IServiceProvider _serviceProvider;
|
||||
private readonly ISqlSugarClient db;
|
||||
|
||||
public TreeTest(IServiceProvider serviceProvider)
|
||||
{
|
||||
_serviceProvider = serviceProvider;
|
||||
db = _serviceProvider.GetRequiredService<ISqlSugarClient>();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TreeTest1()
|
||||
{
|
||||
TreeNode treeNode1 = new TreeNode("1", "山东", "0");
|
||||
TreeNode treeNode2 = new TreeNode("2", "北京", "0");
|
||||
|
||||
TreeNode treeNode3 = new TreeNode("3", "历下区", treeNode1);
|
||||
TreeNode treeNode4 = new TreeNode("4", "高新区", treeNode1);
|
||||
TreeNode treeNode5 = new TreeNode("5", "历城区", treeNode1);
|
||||
TreeNode treeNode6 = new TreeNode("6", "甸柳庄", treeNode3);
|
||||
TreeNode treeNode7 = new TreeNode("7", "济南长途汽车站东站", treeNode6);
|
||||
|
||||
|
||||
TreeNode treeNode8 = new TreeNode("8", "朝阳区", treeNode2);
|
||||
TreeNode treeNode9 = new TreeNode("9", "海淀区", treeNode2);
|
||||
TreeNode treeNode10 = new TreeNode("10", "金盏乡", treeNode8);
|
||||
|
||||
|
||||
List<TreeNode> list = new List<TreeNode>();
|
||||
|
||||
list.Add(treeNode1);
|
||||
list.Add(treeNode2);
|
||||
list.Add(treeNode3);
|
||||
list.Add(treeNode4);
|
||||
list.Add(treeNode5);
|
||||
list.Add(treeNode6);
|
||||
list.Add(treeNode7);
|
||||
list.Add(treeNode8);
|
||||
list.Add(treeNode9);
|
||||
list.Add(treeNode10);
|
||||
|
||||
List<TreeNode> trees = BulidTree(list);
|
||||
Assert.True(true);
|
||||
}
|
||||
|
||||
public class TreeNode
|
||||
{
|
||||
/// <summary>
|
||||
/// 子id
|
||||
/// </summary>
|
||||
public string Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 父id
|
||||
/// </summary>
|
||||
public string ParentId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 名称
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 子节点
|
||||
/// </summary>
|
||||
public List<TreeNode> Children { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 无参构造函数
|
||||
/// </summary>
|
||||
public TreeNode()
|
||||
{
|
||||
Children = new List<TreeNode>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 有参构造函数
|
||||
/// </summary>
|
||||
/// <param name="id">子id</param>
|
||||
/// <param name="name">名称</param>
|
||||
/// <param name="parentId">父id</param>
|
||||
public TreeNode(string id, string name, string parentId)
|
||||
{
|
||||
this.Id = id;
|
||||
this.Name = name;
|
||||
this.ParentId = parentId;
|
||||
Children = new List<TreeNode>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 有参构造函数
|
||||
/// </summary>
|
||||
/// <param name="id">子id</param>
|
||||
/// <param name="name">名称</param>
|
||||
/// <param name="parent">父节点</param>
|
||||
public TreeNode(string id, string name, TreeNode parent)
|
||||
{
|
||||
this.Id = id;
|
||||
this.Name = name;
|
||||
this.ParentId = parent.Id;
|
||||
Children = new List<TreeNode>();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 双层循环
|
||||
/// </summary>
|
||||
/// <param name="treeNodes"></param>
|
||||
/// <returns></returns>
|
||||
public static List<TreeNode> BulidTree(List<TreeNode> treeNodes)
|
||||
{
|
||||
try
|
||||
{
|
||||
List<TreeNode> trees = new List<TreeNode>();
|
||||
|
||||
foreach (var treeNode in treeNodes)
|
||||
{
|
||||
if ("0" == (treeNode.ParentId))
|
||||
{
|
||||
trees.Add(treeNode);
|
||||
}
|
||||
|
||||
foreach (var it in treeNodes)
|
||||
{
|
||||
if (it.ParentId == treeNode.Id)
|
||||
{
|
||||
treeNode.Children.Add(it);
|
||||
}
|
||||
}
|
||||
}
|
||||
return trees;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue