新增device欄位

This commit is contained in:
dev02 2022-11-17 17:56:21 +08:00
parent e2d74c9aef
commit dc19fa51e7
2 changed files with 7 additions and 4 deletions

View File

@ -259,19 +259,20 @@ namespace FrontendWebApi.ApiControllers
/// </summary> /// </summary>
/// <param name="fd"></param> /// <param name="fd"></param>
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpGet]
[Route("api/Device/GetOpeDevice")] [Route("api/Device/GetOpeDevice")]
public async Task<ActionResult<ApiResult<List<DeviceOpeRecord>>>> GetOpeDevice([FromBody] FindDevice fd) public async Task<ActionResult<ApiResult<List<DeviceOpeRecord>>>> GetOpeDevice([FromQuery] string device_guid)
{ {
ApiResult<List<DeviceOpeRecord>> apiResult = new ApiResult<List<DeviceOpeRecord>>(); ApiResult<List<DeviceOpeRecord>> apiResult = new ApiResult<List<DeviceOpeRecord>>();
try try
{ {
string sql = $@"select orr.work_type, orr.fix_do, ui.full_name as work_person_name, finish_time, created_at string sql = $@"select orr.work_type, orr.fix_do, ui.full_name as work_person_name, orr.finish_time, orr.created_at, dn.device_node_guid, dn.full_name as device_node_name
from device d from device d
join operation_record orr on d.device_number = orr.fix_do_code and orr.deleted = 0 join operation_record orr on d.device_number = orr.fix_do_code and orr.deleted = 0
left join userinfo ui on orr.work_person_id = ui.userinfo_guid left join userinfo ui on orr.work_person_id = ui.userinfo_guid
left join device_node dn on d.device_guid = dn.device_guid
where d.deleted = 0 and d.device_guid = @device_guid"; where d.deleted = 0 and d.device_guid = @device_guid";
object param = new { @device_guid = fd.device_guid }; object param = new { @device_guid = device_guid };
var device = await backendRepository.GetAllAsync<DeviceOpeRecord>(sql, param); var device = await backendRepository.GetAllAsync<DeviceOpeRecord>(sql, param);
if (device.Count == 0) if (device.Count == 0)

View File

@ -110,5 +110,7 @@ namespace FrontendWebApi.Models
return Convert.ToDateTime(finish_time).ToString("yyyy-MM-dd HH:mm:ss"); return Convert.ToDateTime(finish_time).ToString("yyyy-MM-dd HH:mm:ss");
} }
} //結束時間 } //結束時間
public string device_node_guid { get; set; }
public string device_node_name { get; set; }
} }
} }