[前台API] DeviceManageController 取得 DisasterDevice API 增加 building_tag 引數
This commit is contained in:
parent
14285abf75
commit
59534413f2
@ -812,7 +812,7 @@ namespace FrontendWebApi.ApiControllers
|
|||||||
catch (Exception exception)
|
catch (Exception exception)
|
||||||
{
|
{
|
||||||
apiResult.Code = "9999";
|
apiResult.Code = "9999";
|
||||||
Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message);
|
Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception);
|
||||||
return Ok(apiResult);
|
return Ok(apiResult);
|
||||||
}
|
}
|
||||||
return Ok(apiResult);
|
return Ok(apiResult);
|
||||||
@ -1183,17 +1183,26 @@ namespace FrontendWebApi.ApiControllers
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[Route("api/Device/GetDisasterDevice")]
|
[Route("api/Device/GetDisasterDevice")]
|
||||||
public async Task<ActionResult<ApiResult<List<DeviceDisaster>>>> GetDisasterDevice()
|
public async Task<ActionResult<ApiResult<List<DeviceDisaster>>>> GetDisasterDevice([FromBody] FindDeviceDisaster fdd)
|
||||||
{
|
{
|
||||||
ApiResult<List<DeviceDisaster>> apiResult = new ApiResult<List<DeviceDisaster>>();
|
ApiResult<List<DeviceDisaster>> apiResult = new ApiResult<List<DeviceDisaster>>();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var sqlString = $@" SELECT * FROM device_disaster";
|
var result = new List<DeviceDisaster>();
|
||||||
var fr = await backendRepository.GetAllAsync<DeviceDisaster>(sqlString);
|
var sqlString = $@" SELECT * FROM device_disaster WHERE 1=1";
|
||||||
|
if (fdd != null)
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrEmpty(fdd.building_tag)) {
|
||||||
|
sqlString += " AND device_building_tag = @building_tag";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
result = await backendRepository.GetAllAsync<DeviceDisaster>(sqlString,fdd);
|
||||||
|
|
||||||
|
|
||||||
apiResult.Code = "0000";
|
apiResult.Code = "0000";
|
||||||
apiResult.Data = fr;
|
apiResult.Data = result;
|
||||||
}
|
}
|
||||||
catch (Exception exception)
|
catch (Exception exception)
|
||||||
{
|
{
|
||||||
|
@ -215,4 +215,8 @@ namespace FrontendWebApi.Models
|
|||||||
public string device_number { get; set; }
|
public string device_number { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class FindDeviceDisaster
|
||||||
|
{
|
||||||
|
public string building_tag { get; set; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user