You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

63 lines
2.0 KiB
C#

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

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<DmsRecordShutDown>, IDmsRecordShutDownService
{
public DmsRecordShutDownServiceImpl(Repository<DmsRecordShutDown> rep):base(rep)
{
}
/// <summary>
/// 查询每个设备关机记录第一条
/// </summary>
/// <param name="palleCode"></param>
/// <returns></returns>
/// <exception cref="InvalidOperationException"></exception>
public List<DmsRecordShutDown> GetAllMachineFirst()
{
List<DmsRecordShutDown> 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<DmsRecordShutDown>(sql);
return list;
}
catch (Exception e)
{
return list;
}
}
}
}