[FrontendWebApi] Device GetBaseDevice 增加 device_number 引數
This commit is contained in:
parent
97a1caa3ec
commit
840ee8e9f0
@ -340,8 +340,20 @@ namespace FrontendWebApi.ApiControllers
|
|||||||
ApiResult<DeviceBaseInfo> apiResult = new ApiResult<DeviceBaseInfo>();
|
ApiResult<DeviceBaseInfo> apiResult = new ApiResult<DeviceBaseInfo>();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string sql = $@"select device_number, full_name, device_coordinate, device_coordinate_3d from device where deleted = 0 and device_guid = @device_guid";
|
if (fd.device_guid == null && fd.device_number == null) {
|
||||||
object param = new { @device_guid = fd.device_guid };
|
apiResult.Code = "0002";
|
||||||
|
apiResult.Msg = "必需輸入設備資訊";
|
||||||
|
return Ok(apiResult);
|
||||||
|
}
|
||||||
|
|
||||||
|
string sql = $@"select device_number, full_name, device_coordinate,device_coordinate_3d from device where deleted = 0 and
|
||||||
|
(
|
||||||
|
(@device_guid is not null and device_guid = @device_guid)
|
||||||
|
OR (@device_guid is null and device_number = @device_number)
|
||||||
|
)
|
||||||
|
";
|
||||||
|
object param = new { @device_guid = fd.device_guid,@device_number = fd.device_number};
|
||||||
|
|
||||||
var device = await backendRepository.GetOneAsync<DeviceBaseInfo>(sql, param);
|
var device = await backendRepository.GetOneAsync<DeviceBaseInfo>(sql, param);
|
||||||
|
|
||||||
if (device == null)
|
if (device == null)
|
||||||
@ -356,6 +368,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.Message);
|
||||||
return Ok(apiResult);
|
return Ok(apiResult);
|
||||||
|
@ -11,6 +11,7 @@ namespace FrontendWebApi.Models
|
|||||||
public string building_tag { get; set; }
|
public string building_tag { get; set; }
|
||||||
public string floor_tag { get; set; }
|
public string floor_tag { get; set; }
|
||||||
public string device_guid { get; set; }
|
public string device_guid { get; set; }
|
||||||
|
public string device_number { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class BuildList
|
public class BuildList
|
||||||
|
Loading…
Reference in New Issue
Block a user