using System;
using System.Collections.Generic;
using HoneyBox.Model.Entities;
using Microsoft.EntityFrameworkCore;

namespace HoneyBox.Model.Data;

public partial class HoneyBoxDbContext : DbContext
{
    public HoneyBoxDbContext()
    {
    }

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

    public virtual DbSet<Admin> Admins { get; set; }

    public virtual DbSet<AdminLoginLog> AdminLoginLogs { get; set; }

    public virtual DbSet<AdminOperationLog> AdminOperationLogs { get; set; }

    public virtual DbSet<Advert> Adverts { get; set; }

    public virtual DbSet<AdvertType> AdvertTypes { get; set; }

    public virtual DbSet<Config> Configs { get; set; }

    public virtual DbSet<Coupon> Coupons { get; set; }

    public virtual DbSet<CouponReceife> CouponReceives { get; set; }

    public virtual DbSet<Delivery> Deliveries { get; set; }

    public virtual DbSet<DiamondOrder> DiamondOrders { get; set; }

    public virtual DbSet<DiamondProduct> DiamondProducts { get; set; }

    public virtual DbSet<Good> Goods { get; set; }

    public virtual DbSet<GoodsExtension> GoodsExtensions { get; set; }

    public virtual DbSet<GoodsItem> GoodsItems { get; set; }

    public virtual DbSet<GoodsType> GoodsTypes { get; set; }

    public virtual DbSet<Order> Orders { get; set; }

    public virtual DbSet<OrderItem> OrderItems { get; set; }

    public virtual DbSet<OrderItemsRecovery> OrderItemsRecoveries { get; set; }

    public virtual DbSet<OrderItemsSend> OrderItemsSends { get; set; }

    public virtual DbSet<Picture> Pictures { get; set; }

    public virtual DbSet<PrizeLevel> PrizeLevels { get; set; }

    public virtual DbSet<ProfitIntegral> ProfitIntegrals { get; set; }

    public virtual DbSet<ProfitMoney> ProfitMoneys { get; set; }

    public virtual DbSet<ProfitMoney2> ProfitMoney2s { get; set; }

    public virtual DbSet<ProfitOuQi> ProfitOuQis { get; set; }

    public virtual DbSet<ProfitPay> ProfitPays { get; set; }

    public virtual DbSet<ProfitScore> ProfitScores { get; set; }

    public virtual DbSet<SignConfig> SignConfigs { get; set; }

    public virtual DbSet<Entities.T_Task> Tasks { get; set; }

    public virtual DbSet<User> Users { get; set; }

    public virtual DbSet<UserAccount> UserAccounts { get; set; }

    public virtual DbSet<UserAddress> UserAddresses { get; set; }

    public virtual DbSet<UserCoupon> UserCoupons { get; set; }

    public virtual DbSet<UserLoginLog> UserLoginLogs { get; set; }

    public virtual DbSet<UserSign> UserSigns { get; set; }

    public virtual DbSet<UserTask> UserTasks { get; set; }

    public virtual DbSet<UserEquityReward> UserEquityRewards { get; set; }

    public virtual DbSet<EquityLevel> EquityLevels { get; set; }

    public virtual DbSet<EquityLevelReward> EquityLevelRewards { get; set; }

    public virtual DbSet<RedeemCode> RedeemCodes { get; set; }

    public virtual DbSet<GoodsCollection> GoodsCollections { get; set; }

    public virtual DbSet<GoodsLock> GoodsLocks { get; set; }

    public virtual DbSet<UserRecharge> UserRecharges { get; set; }

    public virtual DbSet<OrderNotify> OrderNotifies { get; set; }

    public virtual DbSet<UserItemCard> UserItemCards { get; set; }

    public virtual DbSet<Danye> Danyes { get; set; }

    public virtual DbSet<Reward> Rewards { get; set; }

    public virtual DbSet<FloatBallConfig> FloatBallConfigs { get; set; }

    public virtual DbSet<WelfareHouse> WelfareHouses { get; set; }

    public virtual DbSet<RankWeek> RankWeeks { get; set; }

    public virtual DbSet<RankMonth> RankMonths { get; set; }

    public virtual DbSet<GoodsKingRank> GoodsKingRanks { get; set; }

    public virtual DbSet<UserRefreshToken> UserRefreshTokens { get; set; }

    public virtual DbSet<GoodsDesignatedPrize> GoodsDesignatedPrizes { get; set; }

    public virtual DbSet<PrizeAnnouncement> PrizeAnnouncements { get; set; }

    public virtual DbSet<UserPosterCache> UserPosterCaches { get; set; }

    protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
    {
        // Connection string is configured in Program.cs via dependency injection
        // Do not configure here when using DI
    }

