using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Mall.Model.Entity.User;

namespace Mall.Repository.User
{

    public class RB_WeChatPublicAccountRepository : BaseRepository<RB_WeChatPublicAccount>
    {
        /// <summary>
        /// 根据查询条件获取公众号列表
        /// </summary>
        /// <param name="query">查询条件</param>
        /// <returns></returns>
        public List<RB_WeChatPublicAccount> GetWeChatPublicAccountListRepository(RB_WeChatPublicAccount query)
        {
            StringBuilder builder = new StringBuilder();
            builder.Append(" SELECT * FROM RB_WeChatPublicAccount WHERE Status=0 ");
            if (query != null)
            {
                if (query.TenantId > 0)
                {
                    builder.AppendFormat(" AND TenantId={0} ", query.TenantId);
                }
                if (query.MallBaseId > 0)
                {
                    builder.AppendFormat(" AND MallBaseId={0} ", query.MallBaseId);
                }
            }
            return Get<RB_WeChatPublicAccount>(builder.ToString()).ToList();
        }

    }
}
