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

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

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

        public virtual DbSet<Merchant> Merchant { get; set; }
        public virtual DbSet<PushObj> PushObj { get; set; }
        public virtual DbSet<PushObjCondition> PushObjCondition { get; set; }
        public virtual DbSet<PushPosRecord> PushPosRecord { get; set; }
        public virtual DbSet<PushRecord> PushRecord { get; set; }
        public virtual DbSet<RePushQueue> RePushQueue { get; set; }
        public virtual DbSet<SourceCondition> SourceCondition { get; set; }
        public virtual DbSet<SourceData> SourceData { get; set; }
        public virtual DbSet<SourceDataSubTable> SourceDataSubTable { get; set; }

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

        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            modelBuilder.Entity<Merchant>(entity =>
            {
                entity.ToTable("merchant");

                entity.HasComment("商户表");

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

                entity.Property(e => e.AesSecret)
                    .HasColumnName("aes_secret")
                    .HasColumnType("varchar(50)")
                    .HasComment("AES密钥")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.CreateDate)
                    .HasColumnName("create_date")
                    .HasColumnType("datetime")
                    .HasComment("创建时间");

                entity.Property(e => e.MerchantName)
                    .HasColumnName("merchant_name")
                    .HasColumnType("varchar(50)")
                    .HasComment("商户名称")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.MerchantNo)
                    .HasColumnName("merchant_no")
                    .HasColumnType("varchar(50)")
                    .HasComment("商户号")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.RsaPriKey)
                    .HasColumnName("rsa_pri_key")
                    .HasColumnType("mediumtext")
                    .HasComment("RSA私钥")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.RsaPubKey)
                    .HasColumnName("rsa_pub_key")
                    .HasColumnType("mediumtext")
                    .HasComment("RSA公钥")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.Sort)
                    .HasColumnName("sort")
                    .HasColumnType("int(11)")
                    .HasComment("排序序号");

                entity.Property(e => e.Status)
                    .HasColumnName("status")
                    .HasColumnType("int(11)")
                    .HasComment("状态");

                entity.Property(e => e.UpdateDate)
                    .HasColumnName("update_date")
                    .HasColumnType("datetime")
                    .HasComment("修改时间");

                entity.Property(e => e.Version)
                    .HasColumnName("version")
                    .HasColumnType("int(11)")
                    .HasComment("版本号");
            });

            modelBuilder.Entity<PushObj>(entity =>
            {
                entity.ToTable("push_obj");

                entity.HasComment("推送项目");

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

                entity.Property(e => e.CreateDate)
                    .HasColumnName("create_date")
                    .HasColumnType("datetime")
                    .HasComment("创建时间");

                entity.Property(e => e.EncryptMode)
                    .HasColumnName("encrypt_mode")
                    .HasColumnType("int(11)")
                    .HasComment("加密方式");

                entity.Property(e => e.FieldList)
                    .HasColumnName("field_list")
                    .HasColumnType("mediumtext")
                    .HasComment("数据字段")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.MerchantId)
                    .HasColumnName("merchant_id")
                    .HasColumnType("int(11)")
                    .HasComment("商户");

                entity.Property(e => e.NoticeUrl)
                    .HasColumnName("notice_url")
                    .HasColumnType("varchar(500)")
                    .HasComment("推送地址")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.QueryId)
                    .HasColumnType("int(11)")
                    .HasComment("查询表Id");

                entity.Property(e => e.Sort)
                    .HasColumnName("sort")
                    .HasColumnType("int(11)")
                    .HasComment("排序序号");

                entity.Property(e => e.Status)
                    .HasColumnName("status")
                    .HasColumnType("int(11)")
                    .HasComment("状态");

                entity.Property(e => e.TableName)
                    .HasColumnName("table_name")
                    .HasColumnType("varchar(50)")
                    .HasComment("数据表名")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.Title)
                    .HasColumnName("title")
                    .HasColumnType("varchar(50)")
                    .HasComment("标题说明")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.UpdateDate)
                    .HasColumnName("update_date")
                    .HasColumnType("datetime")
                    .HasComment("修改时间");

                entity.Property(e => e.Version)
                    .HasColumnName("version")
                    .HasColumnType("int(11)")
                    .HasComment("版本号");
            });

            modelBuilder.Entity<PushObjCondition>(entity =>
            {
                entity.ToTable("push_obj_condition");

                entity.HasComment("推送数据抓取条件");

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

                entity.Property(e => e.CreateDate)
                    .HasColumnType("datetime")
                    .HasComment("创建时间");

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

                entity.Property(e => e.PushObjId)
                    .HasColumnName("push_obj_id")
                    .HasColumnType("int(11)")
                    .HasComment("推送项目");

                entity.Property(e => e.QueryCondition)
                    .HasColumnName("query_condition")
                    .HasColumnType("int(11)")
                    .HasComment("查询条件");

                entity.Property(e => e.QueryCount)
                    .HasColumnType("int(11)")
                    .HasComment("点击量");

                entity.Property(e => e.QueryField)
                    .HasColumnName("query_field")
                    .HasColumnType("varchar(50)")
                    .HasComment("查询字段")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.QueryVal)
                    .HasColumnName("query_val")
                    .HasColumnType("varchar(50)")
                    .HasComment("查询值")
                    .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)")
                    .HasComment("排序序号");

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

                entity.Property(e => e.UpdateDate)
                    .HasColumnType("datetime")
                    .HasComment("更新时间");

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

                entity.Property(e => e.Version)
                    .HasColumnType("int(11)")
                    .HasComment("版本号");
            });

            modelBuilder.Entity<PushPosRecord>(entity =>
            {
                entity.ToTable("push_pos_record");

                entity.HasComment("推送项目");

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

                entity.Property(e => e.Content)
                    .HasColumnName("content")
                    .HasColumnType("mediumtext")
                    .HasComment("数据内容")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.CreateDate)
                    .HasColumnName("create_date")
                    .HasColumnType("datetime")
                    .HasComment("创建时间");

                entity.Property(e => e.DataType)
                    .HasColumnName("data_type")
                    .HasColumnType("varchar(20)")
                    .HasComment("数据类型")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.EncryptContent)
                    .HasColumnName("encrypt_content")
                    .HasColumnType("mediumtext")
                    .HasComment("数据内容")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");
            });

            modelBuilder.Entity<PushRecord>(entity =>
            {
                entity.ToTable("push_record");

                entity.HasComment("推送记录");

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

                entity.Property(e => e.CreateDate)
                    .HasColumnName("create_date")
                    .HasColumnType("datetime")
                    .HasComment("创建时间");

                entity.Property(e => e.MerchantId)
                    .HasColumnName("merchant_id")
                    .HasColumnType("int(11)")
                    .HasComment("商户");

                entity.Property(e => e.PushData)
                    .HasColumnName("push_data")
                    .HasColumnType("mediumtext")
                    .HasComment("推送数据")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.PushDataEncrypt)
                    .HasColumnName("push_data_encrypt")
                    .HasColumnType("mediumtext")
                    .HasComment("推送数据加密")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.PushObjId)
                    .HasColumnName("push_obj_id")
                    .HasColumnType("int(11)")
                    .HasComment("推送项目");

                entity.Property(e => e.Sort)
                    .HasColumnName("sort")
                    .HasColumnType("int(11)")
                    .HasComment("排序序号");

                entity.Property(e => e.Status)
                    .HasColumnName("status")
                    .HasColumnType("int(11)")
                    .HasComment("状态");

                entity.Property(e => e.UpdateDate)
                    .HasColumnName("update_date")
                    .HasColumnType("datetime")
                    .HasComment("修改时间");

                entity.Property(e => e.Version)
                    .HasColumnName("version")
                    .HasColumnType("int(11)")
                    .HasComment("版本号");
            });

            modelBuilder.Entity<RePushQueue>(entity =>
            {
                entity.ToTable("re_push_queue");

                entity.HasComment("重推队列");

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

                entity.Property(e => e.CreateDate)
                    .HasColumnName("create_date")
                    .HasColumnType("datetime")
                    .HasComment("创建时间");

                entity.Property(e => e.MerchantId)
                    .HasColumnName("merchant_id")
                    .HasColumnType("int(11)")
                    .HasComment("商户");

                entity.Property(e => e.PushData)
                    .HasColumnName("push_data")
                    .HasColumnType("mediumtext")
                    .HasComment("推送数据")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.PushDataEncrypt)
                    .HasColumnName("push_data_encrypt")
                    .HasColumnType("mediumtext")
                    .HasComment("推送数据加密")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.PushObjId)
                    .HasColumnName("push_obj_id")
                    .HasColumnType("int(11)")
                    .HasComment("推送项目");

                entity.Property(e => e.PushRecordId)
                    .HasColumnType("int(11)")
                    .HasComment("推送记录");

                entity.Property(e => e.RePushDate)
                    .HasColumnName("re_push_date")
                    .HasColumnType("datetime")
                    .HasComment("再次重推时间");

                entity.Property(e => e.RePushUrl)
                    .HasColumnName("re_push_url")
                    .HasColumnType("varchar(500)")
                    .HasComment("重推地址")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.Sort)
                    .HasColumnName("sort")
                    .HasColumnType("int(11)")
                    .HasComment("排序序号");

                entity.Property(e => e.Status)
                    .HasColumnName("status")
                    .HasColumnType("int(11)")
                    .HasComment("状态");

                entity.Property(e => e.Times)
                    .HasColumnName("times")
                    .HasColumnType("int(11)")
                    .HasComment("次数");

                entity.Property(e => e.UpdateDate)
                    .HasColumnName("update_date")
                    .HasColumnType("datetime")
                    .HasComment("修改时间");

                entity.Property(e => e.Version)
                    .HasColumnName("version")
                    .HasColumnType("int(11)")
                    .HasComment("版本号");
            });

            modelBuilder.Entity<SourceCondition>(entity =>
            {
                entity.ToTable("source_condition");

                entity.HasComment("原始数据抓取条件");

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

                entity.Property(e => e.CreateDate)
                    .HasColumnName("create_date")
                    .HasColumnType("datetime")
                    .HasComment("创建时间");

                entity.Property(e => e.QueryCondition)
                    .HasColumnName("query_condition")
                    .HasColumnType("int(11)")
                    .HasComment("查询条件");

                entity.Property(e => e.QueryField)
                    .HasColumnName("query_field")
                    .HasColumnType("varchar(50)")
                    .HasComment("查询字段")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.QueryVal)
                    .HasColumnName("query_val")
                    .HasColumnType("varchar(50)")
                    .HasComment("查询值")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.Sort)
                    .HasColumnName("sort")
                    .HasColumnType("int(11)")
                    .HasComment("排序序号");

                entity.Property(e => e.SourceId)
                    .HasColumnName("source_id")
                    .HasColumnType("int(11)")
                    .HasComment("原始数据");

                entity.Property(e => e.Status)
                    .HasColumnName("status")
                    .HasColumnType("int(11)")
                    .HasComment("状态");

                entity.Property(e => e.UpdateDate)
                    .HasColumnName("update_date")
                    .HasColumnType("datetime")
                    .HasComment("修改时间");

                entity.Property(e => e.Version)
                    .HasColumnName("version")
                    .HasColumnType("int(11)")
                    .HasComment("版本号");
            });

            modelBuilder.Entity<SourceData>(entity =>
            {
                entity.ToTable("source_data");

                entity.HasComment("原始数据配置");

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

                entity.Property(e => e.CreateDate)
                    .HasColumnName("create_date")
                    .HasColumnType("datetime")
                    .HasComment("创建时间");

                entity.Property(e => e.FieldList)
                    .HasColumnName("field_list")
                    .HasColumnType("mediumtext")
                    .HasComment("查询数据字段")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.QueryId)
                    .HasColumnType("int(11)")
                    .HasComment("查询数据表Id");

                entity.Property(e => e.Sort)
                    .HasColumnName("sort")
                    .HasColumnType("int(11)")
                    .HasComment("排序序号");

                entity.Property(e => e.Status)
                    .HasColumnName("status")
                    .HasColumnType("int(11)")
                    .HasComment("状态");

                entity.Property(e => e.TableName)
                    .HasColumnName("table_name")
                    .HasColumnType("varchar(50)")
                    .HasComment("数据表名")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.TargetFieldList)
                    .HasColumnName("target_field_list")
                    .HasColumnType("mediumtext")
                    .HasComment("目标表字段")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.Title)
                    .HasColumnName("title")
                    .HasColumnType("varchar(50)")
                    .HasComment("标题说明")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.UpdateDate)
                    .HasColumnName("update_date")
                    .HasColumnType("datetime")
                    .HasComment("修改时间");

                entity.Property(e => e.Version)
                    .HasColumnName("version")
                    .HasColumnType("int(11)")
                    .HasComment("版本号");
            });

            modelBuilder.Entity<SourceDataSubTable>(entity =>
            {
                entity.ToTable("source_data_sub_table");

                entity.HasComment("原始数据关联表");

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

                entity.Property(e => e.CreateDate)
                    .HasColumnName("create_date")
                    .HasColumnType("datetime")
                    .HasComment("创建时间");

                entity.Property(e => e.QueryField)
                    .HasColumnName("query_field")
                    .HasColumnType("varchar(50)")
                    .HasComment("查询字段")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.ReturnField)
                    .HasColumnName("return_field")
                    .HasColumnType("varchar(500)")
                    .HasComment("返回字段")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.Sort)
                    .HasColumnName("sort")
                    .HasColumnType("int(11)")
                    .HasComment("排序序号");

                entity.Property(e => e.SourceId)
                    .HasColumnName("source_id")
                    .HasColumnType("int(11)")
                    .HasComment("原始数据");

                entity.Property(e => e.Status)
                    .HasColumnName("status")
                    .HasColumnType("int(11)")
                    .HasComment("状态");

                entity.Property(e => e.TableName)
                    .HasColumnName("table_name")
                    .HasColumnType("varchar(50)")
                    .HasComment("表名")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.UpdateDate)
                    .HasColumnName("update_date")
                    .HasColumnType("datetime")
                    .HasComment("修改时间");

                entity.Property(e => e.Version)
                    .HasColumnName("version")
                    .HasColumnType("int(11)")
                    .HasComment("版本号");
            });

            OnModelCreatingPartial(modelBuilder);
        }

        partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
    }
}
