fix 获取品牌设备增加factory字段
This commit is contained in:
@@ -72,10 +72,13 @@ public class DevicesConnectController : ControllerBase
|
||||
/// 获取品牌设备
|
||||
/// </summary>
|
||||
/// <param name="brand"></param>
|
||||
/// <param name="factory"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("brand-devices")]
|
||||
public async Task<List<DeviceUniqueWithConnectionInfoDto>> GetDeviceUniqueInfoByBrandAsync([Required(ErrorMessage = "请明确设备品牌")] string brand)
|
||||
public async Task<List<DeviceUniqueWithConnectionInfoDto>> GetDeviceUniqueInfoByBrandAsync(
|
||||
[Required(ErrorMessage = "请明确设备品牌")] string brand,
|
||||
[Required(ErrorMessage = "请明确厂区")] string factory)
|
||||
{
|
||||
return await _deviceConnectService.GetDeviceUniqueInfoByBrandAsync(brand);
|
||||
return await _deviceConnectService.GetDeviceUniqueInfoByBrandAsync(brand, factory);
|
||||
}
|
||||
}
|
||||
@@ -37,11 +37,24 @@ public class DevicesController : ControllerBase
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[Authorize(Roles = "admin")]
|
||||
[HttpGet("template/page")]
|
||||
public async Task<Pagination<DeviceTemplateResponse>> GetTemplatePageAsync([FromQuery] DeviceTemplatePageRequest request)
|
||||
{
|
||||
return await _deviceTemplateService.GetPageAsync(request);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设备模板保存
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[Authorize(Roles = "admin")]
|
||||
[HttpPost("template")]
|
||||
public async Task SaveTemplateAsync(DeviceTemplateSaveRequest request)
|
||||
{
|
||||
await _deviceTemplateService.SaveTemplateAsync(request);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
@@ -70,17 +83,6 @@ public class DevicesController : ControllerBase
|
||||
return await _deviceConnectService.RegisterAsync(request);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设备模板保存
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[Authorize(Roles = "admin")]
|
||||
[HttpPost("template")]
|
||||
public async Task SaveTemplateAsync(DeviceTemplateSaveRequest request)
|
||||
{
|
||||
await _deviceTemplateService.SaveTemplateAsync(request);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设备分页
|
||||
@@ -219,6 +221,6 @@ public class DevicesController : ControllerBase
|
||||
[HttpPost("import")]
|
||||
public async Task Import(List<DeviceImportRequest> request)
|
||||
{
|
||||
await _deviceService.ImportAsync(request);
|
||||
await _deviceService.ImportAsync(request);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -51,6 +51,7 @@ public interface IDeviceConnectService : IScopeDependency
|
||||
/// 根据品牌获取设备信息
|
||||
/// </summary>
|
||||
/// <param name="brand"></param>
|
||||
/// <param name="factory"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<DeviceUniqueWithConnectionInfoDto>> GetDeviceUniqueInfoByBrandAsync(string brand);
|
||||
Task<List<DeviceUniqueWithConnectionInfoDto>> GetDeviceUniqueInfoByBrandAsync(string brand, string factory);
|
||||
}
|
||||
@@ -123,12 +123,12 @@ public class DeviceConnectService : IDeviceConnectService
|
||||
})
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<List<DeviceUniqueWithConnectionInfoDto>> GetDeviceUniqueInfoByBrandAsync(string brand)
|
||||
|
||||
public async Task<List<DeviceUniqueWithConnectionInfoDto>> GetDeviceUniqueInfoByBrandAsync(string brand, string factory)
|
||||
{
|
||||
return await _dbContext.Queryable<DeviceEntity>()
|
||||
.LeftJoin<DeviceTemplateEntity>((d, dt) => d.TemplateCode == dt.Code)
|
||||
.Where((d, dt) => dt.Brand == brand)
|
||||
.Where((d, dt) => dt.Brand == brand && d.TenantId == factory)
|
||||
.Select(d => new DeviceUniqueWithConnectionInfoDto
|
||||
{
|
||||
DeviceUnique = d.UniqueNo,
|
||||
@@ -176,7 +176,7 @@ public class DeviceConnectService : IDeviceConnectService
|
||||
Funcs = new List<DeviceFuncEnumType>(),
|
||||
Type = DeviceTypeEnumType.Meal,
|
||||
DeployPlace = deployPlace,
|
||||
HeartbeatInterval = 30,
|
||||
HeartbeatInterval = 0,
|
||||
DeployDirection = null,
|
||||
Enable = true,
|
||||
AsAttendance = false,
|
||||
|
||||
Reference in New Issue
Block a user