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.

53 lines
1.7 KiB
C#

3 months ago
using Microsoft.Extensions.Logging;
using SlnMesnac.Common;
using SlnMesnac.Model.domain;
using SlnMesnac.Repository.service.@base;
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Threading.Tasks;
namespace SlnMesnac.Repository.service.Impl
{
public class data2_TableServiceImpl : BaseServiceImpl<data2_Table>, Idata2_TableService
{
private Repository<data2_Table> _repository2;
private ILogger<data2_TableServiceImpl> _logger;
public data2_TableServiceImpl(Repository<data2_Table> repository, ILogger<data2_TableServiceImpl> logger) :base(repository)
{
_logger = logger;
_repository2 = repository;
}
public async Task<bool> UpdateAsync(data2_Table record)
{
try
{
bool result = await _rep.UpdateAsync(record);
return result;
}
catch (Exception ex)
{
_logger.LogError($"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݻ<EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>:{ex.Message}");
return false;
}
}
public async Task<List<data2_Table>> Getdata2TableListAsync(DateTime start, DateTime end)
{
List<data2_Table> list = null;
try
{
Expression<Func<data2_Table, bool>> exp = x => true;
exp = exp.And(x =>
(x.flag != "F" && x.time >= start && x.time < end)
);
list = _repository2.GetList(exp);
}
catch (Exception ex)
{
_logger.LogError($"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݻ<EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>:{ex.Message}");
}
return list;
}
}
}