using GxPress.Service.Interface.FlowAttachment;
using GxPress.Repository.Interface.FlowAttachment;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace GxPress.Service.Implement.FlowAttachment
{
    public class FlowAttachmentService : IFlowAttachmentService
    {
        private readonly IFlowAttachmentRepository flowAttachmentRepository;
        public FlowAttachmentService(IFlowAttachmentRepository flowAttachmentRepository)
        {
            this.flowAttachmentRepository = flowAttachmentRepository;
        }
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="flowAttachments"></param>
        /// <returns></returns>
        public async Task<bool> InsertFlowAttachments(List<Entity.WorkFlow.FlowAttachment> flowAttachments)
        {
            return await flowAttachmentRepository.InsertsAsync(flowAttachments);
        }

        /// <summary>
        /// 获取文件
        /// </summary>
        /// <param name="flowAttachments"></param>
        /// <returns></returns>
        public async Task<IEnumerable<Entity.WorkFlow.FlowAttachment>> FindFlowAttachments(SqlKata.Query query)
        {
            return await flowAttachmentRepository.GetAllAsync(query);
        }
    }
}