using SlnMesnac.Model.domain; using SlnMesnac.Repository.service.@base; using System; using System.Collections.Generic; using System.Text; #region << 版 本 注 释 >> /*-------------------------------------------------------------------- * 版权所有 (c) 2024 WenJY 保留所有权利。 * CLR版本:4.0.30319.42000 * 机器名称:LAPTOP-E0N2L34V * 命名空间:SlnMesnac.Repository.service.Impl * 唯一标识:2ef6cbc3-f5ce-4d6a-9750-06aac8227b6f * * 创建者:WenJY * 电子邮箱:wenjy@mesnac.com * 创建时间:2024-04-07 16:57:02 * 版本:V1.0.0 * 描述: * *-------------------------------------------------------------------- * 修改人: * 时间: * 修改说明: * * 版本:V1.0.0 *--------------------------------------------------------------------*/ #endregion << 版 本 注 释 >> namespace SlnMesnac.Repository.service.Impl { public class DmsRecordShutDownServiceImpl : BaseServiceImpl, IDmsRecordShutDownService { public DmsRecordShutDownServiceImpl(Repository rep):base(rep) { } /// /// 查询每个设备关机记录第一条 /// /// /// /// public List GetAllMachineFirst() { List list = null; try { string sql = "WITH RankedRecords AS ( SELECT *, ROW_NUMBER() OVER (PARTITION BY device_id ORDER BY create_time DESC) AS rn FROM dms_record_shut_down WHERE device_id IN (1016, 1017, 1018, 1019, 1020)) SELECT * FROM RankedRecords WHERE rn = 1;"; list = base._rep.Context.Ado.SqlQuery(sql); return list; } catch (Exception e) { return list; } } } }