using Mall.Model.Entity.Finance;
using Mall.Model.Extend.Finance;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Mall.Repository.Finance
{
    public class RB_Finance_RecordRepository : BaseRepository<RB_Finance_Record>
    {

        /// <summary>
        /// 表名称
        /// </summary>
        public string TableName { get { return nameof(RB_Finance_Record); } }
        /// <summary>
        /// 获取列表
        /// </summary>
        /// <param name="dmodel"></param>
        /// <returns></returns>
        public List<RB_Finance_Record_Extend> GetList(RB_Finance_Record_Extend dmodel)
        {
            string where = $" where 1=1  ";
            if (dmodel.TenantId > 0)
            {
                where += $@" and {nameof(RB_Finance_Record.TenantId)}={dmodel.TenantId}";
            }
            if (dmodel.MallBaseId > 0)
            {
                where += $@" and {nameof(RB_Finance_Record.MallBaseId)}={dmodel.MallBaseId}";
            }
            if (dmodel.Type > 0)
            {
                where += $@" and {nameof(RB_Finance_Record.Type)}={dmodel.Type}";
            }

            string sql = $@"SELECT * FROM {TableName}  {where} order by Id asc";
            return Get<RB_Finance_Record_Extend>(sql).ToList();
        }
    }
}
