using DapperORM.Common.Models;
using PushInfo.Core.IDAL;
using PushInfo.Core.Models.Tables;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PushInfo.Core.BLL
{
    public class MappushUserRoleBLL
    {
        /// <summary>
        /// 项目任务配置表数据访问接口
        /// </summary>
        private IMappushUserRoleDAL mapUserRoleDal;
        /// <summary>
        /// 构造函数
        /// </summary>
        public MappushUserRoleBLL()
        {
            this.mapUserRoleDal = DALFactory.CreateMappushUserRoleDAL();
        }
        #region 根据通用配置Id，还有项目Id查询推送配置
        /// <summary>
        /// 根据主键查询
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public List<Mappush_User_Role> QueryByProCfg(string projectId,string proCfgId)
        {
            var result = mapUserRoleDal.Fetch(x => x.Project_Id == projectId && x.Map_Project_Push_Id == proCfgId && x.Is_Deleted == 0);
            if (result.IsSuccess())
                return result.Data.ToList();
            else
                return new List<Mappush_User_Role>();
        }
        #endregion
    }
}