    protected override void OnModelCreating(ModelBuilder modelBuilder)
    {
        modelBuilder.UseCollation("Chinese_PRC_CI_AS");

        modelBuilder.Entity<Admin>(entity =>
        {
            entity.HasKey(e => e.Id).HasName("pk_admins");

            entity.ToTable("admins", tb => tb.HasComment("管理员表，存储后台管理员信息"));

            entity.HasIndex(e => e.Status, "ix_admins_status");

            entity.HasIndex(e => e.Token, "ix_admins_token");

            entity.HasIndex(e => e.Username, "ix_admins_username");

            entity.Property(e => e.Id)
                .HasComment("主键ID")
                .HasColumnName("id");
            entity.Property(e => e.AdminId)
                .HasComment("上级管理员ID")
                .HasColumnName("admin_id");
            entity.Property(e => e.CreatedAt)
                .HasDefaultValueSql("(getdate())")
                .HasComment("创建时间")
                .HasColumnName("created_at");
            entity.Property(e => e.GetTime)
                .HasDefaultValueSql("(getdate())")
                .HasComment("获取时间")
                .HasColumnName("get_time");
            entity.Property(e => e.Nickname)
                .HasMaxLength(20)
                .HasComment("昵称")
                .HasColumnName("nickname");
            entity.Property(e => e.Password)
                .HasMaxLength(40)
                .HasComment("密码（加密）")
                .HasColumnName("password");
            entity.Property(e => e.Qid)
                .HasComment("权限组ID")
                .HasColumnName("qid");
            entity.Property(e => e.Random)
                .HasMaxLength(20)
                .HasComment("随机字符串")
                .HasColumnName("random");
            entity.Property(e => e.Status)
                .HasDefaultValue(0)
                .HasComment("状态：0-正常")
                .HasColumnName("status");
            entity.Property(e => e.Token)
                .HasMaxLength(100)
                .HasComment("登录令牌")
                .HasColumnName("token");
            entity.Property(e => e.UpdatedAt)
                .HasDefaultValueSql("(getdate())")
                .HasComment("更新时间")
                .HasColumnName("updated_at");
            entity.Property(e => e.Username)
                .HasMaxLength(20)
                .HasComment("用户名")
                .HasColumnName("username");
        });

        modelBuilder.Entity<AdminLoginLog>(entity =>
        {
            entity.HasKey(e => e.Id).HasName("pk_admin_login_logs");

            entity.ToTable("admin_login_logs", tb => tb.HasComment("管理员登录日志表，记录管理员登录信息（仅结构，不迁移历史数据）"));

            entity.HasIndex(e => e.AdminId, "ix_admin_login_logs_admin_id");

            entity.HasIndex(e => e.CreatedAt, "ix_admin_login_logs_created_at");

            entity.HasIndex(e => e.Ip, "ix_admin_login_logs_ip");

            entity.Property(e => e.Id)
                .HasComment("主键ID")
                .HasColumnName("id");
            entity.Property(e => e.AdminId)
                .HasComment("管理员ID")
                .HasColumnName("admin_id");
            entity.Property(e => e.CreatedAt)
                .HasDefaultValueSql("(getdate())")
                .HasComment("登录时间")
                .HasColumnName("created_at");
            entity.Property(e => e.Ip)
                .HasMaxLength(50)
                .HasComment("登录IP地址")
                .HasColumnName("ip");
        });

        modelBuilder.Entity<AdminOperationLog>(entity =>
        {
            entity.HasKey(e => e.Id).HasName("pk_admin_operation_logs");

            entity.ToTable("admin_operation_logs", tb => tb.HasComment("管理员操作日志表，记录管理员操作信息（仅结构，不迁移历史数据）"));

            entity.HasIndex(e => e.AdminId, "ix_admin_operation_logs_admin_id");

            entity.HasIndex(e => e.CreatedAt, "ix_admin_operation_logs_created_at");

            entity.HasIndex(e => e.Ip, "ix_admin_operation_logs_ip");

            entity.HasIndex(e => e.Operation, "ix_admin_operation_logs_operation");

            entity.Property(e => e.Id)
                .HasComment("主键ID")
                .HasColumnName("id");
            entity.Property(e => e.AdminId)
                .HasComment("管理员ID")
                .HasColumnName("admin_id");
            entity.Property(e => e.Content)
                .HasComment("操作内容详情")
                .HasColumnName("content");
            entity.Property(e => e.CreatedAt)
                .HasDefaultValueSql("(getdate())")
                .HasComment("操作时间")
                .HasColumnName("created_at");
            entity.Property(e => e.Ip)
                .HasMaxLength(50)
                .HasComment("操作IP地址")
                .HasColumnName("ip");
            entity.Property(e => e.Operation)
                .HasMaxLength(255)
                .HasComment("操作名称")
                .HasColumnName("operation");
        });

        modelBuilder.Entity<Advert>(entity =>
        {
            entity.HasKey(e => e.Id).HasName("pk_adverts");

            entity.ToTable("adverts", tb => tb.HasComment("广告配置表，存储轮播图和广告信息"));

            entity.HasIndex(e => e.CouponId, "ix_adverts_coupon_id");

            entity.HasIndex(e => e.GoodsId, "ix_adverts_goods_id");

            entity.HasIndex(e => e.Sort, "ix_adverts_sort");

            entity.HasIndex(e => e.Type, "ix_adverts_type");

            entity.Property(e => e.Id)
                .HasComment("主键ID")
                .HasColumnName("id");
            entity.Property(e => e.CouponId)
                .HasDefaultValue(0)
                .HasComment("关联优惠券ID")
                .HasColumnName("coupon_id");
            entity.Property(e => e.CreatedAt)
                .HasDefaultValueSql("(getdate())")
                .HasComment("创建时间")
                .HasColumnName("created_at");
            entity.Property(e => e.GoodsId)
                .HasDefaultValue(0)
                .HasComment("关联商品ID")
                .HasColumnName("goods_id");
            entity.Property(e => e.ImgUrl)
                .HasMaxLength(500)
                .HasComment("广告图片URL")
                .HasColumnName("img_url");
            entity.Property(e => e.Sort)
                .HasComment("排序值，越小越靠前")
                .HasColumnName("sort");
            entity.Property(e => e.Ttype)
                .HasDefaultValue((byte)0)
                .HasComment("跳转类型：0-无跳转")
                .HasColumnName("ttype");
            entity.Property(e => e.Type)
                .HasDefaultValue((byte)1)
                .HasComment("广告类型：1-首页轮播")
                .HasColumnName("type");
            entity.Property(e => e.UpdatedAt)
                .HasDefaultValueSql("(getdate())")
                .HasComment("更新时间")
                .HasColumnName("updated_at");
            entity.Property(e => e.Url)
                .HasMaxLength(225)
                .HasComment("跳转链接URL")
                .HasColumnName("url");
        });

        modelBuilder.Entity<AdvertType>(entity =>
        {
            entity.HasKey(e => e.Id).HasName("pk_advert_types");

            entity.ToTable("advert_types", tb => tb.HasComment("广告类型表，存储广告分类信息"));

            entity.HasIndex(e => e.Name, "uk_advert_types_name").IsUnique();

            entity.HasIndex(e => e.Sort, "ix_advert_types_sort");

            entity.Property(e => e.Id)
                .HasComment("主键ID")
                .HasColumnName("id");
            entity.Property(e => e.Name)
                .HasMaxLength(50)
                .HasComment("类型名称")
                .HasColumnName("name");
            entity.Property(e => e.Sort)
                .HasDefaultValue(0)
                .HasComment("排序值，越小越靠前")
                .HasColumnName("sort");
            entity.Property(e => e.CreatedAt)
                .HasDefaultValueSql("(getdate())")
                .HasComment("创建时间")
                .HasColumnName("created_at");
            entity.Property(e => e.UpdatedAt)
                .HasDefaultValueSql("(getdate())")
                .HasComment("更新时间")
                .HasColumnName("updated_at");
        });

        modelBuilder.Entity<Config>(entity =>
        {
            entity.HasKey(e => e.Id).HasName("pk_configs");

            entity.ToTable("configs", tb => tb.HasComment("系统配置表，存储系统各项配置信息"));

            entity.HasIndex(e => e.ConfigKey, "ix_configs_key");

            entity.HasIndex(e => e.ConfigKey, "uk_configs_key").IsUnique();

            entity.Property(e => e.Id)
                .HasComment("主键ID")
                .HasColumnName("id");
            entity.Property(e => e.ConfigKey)
                .HasMaxLength(255)
                .HasComment("配置键名")
                .HasColumnName("config_key");
            entity.Property(e => e.ConfigValue)
                .HasComment("配置值（JSON格式）")
                .HasColumnName("config_value");
        });

        modelBuilder.Entity<Coupon>(entity =>
        {
            entity.HasKey(e => e.Id).HasName("pk_coupons");

            entity.ToTable("coupons", tb => tb.HasComment("优惠券模板表"));

            entity.Property(e => e.Id)
                .HasComment("主键ID")
                .HasColumnName("id");
            entity.Property(e => e.CreatedAt)
                .HasDefaultValueSql("(getdate())")
                .HasComment("创建时间")
                .HasColumnName("created_at");
            entity.Property(e => e.EffectiveDay)
                .HasComment("有效天数")
                .HasColumnName("effective_day");
            entity.Property(e => e.ManPrice)
                .HasComment("满减门槛金额")
                .HasColumnType("decimal(10, 2)")
                .HasColumnName("man_price");
            entity.Property(e => e.Price)
                .HasComment("优惠金额")
                .HasColumnType("decimal(10, 2)")
                .HasColumnName("price");
            entity.Property(e => e.Sort)
                .HasDefaultValue(1)
                .HasComment("排序")
                .HasColumnName("sort");
            entity.Property(e => e.Status)
                .HasComment("状态: 0禁用 1启用")
                .HasColumnName("status");
            entity.Property(e => e.Title)
                .HasMaxLength(255)
                .HasComment("优惠券标题")
                .HasColumnName("title");
            entity.Property(e => e.Ttype)
                .HasDefaultValue((byte)0)
                .HasComment("优惠券子类型")
                .HasColumnName("ttype");
            entity.Property(e => e.Type)
                .HasDefaultValue((byte)0)
                .HasComment("优惠券类型")
                .HasColumnName("type");
        });

        modelBuilder.Entity<CouponReceife>(entity =>
        {
            entity.HasKey(e => e.Id).HasName("pk_coupon_receives");

            entity.ToTable("coupon_receives", tb => tb.HasComment("用户领取的优惠券表"));

            entity.HasIndex(e => e.CouponId, "ix_coupon_receives_coupon_id");

            entity.HasIndex(e => e.Status, "ix_coupon_receives_status");

            entity.HasIndex(e => e.UserId, "ix_coupon_receives_user_id");

            entity.Property(e => e.Id)
                .HasComment("主键ID")
                .HasColumnName("id");
            entity.Property(e => e.CouponId)
                .HasComment("优惠券模板ID")
                .HasColumnName("coupon_id");
            entity.Property(e => e.CreatedAt)
                .HasDefaultValueSql("(getdate())")
                .HasComment("创建时间")
                .HasColumnName("created_at");
            entity.Property(e => e.EndTime)
                .HasComment("过期时间")
                .HasColumnName("end_time");
            entity.Property(e => e.ManPrice)
                .HasComment("满减门槛金额")
                .HasColumnType("decimal(10, 2)")
                .HasColumnName("man_price");
            entity.Property(e => e.Price)
                .HasComment("优惠金额")
                .HasColumnType("decimal(10, 2)")
                .HasColumnName("price");
            entity.Property(e => e.State)
                .HasDefaultValue((byte)0)
                .HasComment("使用状态: 0未使用 1已使用")
                .HasColumnName("state");
            entity.Property(e => e.Status)
                .HasComment("状态: 0禁用 1启用")
                .HasColumnName("status");
            entity.Property(e => e.Title)
                .HasMaxLength(255)
                .HasComment("优惠券标题")
                .HasColumnName("title");
            entity.Property(e => e.Ttype)
                .HasComment("优惠券子类型")
                .HasColumnName("ttype");
            entity.Property(e => e.UserId)
                .HasComment("用户ID")
                .HasColumnName("user_id");
        });

        modelBuilder.Entity<Delivery>(entity =>
        {
            entity.HasKey(e => e.Id).HasName("pk_deliveries");

            entity.ToTable("deliveries", tb => tb.HasComment("快递公司配置表，存储快递公司信息"));

            entity.HasIndex(e => e.Code, "ix_deliveries_code");

            entity.Property(e => e.Id)
                .HasComment("主键ID")
                .HasColumnName("id");
            entity.Property(e => e.Code)
                .HasMaxLength(30)
                .HasComment("快递公司编码")
                .HasColumnName("code");
            entity.Property(e => e.Name)
                .HasMaxLength(50)
                .HasComment("快递公司名称")
                .HasColumnName("name");
        });

        modelBuilder.Entity<DiamondOrder>(entity =>
        {
            entity.HasKey(e => e.Id).HasName("pk_diamond_orders");

            entity.ToTable("diamond_orders", tb => tb.HasComment("钻石订单表"));

            entity.HasIndex(e => e.CreatedAt, "ix_diamond_orders_created_at");

            entity.HasIndex(e => e.DiamondId, "ix_diamond_orders_diamond_id");

            entity.HasIndex(e => e.Status, "ix_diamond_orders_status");

            entity.HasIndex(e => e.UserId, "ix_diamond_orders_user_id");

            entity.HasIndex(e => e.OrderNo, "uk_diamond_orders_order_no").IsUnique();

            entity.Property(e => e.Id)
                .HasComment("主键ID")
                .HasColumnName("id");
            entity.Property(e => e.AmountPaid)
                .HasComment("支付金额")
                .HasColumnType("decimal(10, 2)")
                .HasColumnName("amount_paid");
            entity.Property(e => e.CreatedAt)
                .HasDefaultValueSql("(getdate())")
                .HasComment("创建时间")
                .HasColumnName("created_at");
            entity.Property(e => e.DiamondId)
                .HasComment("钻石商品ID")
                .HasColumnName("diamond_id");
            entity.Property(e => e.IsFirstCharge)
                .HasDefaultValue((byte)0)
                .HasComment("是否首充: 0否 1是")
                .HasColumnName("is_first_charge");
            entity.Property(e => e.OrderNo)
                .HasMaxLength(64)
                .HasComment("订单号")
                .HasColumnName("order_no");
            entity.Property(e => e.PaidAt)
                .HasComment("支付时间")
                .HasColumnName("paid_at");
            entity.Property(e => e.PayMethod)
                .HasMaxLength(20)
                .HasComment("支付方式")
                .HasColumnName("pay_method");
            entity.Property(e => e.ProductId)
                .HasMaxLength(64)
                .HasComment("产品ID")
                .HasColumnName("product_id");
            entity.Property(e => e.ProductName)
                .HasMaxLength(50)
                .HasComment("产品名称")
                .HasColumnName("product_name");
            entity.Property(e => e.RewardLog)
                .HasMaxLength(300)
                .HasComment("奖励日志")
                .HasColumnName("reward_log");
            entity.Property(e => e.Status)
                .HasMaxLength(20)
                .HasDefaultValue("pending")
                .HasComment("订单状态: pending待支付 paid已支付 cancelled已取消")
                .HasColumnName("status");
            entity.Property(e => e.UserId)
                .HasComment("用户ID")
                .HasColumnName("user_id");
        });

        modelBuilder.Entity<DiamondProduct>(entity =>
        {
            entity.HasKey(e => e.Id).HasName("pk_diamond_products");

            entity.ToTable("diamond_products", tb => tb.HasComment("钻石商品配置表"));

            entity.HasIndex(e => e.SortOrder, "ix_diamond_products_sort_order");

            entity.HasIndex(e => e.Status, "ix_diamond_products_status");

            entity.Property(e => e.Id)
                .HasComment("主键ID")
                .HasColumnName("id");
            entity.Property(e => e.BaseReward)
                .HasMaxLength(64)
                .HasComment("基础奖励")
                .HasColumnName("base_reward");
            entity.Property(e => e.CreatedAt)
                .HasDefaultValueSql("(getdate())")
                .HasComment("创建时间")
                .HasColumnName("created_at");
            entity.Property(e => e.FirstBonusReward)
                .HasMaxLength(64)
                .HasComment("首充额外奖励")
                .HasColumnName("first_bonus_reward");
            entity.Property(e => e.FirstChargeImage)
                .HasMaxLength(255)
                .HasComment("首充图片URL")
                .HasColumnName("first_charge_image");
            entity.Property(e => e.FirstSelectChargeImage)
                .HasMaxLength(255)
                .HasComment("首充选中图片URL")
                .HasColumnName("first_select_charge_image");
            entity.Property(e => e.IsFirst)
                .HasDefaultValue((byte)0)
                .HasComment("是否首充商品: 0否 1是")
                .HasColumnName("is_first");
            entity.Property(e => e.Name)
                .HasMaxLength(50)
                .HasComment("商品名称")
                .HasColumnName("name");
            entity.Property(e => e.NormalImage)
                .HasMaxLength(255)
                .HasComment("普通图片URL")
                .HasColumnName("normal_image");
            entity.Property(e => e.NormalSelectImage)
                .HasMaxLength(255)
                .HasComment("普通选中图片URL")
                .HasColumnName("normal_select_image");
            entity.Property(e => e.Price)
                .HasComment("价格")
                .HasColumnType("decimal(10, 2)")
                .HasColumnName("price");
            entity.Property(e => e.ProductsId)
                .HasMaxLength(64)
                .HasComment("产品ID")
                .HasColumnName("products_id");
            entity.Property(e => e.ProductsType)
                .HasMaxLength(64)
                .HasComment("产品类型")
                .HasColumnName("products_type");
            entity.Property(e => e.SortOrder)
                .HasDefaultValue(0)
                .HasComment("排序")
                .HasColumnName("sort_order");
            entity.Property(e => e.Status)
                .HasDefaultValue((byte)1)
                .HasComment("状态: 0禁用 1启用")
                .HasColumnName("status");
            entity.Property(e => e.UpdatedAt)
                .HasDefaultValueSql("(getdate())")
                .HasComment("更新时间")
                .HasColumnName("updated_at");
        });

        modelBuilder.Entity<Good>(entity =>
        {
            entity.HasKey(e => e.Id).HasName("pk_goods");

            entity.ToTable("goods", tb => tb.HasComment("商品主表，存储盲盒商品信息"));

            entity.HasIndex(e => e.CategoryId, "ix_goods_category_id");

            entity.HasIndex(e => e.CreatedAt, "ix_goods_created_at");

            entity.HasIndex(e => e.IsFlw, "ix_goods_is_flw");

            entity.HasIndex(e => e.Status, "ix_goods_status");

            entity.HasIndex(e => e.Type, "ix_goods_type");

            entity.Property(e => e.Id)
                .HasComment("商品ID")
                .HasColumnName("id");
            entity.Property(e => e.AsyncCode)
                .HasMaxLength(64)
                .HasComment("异步处理编码")
                .HasColumnName("async_code");
            entity.Property(e => e.AsyncDate)
                .HasComment("异步处理日期")
                .HasColumnName("async_date");
            entity.Property(e => e.CardBanner)
                .HasMaxLength(255)
                .HasComment("卡片横幅图片")
                .HasColumnName("card_banner");
            entity.Property(e => e.CardNotice)
                .HasMaxLength(255)
                .HasComment("卡片公告")
                .HasColumnName("card_notice");
            entity.Property(e => e.CardNum)
                .HasDefaultValue(1)
                .HasComment("卡片数量")
                .HasColumnName("card_num");
            entity.Property(e => e.CardSet)
                .HasComment("卡片设置JSON")
                .HasColumnName("card_set");
            entity.Property(e => e.CategoryId)
                .HasComment("分类ID")
                .HasColumnName("category_id");
            entity.Property(e => e.ChoujiangXianzhi)
                .HasComment("抽奖限制次数")
                .HasColumnName("choujiang_xianzhi");
            entity.Property(e => e.CouponIs)
                .HasComment("是否支持优惠券 0-否 1-是")
                .HasColumnName("coupon_is");
            entity.Property(e => e.CouponPro)
                .HasComment("优惠券比例")
                .HasColumnName("coupon_pro");
            entity.Property(e => e.CreatedAt)
                .HasDefaultValueSql("(getdate())")
                .HasComment("创建时间")
                .HasColumnName("created_at");
            entity.Property(e => e.DailyXiangou)
                .HasComment("每日限购数量")
                .HasColumnName("daily_xiangou");
            entity.Property(e => e.DayPayPrice)
                .HasComment("日支付价格")
                .HasColumnType("decimal(10, 2)")
                .HasColumnName("day_pay_price");
            entity.Property(e => e.DayPrice)
                .HasComment("日价格")
                .HasColumnType("decimal(10, 2)")
                .HasColumnName("day_price");
            entity.Property(e => e.DeletedAt)
                .HasComment("删除时间")
                .HasColumnName("deleted_at");
            entity.Property(e => e.FlwEndTime)
                .HasComment("福利屋结束时间")
                .HasColumnName("flw_end_time");
            entity.Property(e => e.FlwStartTime)
                .HasComment("福利屋开始时间")
                .HasColumnName("flw_start_time");
            entity.Property(e => e.GoodsDescribe)
                .HasMaxLength(300)
                .HasComment("商品描述")
                .HasColumnName("goods_describe");
            entity.Property(e => e.ImgUrl)
                .HasMaxLength(255)
                .HasComment("商品图片URL")
                .HasColumnName("img_url");
            entity.Property(e => e.ImgUrlDetail)
                .HasMaxLength(255)
                .HasComment("商品详情图片URL")
                .HasColumnName("img_url_detail");
            entity.Property(e => e.ImgUrlBanner)
                .HasMaxLength(500)
                .HasComment("商品详情页Banner图片URL（商城类型专用）")
                .HasColumnName("imgurl_banner");
            entity.Property(e => e.IntegralIs)
                .HasComment("是否支持积分 0-否 1-是")
                .HasColumnName("integral_is");
            entity.Property(e => e.IsAutoXiajia)
                .HasComment("是否自动下架 0-否 1-是")
                .HasColumnName("is_auto_xiajia");
            entity.Property(e => e.IsFlw)
                .HasComment("是否福利屋商品 0-否 1-是")
                .HasColumnName("is_flw");
            entity.Property(e => e.IsOpen)
                .HasComment("是否开放 0-否 1-是")
                .HasColumnName("is_open");
            entity.Property(e => e.IsShouZhe)
                .HasComment("是否首折 0-否 1-是")
                .HasColumnName("is_shou_zhe");
            entity.Property(e => e.ItemCardId)
                .HasComment("物品卡片ID")
                .HasColumnName("item_card_id");
            entity.Property(e => e.KingUserId)
                .HasComment("擂台王用户ID")
                .HasColumnName("king_user_id");
            entity.Property(e => e.LianJiNum)
                .HasComment("连击次数")
                .HasColumnName("lian_ji_num");
            entity.Property(e => e.LianJiShangId)
                .HasComment("连击奖品等级ID")
                .HasColumnName("lian_ji_shang_id");
            entity.Property(e => e.LingzhuFan)
                .HasComment("灵珠翻倍")
                .HasColumnName("lingzhu_fan");
            entity.Property(e => e.LingzhuIs)
                .HasComment("是否开启灵珠 0-否 1-是")
                .HasColumnName("lingzhu_is");
            entity.Property(e => e.LingzhuShangId)
                .HasComment("灵珠奖品等级ID")
                .HasColumnName("lingzhu_shang_id");
            entity.Property(e => e.LockIs)
                .HasComment("是否锁定 0-否 1-是")
                .HasColumnName("lock_is");
            entity.Property(e => e.LockTime)
                .HasComment("锁定时间")
                .HasColumnName("lock_time");
            entity.Property(e => e.MouthPayPrice)
                .HasComment("月支付价格")
                .HasColumnType("decimal(10, 2)")
                .HasColumnName("mouth_pay_price");
            entity.Property(e => e.MouthPrice)
                .HasComment("月价格")
                .HasColumnType("decimal(10, 2)")
                .HasColumnName("mouth_price");
            entity.Property(e => e.NewIs)
                .HasComment("是否新品 0-否 1-是")
                .HasColumnName("new_is");
            entity.Property(e => e.OpenTime)
                .HasComment("开放时间")
                .HasColumnName("open_time");
            entity.Property(e => e.Price)
                .HasComment("商品价格")
                .HasColumnType("decimal(10, 2)")
                .HasColumnName("price");
            entity.Property(e => e.PrizeImgUrl)
                .HasMaxLength(255)
                .HasComment("奖品图片URL")
                .HasColumnName("prize_img_url");
            entity.Property(e => e.PrizeNum)
                .HasComment("奖品数量")
                .HasColumnName("prize_num");
            entity.Property(e => e.QuanjuXiangou)
                .HasComment("全局限购数量")
                .HasColumnName("quanju_xiangou");
            entity.Property(e => e.Rage)
                .HasComment("暴怒值")
                .HasColumnName("rage");
            entity.Property(e => e.RageIs)
                .HasComment("是否开启暴怒 0-否 1-是")
                .HasColumnName("rage_is");
            entity.Property(e => e.SaleStock)
                .HasComment("已售库存")
                .HasColumnName("sale_stock");
            entity.Property(e => e.SaleTime)
                .HasComment("开售时间")
                .HasColumnName("sale_time");
            entity.Property(e => e.ShowIs)
                .HasComment("是否显示 0-否 1-是")
                .HasColumnName("show_is");
            entity.Property(e => e.ShowPrice)
                .HasMaxLength(100)
                .HasComment("显示价格")
                .HasColumnName("show_price");
            entity.Property(e => e.Sort)
                .HasDefaultValue(1)
                .HasComment("排序值")
                .HasColumnName("sort");
            entity.Property(e => e.Status)
                .HasDefaultValue((byte)1)
                .HasComment("状态 0-下架 1-上架")
                .HasColumnName("status");
            entity.Property(e => e.Stock)
                .HasComment("总库存")
                .HasColumnName("stock");
            entity.Property(e => e.Title)
                .HasMaxLength(255)
                .HasComment("商品标题")
                .HasColumnName("title");
            entity.Property(e => e.Type)
                .HasComment("商品类型")
                .HasColumnName("type");
            entity.Property(e => e.UnlockAmount)
                .HasComment("解锁金额")
                .HasColumnType("decimal(10, 2)")
                .HasColumnName("unlock_amount");
            entity.Property(e => e.UpdatedAt)
                .HasDefaultValueSql("(getdate())")
                .HasComment("更新时间")
                .HasColumnName("updated_at");
            entity.Property(e => e.UserLv)
                .HasDefaultValue(-1)
                .HasComment("用户等级限制 -1表示无限制")
                .HasColumnName("user_lv");
            entity.Property(e => e.XiajiaAutoCoushu)
                .HasComment("下架自动次数")
                .HasColumnName("xiajia_auto_coushu");
            entity.Property(e => e.XiajiaJine)
                .HasComment("下架金额阈值")
                .HasColumnName("xiajia_jine");
            entity.Property(e => e.XiajiaLirun)
                .HasComment("下架利润阈值")
                .HasColumnName("xiajia_lirun");
        });

        modelBuilder.Entity<GoodsExtension>(entity =>
        {
            entity.HasKey(e => e.Id).HasName("pk_goods_extensions");

            entity.ToTable("goods_extensions", tb => tb.HasComment("商品扩展配置表，存储商品的支付方式配置"));

            entity.HasIndex(e => e.GoodsId, "ix_goods_extensions_goods_id");

            entity.Property(e => e.Id)
                .HasComment("扩展ID")
                .HasColumnName("id");
            entity.Property(e => e.GoodsId)
                .HasComment("商品ID")
                .HasColumnName("goods_id");
            entity.Property(e => e.IsDeduction)
                .HasDefaultValue((byte)1)
                .HasComment("是否支持抵扣 0-否 1-是")
                .HasColumnName("is_deduction");
            entity.Property(e => e.PayBalance)
                .HasDefaultValue((byte)1)
                .HasComment("是否支持余额支付 0-否 1-是")
                .HasColumnName("pay_balance");
            entity.Property(e => e.PayCoupon)
                .HasDefaultValue((byte)1)
                .HasComment("是否支持优惠券 0-否 1-是")
                .HasColumnName("pay_coupon");
            entity.Property(e => e.PayCurrency)
                .HasDefaultValue((byte)1)
                .HasComment("是否支持积分支付 0-否 1-是")
                .HasColumnName("pay_currency");
            entity.Property(e => e.PayCurrency2)
                .HasDefaultValue((byte)1)
                .HasComment("是否支持积分2支付 0-否 1-是")
                .HasColumnName("pay_currency2");
            entity.Property(e => e.PayWechat)
                .HasDefaultValue((byte)1)
                .HasComment("是否支持微信支付 0-否 1-是")
                .HasColumnName("pay_wechat");
        });

        modelBuilder.Entity<GoodsItem>(entity =>
        {
            entity.HasKey(e => e.Id).HasName("pk_goods_items");

            entity.ToTable("goods_items", tb => tb.HasComment("商品奖品列表，存储盲盒中的奖品信息"));

            entity.HasIndex(e => e.CardNo, "ix_goods_items_card_no");

            entity.HasIndex(e => e.GoodsId, "ix_goods_items_goods_id");

            entity.HasIndex(e => e.Num, "ix_goods_items_num");

            entity.HasIndex(e => e.PrizeCode, "ix_goods_items_prize_code");

            entity.HasIndex(e => e.RealPro, "ix_goods_items_real_pro");

            entity.HasIndex(e => e.ShangId, "ix_goods_items_shang_id");

            entity.HasIndex(e => e.Stock, "ix_goods_items_stock");

            entity.HasIndex(e => e.SurplusStock, "ix_goods_items_surplus_stock");

            entity.Property(e => e.Id)
                .HasComment("奖品ID")
                .HasColumnName("id");
            entity.Property(e => e.CardNo)
                .HasMaxLength(100)
                .HasComment("卡片编号")
                .HasColumnName("card_no");
            entity.Property(e => e.CreatedAt)
                .HasComment("创建时间")
                .HasColumnName("created_at");
            entity.Property(e => e.Doubling)
                .HasComment("翻倍倍数")
                .HasColumnName("doubling");
            entity.Property(e => e.GiveMoney)
                .HasComment("赠送金额")
                .HasColumnName("give_money");
            entity.Property(e => e.GoodsId)
                .HasComment("商品ID")
                .HasColumnName("goods_id");
            entity.Property(e => e.GoodsListId)
                .HasComment("关联奖品列表ID")
                .HasColumnName("goods_list_id");
            entity.Property(e => e.GoodsType)
                .HasDefaultValue((byte)1)
                .HasComment("商品类型 1-实物 2-虚拟")
                .HasColumnName("goods_type");
            entity.Property(e => e.ImgUrl)
                .HasMaxLength(255)
                .HasComment("奖品图片URL")
                .HasColumnName("img_url");
            entity.Property(e => e.ImgUrlDetail)
                .HasMaxLength(255)
                .HasComment("奖品详情图片URL")
                .HasColumnName("img_url_detail");
            entity.Property(e => e.IsLingzhu)
                .HasComment("是否灵珠奖品 0-否 1-是")
                .HasColumnName("is_lingzhu");
            entity.Property(e => e.LianJiType)
                .HasComment("连击类型")
                .HasColumnName("lian_ji_type");
            entity.Property(e => e.Money)
                .HasComment("回收金额")
                .HasColumnType("decimal(10, 2)")
                .HasColumnName("money");
            entity.Property(e => e.Num)
                .HasComment("奖品编号")
                .HasColumnName("num");
            entity.Property(e => e.Price)
                .HasComment("奖品价格")
                .HasColumnType("decimal(10, 2)")
                .HasColumnName("price");
            entity.Property(e => e.PrizeCode)
                .HasMaxLength(30)
                .HasComment("奖品编码")
                .HasColumnName("prize_code");
            entity.Property(e => e.PrizeNum)
                .HasComment("奖品数量")
                .HasColumnName("prize_num");
            entity.Property(e => e.Rank)
                .HasComment("排名")
                .HasColumnName("rank");
            entity.Property(e => e.RealPro)
                .HasComment("真实概率")
                .HasColumnType("decimal(10, 5)")
                .HasColumnName("real_pro");
            entity.Property(e => e.RewardId)
                .HasMaxLength(64)
                .HasComment("奖励ID")
                .HasColumnName("reward_id");
            entity.Property(e => e.RewardNum)
                .HasComment("奖励数量")
                .HasColumnName("reward_num");
            entity.Property(e => e.SaleTime)
                .HasComment("开售时间")
                .HasColumnName("sale_time");
            entity.Property(e => e.ScMoney)
                .HasComment("市场回收金额")
                .HasColumnType("decimal(10, 2)")
                .HasColumnName("sc_money");
            entity.Property(e => e.ShangId)
                .HasComment("奖品等级ID")
                .HasColumnName("shang_id");
            entity.Property(e => e.Sort)
                .HasComment("排序值")
                .HasColumnName("sort");
            entity.Property(e => e.SpecialStock)
                .HasDefaultValue(-100)
                .HasComment("特殊库存")
                .HasColumnName("special_stock");
            entity.Property(e => e.Stock)
                .HasComment("总库存")
                .HasColumnName("stock");
            entity.Property(e => e.SurplusStock)
                .HasComment("剩余库存")
                .HasColumnName("surplus_stock");
            entity.Property(e => e.Title)
                .HasMaxLength(255)
                .HasComment("奖品标题")
                .HasColumnName("title");
            entity.Property(e => e.Type)
                .HasComment("类型")
                .HasColumnName("type");
            entity.Property(e => e.UpdatedAt)
                .HasDefaultValueSql("(getdate())")
                .HasComment("更新时间")
                .HasColumnName("updated_at");
        });

        modelBuilder.Entity<GoodsType>(entity =>
        {
            entity.HasKey(e => e.Id).HasName("pk_goods_types");

            entity.ToTable("goods_types", tb => tb.HasComment("商品类型配置表，存储盲盒商品分类信息"));

            entity.HasIndex(e => e.IsShow, "ix_goods_types_is_show");

            entity.HasIndex(e => e.Value, "ix_goods_types_value");

            entity.Property(e => e.Id)
                .HasComment("类型ID")
                .HasColumnName("id");
            entity.Property(e => e.CornerText)
                .HasMaxLength(255)
                .HasComment("角标文字")
                .HasColumnName("corner_text");
            entity.Property(e => e.FlName)
                .HasMaxLength(30)
                .HasDefaultValue("")
                .HasComment("分类名称")
                .HasColumnName("fl_name");
            entity.Property(e => e.IsDeduction)
                .HasDefaultValue((byte)1)
                .HasComment("是否支持抵扣 0-否 1-是")
                .HasColumnName("is_deduction");
            entity.Property(e => e.IsFenlei)
                .HasComment("是否分类 0-否 1-是")
                .HasColumnName("is_fenlei");
            entity.Property(e => e.IsShow)
                .HasDefaultValue((byte)1)
                .HasComment("是否显示 0-否 1-是")
                .HasColumnName("is_show");
            entity.Property(e => e.Name)
                .HasMaxLength(30)
                .HasComment("类型名称")
                .HasColumnName("name");
            entity.Property(e => e.PayBalance)
                .HasDefaultValue((byte)1)
                .HasComment("是否支持余额支付 0-否 1-是")
                .HasColumnName("pay_balance");
            entity.Property(e => e.PayCoupon)
                .HasDefaultValue((byte)1)
                .HasComment("是否支持优惠券 0-否 1-是")
                .HasColumnName("pay_coupon");
            entity.Property(e => e.PayCurrency)
                .HasDefaultValue((byte)1)
                .HasComment("是否支持积分支付 0-否 1-是")
                .HasColumnName("pay_currency");
            entity.Property(e => e.PayCurrency2)
                .HasDefaultValue((byte)1)
                .HasComment("是否支持积分2支付 0-否 1-是")
                .HasColumnName("pay_currency2");
            entity.Property(e => e.PayWechat)
                .HasDefaultValue((byte)1)
                .HasComment("是否支持微信支付 0-否 1-是")
                .HasColumnName("pay_wechat");
            entity.Property(e => e.Remark)
                .HasMaxLength(255)
                .HasComment("备注")
                .HasColumnName("remark");
            entity.Property(e => e.SortOrder)
                .HasComment("排序值")
                .HasColumnName("sort_order");
            entity.Property(e => e.Value)
                .HasComment("类型值")
                .HasColumnName("value");
        });

        modelBuilder.Entity<Order>(entity =>
        {
            entity.HasKey(e => e.Id).HasName("pk_orders");

            entity.ToTable("orders", tb => tb.HasComment("订单主表，存储用户订单信息"));

            entity.HasIndex(e => e.GoodsId, "ix_orders_goods_id");

            entity.HasIndex(e => e.Num, "ix_orders_num");

            entity.HasIndex(e => e.Status, "ix_orders_status");

            entity.HasIndex(e => e.UserId, "ix_orders_user_id");

            entity.HasIndex(e => e.OrderNum, "uk_orders_order_num").IsUnique();

            entity.Property(e => e.Id)
                .HasComment("订单ID，主键自增")
                .HasColumnName("id");
            entity.Property(e => e.AdId)
                .HasDefaultValue(0)
                .HasComment("广告ID")
                .HasColumnName("ad_id");
            entity.Property(e => e.Addtime)
                .HasComment("创建时间戳")
                .HasColumnName("addtime");
            entity.Property(e => e.ClickId)
                .HasComment("点击ID")
                .HasColumnName("click_id");
            entity.Property(e => e.CouponId)
                .HasDefaultValue(0)
                .HasComment("使用的优惠券ID")
                .HasColumnName("coupon_id");
            entity.Property(e => e.CreatedAt)
                .HasDefaultValueSql("(getdate())")
                .HasComment("记录创建时间")
                .HasColumnName("created_at");
            entity.Property(e => e.GoodsId)
                .HasComment("商品ID")
                .HasColumnName("goods_id");
            entity.Property(e => e.GoodsImgurl)
                .HasMaxLength(200)
                .HasComment("商品图片快照")
                .HasColumnName("goods_imgurl");
            entity.Property(e => e.GoodsPrice)
                .HasComment("商品单价")
                .HasColumnType("decimal(10, 2)")
                .HasColumnName("goods_price");
            entity.Property(e => e.GoodsTitle)
                .HasMaxLength(100)
                .HasComment("商品标题快照")
                .HasColumnName("goods_title");
            entity.Property(e => e.IsFlw)
                .HasComment("是否福利屋订单：0否，1是")
                .HasColumnName("is_flw");
            entity.Property(e => e.IsMibao)
                .HasDefaultValue((byte)0)
                .HasComment("是否秘宝：0否，1是")
                .HasColumnName("is_mibao");
            entity.Property(e => e.IsShouZhe)
                .HasDefaultValue((byte)0)
                .HasComment("是否首折：0否，1是")
                .HasColumnName("is_shou_zhe");
            entity.Property(e => e.KdIs)
                .HasComment("是否快递：0否，1是")
                .HasColumnName("kd_is");
            entity.Property(e => e.Num)
                .HasComment("购买数量/抽奖次数")
                .HasColumnName("num");
            entity.Property(e => e.OrderNum)
                .HasMaxLength(60)
                .HasComment("订单编号，唯一")
                .HasColumnName("order_num");
            entity.Property(e => e.OrderTotal)
                .HasComment("订单总金额")
                .HasColumnType("decimal(10, 2)")
                .HasColumnName("order_total");
            entity.Property(e => e.OrderType)
                .HasComment("订单类型：0普通，1福利屋")
                .HasColumnName("order_type");
            entity.Property(e => e.OrderZheTotal)
                .HasComment("折后订单总金额")
                .HasColumnType("decimal(10, 2)")
                .HasColumnName("order_zhe_total");
            entity.Property(e => e.PayTime)
                .HasComment("支付时间戳")
                .HasColumnName("pay_time");
            entity.Property(e => e.PayType)
                .HasDefaultValue((byte)1)
                .HasComment("支付方式：1微信，2支付宝")
                .HasColumnName("pay_type");
            entity.Property(e => e.Price)
                .HasComment("实际支付价格")
                .HasColumnType("decimal(10, 2)")
                .HasColumnName("price");
            entity.Property(e => e.PrizeCardSet)
                .HasComment("中奖卡片集合JSON")
                .HasColumnName("prize_card_set");
            entity.Property(e => e.PrizeNum)
                .HasComment("中奖数量")
                .HasColumnName("prize_num");
            entity.Property(e => e.Status)
                .HasComment("订单状态：0待支付，1已支付，2已取消")
                .HasColumnName("status");
            entity.Property(e => e.UpdatedAt)
                .HasDefaultValueSql("(getdate())")
                .HasComment("记录更新时间")
                .HasColumnName("updated_at");
            entity.Property(e => e.UseCoupon)
                .HasDefaultValue(0.00m)
                .HasComment("优惠券抵扣金额")
                .HasColumnType("decimal(10, 2)")
                .HasColumnName("use_coupon");
            entity.Property(e => e.UseDraw)
                .HasDefaultValue(0)
                .HasComment("使用抽奖次数")
                .HasColumnName("use_draw");
            entity.Property(e => e.UseIntegral)
                .HasComment("使用积分金额")
                .HasColumnType("decimal(10, 2)")
                .HasColumnName("use_integral");
            entity.Property(e => e.UseItemCard)
                .HasDefaultValue(0)
                .HasComment("使用道具卡数量")
                .HasColumnName("use_item_card");
            entity.Property(e => e.UseMoney)
                .HasComment("使用余额金额")
                .HasColumnType("decimal(10, 2)")
                .HasColumnName("use_money");
            entity.Property(e => e.UseMoney2)
                .HasComment("使用积分2金额")
                .HasColumnType("decimal(10, 2)")
                .HasColumnName("use_money2");
            entity.Property(e => e.UseScore)
                .HasComment("使用评分金额")
                .HasColumnType("decimal(10, 2)")
                .HasColumnName("use_score");
            entity.Property(e => e.UserId)
                .HasComment("用户ID")
                .HasColumnName("user_id");
            entity.Property(e => e.ZdfhIs)
                .HasComment("是否自动发货：0否，1是")
                .HasColumnName("zdfh_is");
            entity.Property(e => e.ZdfhTime)
                .HasDefaultValue(0)
                .HasComment("自动发货时间戳")
                .HasColumnName("zdfh_time");
            entity.Property(e => e.Zhe)
                .HasComment("折扣比例")
                .HasColumnType("decimal(10, 2)")
                .HasColumnName("zhe");
        });

        modelBuilder.Entity<OrderItem>(entity =>
        {
            entity.HasKey(e => e.Id).HasName("pk_order_items");

            entity.ToTable("order_items", tb => tb.HasComment("订单详情表，存储订单中的抽奖结果/奖品信息"));

            entity.HasIndex(e => e.GoodsId, "ix_order_items_goods_id");

            entity.HasIndex(e => e.GoodslistId, "ix_order_items_goodslist_id");

            entity.HasIndex(e => e.GoodslistType, "ix_order_items_goodslist_type");

            entity.HasIndex(e => e.InsuranceIs, "ix_order_items_insurance_is");

            entity.HasIndex(e => e.Num, "ix_order_items_num");

            entity.HasIndex(e => e.OrderId, "ix_order_items_order_id");

            entity.HasIndex(e => e.OrderType, "ix_order_items_order_type");

            entity.HasIndex(e => e.PrizeCode, "ix_order_items_prize_code");

            entity.HasIndex(e => e.RecoveryNum, "ix_order_items_recovery_num");

            entity.HasIndex(e => e.SendNum, "ix_order_items_send_num");

            entity.HasIndex(e => e.ShangId, "ix_order_items_shang_id");

            entity.HasIndex(e => e.Status, "ix_order_items_status");

            entity.HasIndex(e => e.UserId, "ix_order_items_user_id");

            entity.Property(e => e.Id)
                .HasComment("订单详情ID，主键自增")
                .HasColumnName("id");
            entity.Property(e => e.Addtime)
                .HasComment("创建时间戳")
                .HasColumnName("addtime");
            entity.Property(e => e.ChoiceTime)
                .HasComment("选择时间戳")
                .HasColumnName("choice_time");
            entity.Property(e => e.CreatedAt)
                .HasDefaultValueSql("(getdate())")
                .HasComment("记录创建时间")
                .HasColumnName("created_at");
            entity.Property(e => e.Deltime)
                .HasComment("删除时间戳")
                .HasColumnName("deltime");
            entity.Property(e => e.Doubling)
                .HasComment("翻倍倍数")
                .HasColumnName("doubling");
            entity.Property(e => e.FhRemarks)
                .HasMaxLength(255)
                .HasComment("发货备注")
                .HasColumnName("fh_remarks");
            entity.Property(e => e.FhStatus)
                .HasComment("发货状态")
                .HasColumnName("fh_status");
            entity.Property(e => e.GoodsId)
                .HasDefaultValue(0)
                .HasComment("商品ID")
                .HasColumnName("goods_id");
            entity.Property(e => e.GoodslistId)
                .HasComment("商品奖品ID")
                .HasColumnName("goodslist_id");
            entity.Property(e => e.GoodslistImgurl)
                .HasMaxLength(255)
                .HasComment("奖品图片快照")
                .HasColumnName("goodslist_imgurl");
            entity.Property(e => e.GoodslistMoney)
                .HasComment("回收金额")
                .HasColumnType("decimal(10, 2)")
                .HasColumnName("goodslist_money");
            entity.Property(e => e.GoodslistPrice)
                .HasComment("奖品价格")
                .HasColumnType("decimal(10, 2)")
                .HasColumnName("goodslist_price");
            entity.Property(e => e.GoodslistSaleTime)
                .HasComment("奖品销售时间戳")
                .HasColumnName("goodslist_sale_time");
            entity.Property(e => e.GoodslistTitle)
                .HasMaxLength(100)
                .HasComment("奖品标题快照")
                .HasColumnName("goodslist_title");
            entity.Property(e => e.GoodslistType)
                .HasDefaultValue((byte)1)
                .HasComment("奖品类型：1实物，2虚拟")
                .HasColumnName("goodslist_type");
            entity.Property(e => e.InsuranceIs)
                .HasComment("是否保险：0否，1是")
                .HasColumnName("insurance_is");
            entity.Property(e => e.IsChong)
                .HasDefaultValue((byte)0)
                .HasComment("是否重复：0否，1是")
                .HasColumnName("is_chong");
            entity.Property(e => e.IsLingzhu)
                .HasComment("是否灵珠：0否，1是")
                .HasColumnName("is_lingzhu");
            entity.Property(e => e.LuckNo)
                .HasComment("幸运号码")
                .HasColumnName("luck_no");
            entity.Property(e => e.Num)
                .HasComment("抽奖次数序号")
                .HasColumnName("num");
            entity.Property(e => e.OrderId)
                .HasComment("关联订单ID")
                .HasColumnName("order_id");
            entity.Property(e => e.OrderListId)
                .HasComment("关联订单详情ID")
                .HasColumnName("order_list_id");
            entity.Property(e => e.OrderType)
                .HasComment("订单类型：0普通，1福利屋")
                .HasColumnName("order_type");
            entity.Property(e => e.ParentGoodsListId)
                .HasComment("父商品奖品ID")
                .HasColumnName("parent_goods_list_id");
            entity.Property(e => e.PrizeCode)
                .HasMaxLength(30)
                .HasComment("奖品编码")
                .HasColumnName("prize_code");
            entity.Property(e => e.RecoveryNum)
                .HasMaxLength(100)
                .HasComment("回收单号")
                .HasColumnName("recovery_num");
            entity.Property(e => e.SendNum)
                .HasMaxLength(100)
                .HasComment("发货单号")
                .HasColumnName("send_num");
            entity.Property(e => e.ShangId)
                .HasComment("奖品等级ID")
                .HasColumnName("shang_id");
            entity.Property(e => e.Source)
                .HasDefaultValue((byte)1)
                .HasComment("来源：1普通，2其他")
                .HasColumnName("source");
            entity.Property(e => e.Status)
                .HasComment("状态：0待处理，1已回收，2已发货")
                .HasColumnName("status");
            entity.Property(e => e.UpdatedAt)
                .HasDefaultValueSql("(getdate())")
                .HasComment("记录更新时间")
                .HasColumnName("updated_at");
            entity.Property(e => e.UserId)
                .HasComment("用户ID")
                .HasColumnName("user_id");
        });

        modelBuilder.Entity<OrderItemsRecovery>(entity =>
        {
            entity.HasKey(e => e.Id).HasName("pk_order_items_recovery");

            entity.ToTable("order_items_recovery", tb => tb.HasComment("订单奖品回收记录表，存储用户回收奖品的汇总信息"));

            entity.HasIndex(e => e.UserId, "ix_order_items_recovery_user_id");

            entity.HasIndex(e => e.RecoveryNum, "uk_order_items_recovery_num").IsUnique();

            entity.Property(e => e.Id)
                .HasComment("回收记录ID，主键自增")
                .HasColumnName("id");
            entity.Property(e => e.Addtime)
                .HasComment("创建时间戳")
                .HasColumnName("addtime");
            entity.Property(e => e.Count)
                .HasComment("回收奖品数量")
                .HasColumnName("count");
            entity.Property(e => e.CreatedAt)
                .HasDefaultValueSql("(getdate())")
                .HasComment("记录创建时间")
                .HasColumnName("created_at");
            entity.Property(e => e.Money)
                .HasComment("回收总金额")
                .HasColumnType("decimal(10, 2)")
                .HasColumnName("money");
            entity.Property(e => e.RecoveryNum)
                .HasMaxLength(100)
                .HasComment("回收单号，唯一")
                .HasColumnName("recovery_num");
            entity.Property(e => e.UpdatedAt)
                .HasDefaultValueSql("(getdate())")
                .HasComment("记录更新时间")
                .HasColumnName("updated_at");
            entity.Property(e => e.UserId)
                .HasComment("用户ID")
                .HasColumnName("user_id");
        });

        modelBuilder.Entity<OrderItemsSend>(entity =>
        {
            entity.HasKey(e => e.Id).HasName("pk_order_items_send");

            entity.ToTable("order_items_send", tb => tb.HasComment("订单发货记录表，存储用户申请发货的汇总信息"));

            entity.HasIndex(e => e.Status, "ix_order_items_send_status");

            entity.HasIndex(e => e.UserId, "ix_order_items_send_user_id");

            entity.HasIndex(e => e.SendNum, "uk_order_items_send_num").IsUnique();

            entity.Property(e => e.Id)
                .HasComment("发货记录ID，主键自增")
                .HasColumnName("id");
            entity.Property(e => e.Address)
                .HasMaxLength(255)
                .HasComment("收货地址")
                .HasColumnName("address");
            entity.Property(e => e.Addtime)
                .HasComment("创建时间戳")
                .HasColumnName("addtime");
            entity.Property(e => e.AdminId)
                .HasComment("操作管理员ID")
                .HasColumnName("admin_id");
            entity.Property(e => e.CancelTime)
                .HasComment("取消时间戳")
                .HasColumnName("cancel_time");
            entity.Property(e => e.Count)
                .HasComment("发货奖品数量")
                .HasColumnName("count");
            entity.Property(e => e.CourierCode)
                .HasMaxLength(50)
                .HasComment("快递公司编码")
                .HasColumnName("courier_code");
            entity.Property(e => e.CourierName)
                .HasMaxLength(255)
                .HasComment("快递公司名称")
                .HasColumnName("courier_name");
            entity.Property(e => e.CourierNumber)
                .HasMaxLength(50)
                .HasComment("快递单号")
                .HasColumnName("courier_number");
            entity.Property(e => e.CreatedAt)
                .HasDefaultValueSql("(getdate())")
                .HasComment("记录创建时间")
                .HasColumnName("created_at");
            entity.Property(e => e.DeliveryList)
                .HasComment("物流信息JSON")
                .HasColumnName("delivery_list");
            entity.Property(e => e.DeliveryStatus)
                .HasDefaultValueSql("((-1))")
                .HasComment("物流状态：-1未查询，0在途，1揽收，2疑难，3签收，4退签，5派件，6退回")
                .HasColumnName("delivery_status");
            entity.Property(e => e.DeliveryTime)
                .HasComment("物流更新时间戳")
                .HasColumnName("delivery_time");
            entity.Property(e => e.Freight)
                .HasComment("运费")
                .HasColumnType("decimal(10, 2)")
                .HasColumnName("freight");
            entity.Property(e => e.Message)
                .HasMaxLength(255)
                .HasComment("留言备注")
                .HasColumnName("message");
            entity.Property(e => e.Mobile)
                .HasMaxLength(255)
                .HasComment("收货人手机号")
                .HasColumnName("mobile");
            entity.Property(e => e.Name)
                .HasMaxLength(255)
                .HasComment("收货人姓名")
                .HasColumnName("name");
            entity.Property(e => e.PayTime)
                .HasComment("支付时间戳")
                .HasColumnName("pay_time");
            entity.Property(e => e.SendNum)
                .HasMaxLength(100)
                .HasComment("发货单号，唯一")
                .HasColumnName("send_num");
            entity.Property(e => e.SendTime)
                .HasComment("发货时间戳")
                .HasColumnName("send_time");
            entity.Property(e => e.ShouTime)
                .HasComment("签收时间戳")
                .HasColumnName("shou_time");
            entity.Property(e => e.Status)
                .HasComment("状态：0待支付，1待发货，2已发货，3已签收，4已取消")
                .HasColumnName("status");
            entity.Property(e => e.UpdatedAt)
                .HasDefaultValueSql("(getdate())")
                .HasComment("记录更新时间")
                .HasColumnName("updated_at");
            entity.Property(e => e.UserId)
                .HasComment("用户ID")
                .HasColumnName("user_id");
        });

        modelBuilder.Entity<Picture>(entity =>
        {
            entity.HasKey(e => e.Id).HasName("pk_pictures");

            entity.ToTable("pictures", tb => tb.HasComment("图片管理表，存储上传的图片信息"));

            entity.HasIndex(e => e.Status, "ix_pictures_status");

            entity.HasIndex(e => e.Token, "ix_pictures_token");

            entity.HasIndex(e => e.Type, "ix_pictures_type");

            entity.Property(e => e.Id)
                .HasComment("主键ID")
                .HasColumnName("id");
            entity.Property(e => e.CreatedAt)
                .HasDefaultValueSql("(getdate())")
                .HasComment("创建时间")
                .HasColumnName("created_at");
            entity.Property(e => e.ImgUrl)
                .HasMaxLength(255)
                .HasComment("图片URL地址")
                .HasColumnName("img_url");
            entity.Property(e => e.Status)
                .HasDefaultValue((byte)1)
                .HasComment("状态：1-正常")
                .HasColumnName("status");
            entity.Property(e => e.Token)
                .HasMaxLength(255)
                .HasComment("图片令牌/标识")
                .HasColumnName("token");
            entity.Property(e => e.Type)
                .HasComment("图片类型")
                .HasColumnName("type");
        });

        modelBuilder.Entity<PrizeLevel>(entity =>
        {
            entity.HasKey(e => e.Id).HasName("pk_prize_levels");

            entity.ToTable("prize_levels", tb => tb.HasComment("奖品等级配置表，存储奖品等级和概率信息"));

            entity.HasIndex(e => e.GoodsId, "ix_prize_levels_goods_id");

            entity.Property(e => e.Id)
                .HasComment("等级ID")
                .HasColumnName("id");
            entity.Property(e => e.Color)
                .HasMaxLength(30)
                .HasComment("等级颜色")
                .HasColumnName("color");
            entity.Property(e => e.GoodsId)
                .HasComment("商品ID")
                .HasColumnName("goods_id");
            entity.Property(e => e.ImgUrl)
                .HasMaxLength(200)
                .HasComment("等级图片URL")
                .HasColumnName("img_url");
            entity.Property(e => e.Pro)
                .HasComment("概率")
                .HasColumnType("decimal(10, 2)")
                .HasColumnName("pro");
            entity.Property(e => e.Sort)
                .HasComment("排序值")
                .HasColumnName("sort");
            entity.Property(e => e.SpecialImgUrl)
                .HasMaxLength(200)
                .HasComment("特殊图片URL")
                .HasColumnName("special_img_url");
            entity.Property(e => e.Title)
                .HasMaxLength(255)
                .HasComment("等级标题")
                .HasColumnName("title");
            entity.Property(e => e.UpdatedAt)
                .HasComment("更新时间")
                .HasColumnName("updated_at");
        });

        modelBuilder.Entity<ProfitIntegral>(entity =>
        {
            entity.HasKey(e => e.Id).HasName("pk_profit_integral");

            entity.ToTable("profit_integral", tb => tb.HasComment("积分变动明细表，记录用户积分的所有变动记录"));

            entity.HasIndex(e => e.CreatedAt, "ix_profit_integral_created_at");

            entity.HasIndex(e => e.Type, "ix_profit_integral_type");

            entity.HasIndex(e => e.UserId, "ix_profit_integral_user_id");

            entity.Property(e => e.Id)
                .HasComment("主键ID")
                .HasColumnName("id");
            entity.Property(e => e.ChangeMoney)
                .HasComment("变动积分（正数为增加，负数为减少）")
                .HasColumnType("decimal(10, 2)")
                .HasColumnName("change_money");
            entity.Property(e => e.Content)
                .HasMaxLength(255)
                .HasComment("变动说明")
                .HasColumnName("content");
            entity.Property(e => e.CreatedAt)
                .HasDefaultValueSql("(getdate())")
                .HasComment("创建时间")
                .HasColumnName("created_at");
            entity.Property(e => e.Money)
                .HasComment("变动后积分余额")
                .HasColumnType("decimal(10, 2)")
                .HasColumnName("money");
            entity.Property(e => e.Other)
                .HasMaxLength(255)
                .HasComment("其他信息")
                .HasColumnName("other");
            entity.Property(e => e.ShareUid)
                .HasComment("关联分享用户ID")
                .HasColumnName("share_uid");
            entity.Property(e => e.Type)
                .HasComment("变动类型")
                .HasColumnName("type");
            entity.Property(e => e.UserId)
                .HasComment("用户ID")
                .HasColumnName("user_id");
        });

        modelBuilder.Entity<ProfitMoney>(entity =>
        {
            entity.HasKey(e => e.Id).HasName("pk_profit_money");

            entity.ToTable("profit_money", tb => tb.HasComment("余额变动明细表，记录用户余额的所有变动记录"));

            entity.HasIndex(e => e.CreatedAt, "ix_profit_money_created_at");

            entity.HasIndex(e => e.Type, "ix_profit_money_type");

            entity.HasIndex(e => e.UserId, "ix_profit_money_user_id");

            entity.Property(e => e.Id)
                .HasComment("主键ID")
                .HasColumnName("id");
            entity.Property(e => e.ChangeMoney)
                .HasComment("变动金额（正数为增加，负数为减少）")
                .HasColumnType("decimal(10, 2)")
                .HasColumnName("change_money");
            entity.Property(e => e.Content)
                .HasMaxLength(255)
                .HasComment("变动说明")
                .HasColumnName("content");
            entity.Property(e => e.CreatedAt)
                .HasDefaultValueSql("(getdate())")
                .HasComment("创建时间")
                .HasColumnName("created_at");
            entity.Property(e => e.Money)
                .HasComment("变动后余额")
                .HasColumnType("decimal(10, 2)")
                .HasColumnName("money");
            entity.Property(e => e.Other)
                .HasMaxLength(255)
                .HasComment("其他信息")
                .HasColumnName("other");
            entity.Property(e => e.ShareUid)
                .HasComment("关联分享用户ID")
                .HasColumnName("share_uid");
            entity.Property(e => e.Type)
                .HasComment("变动类型")
                .HasColumnName("type");
            entity.Property(e => e.UserId)
                .HasComment("用户ID")
                .HasColumnName("user_id");
        });

        modelBuilder.Entity<ProfitMoney2>(entity =>
        {
            entity.HasKey(e => e.Id).HasName("pk_profit_money2");

            entity.ToTable("profit_money2", tb => tb.HasComment("积分2变动明细表，记录用户积分2（钻石/代币）的所有变动记录"));

            entity.HasIndex(e => e.CreatedAt, "ix_profit_money2_created_at");

            entity.HasIndex(e => e.Type, "ix_profit_money2_type");

            entity.HasIndex(e => e.UserId, "ix_profit_money2_user_id");

            entity.Property(e => e.Id)
                .HasComment("主键ID")
                .HasColumnName("id");
            entity.Property(e => e.ChangeMoney)
                .HasComment("变动数量（正数为增加，负数为减少）")
                .HasColumnType("decimal(10, 2)")
                .HasColumnName("change_money");
            entity.Property(e => e.Content)
                .HasMaxLength(255)
                .HasComment("变动说明")
                .HasColumnName("content");
            entity.Property(e => e.CreatedAt)
                .HasDefaultValueSql("(getdate())")
                .HasComment("创建时间")
                .HasColumnName("created_at");
            entity.Property(e => e.Money)
                .HasComment("变动后余额")
                .HasColumnType("decimal(10, 2)")
                .HasColumnName("money");
            entity.Property(e => e.Other)
                .HasMaxLength(255)
                .HasComment("其他信息")
                .HasColumnName("other");
            entity.Property(e => e.ShareUid)
                .HasComment("关联分享用户ID")
                .HasColumnName("share_uid");
            entity.Property(e => e.Type)
                .HasComment("变动类型")
                .HasColumnName("type");
            entity.Property(e => e.UserId)
                .HasComment("用户ID")
                .HasColumnName("user_id");
        });

        modelBuilder.Entity<ProfitOuQi>(entity =>
        {
            entity.HasKey(e => e.Id).HasName("pk_profit_ou_qi");

            entity.ToTable("profit_ou_qi", tb => tb.HasComment("欧气值变动明细表，记录用户欧气值的所有变动记录"));

            entity.HasIndex(e => e.CreatedAt, "ix_profit_ou_qi_created_at");

            entity.HasIndex(e => e.Type, "ix_profit_ou_qi_type");

            entity.HasIndex(e => e.UserId, "ix_profit_ou_qi_user_id");

            entity.Property(e => e.Id)
                .HasComment("主键ID")
                .HasColumnName("id");
            entity.Property(e => e.ChangeMoney)
                .HasComment("变动欧气值（正数为增加，负数为减少）")
                .HasColumnType("decimal(10, 2)")
                .HasColumnName("change_money");
            entity.Property(e => e.Content)
                .HasMaxLength(255)
                .HasComment("变动说明")
                .HasColumnName("content");
            entity.Property(e => e.CreatedAt)
                .HasDefaultValueSql("(getdate())")
                .HasComment("创建时间")
                .HasColumnName("created_at");
            entity.Property(e => e.Money)
                .HasComment("变动后欧气值")
                .HasColumnType("decimal(10, 2)")
                .HasColumnName("money");
            entity.Property(e => e.Other)
                .HasMaxLength(255)
                .HasComment("其他信息")
                .HasColumnName("other");
            entity.Property(e => e.Type)
                .HasComment("变动类型")
                .HasColumnName("type");
            entity.Property(e => e.UserId)
                .HasComment("用户ID")
                .HasColumnName("user_id");
        });

        modelBuilder.Entity<ProfitPay>(entity =>
        {
            entity.HasKey(e => e.Id).HasName("pk_profit_pay");

            entity.ToTable("profit_pay", tb => tb.HasComment("支付流水表，记录所有支付交易流水"));

            entity.HasIndex(e => e.CreatedAt, "ix_profit_pay_created_at");

            entity.HasIndex(e => e.OrderNum, "ix_profit_pay_order_num");

            entity.HasIndex(e => e.PayType, "ix_profit_pay_pay_type");

            entity.HasIndex(e => e.UserId, "ix_profit_pay_user_id");

            entity.Property(e => e.Id)
                .HasComment("主键ID")
                .HasColumnName("id");
            entity.Property(e => e.ChangeMoney)
                .HasComment("支付金额")
                .HasColumnType("decimal(10, 2)")
                .HasColumnName("change_money");
            entity.Property(e => e.Content)
                .HasMaxLength(255)
                .HasComment("支付说明")
                .HasColumnName("content");
            entity.Property(e => e.CreatedAt)
                .HasDefaultValueSql("(getdate())")
                .HasComment("创建时间")
                .HasColumnName("created_at");
            entity.Property(e => e.OrderNum)
                .HasMaxLength(100)
                .HasComment("订单编号")
                .HasColumnName("order_num");
            entity.Property(e => e.PayType)
                .HasComment("支付类型（0-微信支付，1-支付宝，2-余额支付等）")
                .HasColumnName("pay_type");
            entity.Property(e => e.UserId)
                .HasComment("用户ID")
                .HasColumnName("user_id");
        });

        modelBuilder.Entity<ProfitScore>(entity =>
        {
            entity.HasKey(e => e.Id).HasName("pk_profit_score");

            entity.ToTable("profit_score", tb => tb.HasComment("评分变动明细表，记录用户评分的所有变动记录"));

            entity.HasIndex(e => e.CreatedAt, "ix_profit_score_created_at");

            entity.HasIndex(e => e.Type, "ix_profit_score_type");

            entity.HasIndex(e => e.UserId, "ix_profit_score_user_id");

            entity.Property(e => e.Id)
                .HasComment("主键ID")
                .HasColumnName("id");
            entity.Property(e => e.ChangeMoney)
                .HasComment("变动评分（正数为增加，负数为减少）")
                .HasColumnType("decimal(10, 2)")
                .HasColumnName("change_money");
            entity.Property(e => e.Content)
                .HasMaxLength(255)
                .HasComment("变动说明")
                .HasColumnName("content");
            entity.Property(e => e.CreatedAt)
                .HasDefaultValueSql("(getdate())")
                .HasComment("创建时间")
                .HasColumnName("created_at");
            entity.Property(e => e.Money)
                .HasComment("变动后评分")
                .HasColumnType("decimal(10, 2)")
                .HasColumnName("money");
            entity.Property(e => e.Other)
                .HasMaxLength(255)
                .HasComment("其他信息")
                .HasColumnName("other");
            entity.Property(e => e.ShareUid)
                .HasComment("关联分享用户ID")
                .HasColumnName("share_uid");
            entity.Property(e => e.Type)
                .HasComment("变动类型")
                .HasColumnName("type");
            entity.Property(e => e.UserId)
                .HasComment("用户ID")
                .HasColumnName("user_id");
        });

        modelBuilder.Entity<SignConfig>(entity =>
        {
            entity.HasKey(e => e.Id).HasName("pk_sign_configs");

            entity.ToTable("sign_configs", tb => tb.HasComment("签到配置表"));

            entity.HasIndex(e => e.Sort, "ix_sign_configs_sort");

            entity.HasIndex(e => e.Status, "ix_sign_configs_status");

            entity.HasIndex(e => e.Type, "ix_sign_configs_type");

            entity.Property(e => e.Id)
                .HasComment("主键ID")
                .HasColumnName("id");
            entity.Property(e => e.CreatedAt)
                .HasComment("创建时间")
                .HasColumnName("created_at");
            entity.Property(e => e.Day)
                .HasComment("签到天数")
                .HasColumnName("day");
            entity.Property(e => e.Description)
                .HasMaxLength(255)
                .HasComment("描述")
                .HasColumnName("description");
            entity.Property(e => e.Icon)
                .HasMaxLength(255)
                .HasComment("图标URL")
                .HasColumnName("icon");
            entity.Property(e => e.RewardId)
                .HasMaxLength(64)
                .HasComment("奖励ID")
                .HasColumnName("reward_id");
            entity.Property(e => e.Sort)
                .HasDefaultValue(0)
                .HasComment("排序")
                .HasColumnName("sort");
            entity.Property(e => e.Status)
                .HasDefaultValue((byte)1)
                .HasComment("状态 1:启用 0:禁用")
                .HasColumnName("status");
            entity.Property(e => e.Title)
                .HasMaxLength(100)
                .HasComment("标题")
                .HasColumnName("title");
            entity.Property(e => e.Type)
                .HasComment("签到类型")
                .HasColumnName("type");
            entity.Property(e => e.UpdatedAt)
                .HasComment("更新时间")
                .HasColumnName("updated_at");
        });

        modelBuilder.Entity<Entities.T_Task>(entity =>
        {
            entity.HasKey(e => e.Id).HasName("pk_tasks");

            entity.ToTable("tasks", tb => tb.HasComment("任务配置表"));

            entity.HasIndex(e => e.Cate, "ix_tasks_cate");

            entity.HasIndex(e => e.Sort, "ix_tasks_sort");

            entity.HasIndex(e => e.Type, "ix_tasks_type");

            entity.Property(e => e.Id)
                .HasComment("主键ID")
                .HasColumnName("id");
            entity.Property(e => e.Cate)
                .HasComment("任务分类")
                .HasColumnName("cate");
            entity.Property(e => e.CreatedAt)
                .HasDefaultValueSql("(getdate())")
                .HasComment("创建时间")
                .HasColumnName("created_at");
            entity.Property(e => e.DeletedAt)
                .HasComment("删除时间")
                .HasColumnName("deleted_at");
            entity.Property(e => e.IsImportant)
                .HasDefaultValue((byte)0)
                .HasComment("是否重要任务")
                .HasColumnName("is_important");
            entity.Property(e => e.Number)
                .HasDefaultValue(0)
                .HasComment("完成次数要求")
                .HasColumnName("number");
            entity.Property(e => e.Sort)
                .HasDefaultValue(0)
                .HasComment("排序")
                .HasColumnName("sort");
            entity.Property(e => e.Title)
                .HasMaxLength(255)
                .HasComment("任务标题")
                .HasColumnName("title");
            entity.Property(e => e.Type)
                .HasComment("任务类型")
                .HasColumnName("type");
            entity.Property(e => e.UpdatedAt)
                .HasDefaultValueSql("(getdate())")
                .HasComment("更新时间")
                .HasColumnName("updated_at");
            entity.Property(e => e.ZNumber)
                .HasDefaultValue(0)
                .HasComment("奖励数量")
                .HasColumnName("z_number");
        });

        modelBuilder.Entity<User>(entity =>
        {
            entity.HasKey(e => e.Id).HasName("pk_users");

            entity.ToTable("users", tb => tb.HasComment("用户主表，存储用户基本信息、账户余额、积分等"));

            entity.HasIndex(e => e.CreatedAt, "ix_users_created_at");

            entity.HasIndex(e => e.Mobile, "ix_users_mobile").HasFilter("([mobile] IS NOT NULL)");

            entity.HasIndex(e => e.OpenId, "ix_users_open_id");

            entity.HasIndex(e => e.Pid, "ix_users_pid");

            entity.HasIndex(e => e.Status, "ix_users_status");

            entity.HasIndex(e => e.Vip, "ix_users_vip");

            entity.HasIndex(e => e.Uid, "uk_users_uid").IsUnique();

            entity.Property(e => e.Id)
                .HasComment("主键ID")
                .HasColumnName("id");
            entity.Property(e => e.ClickId)
                .HasDefaultValue(0)
                .HasComment("点击ID")
                .HasColumnName("click_id");
            entity.Property(e => e.CreatedAt)
                .HasDefaultValueSql("(getdate())")
                .HasComment("创建时间")
                .HasColumnName("created_at");
            entity.Property(e => e.DrawNum)
                .HasDefaultValue(0)
                .HasComment("抽奖次数")
                .HasColumnName("draw_num");
            entity.Property(e => e.GzhOpenId)
                .HasMaxLength(255)
                .HasComment("公众号openid")
                .HasColumnName("gzh_open_id");
            entity.Property(e => e.HeadImg)
                .HasMaxLength(255)
                .HasComment("头像URL")
                .HasColumnName("head_img");
            entity.Property(e => e.Integral)
                .HasComment("积分")
                .HasColumnType("decimal(10, 2)")
                .HasColumnName("integral");
            entity.Property(e => e.IsTest)
                .HasComment("是否测试账号: 0否 1是")
                .HasColumnName("is_test");
            entity.Property(e => e.IsUseCoupon)
                .HasDefaultValue((byte)0)
                .HasComment("是否使用优惠券: 0否 1是")
                .HasColumnName("is_use_coupon");
            entity.Property(e => e.LastLoginTime)
                .HasComment("最后登录时间")
                .HasColumnName("last_login_time");
            entity.Property(e => e.MbNumber)
                .HasDefaultValue(0)
                .HasComment("盲盒数量")
                .HasColumnName("mb_number");
            entity.Property(e => e.Mobile)
                .HasMaxLength(15)
                .HasComment("手机号")
                .HasColumnName("mobile");
            entity.Property(e => e.Money)
                .HasComment("账户余额")
                .HasColumnType("decimal(10, 2)")
                .HasColumnName("money");
            entity.Property(e => e.Money2)
                .HasDefaultValue(0.00m)
                .HasComment("余额2/积分2")
                .HasColumnType("decimal(10, 2)")
                .HasColumnName("money2");
            entity.Property(e => e.Nickname)
                .HasMaxLength(255)
                .HasComment("昵称")
                .HasColumnName("nickname");
            entity.Property(e => e.OldMobile)
                .HasMaxLength(255)
                .HasComment("旧手机号")
                .HasColumnName("old_mobile");
            entity.Property(e => e.OpenId)
                .HasMaxLength(50)
                .HasComment("微信openid")
                .HasColumnName("open_id");
            entity.Property(e => e.OuQi)
                .HasDefaultValue(0)
                .HasComment("欧气值")
                .HasColumnName("ou_qi");
            entity.Property(e => e.OuQiLevel)
                .HasDefaultValue(0)
                .HasComment("欧气等级")
                .HasColumnName("ou_qi_level");
            entity.Property(e => e.Password)
                .HasMaxLength(40)
                .HasComment("密码")
                .HasColumnName("password");
            entity.Property(e => e.Pid)
                .HasComment("推荐人ID")
                .HasColumnName("pid");
            entity.Property(e => e.Score)
                .HasComment("评分")
                .HasColumnType("decimal(10, 2)")
                .HasColumnName("score");
            entity.Property(e => e.ShareImage)
                .HasMaxLength(255)
                .HasComment("分享图片URL")
                .HasColumnName("share_image");
            entity.Property(e => e.Status)
                .HasDefaultValue((byte)1)
                .HasComment("状态: 1正常 0禁用")
                .HasColumnName("status");
            entity.Property(e => e.Uid)
                .HasMaxLength(16)
                .HasComment("用户唯一标识")
                .HasColumnName("uid");
            entity.Property(e => e.UnionId)
                .HasMaxLength(255)
                .HasComment("微信unionid")
                .HasColumnName("union_id");
            entity.Property(e => e.UpdatedAt)
                .HasDefaultValueSql("(getdate())")
                .HasComment("更新时间")
                .HasColumnName("updated_at");
            entity.Property(e => e.Vip)
                .HasDefaultValue((byte)1)
                .HasComment("VIP等级")
                .HasColumnName("vip");
        });

        modelBuilder.Entity<UserAccount>(entity =>
        {
            entity.HasKey(e => e.Id).HasName("pk_user_accounts");

            entity.ToTable("user_accounts", tb => tb.HasComment("用户账户表，存储用户登录令牌和IP信息"));

            entity.HasIndex(e => e.AccountToken, "ix_user_accounts_account_token");

            entity.HasIndex(e => e.LastLoginTime, "ix_user_accounts_last_login_time");

            entity.HasIndex(e => e.UserId, "ix_user_accounts_user_id");

            entity.Property(e => e.Id)
                .HasComment("主键ID")
                .HasColumnName("id");
            entity.Property(e => e.AccountToken)
                .HasMaxLength(255)
                .HasComment("账户令牌")
                .HasColumnName("account_token");
            entity.Property(e => e.IpAdcode)
                .HasMaxLength(255)
                .HasComment("IP地区编码")
                .HasColumnName("ip_adcode");
            entity.Property(e => e.IpCity)
                .HasMaxLength(50)
                .HasComment("IP城市")
                .HasColumnName("ip_city");
            entity.Property(e => e.IpProvince)
                .HasMaxLength(50)
                .HasComment("IP省份")
                .HasColumnName("ip_province");
            entity.Property(e => e.LastLoginIp)
                .HasMaxLength(50)
                .HasComment("最后登录IP")
                .HasColumnName("last_login_ip");
            entity.Property(e => e.LastLoginIp1)
                .HasMaxLength(255)
                .HasComment("备用登录IP")
                .HasColumnName("last_login_ip1");
            entity.Property(e => e.LastLoginTime)
                .HasComment("最后登录时间")
                .HasColumnName("last_login_time");
            entity.Property(e => e.TokenNum)
                .HasMaxLength(50)
                .HasComment("令牌编号")
                .HasColumnName("token_num");
            entity.Property(e => e.TokenTime)
                .HasComment("令牌时间")
                .HasColumnName("token_time");
            entity.Property(e => e.UserId)
                .HasComment("用户ID")
                .HasColumnName("user_id");
        });

        modelBuilder.Entity<UserAddress>(entity =>
        {
            entity.HasKey(e => e.Id).HasName("pk_user_addresses");

            entity.ToTable("user_addresses", tb => tb.HasComment("用户收货地址表，存储用户的收货地址信息"));

            entity.HasIndex(e => new { e.UserId, e.IsDefault }, "ix_user_addresses_is_default").HasFilter("([is_deleted]=(0))");

            entity.HasIndex(e => e.UserId, "ix_user_addresses_user_id");

            entity.Property(e => e.Id)
                .HasComment("主键ID")
                .HasColumnName("id");
            entity.Property(e => e.CreatedAt)
                .HasDefaultValueSql("(getdate())")
                .HasComment("创建时间")
                .HasColumnName("created_at");
            entity.Property(e => e.DetailedAddress)
                .HasMaxLength(255)
                .HasComment("详细地址")
                .HasColumnName("detailed_address");
            entity.Property(e => e.IsDefault)
                .HasDefaultValue((byte)0)
                .HasComment("是否默认地址: 0否 1是")
                .HasColumnName("is_default");
            entity.Property(e => e.IsDeleted)
                .HasDefaultValue((byte)0)
                .HasComment("是否删除: 0否 1是")
                .HasColumnName("is_deleted");
            entity.Property(e => e.ReceiverName)
                .HasMaxLength(50)
                .HasComment("收货人姓名")
                .HasColumnName("receiver_name");
            entity.Property(e => e.ReceiverPhone)
                .HasMaxLength(20)
                .HasComment("收货人电话")
                .HasColumnName("receiver_phone");
            entity.Property(e => e.UpdatedAt)
                .HasDefaultValueSql("(getdate())")
                .HasComment("更新时间")
                .HasColumnName("updated_at");
            entity.Property(e => e.UserId)
                .HasComment("用户ID")
                .HasColumnName("user_id");
        });

        modelBuilder.Entity<UserCoupon>(entity =>
        {
            entity.HasKey(e => e.Id).HasName("pk_user_coupons");

            entity.ToTable("user_coupons", tb => tb.HasComment("欧气券表"));

            entity.HasIndex(e => e.Status, "ix_user_coupons_status");

            entity.HasIndex(e => e.UserId, "ix_user_coupons_user_id");

            entity.Property(e => e.Id)
                .HasComment("主键ID")
                .HasColumnName("id");
            entity.Property(e => e.CreatedAt)
                .HasDefaultValueSql("(getdate())")
                .HasComment("创建时间")
                .HasColumnName("created_at");
            entity.Property(e => e.FromId)
                .HasMaxLength(50)
                .HasDefaultValue("0")
                .HasComment("来源ID")
                .HasColumnName("from_id");
            entity.Property(e => e.KlNum)
                .HasDefaultValue(0)
                .HasComment("扣除数量")
                .HasColumnName("kl_num");
            entity.Property(e => e.KlNum2)
                .HasDefaultValue(0)
                .HasComment("扣除数量2")
                .HasColumnName("kl_num2");
            entity.Property(e => e.LNum)
                .HasDefaultValue(0.00m)
                .HasComment("剩余数量")
                .HasColumnType("decimal(10, 2)")
                .HasColumnName("l_num");
            entity.Property(e => e.Level)
                .HasDefaultValue(0)
                .HasComment("等级")
                .HasColumnName("level");
            entity.Property(e => e.Num)
                .HasComment("数量")
                .HasColumnName("num");
            entity.Property(e => e.Other)
                .HasDefaultValue(0.00m)
                .HasComment("他人获得金额")
                .HasColumnType("decimal(10, 2)")
                .HasColumnName("other");
            entity.Property(e => e.Other2)
                .HasDefaultValue(0.00m)
                .HasComment("他人获得金额2")
                .HasColumnType("decimal(10, 2)")
                .HasColumnName("other2");
            entity.Property(e => e.Own)
                .HasDefaultValue(0.00m)
                .HasComment("自己获得金额")
                .HasColumnType("decimal(10, 2)")
                .HasColumnName("own");
            entity.Property(e => e.Own2)
                .HasDefaultValue(0.00m)
                .HasComment("自己获得金额2")
                .HasColumnType("decimal(10, 2)")
                .HasColumnName("own2");
            entity.Property(e => e.ShareTime)
                .HasComment("分享时间")
                .HasColumnName("share_time");
            entity.Property(e => e.Status)
                .HasDefaultValue((byte)1)
                .HasComment("状态: 1启用 0禁用")
                .HasColumnName("status");
            entity.Property(e => e.Title)
                .HasMaxLength(255)
                .HasComment("标题")
                .HasColumnName("title");
            entity.Property(e => e.Type)
                .HasComment("类型")
                .HasColumnName("type");
            entity.Property(e => e.UpdatedAt)
                .HasComment("更新时间")
                .HasColumnName("updated_at");
            entity.Property(e => e.UserId)
                .HasComment("用户ID")
                .HasColumnName("user_id");
        });

        modelBuilder.Entity<UserLoginLog>(entity =>
        {
            entity.HasKey(e => e.Id).HasName("pk_user_login_logs");

            entity.ToTable("user_login_logs", tb => tb.HasComment("用户登录日志表，记录用户每次登录的时间、设备和位置信息"));

            entity.HasIndex(e => e.LoginDate, "ix_user_login_logs_login_date");

            entity.HasIndex(e => e.LoginTime, "ix_user_login_logs_login_time");

            entity.HasIndex(e => e.UserId, "ix_user_login_logs_user_id");

            entity.HasIndex(e => e.Year, "ix_user_login_logs_year");

            entity.HasIndex(e => new { e.Year, e.Month }, "ix_user_login_logs_year_month");

            entity.Property(e => e.Id)
                .HasComment("主键ID")
                .HasColumnName("id");
            entity.Property(e => e.Device)
                .HasMaxLength(50)
                .HasComment("设备类型")
                .HasColumnName("device");
            entity.Property(e => e.Ip)
                .HasMaxLength(50)
                .HasComment("登录IP")
                .HasColumnName("ip");
            entity.Property(e => e.LastLoginTime)
                .HasComment("最后登录时间")
                .HasColumnName("last_login_time");
            entity.Property(e => e.Location)
                .HasMaxLength(100)
                .HasComment("登录位置")
                .HasColumnName("location");
            entity.Property(e => e.LoginDate)
                .HasComment("登录日期")
                .HasColumnName("login_date");
            entity.Property(e => e.LoginTime)
                .HasComment("登录时间")
                .HasColumnName("login_time");
            entity.Property(e => e.Month)
                .HasComment("月份")
                .HasColumnName("month");
            entity.Property(e => e.UserId)
                .HasComment("用户ID")
                .HasColumnName("user_id");
            entity.Property(e => e.Week)
                .HasComment("周数")
                .HasColumnName("week");
            entity.Property(e => e.Year)
                .HasComment("年份")
                .HasColumnName("year");
        });

        modelBuilder.Entity<UserSign>(entity =>
        {
            entity.HasKey(e => e.Id).HasName("pk_user_signs");

            entity.ToTable("user_signs", tb => tb.HasComment("用户签到记录表"));

            entity.HasIndex(e => e.SignDate, "ix_user_signs_sign_date");

            entity.HasIndex(e => e.SignType, "ix_user_signs_sign_type");

            entity.HasIndex(e => new { e.UserId, e.SignDate }, "ix_user_signs_user_date");

            entity.HasIndex(e => e.UserId, "ix_user_signs_user_id");

            entity.HasIndex(e => new { e.Year, e.Month }, "ix_user_signs_year_month");

            entity.Property(e => e.Id)
                .HasComment("主键ID")
                .HasColumnName("id");
            entity.Property(e => e.CreatedAt)
                .HasDefaultValueSql("(getdate())")
                .HasComment("创建时间")
                .HasColumnName("created_at");
            entity.Property(e => e.Days)
                .HasComment("连续签到天数")
                .HasColumnName("days");
            entity.Property(e => e.Month)
                .HasComment("月份")
                .HasColumnName("month");
            entity.Property(e => e.Num)
                .HasComment("签到次数")
                .HasColumnName("num");
            entity.Property(e => e.SignDate)
                .HasMaxLength(24)
                .HasComment("签到日期")
                .HasColumnName("sign_date");
            entity.Property(e => e.SignDay)
                .HasComment("当月签到天数")
                .HasColumnName("sign_day");
            entity.Property(e => e.SignType)
                .HasComment("签到类型")
                .HasColumnName("sign_type");
            entity.Property(e => e.UpdatedAt)
                .HasDefaultValueSql("(getdate())")
                .HasComment("更新时间")
                .HasColumnName("updated_at");
            entity.Property(e => e.UserId)
                .HasComment("用户ID")
                .HasColumnName("user_id");
            entity.Property(e => e.Year)
                .HasComment("年份")
                .HasColumnName("year");
        });

        modelBuilder.Entity<UserTask>(entity =>
        {
            entity.HasKey(e => e.Id).HasName("pk_user_tasks");

            entity.ToTable("user_tasks", tb => tb.HasComment("用户任务完成记录表"));

            entity.HasIndex(e => e.Cate, "ix_user_tasks_cate");

            entity.HasIndex(e => e.TaskId, "ix_user_tasks_task_id");

            entity.HasIndex(e => e.Type, "ix_user_tasks_type");

            entity.HasIndex(e => e.UserId, "ix_user_tasks_user_id");

            entity.HasIndex(e => new { e.UserId, e.TaskId }, "ix_user_tasks_user_task");

            entity.Property(e => e.Id)
                .HasComment("主键ID")
                .HasColumnName("id");
            entity.Property(e => e.Cate)
                .HasComment("任务分类")
                .HasColumnName("cate");
            entity.Property(e => e.CreatedAt)
                .HasDefaultValueSql("(getdate())")
                .HasComment("创建时间")
                .HasColumnName("created_at");
            entity.Property(e => e.DeletedAt)
                .HasComment("删除时间")
                .HasColumnName("deleted_at");
            entity.Property(e => e.IsImportant)
                .HasDefaultValue((byte)0)
                .HasComment("是否重要任务")
                .HasColumnName("is_important");
            entity.Property(e => e.Number)
                .HasDefaultValue(0)
                .HasComment("已完成次数")
                .HasColumnName("number");
            entity.Property(e => e.TaskId)
                .HasComment("任务ID")
                .HasColumnName("task_id");
            entity.Property(e => e.Type)
                .HasComment("任务类型")
                .HasColumnName("type");
            entity.Property(e => e.UpdatedAt)
                .HasDefaultValueSql("(getdate())")
                .HasComment("更新时间")
                .HasColumnName("updated_at");
            entity.Property(e => e.UserId)
                .HasComment("用户ID")
                .HasColumnName("user_id");
            entity.Property(e => e.ZNumber)
                .HasDefaultValue(0)
                .HasComment("奖励数量")
                .HasColumnName("z_number");
        });

        modelBuilder.Entity<UserEquityReward>(entity =>
        {
            entity.HasKey(e => e.Id).HasName("pk_user_equity_rewards");

            entity.ToTable("user_equity_rewards", tb => tb.HasComment("用户领取的权益奖品表"));

            entity.HasIndex(e => e.Type, "ix_user_equity_rewards_type");

            entity.HasIndex(e => e.UserId, "ix_user_equity_rewards_user_id");

            entity.HasIndex(e => new { e.UserId, e.EquityLevel }, "ix_user_equity_rewards_user_level");

            entity.HasIndex(e => e.EquityLevel, "ix_user_equity_rewards_equity_level");

            entity.HasIndex(e => e.EquityLevelId, "ix_user_equity_rewards_equity_level_id");

            entity.Property(e => e.Id)
                .HasComment("主键ID")
                .HasColumnName("id");
            entity.Property(e => e.CouponId)
                .HasDefaultValue(0)
                .HasComment("优惠券ID")
                .HasColumnName("coupon_id");
            entity.Property(e => e.CreatedAt)
                .HasDefaultValueSql("(getdate())")
                .HasComment("创建时间")
                .HasColumnName("created_at");
            entity.Property(e => e.DeletedAt)
                .HasComment("删除时间")
                .HasColumnName("deleted_at");
            entity.Property(e => e.EffectiveDay)
                .HasComment("有效天数")
                .HasColumnName("effective_day");
            entity.Property(e => e.EndTime)
                .HasComment("结束时间")
                .HasColumnName("end_time");
            entity.Property(e => e.ImgUrl)
                .HasMaxLength(255)
                .HasComment("图片URL")
                .HasColumnName("img_url");
            entity.Property(e => e.JianPrice)
                .HasDefaultValue(0.00m)
                .HasComment("减免金额")
                .HasColumnType("decimal(10, 2)")
                .HasColumnName("jian_price");
            entity.Property(e => e.JiangPrice)
                .HasDefaultValue(0.00m)
                .HasComment("奖品价格")
                .HasColumnType("decimal(10, 2)")
                .HasColumnName("jiang_price");
            entity.Property(e => e.ManPrice)
                .HasDefaultValue(0.00m)
                .HasComment("满减门槛")
                .HasColumnType("decimal(10, 2)")
                .HasColumnName("man_price");
            entity.Property(e => e.Money)
                .HasDefaultValue(0.00m)
                .HasComment("金额")
                .HasColumnType("decimal(10, 2)")
                .HasColumnName("money");
            entity.Property(e => e.PrizeCode)
                .HasMaxLength(30)
                .HasComment("奖品编码")
                .HasColumnName("prize_code");
            entity.Property(e => e.PrizeLevelId)
                .HasComment("奖品等级ID")
                .HasColumnName("prize_level_id");
            entity.Property(e => e.Probability)
                .HasComment("概率")
                .HasColumnType("decimal(10, 2)")
                .HasColumnName("probability");
            entity.Property(e => e.ScMoney)
                .HasDefaultValue(0.00m)
                .HasComment("市场价")
                .HasColumnType("decimal(10, 2)")
                .HasColumnName("sc_money");
            entity.Property(e => e.Title)
                .HasMaxLength(255)
                .HasComment("奖品标题")
                .HasColumnName("title");
            entity.Property(e => e.Type)
                .HasComment("奖品类型")
                .HasColumnName("type");
            entity.Property(e => e.UpdatedAt)
                .HasDefaultValueSql("(getdate())")
                .HasComment("更新时间")
                .HasColumnName("updated_at");
            entity.Property(e => e.UserId)
                .HasComment("用户ID")
                .HasColumnName("user_id");
            entity.Property(e => e.EquityLevel)
                .HasDefaultValue(0)
                .HasComment("权益等级")
                .HasColumnName("equity_level");
            entity.Property(e => e.EquityLevelId)
                .HasComment("权益等级ID")
                .HasColumnName("equity_level_id");
            entity.Property(e => e.ZNum)
                .HasDefaultValue(0)
                .HasComment("数量")
                .HasColumnName("z_num");
        });

        modelBuilder.Entity<EquityLevel>(entity =>
        {
            entity.HasKey(e => e.Id).HasName("pk_equity_levels");

            entity.ToTable("equity_levels", tb => tb.HasComment("权益等级配置表"));

            entity.HasIndex(e => e.Level, "ix_equity_levels_level");

            entity.Property(e => e.Id)
                .HasComment("主键ID")
                .HasColumnName("id");
            entity.Property(e => e.CreatedAt)
                .HasDefaultValueSql("(getdate())")
                .HasComment("创建时间")
                .HasColumnName("created_at");
            entity.Property(e => e.DeletedAt)
                .HasComment("删除时间")
                .HasColumnName("deleted_at");
            entity.Property(e => e.Level)
                .HasComment("权益等级")
                .HasColumnName("level");
            entity.Property(e => e.Number)
                .HasComment("升级所需欧气值")
                .HasColumnName("number");
            entity.Property(e => e.Title)
                .HasMaxLength(255)
                .HasComment("等级名称")
                .HasColumnName("title");
            entity.Property(e => e.UpdatedAt)
                .HasDefaultValueSql("(getdate())")
                .HasComment("更新时间")
                .HasColumnName("updated_at");
        });

        modelBuilder.Entity<EquityLevelReward>(entity =>
        {
            entity.HasKey(e => e.Id).HasName("pk_equity_level_rewards");

            entity.ToTable("equity_level_rewards", tb => tb.HasComment("权益等级奖品配置表"));

            entity.HasIndex(e => e.CouponId, "ix_equity_level_rewards_coupon_id");

            entity.HasIndex(e => e.Type, "ix_equity_level_rewards_type");

            entity.HasIndex(e => e.EquityLevel, "ix_equity_level_rewards_equity_level");

            entity.HasIndex(e => e.EquityLevelId, "ix_equity_level_rewards_equity_level_id");

            entity.Property(e => e.Id)
                .HasComment("主键ID")
                .HasColumnName("id");
            entity.Property(e => e.CouponId)
                .HasDefaultValue(0)
                .HasComment("优惠券ID")
                .HasColumnName("coupon_id");
            entity.Property(e => e.CreatedAt)
                .HasDefaultValueSql("(getdate())")
                .HasComment("创建时间")
                .HasColumnName("created_at");
            entity.Property(e => e.DeletedAt)
                .HasComment("删除时间")
                .HasColumnName("deleted_at");
            entity.Property(e => e.EffectiveDay)
                .HasComment("有效天数")
                .HasColumnName("effective_day");
            entity.Property(e => e.ImgUrl)
                .HasMaxLength(255)
                .HasComment("图片URL")
                .HasColumnName("img_url");
            entity.Property(e => e.JianPrice)
                .HasDefaultValue(0.00m)
                .HasComment("减免金额")
                .HasColumnType("decimal(10, 2)")
                .HasColumnName("jian_price");
            entity.Property(e => e.JiangPrice)
                .HasDefaultValue(0.00m)
                .HasComment("奖品价格")
                .HasColumnType("decimal(10, 2)")
                .HasColumnName("jiang_price");
            entity.Property(e => e.ManPrice)
                .HasDefaultValue(0.00m)
                .HasComment("满减门槛")
                .HasColumnType("decimal(10, 2)")
                .HasColumnName("man_price");
            entity.Property(e => e.Money)
                .HasDefaultValue(0.00m)
                .HasComment("金额")
                .HasColumnType("decimal(10, 2)")
                .HasColumnName("money");
            entity.Property(e => e.PrizeCode)
                .HasMaxLength(30)
                .HasComment("奖品编码")
                .HasColumnName("prize_code");
            entity.Property(e => e.PrizeLevelId)
                .HasComment("奖品等级ID")
                .HasColumnName("prize_level_id");
            entity.Property(e => e.Probability)
                .HasDefaultValue(0.00m)
                .HasComment("概率")
                .HasColumnType("decimal(10, 2)")
                .HasColumnName("probability");
            entity.Property(e => e.ScMoney)
                .HasDefaultValue(0.00m)
                .HasComment("市场价")
                .HasColumnType("decimal(10, 2)")
                .HasColumnName("sc_money");
            entity.Property(e => e.Title)
                .HasMaxLength(255)
                .HasComment("奖品标题")
                .HasColumnName("title");
            entity.Property(e => e.Type)
                .HasComment("奖品类型")
                .HasColumnName("type");
            entity.Property(e => e.UpdatedAt)
                .HasDefaultValueSql("(getdate())")
                .HasComment("更新时间")
                .HasColumnName("updated_at");
            entity.Property(e => e.EquityLevel)
                .HasDefaultValue(0)
                .HasComment("权益等级")
                .HasColumnName("equity_level");
            entity.Property(e => e.EquityLevelId)
                .HasComment("权益等级ID")
                .HasColumnName("equity_level_id");
            entity.Property(e => e.ZNum)
                .HasDefaultValue(0)
                .HasComment("数量")
                .HasColumnName("z_num");
        });

        modelBuilder.Entity<RedeemCode>(entity =>
        {
            entity.HasKey(e => e.Id).HasName("pk_redeem_codes");

            entity.ToTable("redeem_codes", tb => tb.HasComment("兑换码表"));

            entity.HasIndex(e => e.Code, "uk_redeem_codes_code").IsUnique();

            entity.HasIndex(e => e.Status, "ix_redeem_codes_status");

            entity.HasIndex(e => e.UsedByUserId, "ix_redeem_codes_used_by_user_id");

            entity.Property(e => e.Id)
                .HasComment("主键ID")
                .HasColumnName("id");
            entity.Property(e => e.Code)
                .HasMaxLength(50)
                .HasComment("兑换码")
                .HasColumnName("code");
            entity.Property(e => e.RewardType)
                .HasMaxLength(20)
                .HasComment("奖励类型: money=余额, integral=吧唧币, score=积分")
                .HasColumnName("reward_type");
            entity.Property(e => e.RewardAmount)
                .HasComment("奖励数量")
                .HasColumnType("decimal(10, 2)")
                .HasColumnName("reward_amount");
            entity.Property(e => e.Status)
                .HasDefaultValue((byte)0)
                .HasComment("状态: 0=未使用, 1=已使用")
                .HasColumnName("status");
            entity.Property(e => e.UsedByUserId)
                .HasComment("使用者用户ID")
                .HasColumnName("used_by_user_id");
            entity.Property(e => e.UsedAt)
                .HasComment("使用时间")
                .HasColumnName("used_at");
            entity.Property(e => e.ExpiredAt)
                .HasComment("过期时间")
                .HasColumnName("expired_at");
            entity.Property(e => e.CreatedAt)
                .HasDefaultValueSql("(getdate())")
                .HasComment("创建时间")
                .HasColumnName("created_at");
            entity.Property(e => e.Remark)
                .HasMaxLength(255)
                .HasComment("备注")
                .HasColumnName("remark");
        });

        modelBuilder.Entity<GoodsCollection>(entity =>
        {
            entity.HasKey(e => e.Id).HasName("pk_goods_collections");

            entity.ToTable("goods_collections", tb => tb.HasComment("商品收藏表，存储用户收藏的商品信息"));

            entity.HasIndex(e => e.UserId, "ix_goods_collections_user_id");

            entity.HasIndex(e => e.GoodsId, "ix_goods_collections_goods_id");

            entity.HasIndex(e => new { e.UserId, e.GoodsId, e.Num }, "uk_goods_collections_user_goods_num").IsUnique();

            entity.Property(e => e.Id)
                .HasComment("收藏ID")
                .HasColumnName("id");
            entity.Property(e => e.UserId)
                .HasComment("用户ID")
                .HasColumnName("user_id");
            entity.Property(e => e.GoodsId)
                .HasComment("商品ID")
                .HasColumnName("goods_id");
            entity.Property(e => e.Num)
                .HasComment("箱号")
                .HasColumnName("num");
            entity.Property(e => e.Type)
                .HasComment("商品类型 1-一番赏 2-无限赏 3-擂台赏 4-抽卡机 5-积分赏 6-全局赏 7-福利盲盒 8-领主赏 9-连击赏")
                .HasColumnName("type");
            entity.Property(e => e.CreatedAt)
                .HasDefaultValueSql("(getdate())")
                .HasComment("添加时间")
                .HasColumnName("created_at");
        });

        modelBuilder.Entity<GoodsLock>(entity =>
        {
            entity.HasKey(e => e.Id).HasName("pk_goods_locks");

            entity.ToTable("goods_locks", tb => tb.HasComment("商品锁箱信息表，存储盲盒锁箱状态"));

            entity.HasIndex(e => e.UserId, "ix_goods_locks_user_id");

            entity.HasIndex(e => e.GoodsIdNum, "ix_goods_locks_goods_id_num");

            entity.Property(e => e.Id)
                .HasComment("锁箱ID")
                .HasColumnName("id");
            entity.Property(e => e.UserId)
                .HasComment("用户ID")
                .HasColumnName("user_id");
            entity.Property(e => e.GoodsIdNum)
                .HasMaxLength(20)
                .HasComment("商品ID和箱号组合")
                .HasColumnName("goods_id_num");
            entity.Property(e => e.EndTime)
                .HasComment("过期时间")
                .HasColumnName("endtime");
            entity.Property(e => e.UpdateTime)
                .HasComment("更新时间")
                .HasColumnName("update_time");
        });

        modelBuilder.Entity<OrderNotify>(entity =>
        {
            entity.HasKey(e => e.Id).HasName("pk_order_notifies");

            entity.ToTable("order_notifies", tb => tb.HasComment("支付通知记录表，记录微信支付回调通知"));

            entity.HasIndex(e => e.OrderNo, "ix_order_notifies_order_no");

            entity.HasIndex(e => e.TransactionId, "ix_order_notifies_transaction_id");

            entity.HasIndex(e => e.Status, "ix_order_notifies_status");

            entity.HasIndex(e => e.CreatedAt, "ix_order_notifies_created_at");

            entity.Property(e => e.Id)
                .HasComment("主键ID")
                .HasColumnName("id");
            entity.Property(e => e.OrderNo)
                .HasMaxLength(64)
                .HasComment("商户订单号")
                .HasColumnName("order_no");
            entity.Property(e => e.TransactionId)
                .HasMaxLength(64)
                .HasComment("微信支付订单号")
                .HasColumnName("transaction_id");
            entity.Property(e => e.NotifyUrl)
                .HasMaxLength(255)
                .HasComment("回调通知URL")
                .HasColumnName("notify_url");
            entity.Property(e => e.NonceStr)
                .HasMaxLength(64)
                .HasComment("随机字符串")
                .HasColumnName("nonce_str");
            entity.Property(e => e.PayTime)
                .HasComment("支付时间")
                .HasColumnName("pay_time");
            entity.Property(e => e.PayAmount)
                .HasComment("支付金额")
                .HasColumnType("decimal(10, 2)")
                .HasColumnName("pay_amount");
            entity.Property(e => e.Status)
                .HasDefaultValue((byte)0)
                .HasComment("处理状态：0=待处理，1=处理成功，2=处理失败")
                .HasColumnName("status");
            entity.Property(e => e.RetryCount)
                .HasDefaultValue(0)
                .HasComment("重试次数")
                .HasColumnName("retry_count");
            entity.Property(e => e.Attach)
                .HasMaxLength(128)
                .HasComment("附加数据（订单类型）")
                .HasColumnName("attach");
            entity.Property(e => e.OpenId)
                .HasMaxLength(64)
                .HasComment("用户OpenId")
                .HasColumnName("open_id");
            entity.Property(e => e.RawData)
                .HasComment("原始回调数据")
                .HasColumnName("raw_data");
            entity.Property(e => e.ErrorMessage)
                .HasMaxLength(500)
                .HasComment("错误信息")
                .HasColumnName("error_message");
            entity.Property(e => e.CreatedAt)
                .HasDefaultValueSql("(getdate())")
                .HasComment("创建时间")
                .HasColumnName("created_at");
            entity.Property(e => e.UpdatedAt)
                .HasDefaultValueSql("(getdate())")
                .HasComment("更新时间")
                .HasColumnName("updated_at");
        });

        modelBuilder.Entity<UserRecharge>(entity =>
        {
            entity.HasKey(e => e.Id).HasName("pk_user_recharges");

            entity.ToTable("user_recharges", tb => tb.HasComment("用户充值订单表"));

            entity.HasIndex(e => e.OrderNum, "uk_user_recharges_order_num").IsUnique();

            entity.HasIndex(e => e.UserId, "ix_user_recharges_user_id");

            entity.HasIndex(e => e.Status, "ix_user_recharges_status");

            entity.Property(e => e.Id)
                .HasComment("主键ID")
                .HasColumnName("id");
            entity.Property(e => e.UserId)
                .HasComment("用户ID")
                .HasColumnName("user_id");
            entity.Property(e => e.OrderNum)
                .HasMaxLength(100)
                .HasComment("订单号")
                .HasColumnName("order_num");
            entity.Property(e => e.Money)
                .HasComment("充值金额")
                .HasColumnType("decimal(10, 2)")
                .HasColumnName("money");
            entity.Property(e => e.Status)
                .HasDefaultValue((byte)1)
                .HasComment("状态: 1待支付 2已完成")
                .HasColumnName("status");
            entity.Property(e => e.CreatedAt)
                .HasComment("创建时间（Unix时间戳）")
                .HasColumnName("created_at");
            entity.Property(e => e.PayTime)
                .HasDefaultValue(0)
                .HasComment("支付时间（Unix时间戳）")
                .HasColumnName("pay_time");
        });

        modelBuilder.Entity<UserItemCard>(entity =>
        {
            entity.ToTable("user_item_card");

            entity.HasKey(e => e.Id);

            entity.HasIndex(e => e.UserId, "ix_user_item_card_user_id");

            entity.HasIndex(e => e.Status, "ix_user_item_card_status");

            entity.Property(e => e.Id)
                .HasComment("主键ID")
                .HasColumnName("id");
            entity.Property(e => e.UserId)
                .HasComment("用户ID")
                .HasColumnName("user_id");
            entity.Property(e => e.Type)
                .HasDefaultValue((byte)0)
                .HasComment("类型")
                .HasColumnName("type");
            entity.Property(e => e.ItemCardId)
                .HasComment("道具卡ID")
                .HasColumnName("item_card_id");
            entity.Property(e => e.Title)
                .HasMaxLength(255)
                .HasComment("名称")
                .HasColumnName("title");
            entity.Property(e => e.Status)
                .HasDefaultValue((byte)0)
                .HasComment("状态：1=未使用，2=已使用")
                .HasColumnName("status");
            entity.Property(e => e.OrderId)
                .HasDefaultValue(0)
                .HasComment("抵扣的订单ID")
                .HasColumnName("order_id");
            entity.Property(e => e.Addtime)
                .HasComment("创建时间戳")
                .HasColumnName("addtime");
            entity.Property(e => e.Updatetime)
                .HasComment("更新时间戳")
                .HasColumnName("updatetime");
            entity.Property(e => e.Deltime)
                .HasComment("删除时间戳")
                .HasColumnName("deltime");
        });

        modelBuilder.Entity<Danye>(entity =>
        {
            entity.HasKey(e => e.Id).HasName("pk_danye");

            entity.ToTable("danye", tb => tb.HasComment("单页内容表"));

            entity.Property(e => e.Id)
                .HasComment("主键ID")
                .HasColumnName("id");
            entity.Property(e => e.Title)
                .HasMaxLength(255)
                .HasComment("标题")
                .HasColumnName("title");
            entity.Property(e => e.Content)
                .HasComment("内容（富文本）")
                .HasColumnName("content");
            entity.Property(e => e.UpdateTime)
                .HasComment("更新时间戳")
                .HasColumnName("update_time");
            entity.Property(e => e.Status)
                .HasDefaultValue((byte)0)
                .HasComment("状态：0-禁用 1-启用")
                .HasColumnName("status");
            entity.Property(e => e.IsImageOptimizer)
                .HasDefaultValue((byte)0)
                .HasComment("是否启用图片优化：0-否 1-是")
                .HasColumnName("is_image_optimizer");
        });

        modelBuilder.Entity<Reward>(entity =>
        {
            entity.HasKey(e => e.Id).HasName("pk_rewards");

            entity.ToTable("rewards", tb => tb.HasComment("奖励配置表"));

            entity.HasIndex(e => e.RewardId, "ix_rewards_reward_id");

            entity.Property(e => e.Id)
                .HasComment("主键ID")
                .HasColumnName("id");
            entity.Property(e => e.RewardId)
                .HasMaxLength(64)
                .HasComment("奖励ID（业务标识）")
                .HasColumnName("reward_id");
            entity.Property(e => e.RewardType)
                .HasComment("奖励类型：1-钻石 2-UU币 3-达达卷 4-优惠券")
                .HasColumnName("reward_type");
            entity.Property(e => e.RewardExtend)
                .HasComment("奖励扩展参数（如优惠券ID）")
                .HasColumnName("reward_extend");
            entity.Property(e => e.RewardValue)
                .HasColumnType("decimal(10, 2)")
                .HasComment("奖励数值")
                .HasColumnName("reward_value");
            entity.Property(e => e.Description)
                .HasMaxLength(255)
                .HasComment("描述")
                .HasColumnName("description");
            entity.Property(e => e.CreatedAt)
                .HasComment("创建时间")
                .HasColumnName("created_at");
            entity.Property(e => e.UpdatedAt)
                .HasComment("更新时间")
                .HasColumnName("updated_at");
        });

        modelBuilder.Entity<FloatBallConfig>(entity =>
        {
            entity.HasKey(e => e.Id).HasName("pk_float_ball_configs");

            entity.ToTable("float_ball_configs", tb => tb.HasComment("悬浮球配置表，存储首页悬浮球配置信息"));

            entity.HasIndex(e => e.Status, "ix_float_ball_configs_status");

            entity.Property(e => e.Id)
                .HasComment("主键ID")
                .HasColumnName("id");
            entity.Property(e => e.Status)
                .HasDefaultValue((byte)0)
                .HasComment("状态: 0关闭 1开启")
                .HasColumnName("status");
            entity.Property(e => e.Type)
                .HasDefaultValue((byte)1)
                .HasComment("类型: 1展示图片 2跳转页面")
                .HasColumnName("type");
            entity.Property(e => e.Image)
                .HasMaxLength(255)
                .HasDefaultValue("")
                .HasComment("悬浮球图片URL")
                .HasColumnName("image");
            entity.Property(e => e.LinkUrl)
                .HasMaxLength(255)
                .HasDefaultValue("")
                .HasComment("跳转链接")
                .HasColumnName("link_url");
            entity.Property(e => e.PositionX)
                .HasMaxLength(30)
                .HasDefaultValue("")
                .HasComment("X轴位置")
                .HasColumnName("position_x");
            entity.Property(e => e.PositionY)
                .HasMaxLength(30)
                .HasDefaultValue("")
                .HasComment("Y轴位置")
                .HasColumnName("position_y");
            entity.Property(e => e.Width)
                .HasMaxLength(30)
                .HasDefaultValue("")
                .HasComment("宽度")
                .HasColumnName("width");
            entity.Property(e => e.Height)
                .HasMaxLength(30)
                .HasDefaultValue("")
                .HasComment("高度")
                .HasColumnName("height");
            entity.Property(e => e.Effect)
                .HasDefaultValue((byte)0)
                .HasComment("特效: 0无 1缩放动画")
                .HasColumnName("effect");
            entity.Property(e => e.Title)
                .HasMaxLength(255)
                .HasComment("标题")
                .HasColumnName("title");
            entity.Property(e => e.ImageDetails)
                .HasMaxLength(255)
                .HasComment("详情图片URL")
                .HasColumnName("image_details");
            entity.Property(e => e.ImageBj)
                .HasMaxLength(255)
                .HasComment("背景图片URL")
                .HasColumnName("image_bj");
            entity.Property(e => e.ImageDetailsX)
                .HasMaxLength(255)
                .HasComment("详情图片X偏移")
                .HasColumnName("image_details_x");
            entity.Property(e => e.ImageDetailsY)
                .HasMaxLength(255)
                .HasComment("详情图片Y偏移")
                .HasColumnName("image_details_y");
            entity.Property(e => e.ImageDetailsW)
                .HasMaxLength(255)
                .HasComment("详情图片宽度")
                .HasColumnName("image_details_w");
            entity.Property(e => e.ImageDetailsH)
                .HasMaxLength(255)
                .HasComment("详情图片高度")
                .HasColumnName("image_details_h");
            entity.Property(e => e.CreatedAt)
                .HasDefaultValueSql("(getdate())")
                .HasComment("创建时间")
                .HasColumnName("created_at");
            entity.Property(e => e.UpdatedAt)
                .HasDefaultValueSql("(getdate())")
                .HasComment("更新时间")
                .HasColumnName("updated_at");
        });

        modelBuilder.Entity<WelfareHouse>(entity =>
        {
            entity.HasKey(e => e.Id).HasName("pk_welfare_house");

            entity.ToTable("welfare_house", tb => tb.HasComment("福利屋配置表"));

            entity.HasIndex(e => e.Status, "ix_welfare_house_status");
            entity.HasIndex(e => e.Sort, "ix_welfare_house_sort");

            entity.Property(e => e.Id)
                .HasComment("主键ID")
                .HasColumnName("id");
            entity.Property(e => e.Name)
                .HasMaxLength(100)
                .HasComment("名称")
                .HasColumnName("name");
            entity.Property(e => e.Image)
                .HasMaxLength(255)
                .HasComment("图片")
                .HasColumnName("image");
            entity.Property(e => e.Url)
                .HasMaxLength(255)
                .HasComment("跳转链接")
                .HasColumnName("url");
            entity.Property(e => e.Sort)
                .HasDefaultValue(0)
                .HasComment("排序")
                .HasColumnName("sort");
            entity.Property(e => e.Status)
                .HasDefaultValue((byte)1)
                .HasComment("状态：0禁用 1启用")
                .HasColumnName("status");
            entity.Property(e => e.CreateTime)
                .HasComment("创建时间")
                .HasColumnName("create_time");
            entity.Property(e => e.UpdateTime)
                .HasComment("更新时间")
                .HasColumnName("update_time");
        });

        modelBuilder.Entity<RankWeek>(entity =>
        {
            entity.HasKey(e => e.Id).HasName("pk_rank_week");

            entity.ToTable("rank_week", tb => tb.HasComment("周榜中奖记录表"));

            entity.HasIndex(e => e.UserId, "ix_rank_week_user_id");

            entity.Property(e => e.Id)
                .HasComment("主键ID")
                .HasColumnName("id");
            entity.Property(e => e.UserId)
                .HasComment("用户ID")
                .HasColumnName("user_id");
            entity.Property(e => e.Rank)
                .HasComment("排名")
                .HasColumnName("rank");
            entity.Property(e => e.Money)
                .HasComment("消费金额")
                .HasColumnType("decimal(10, 2)")
                .HasColumnName("money");
            entity.Property(e => e.WeekTime)
                .HasMaxLength(100)
                .HasComment("统计时间范围")
                .HasColumnName("week_time");
            entity.Property(e => e.Addtime)
                .HasComment("添加时间")
                .HasColumnName("addtime");
            entity.Property(e => e.OrderListId)
                .HasComment("奖品ID")
                .HasColumnName("order_list_id");
            entity.Property(e => e.PrizeTitle)
                .HasMaxLength(255)
                .HasComment("奖品标题")
                .HasColumnName("prize_title");
            entity.Property(e => e.PrizeImgUrl)
                .HasMaxLength(255)
                .HasComment("奖品图片URL")
                .HasColumnName("prize_imgurl");
        });

        modelBuilder.Entity<RankMonth>(entity =>
        {
            entity.HasKey(e => e.Id).HasName("pk_rank_month");

            entity.ToTable("rank_month", tb => tb.HasComment("月榜中奖记录表"));

            entity.HasIndex(e => e.UserId, "ix_rank_month_user_id");

            entity.Property(e => e.Id)
                .HasComment("主键ID")
                .HasColumnName("id");
            entity.Property(e => e.UserId)
                .HasComment("用户ID")
                .HasColumnName("user_id");
            entity.Property(e => e.Rank)
                .HasComment("排名")
                .HasColumnName("rank");
            entity.Property(e => e.Money)
                .HasComment("消费金额")
                .HasColumnType("decimal(10, 2)")
                .HasColumnName("money");
            entity.Property(e => e.MonthTime)
                .HasMaxLength(100)
                .HasComment("统计时间范围")
                .HasColumnName("month_time");
            entity.Property(e => e.Addtime)
                .HasComment("添加时间")
                .HasColumnName("addtime");
            entity.Property(e => e.OrderListId)
                .HasComment("奖品ID")
                .HasColumnName("order_list_id");
            entity.Property(e => e.PrizeTitle)
                .HasMaxLength(255)
                .HasComment("奖品标题")
                .HasColumnName("prize_title");
            entity.Property(e => e.PrizeImgUrl)
                .HasMaxLength(255)
                .HasComment("奖品图片URL")
                .HasColumnName("prize_imgurl");
        });

        modelBuilder.Entity<GoodsKingRank>(entity =>
        {
            entity.HasKey(e => e.Id).HasName("pk_goods_king_ranks");

            entity.ToTable("goods_king_ranks", tb => tb.HasComment("领主赏记录表，记录领主占领和挑战信息"));

            entity.HasIndex(e => e.UserId, "ix_goods_king_ranks_user_id");
            entity.HasIndex(e => e.GoodsId, "ix_goods_king_ranks_goods_id");
            entity.HasIndex(e => new { e.UserId, e.GoodsId }, "ix_goods_king_ranks_user_goods");

            entity.Property(e => e.Id)
                .HasComment("主键ID")
                .HasColumnName("id");
            entity.Property(e => e.UserId)
                .HasComment("用户ID（领主）")
                .HasColumnName("user_id");
            entity.Property(e => e.GoodsId)
                .HasComment("商品ID")
                .HasColumnName("goods_id");
            entity.Property(e => e.Count)
                .HasDefaultValue(0)
                .HasComment("占领时的抽奖次数")
                .HasColumnName("count");
            entity.Property(e => e.ZNums)
                .HasDefaultValue(0)
                .HasComment("被挑战次数")
                .HasColumnName("z_nums");
            entity.Property(e => e.Money)
                .HasDefaultValue(0m)
                .HasComment("领主收益金额")
                .HasColumnType("decimal(10, 2)")
                .HasColumnName("money");
            entity.Property(e => e.OrderListId)
                .HasDefaultValue(0)
                .HasComment("关联的中奖记录ID")
                .HasColumnName("order_list_id");
            entity.Property(e => e.Addtime)
                .HasDefaultValue(0)
                .HasComment("成为领主的时间戳")
                .HasColumnName("addtime");
            entity.Property(e => e.EndTime)
                .HasDefaultValue(0)
                .HasComment("结束领主的时间戳")
                .HasColumnName("end_time");
        });

        modelBuilder.Entity<UserRefreshToken>(entity =>
        {
            entity.HasKey(e => e.Id).HasName("pk_user_refresh_tokens");

            entity.ToTable("user_refresh_tokens", tb => tb.HasComment("用户刷新令牌表，存储 Refresh Token 信息用于双 Token 认证机制"));

            entity.HasIndex(e => e.UserId, "ix_user_refresh_tokens_user_id");
            entity.HasIndex(e => e.TokenHash, "ix_user_refresh_tokens_token_hash");
            entity.HasIndex(e => e.ExpiresAt, "ix_user_refresh_tokens_expires_at");

            entity.Property(e => e.Id)
                .HasComment("主键ID")
                .HasColumnName("id");
            entity.Property(e => e.UserId)
                .HasComment("用户ID")
                .HasColumnName("user_id");
            entity.Property(e => e.TokenHash)
                .HasMaxLength(256)
                .HasComment("Token 哈希值（SHA256）")
                .HasColumnName("token_hash");
            entity.Property(e => e.ExpiresAt)
                .HasComment("过期时间")
                .HasColumnName("expires_at");
            entity.Property(e => e.CreatedAt)
                .HasDefaultValueSql("(getdate())")
                .HasComment("创建时间")
                .HasColumnName("created_at");
            entity.Property(e => e.CreatedByIp)
                .HasMaxLength(50)
                .HasComment("创建时的 IP 地址")
                .HasColumnName("created_by_ip");
            entity.Property(e => e.RevokedAt)
                .HasComment("撤销时间")
                .HasColumnName("revoked_at");
            entity.Property(e => e.RevokedByIp)
                .HasMaxLength(50)
                .HasComment("撤销时的 IP 地址")
                .HasColumnName("revoked_by_ip");
            entity.Property(e => e.ReplacedByToken)
                .HasMaxLength(256)
                .HasComment("被替换的新 Token 哈希值")
                .HasColumnName("replaced_by_token");

            entity.HasOne(e => e.User)
                .WithMany()
                .HasForeignKey(e => e.UserId)
                .OnDelete(DeleteBehavior.Cascade)
                .HasConstraintName("fk_user_refresh_tokens_users");
        });

        modelBuilder.Entity<GoodsDesignatedPrize>(entity =>
        {
            entity.HasKey(e => e.Id).HasName("pk_goods_designated_prizes");

            entity.ToTable("goods_designated_prizes", tb => tb.HasComment("指定中奖配置表，用于配置特定奖品只能被指定用户抽中"));

            entity.HasIndex(e => e.GoodsId, "ix_goods_designated_prizes_goods_id");
            entity.HasIndex(e => e.UserId, "ix_goods_designated_prizes_user_id");
            entity.HasIndex(e => e.GoodsItemId, "ix_goods_designated_prizes_goods_item_id");
            entity.HasIndex(e => new { e.GoodsId, e.GoodsItemId }, "uq_goods_designated_prizes_goods_item").IsUnique();

            entity.Property(e => e.Id)
                .HasComment("主键ID")
                .HasColumnName("id");
            entity.Property(e => e.GoodsId)
                .HasComment("商品/盒子ID")
                .HasColumnName("goods_id");
            entity.Property(e => e.GoodsItemId)
                .HasComment("奖品ID")
                .HasColumnName("goods_item_id");
            entity.Property(e => e.UserId)
                .HasComment("指定用户ID")
                .HasColumnName("user_id");
            entity.Property(e => e.IsActive)
                .HasDefaultValue(true)
                .HasComment("是否启用 true-启用 false-禁用")
                .HasColumnName("is_active");
            entity.Property(e => e.Remark)
                .HasMaxLength(200)
                .HasComment("备注")
                .HasColumnName("remark");
            entity.Property(e => e.CreatedAt)
                .HasDefaultValueSql("(getdate())")
                .HasComment("创建时间")
                .HasColumnName("created_at");
            entity.Property(e => e.UpdatedAt)
                .HasComment("更新时间")
                .HasColumnName("updated_at");

            entity.HasOne(e => e.Goods)
                .WithMany()
                .HasForeignKey(e => e.GoodsId)
                .OnDelete(DeleteBehavior.Cascade)
                .HasConstraintName("fk_goods_designated_prizes_goods");

            entity.HasOne(e => e.GoodsItem)
                .WithMany()
                .HasForeignKey(e => e.GoodsItemId)
                .OnDelete(DeleteBehavior.NoAction)
                .HasConstraintName("fk_goods_designated_prizes_goods_items");

            entity.HasOne(e => e.User)
                .WithMany()
                .HasForeignKey(e => e.UserId)
                .OnDelete(DeleteBehavior.NoAction)
                .HasConstraintName("fk_goods_designated_prizes_users");
        });

        modelBuilder.Entity<PrizeAnnouncement>(entity =>
        {
            entity.HasKey(e => e.Id).HasName("pk_prize_announcements");

            entity.ToTable("prize_announcements", tb => tb.HasComment("中奖公告配置表，存储首页假中奖公告信息"));

            entity.HasIndex(e => e.IsEnabled, "ix_prize_announcements_is_enabled");
            entity.HasIndex(e => e.Sort, "ix_prize_announcements_sort");

            entity.Property(e => e.Id)
                .HasComment("主键ID")
                .HasColumnName("id");
            entity.Property(e => e.UserAvatar)
                .HasMaxLength(500)
                .HasComment("用户头像URL")
                .HasColumnName("user_avatar");
            entity.Property(e => e.UserName)
                .HasMaxLength(50)
                .IsRequired()
                .HasComment("用户名称")
                .HasColumnName("user_name");
            entity.Property(e => e.PrizeLevel)
                .HasMaxLength(20)
                .IsRequired()
                .HasComment("奖品等级（如：无上、传说、史诗、稀有）")
                .HasColumnName("prize_level");
            entity.Property(e => e.PrizeName)
                .HasMaxLength(100)
                .IsRequired()
                .HasComment("奖品名称")
                .HasColumnName("prize_name");
            entity.Property(e => e.Sort)
                .HasDefaultValue(0)
                .HasComment("排序值，越小越靠前")
                .HasColumnName("sort");
            entity.Property(e => e.IsEnabled)
                .HasDefaultValue(true)
                .HasComment("是否启用")
                .HasColumnName("is_enabled");
            entity.Property(e => e.CreatedAt)
                .HasDefaultValueSql("(getdate())")
                .HasComment("创建时间")
                .HasColumnName("created_at");
            entity.Property(e => e.UpdatedAt)
                .HasDefaultValueSql("(getdate())")
                .HasComment("更新时间")
                .HasColumnName("updated_at");
        });

        OnModelCreatingPartial(modelBuilder);
    }

    partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
}

