| | |
| | | #endregion << 版 本 注 释 >> |
| | | |
| | | using AutoMapper; |
| | | using Newtonsoft.Json; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEAWCS_Core; |
| | | using WIDESEAWCS_Core.BaseRepository; |
| | | using WIDESEAWCS_Core.BaseServices; |
| | | |
| | | using WIDESEAWCS_Core.Helper; |
| | | using WIDESEAWCS_QuartzJob.DeviceEnum; |
| | | using WIDESEAWCS_QuartzJob.DTO; |
| | | using WIDESEAWCS_QuartzJob.Models; |
| | |
| | | |
| | | namespace WIDESEAWCS_QuartzJob.Service |
| | | { |
| | | /// <summary> |
| | | /// 设备信息业务层 |
| | | /// </summary> |
| | | public class DeviceInfoService : ServiceBase<Dt_DeviceInfo, IDeviceInfoRepository>, IDeviceInfoService |
| | | { |
| | | private readonly IUnitOfWorkManage _unitOfWorkManage; |
| | | private readonly IMapper _mapper; |
| | | |
| | | /// <summary> |
| | | /// 设备信息业务层 |
| | | /// </summary> |
| | | public DeviceInfoService(IDeviceInfoRepository BaseDal, IUnitOfWorkManage unitOfWorkManage, IMapper mapper) : base(BaseDal) |
| | | { |
| | | _unitOfWorkManage = unitOfWorkManage; |
| | | _mapper = mapper; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 添加数据 |
| | | /// </summary> |
| | | /// <param name="saveModel"></param> |
| | | /// <returns></returns> |
| | | public override WebResponseContent AddData(SaveModel saveModel) |
| | | { |
| | | return base.AddData(saveModel); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 查询设备以及对应的协议信息。 |
| | | /// </summary> |
| | | /// <returns>返回设备信息以及对应协议信息的集合。</returns> |
| | | public async Task<List<DeviceInfoDTO>> QueryDeviceProInfos() |
| | | { |
| | | List<Dt_DeviceInfo> deviceInfos = await Db.Queryable<Dt_DeviceInfo>().Where(x => true).Includes(x => x.ProtocolList).ToListAsync(); |
| | | List<Dt_DeviceInfo> deviceInfos = await Db.Queryable<Dt_DeviceInfo>().Where(x => x.DeviceStatus == ((int)DeviceStatusEnum.Enable).ToString()).Includes(x => x.ProtocolList).ToListAsync(); |
| | | return _mapper.Map<List<DeviceInfoDTO>>(deviceInfos); |
| | | } |
| | | } |