using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata;

namespace MySystem.ProfitModels
{
    public partial class WebCMSEntities : DbContext
    {
        public WebCMSEntities()
        {
        }

        public WebCMSEntities(DbContextOptions<WebCMSEntities> options)
            : base(options)
        {
        }

        public virtual DbSet<ProfitRecord> ProfitRecord { get; set; }
        public virtual DbSet<SubsidyRecord> SubsidyRecord { get; set; }
        public virtual DbSet<TradeDaySummary> TradeDaySummary { get; set; }
        public virtual DbSet<UserAccountRecord> UserAccountRecord { get; set; }

        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
            if (!optionsBuilder.IsConfigured)
            {
                optionsBuilder.UseMySql(Library.ConfigurationManager.AppSettings["ProfitSqlConnStr"].ToString(), x => x.ServerVersion("5.7.17-mysql"));
            }
        }

        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            modelBuilder.Entity<ProfitRecord>(entity =>
            {
                entity.Property(e => e.Id).HasColumnType("int(11)");

                entity.Property(e => e.BrandId).HasColumnType("int(11)");

                entity.Property(e => e.CapFlag).HasColumnType("int(11)");

                entity.Property(e => e.ClearDate).HasColumnType("datetime");

                entity.Property(e => e.CreateDate).HasColumnType("datetime");

                entity.Property(e => e.CreateMan)
                    .HasColumnType("varchar(50)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.DirectFlag)
                    .HasColumnType("bit(1)")
                    .HasDefaultValueSql("b'0'");

                entity.Property(e => e.HelpMonthCount).HasColumnType("int(11)");

                entity.Property(e => e.MerBuddyType).HasColumnType("int(11)");

                entity.Property(e => e.MerHelpFlag)
                    .HasColumnType("bit(1)")
                    .HasDefaultValueSql("b'0'");

                entity.Property(e => e.MerNo)
                    .HasColumnType("varchar(32)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.MerchantId).HasColumnType("int(11)");

                entity.Property(e => e.ParentNav)
                    .HasColumnType("varchar(1000)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.ProfitAmount).HasColumnType("decimal(18,2)");

                entity.Property(e => e.QrPayFlag).HasColumnType("int(11)");

                entity.Property(e => e.QueryCount).HasColumnType("int(11)");

                entity.Property(e => e.Remark)
                    .HasColumnType("varchar(64)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.SeoDescription)
                    .HasColumnType("varchar(500)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.SeoKeyword)
                    .HasColumnType("varchar(200)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.SeoTitle)
                    .HasColumnType("varchar(100)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.SnNo)
                    .HasColumnType("varchar(32)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.Sort).HasColumnType("int(11)");

                entity.Property(e => e.Status).HasColumnType("int(11)");

                entity.Property(e => e.TradeDate).HasColumnType("datetime");

                entity.Property(e => e.TradeId).HasColumnType("int(11)");

                entity.Property(e => e.UpdateDate).HasColumnType("datetime");

                entity.Property(e => e.UpdateMan)
                    .HasColumnType("varchar(50)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.UserId).HasColumnType("int(11)");

                entity.Property(e => e.Version).HasColumnType("int(11)");
            });

            modelBuilder.Entity<SubsidyRecord>(entity =>
            {
                entity.HasIndex(e => new { e.UserId, e.SeoTitle, e.BrandId })
                    .HasName("SubsidyRecordIndex");

                entity.Property(e => e.Id).HasColumnType("int(11)");

                entity.Property(e => e.BrandId).HasColumnType("int(11)");

                entity.Property(e => e.CapFlag).HasColumnType("int(11)");

                entity.Property(e => e.ClearDate).HasColumnType("datetime");

                entity.Property(e => e.CreateDate).HasColumnType("datetime");

                entity.Property(e => e.DirectFlag)
                    .HasColumnType("bit(1)")
                    .HasDefaultValueSql("b'0'");

                entity.Property(e => e.HelpMonthCount).HasColumnType("int(11)");

                entity.Property(e => e.MerBuddyType).HasColumnType("int(11)");

                entity.Property(e => e.MerHelpFlag)
                    .HasColumnType("bit(1)")
                    .HasDefaultValueSql("b'0'");

                entity.Property(e => e.MerNo)
                    .HasColumnType("varchar(32)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.MerchantId).HasColumnType("int(11)");

                entity.Property(e => e.ParentNav)
                    .HasColumnType("varchar(1000)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.ProfitAmount).HasColumnType("decimal(18,2)");

                entity.Property(e => e.QrPayFlag).HasColumnType("int(11)");

                entity.Property(e => e.QueryCount).HasColumnType("int(11)");

                entity.Property(e => e.Remark)
                    .HasColumnType("varchar(64)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.SeoDescription)
                    .HasColumnType("varchar(500)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.SeoKeyword)
                    .HasColumnType("varchar(200)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.SeoTitle)
                    .HasColumnType("varchar(100)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.SnNo)
                    .HasColumnType("varchar(32)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.Sort).HasColumnType("int(11)");

                entity.Property(e => e.Status).HasColumnType("int(11)");

                entity.Property(e => e.TradeDate).HasColumnType("datetime");

                entity.Property(e => e.TradeId).HasColumnType("int(11)");

                entity.Property(e => e.UpdateDate).HasColumnType("datetime");

                entity.Property(e => e.UserId).HasColumnType("int(11)");
            });

            modelBuilder.Entity<TradeDaySummary>(entity =>
            {
                entity.HasIndex(e => new { e.UserId, e.TradeMonth, e.TradeDate, e.BrandId, e.QueryCount, e.VipFlag, e.PayType, e.SeoTitle })
                    .HasName("TradeDaySummaryIndex");

                entity.Property(e => e.Id).HasColumnType("int(11)");

                entity.Property(e => e.BrandId).HasColumnType("int(11)");

                entity.Property(e => e.CreateDate).HasColumnType("datetime");

                entity.Property(e => e.CreateMan)
                    .HasColumnType("varchar(50)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.HelpDirectCreditTradeAmt).HasColumnType("decimal(18,2)");

                entity.Property(e => e.HelpDirectDebitCapNum).HasColumnType("decimal(18,2)");

                entity.Property(e => e.HelpDirectDebitCapTradeAmt).HasColumnType("decimal(18,2)");

                entity.Property(e => e.HelpDirectDebitTradeAmt).HasColumnType("decimal(18,2)");

                entity.Property(e => e.HelpDirectNonQrCreditTradeAmt).HasColumnType("decimal(18,2)");

                entity.Property(e => e.HelpDirectNonQrDebitTradeAmt).HasColumnType("decimal(18,2)");

                entity.Property(e => e.HelpDirectQrCreditTradeAmt).HasColumnType("decimal(18,2)");

                entity.Property(e => e.HelpDirectQrDebitTradeAmt).HasColumnType("decimal(18,2)");

                entity.Property(e => e.HelpDirectTradeAmt).HasColumnType("decimal(18,2)");

                entity.Property(e => e.HelpNonDirectCreditTradeAmt).HasColumnType("decimal(18,2)");

                entity.Property(e => e.HelpNonDirectDebitCapNum).HasColumnType("decimal(18,2)");

                entity.Property(e => e.HelpNonDirectDebitCapTradeAmt).HasColumnType("decimal(18,2)");

                entity.Property(e => e.HelpNonDirectDebitTradeAmt).HasColumnType("decimal(18,2)");

                entity.Property(e => e.HelpNonDirectNonQrCreditTradeAmt).HasColumnType("decimal(18,2)");

                entity.Property(e => e.HelpNonDirectNonQrDebitTradeAmt).HasColumnType("decimal(18,2)");

                entity.Property(e => e.HelpNonDirectQrCreditTradeAmt).HasColumnType("decimal(18,2)");

                entity.Property(e => e.HelpNonDirectQrDebitTradeAmt).HasColumnType("decimal(18,2)");

                entity.Property(e => e.HelpNonDirectTradeAmt).HasColumnType("decimal(18,2)");

                entity.Property(e => e.MgrName)
                    .HasColumnType("varchar(32)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.MgrNo)
                    .HasColumnType("varchar(16)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.NotHelpDirectCreditTradeAmt).HasColumnType("decimal(18,2)");

                entity.Property(e => e.NotHelpDirectDebitCapNum).HasColumnType("int(11)");

                entity.Property(e => e.NotHelpDirectDebitCapTradeAmt).HasColumnType("decimal(18,2)");

                entity.Property(e => e.NotHelpDirectDebitTradeAmt).HasColumnType("decimal(18,2)");

                entity.Property(e => e.NotHelpDirectNonQrCreditTradeAmt).HasColumnType("decimal(18,2)");

                entity.Property(e => e.NotHelpDirectNonQrDebitTradeAmt).HasColumnType("decimal(18,2)");

                entity.Property(e => e.NotHelpDirectQrCreditTradeAmt).HasColumnType("decimal(18,2)");

                entity.Property(e => e.NotHelpDirectQrDebitTradeAmt).HasColumnType("decimal(18,2)");

                entity.Property(e => e.NotHelpDirectTradeAmt).HasColumnType("decimal(18,2)");

                entity.Property(e => e.NotHelpNonDirectCreditTradeAmt).HasColumnType("decimal(18,2)");

                entity.Property(e => e.NotHelpNonDirectDebitCapNum).HasColumnType("int(11)");

                entity.Property(e => e.NotHelpNonDirectDebitCapTradeAmt).HasColumnType("decimal(18,2)");

                entity.Property(e => e.NotHelpNonDirectDebitTradeAmt).HasColumnType("decimal(18,2)");

                entity.Property(e => e.NotHelpNonDirectNonQrCreditTradeAmt).HasColumnType("decimal(18,2)");

                entity.Property(e => e.NotHelpNonDirectNonQrDebitTradeAmt).HasColumnType("decimal(18,2)");

                entity.Property(e => e.NotHelpNonDirectQrCreditTradeAmt).HasColumnType("decimal(18,2)");

                entity.Property(e => e.NotHelpNonDirectQrDebitTradeAmt).HasColumnType("decimal(18,2)");

                entity.Property(e => e.NotHelpNonDirectTradeAmt).HasColumnType("decimal(18,2)");

                entity.Property(e => e.PayType).HasColumnType("int(11)");

                entity.Property(e => e.ProfitDirectCreditTradeAmt).HasColumnType("decimal(18,2)");

                entity.Property(e => e.ProfitDirectDebitCapNum).HasColumnType("decimal(18,2)");

                entity.Property(e => e.ProfitDirectDebitCapTradeAmt).HasColumnType("decimal(18,2)");

                entity.Property(e => e.ProfitDirectDebitTradeAmt).HasColumnType("decimal(18,2)");

                entity.Property(e => e.ProfitDirectNonQrCreditTradeAmt).HasColumnType("decimal(18,2)");

                entity.Property(e => e.ProfitDirectNonQrDebitTradeAmt).HasColumnType("decimal(18,2)");

                entity.Property(e => e.ProfitDirectQrCreditTradeAmt).HasColumnType("decimal(18,2)");

                entity.Property(e => e.ProfitDirectQrDebitTradeAmt).HasColumnType("decimal(18,2)");

                entity.Property(e => e.ProfitDirectTradeAmt).HasColumnType("decimal(18,2)");

                entity.Property(e => e.ProfitNonDirectCreditTradeAmt).HasColumnType("decimal(18,2)");

                entity.Property(e => e.ProfitNonDirectDebitCapNum).HasColumnType("decimal(18,2)");

                entity.Property(e => e.ProfitNonDirectDebitCapTradeAmt).HasColumnType("decimal(18,2)");

                entity.Property(e => e.ProfitNonDirectDebitTradeAmt).HasColumnType("decimal(18,2)");

                entity.Property(e => e.ProfitNonDirectNonQrCreditTradeAmt).HasColumnType("decimal(18,2)");

                entity.Property(e => e.ProfitNonDirectNonQrDebitTradeAmt).HasColumnType("decimal(18,2)");

                entity.Property(e => e.ProfitNonDirectQrCreditTradeAmt).HasColumnType("decimal(18,2)");

                entity.Property(e => e.ProfitNonDirectQrDebitTradeAmt).HasColumnType("decimal(18,2)");

                entity.Property(e => e.ProfitNonDirectTradeAmt).HasColumnType("decimal(18,2)");

                entity.Property(e => e.QueryCount).HasColumnType("int(11)");

                entity.Property(e => e.SeoDescription)
                    .HasColumnType("varchar(500)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.SeoKeyword)
                    .HasColumnType("varchar(200)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.SeoTitle)
                    .HasColumnType("varchar(100)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.Sort).HasColumnType("int(11)");

                entity.Property(e => e.Status).HasColumnType("int(11)");

                entity.Property(e => e.TopUserId).HasColumnType("int(11)");

                entity.Property(e => e.TradeDate)
                    .HasColumnType("varchar(8)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.TradeMonth)
                    .HasColumnType("varchar(6)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.UpdateDate).HasColumnType("datetime");

                entity.Property(e => e.UpdateMan)
                    .HasColumnType("varchar(50)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.UserId).HasColumnType("int(11)");

                entity.Property(e => e.Version).HasColumnType("int(11)");

                entity.Property(e => e.VipFlag).HasColumnType("int(11)");
            });

            modelBuilder.Entity<UserAccountRecord>(entity =>
            {
                entity.HasComment("创客账户变动记录");

                entity.HasIndex(e => new { e.UserId, e.ChangeType })
                    .HasName("UserAccountRecordIndex");

                entity.Property(e => e.Id).HasColumnType("int(11)");

                entity.Property(e => e.AfterBalanceAmount).HasColumnType("decimal(18,2)");

                entity.Property(e => e.AfterFreezeAmount).HasColumnType("decimal(18,2)");

                entity.Property(e => e.AfterTotalAmount).HasColumnType("decimal(18,2)");

                entity.Property(e => e.BeforeBalanceAmount).HasColumnType("decimal(18,2)");

                entity.Property(e => e.BeforeFreezeAmount).HasColumnType("decimal(18,2)");

                entity.Property(e => e.BeforeTotalAmount).HasColumnType("decimal(18,2)");

                entity.Property(e => e.ChangeAmount).HasColumnType("decimal(18,2)");

                entity.Property(e => e.ChangeType).HasColumnType("int(11)");

                entity.Property(e => e.CreateDate).HasColumnType("datetime");

                entity.Property(e => e.CreateMan)
                    .HasColumnType("varchar(50)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.Kind).HasColumnType("int(11)");

                entity.Property(e => e.ProductType).HasColumnType("int(11)");

                entity.Property(e => e.QueryCount).HasColumnType("int(11)");

                entity.Property(e => e.Remark)
                    .HasColumnType("varchar(64)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.SeoDescription)
                    .HasColumnType("varchar(500)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.SeoKeyword)
                    .HasColumnType("varchar(200)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.SeoTitle)
                    .HasColumnType("varchar(100)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.Sort).HasColumnType("int(11)");

                entity.Property(e => e.Status).HasColumnType("int(11)");

                entity.Property(e => e.TransRecordNo)
                    .HasColumnType("varchar(32)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.UpdateDate).HasColumnType("datetime");

                entity.Property(e => e.UpdateMan)
                    .HasColumnType("varchar(50)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.UserId).HasColumnType("int(11)");

                entity.Property(e => e.Version).HasColumnType("int(11)");
            });

            OnModelCreatingPartial(modelBuilder);
        }

        partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
    }
}
