提交 fd242d02 编写于 作者: 麦壳饼's avatar 麦壳饼

修改租户ID的问题

上级 94340855
......@@ -20,7 +20,6 @@ namespace IoTSharp.Data
public string Street { get; set; }
public string Address { get; set; }
public int ZipCode { get; set; }
public Guid? TenantId { get; set; }
[System.Text.Json.Serialization.JsonIgnore]
[Newtonsoft.Json.JsonIgnore]
......
......@@ -59,8 +59,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IoTSharp.Interpreter", "IoT
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IoTSharp.Data.InMemory", "IoTSharp.Data.Storage\IoTSharp.Data.InMemory\IoTSharp.Data.InMemory.csproj", "{A57917E3-6F60-4D0E-8F13-36E5088DEFCE}"
EndProject
Project("{9092AA53-FB77-4645-B42D-1CCCA6BD08BD}") = "IoTSharp.Docs", "docs\IoTSharp.Docs.njsproj", "{F5644BA6-2A0C-49A5-9C9B-3CECD6DB2D1F}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IoTSharp.Data.Cassandra", "IoTSharp.Data.Storage\IoTSharp.Data.Cassandra\IoTSharp.Data.Cassandra.csproj", "{9C6FA709-3334-4C39-922D-6FF5ADB8C683}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "2.workflows", "2.workflows", "{59A51D63-F292-46F0-A4BF-975C98966DAA}"
......@@ -161,8 +159,6 @@ Global
{A57917E3-6F60-4D0E-8F13-36E5088DEFCE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A57917E3-6F60-4D0E-8F13-36E5088DEFCE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A57917E3-6F60-4D0E-8F13-36E5088DEFCE}.Release|Any CPU.Build.0 = Release|Any CPU
{F5644BA6-2A0C-49A5-9C9B-3CECD6DB2D1F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F5644BA6-2A0C-49A5-9C9B-3CECD6DB2D1F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9C6FA709-3334-4C39-922D-6FF5ADB8C683}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9C6FA709-3334-4C39-922D-6FF5ADB8C683}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9C6FA709-3334-4C39-922D-6FF5ADB8C683}.Release|Any CPU.ActiveCfg = Release|Any CPU
......
......@@ -52,7 +52,7 @@ namespace IoTSharp.Controllers
/// </summary>
/// <returns></returns>
[HttpPost("Tenant")]
[Authorize(Roles = nameof(UserRole.NormalUser))]
[Authorize(Roles = nameof(UserRole.TenantAdmin))]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(typeof(ApiResult), StatusCodes.Status404NotFound)]
[ProducesDefaultResponseType]
......@@ -61,15 +61,14 @@ namespace IoTSharp.Controllers
var profile = this.GetUserProfile();
if (m.tenantId != Guid.Empty)
{
var querym = _context.Customer.Where(c => c.Deleted == false && c.TenantId == m.tenantId);
var querym = _context.Customer.Include(c=>c.Tenant).Where(c => !c.Deleted && c.Tenant.Id==m.tenantId);
var data = await m.Query(querym, c => c.Name);
return new ApiResult<PagedData<Customer>>(ApiCode.Success, "OK", data);
}
else
{
var querym = _context.Customer.Where(c => c.Deleted == false);
var data = await m.Query(querym, c => c.Name);
return new ApiResult<PagedData<Customer>>(ApiCode.Success, "OK", data);
return new ApiResult<PagedData<Customer>>(ApiCode.NotFoundCustomer, "没有指定客户ID",new PagedData<Customer> ());
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册