using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Mall.Model.Entity.Education;
using Mall.Model.Extend.Education;
using VT.FW.DB.Dapper;

namespace Mall.Repository.Education
{

    /// <summary>
    /// 汇付天下配置仓储层
    /// </summary>
    public class RB_Trade_ConfigRepository : BaseRepository<Model.Entity.User.RB_Member_User>
    {
        /// <summary>
        /// 获取列表
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        public List<RB_Trade_Config> GetList(RB_Trade_Config query)
        {
            StringBuilder builder = new StringBuilder();

            builder.AppendFormat(@" 
SELECT *
FROM RB_Trade_Config
WHERE 1=1
");
            if (query != null)
            {
                if (query.GroupId > 0)
                {
                    builder.AppendFormat(" AND {0}={1} ", nameof(RB_Trade_Config.GroupId), query.GroupId);
                }
                if (query.Type > 0)
                {
                    builder.AppendFormat(" AND {0}={1} ", nameof(RB_Trade_Config.Type), query.Type);
                }
            }
            return Get<RB_Trade_Config>(builder.ToString()).ToList();
        }
    }
}
