This commit is contained in:
2026-03-25 14:55:34 +08:00
commit 2c44b3a4b2
131 changed files with 7453 additions and 0 deletions

View File

@@ -0,0 +1,67 @@
using System;
using System.Collections.Generic;
namespace StopShopping.EF.Models;
/// <summary>
/// 收货地址
/// </summary>
public partial class Address
{
/// <summary>
/// 主键
/// </summary>
public int Id { get; set; }
/// <summary>
/// 用户表id
/// </summary>
public int UserId { get; set; }
/// <summary>
/// 收货人地址
/// </summary>
public string Name { get; set; } = null!;
/// <summary>
/// 联系电话
/// </summary>
public string Telephone { get; set; } = null!;
/// <summary>
/// 自定义标签:学校、家等
/// </summary>
public string? Tag { get; set; }
/// <summary>
/// 是否默认地址
/// </summary>
public bool Default { get; set; }
/// <summary>
/// 行政区域id表示省/直辖市
/// </summary>
public int DistrictLevel1Id { get; set; }
/// <summary>
/// 行政区域id表示市/直辖市为空
/// </summary>
public int? DistrictLevel2Id { get; set; }
/// <summary>
/// 行政区域id表示区
/// </summary>
public int DistrictLevel3Id { get; set; }
/// <summary>
/// 详细地址
/// </summary>
public string? Detail { get; set; }
/// <summary>
/// 行政区域id表示街道/镇
/// </summary>
public int DistrictLevel4Id { get; set; }
public virtual User User { get; set; } = null!;
}

View File

@@ -0,0 +1,40 @@
using System;
using System.Collections.Generic;
namespace StopShopping.EF.Models;
/// <summary>
/// 管理员
/// </summary>
public partial class Administrator
{
/// <summary>
/// 主键
/// </summary>
public int Id { get; set; }
/// <summary>
/// 登录账号
/// </summary>
public string Account { get; set; } = null!;
/// <summary>
/// 昵称
/// </summary>
public string NickName { get; set; } = null!;
/// <summary>
/// 登录密码(已加密)
/// </summary>
public string Password { get; set; } = null!;
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateTime { get; set; }
/// <summary>
/// 最后登录时间
/// </summary>
public DateTime LastLoginTime { get; set; }
}

View File

@@ -0,0 +1,54 @@
using System;
using System.Collections.Generic;
namespace StopShopping.EF.Models;
/// <summary>
/// 商品分类
/// </summary>
public partial class Category
{
/// <summary>
/// 主键
/// </summary>
public int Id { get; set; }
/// <summary>
/// 父级id顶级为0
/// </summary>
public int ParentId { get; set; }
/// <summary>
/// id路径枚举/1/2/3/
/// </summary>
public string Path { get; set; } = null!;
/// <summary>
/// 名称
/// </summary>
public string Name { get; set; } = null!;
/// <summary>
/// 层级从1开始
/// </summary>
public short Level { get; set; }
/// <summary>
/// logo图片名后台生成地址
/// </summary>
public string? Logo { get; set; }
/// <summary>
/// 层级中序号
/// </summary>
public short Order { get; set; }
/// <summary>
/// 软删除标识
/// </summary>
public bool Deleted { get; set; }
public virtual ICollection<Product> Products { get; set; } = new List<Product>();
public virtual ICollection<Request> Requests { get; set; } = new List<Request>();
}

View File

@@ -0,0 +1,60 @@
using System;
using System.Collections.Generic;
namespace StopShopping.EF.Models;
/// <summary>
/// 行政区划
/// </summary>
public partial class District
{
/// <summary>
/// 主键
/// </summary>
public int Id { get; set; }
/// <summary>
/// 父级id顶级时为0
/// </summary>
public int ParentId { get; set; }
/// <summary>
/// 编码
/// </summary>
public string Code { get; set; } = null!;
/// <summary>
/// 简称
/// </summary>
public string? Name { get; set; }
/// <summary>
/// 全称
/// </summary>
public string FullName { get; set; } = null!;
/// <summary>
/// 名称拼音
/// </summary>
public string? Pinyin { get; set; }
/// <summary>
/// 层级1-省/直辖市2-市/直辖市无3-区4-街道
/// </summary>
public short Level { get; set; }
/// <summary>
/// 经度
/// </summary>
public string? Latitude { get; set; }
/// <summary>
/// 纬度
/// </summary>
public string? Longitude { get; set; }
/// <summary>
/// 层级中序号
/// </summary>
public short Order { get; set; }
}

View File

@@ -0,0 +1,55 @@
using System;
using System.Collections.Generic;
namespace StopShopping.EF.Models;
/// <summary>
/// 物流
/// </summary>
public partial class Logistic
{
/// <summary>
/// 主键
/// </summary>
public int Id { get; set; }
/// <summary>
/// 快递单号
/// </summary>
public string OrderNo { get; set; } = null!;
/// <summary>
/// 快递公司
/// </summary>
public string Company { get; set; } = null!;
/// <summary>
/// 物流状态1-揽收0-在途5-派件6-退回4-退签3-签收2-疑难7-转投8。。。-清关
/// </summary>
public short Status { get; set; }
/// <summary>
/// 到达时间
/// </summary>
public DateTime ArrivalTime { get; set; }
/// <summary>
/// 到达地点
/// </summary>
public string Location { get; set; } = null!;
/// <summary>
/// 详情
/// </summary>
public string Context { get; set; } = null!;
/// <summary>
/// 需求id
/// </summary>
public int RequestId { get; set; }
/// <summary>
/// 入库时间
/// </summary>
public DateTime CreateTime { get; set; }
}

View File

@@ -0,0 +1,45 @@
using System;
using System.Collections.Generic;
namespace StopShopping.EF.Models;
/// <summary>
/// 用户消息
/// </summary>
public partial class Message
{
/// <summary>
/// 主键
/// </summary>
public int Id { get; set; }
/// <summary>
/// 发出用户id
/// </summary>
public int FromUserId { get; set; }
/// <summary>
/// 接收用户id
/// </summary>
public int ToUserId { get; set; }
/// <summary>
/// 发出时间
/// </summary>
public DateTime SentTime { get; set; }
/// <summary>
/// 是否已读
/// </summary>
public bool Read { get; set; }
/// <summary>
/// 是否已撤回
/// </summary>
public bool Recalled { get; set; }
/// <summary>
/// 内容
/// </summary>
public string Content { get; set; } = null!;
}

View File

@@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
namespace StopShopping.EF.Models;
/// <summary>
/// 系统通知
/// </summary>
public partial class Notice
{
/// <summary>
/// 主键
/// </summary>
public int Id { get; set; }
/// <summary>
/// 内容
/// </summary>
public string Content { get; set; } = null!;
/// <summary>
/// 是否已审核
/// </summary>
public bool Verified { get; set; }
/// <summary>
/// 发布时间
/// </summary>
public DateTime PublishTime { get; set; }
}

View File

@@ -0,0 +1,50 @@
using System;
using System.Collections.Generic;
namespace StopShopping.EF.Models;
/// <summary>
/// 操作日志
/// </summary>
public partial class OperateLog
{
/// <summary>
/// 主键
/// </summary>
public int Id { get; set; }
/// <summary>
/// 操作类型c-创建u-修改d-删除
/// </summary>
public char OperateType { get; set; }
/// <summary>
/// 目标类型0-行政区划1-商品分类。。。
/// </summary>
public int TargetType { get; set; }
/// <summary>
/// 关联id目标表主键
/// </summary>
public int RelatedId { get; set; }
/// <summary>
/// 管理员id
/// </summary>
public int OperaterId { get; set; }
/// <summary>
/// 操作描述
/// </summary>
public string? Description { get; set; }
/// <summary>
/// 操作时间
/// </summary>
public DateTime OperateTime { get; set; }
/// <summary>
/// 入库时间
/// </summary>
public DateTime CreateTime { get; set; }
}

View File

@@ -0,0 +1,79 @@
using System;
using System.Collections.Generic;
namespace StopShopping.EF.Models;
/// <summary>
/// 卖家商品表
/// </summary>
public partial class Product
{
/// <summary>
/// 主键
/// </summary>
public int Id { get; set; }
/// <summary>
/// 系统唯一编号
/// </summary>
public string SerialNo { get; set; } = null!;
/// <summary>
/// 名称
/// </summary>
public string Name { get; set; } = null!;
/// <summary>
/// 商品描述
/// </summary>
public string? Description { get; set; }
/// <summary>
/// 商品图片
/// </summary>
public string Logo { get; set; } = null!;
/// <summary>
/// 商品分类id
/// </summary>
public int CategoryId { get; set; }
/// <summary>
/// 用户id
/// </summary>
public int UserId { get; set; }
/// <summary>
/// 最小销售单元
/// </summary>
public string MinimumUnit { get; set; } = null!;
/// <summary>
/// 单价
/// </summary>
public decimal UnitPrice { get; set; }
/// <summary>
/// 详情
/// </summary>
public string? Detail { get; set; }
/// <summary>
/// 已售数量
/// </summary>
public int SoldAmount { get; set; }
/// <summary>
/// 软删除标识
/// </summary>
public bool Deleted { get; set; }
/// <summary>
/// 添加时间
/// </summary>
public DateTime CreateTime { get; set; }
public virtual Category Category { get; set; } = null!;
public virtual ICollection<Reply> Replies { get; set; } = new List<Reply>();
}

View File

@@ -0,0 +1,40 @@
using System;
using System.Collections.Generic;
namespace StopShopping.EF.Models;
/// <summary>
/// 刷新令牌
/// </summary>
public partial class RefreshToken
{
/// <summary>
/// 主键
/// </summary>
public long Id { get; set; }
/// <summary>
/// 系统角色a-管理员u-用户
/// </summary>
public char SystemRole { get; set; }
/// <summary>
/// 令牌
/// </summary>
public string Token { get; set; } = null!;
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateTime { get; set; }
/// <summary>
/// 失效时间
/// </summary>
public DateTime ExpiresAt { get; set; }
/// <summary>
/// 用户/管理员id
/// </summary>
public int UserId { get; set; }
}

View File

@@ -0,0 +1,61 @@
using System;
using System.Collections.Generic;
namespace StopShopping.EF.Models;
/// <summary>
/// 竞标表
/// </summary>
public partial class Reply
{
/// <summary>
/// 主键
/// </summary>
public int Id { get; set; }
/// <summary>
/// 商品id
/// </summary>
public int ProductId { get; set; }
/// <summary>
/// 数量
/// </summary>
public int Amount { get; set; }
/// <summary>
/// 价格,自动计算的价格(product.unit_price * amount)之后的优惠价格
/// </summary>
public decimal Price { get; set; }
/// <summary>
/// 竞标者id
/// </summary>
public int UserId { get; set; }
/// <summary>
/// 回应时间
/// </summary>
public DateTime ReplyTime { get; set; }
/// <summary>
/// 需求id
/// </summary>
public int RequestId { get; set; }
/// <summary>
/// 留言
/// </summary>
public string? Memo { get; set; }
/// <summary>
/// 是否已拒绝
/// </summary>
public bool Rejected { get; set; }
public virtual Product Product { get; set; } = null!;
public virtual Request Request { get; set; } = null!;
public virtual User User { get; set; } = null!;
}

View File

@@ -0,0 +1,66 @@
using System;
using System.Collections.Generic;
namespace StopShopping.EF.Models;
/// <summary>
/// 用户需求
/// </summary>
public partial class Request
{
/// <summary>
/// 主键
/// </summary>
public int Id { get; set; }
/// <summary>
/// 需求单号,系统唯一,后台生成
/// </summary>
public string SerialNo { get; set; } = null!;
/// <summary>
/// 名称
/// </summary>
public string Name { get; set; } = null!;
/// <summary>
/// 需求描述
/// </summary>
public string? Description { get; set; }
/// <summary>
/// 商品分类id
/// </summary>
public int CategoryId { get; set; }
/// <summary>
/// 状态0-发布1-有竞标2-待发货3-待收货4-已完成5-已评价
/// </summary>
public short Status { get; set; }
/// <summary>
/// 发布者id
/// </summary>
public int PublisherId { get; set; }
/// <summary>
/// 发布时间
/// </summary>
public DateTime PublishTime { get; set; }
/// <summary>
/// 截止日期
/// </summary>
public DateOnly Deadline { get; set; }
/// <summary>
/// 是否已删除
/// </summary>
public bool Deleted { get; set; }
public virtual Category Category { get; set; } = null!;
public virtual User Publisher { get; set; } = null!;
public virtual ICollection<Reply> Replies { get; set; } = new List<Reply>();
}

View File

@@ -0,0 +1,61 @@
using System;
using System.Collections.Generic;
namespace StopShopping.EF.Models;
/// <summary>
/// 用户
/// </summary>
public partial class User
{
/// <summary>
/// 主键
/// </summary>
public int Id { get; set; }
/// <summary>
/// 登录账号
/// </summary>
public string Account { get; set; } = null!;
/// <summary>
/// 昵称
/// </summary>
public string NickName { get; set; } = null!;
/// <summary>
/// 头像图片名,后台生成链接
/// </summary>
public string? Avatar { get; set; }
/// <summary>
/// 当前角色c-买家s-卖家
/// </summary>
public char CurrentRole { get; set; }
/// <summary>
/// 电话
/// </summary>
public string? Telephone { get; set; }
/// <summary>
/// 密码(已加密)
/// </summary>
public string Password { get; set; } = null!;
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateTime { get; set; }
/// <summary>
/// 最后登录时间
/// </summary>
public DateTime? LastLoginTime { get; set; }
public virtual ICollection<Address> Addresses { get; set; } = new List<Address>();
public virtual ICollection<Reply> Replies { get; set; } = new List<Reply>();
public virtual ICollection<Request> Requests { get; set; } = new List<Request>();
}

View File

@@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<NoWarn>IDE0005;CS1591</NoWarn>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="10.0.0" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,597 @@
using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore;
using StopShopping.EF.Models;
namespace StopShopping.EF;
public partial class StopShoppingContext : DbContext
{
public StopShoppingContext(DbContextOptions<StopShoppingContext> options)
: base(options)
{
}
public virtual DbSet<Address> Addresses { get; set; }
public virtual DbSet<Administrator> Administrators { get; set; }
public virtual DbSet<Category> Categories { get; set; }
public virtual DbSet<District> Districts { get; set; }
public virtual DbSet<Logistic> Logistics { get; set; }
public virtual DbSet<Message> Messages { get; set; }
public virtual DbSet<Notice> Notices { get; set; }
public virtual DbSet<OperateLog> OperateLogs { get; set; }
public virtual DbSet<Product> Products { get; set; }
public virtual DbSet<RefreshToken> RefreshTokens { get; set; }
public virtual DbSet<Reply> Replies { get; set; }
public virtual DbSet<Request> Requests { get; set; }
public virtual DbSet<User> Users { get; set; }
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<Address>(entity =>
{
entity.HasKey(e => e.Id).HasName("address_pkey");
entity.ToTable("address", tb => tb.HasComment("收货地址"));
entity.Property(e => e.Id)
.HasComment("主键")
.UseIdentityAlwaysColumn()
.HasColumnName("id");
entity.Property(e => e.Default)
.HasComment("是否默认地址")
.HasColumnName("default");
entity.Property(e => e.Detail)
.HasMaxLength(200)
.HasComment("详细地址")
.HasColumnName("detail");
entity.Property(e => e.DistrictLevel1Id)
.HasComment("行政区域id表示省/直辖市")
.HasColumnName("district_level1_id");
entity.Property(e => e.DistrictLevel2Id)
.HasComment("行政区域id表示市/直辖市为空")
.HasColumnName("district_level2_id");
entity.Property(e => e.DistrictLevel3Id)
.HasComment("行政区域id表示区")
.HasColumnName("district_level3_id");
entity.Property(e => e.DistrictLevel4Id)
.HasComment("行政区域id表示街道/镇")
.HasColumnName("district_level4_id");
entity.Property(e => e.Name)
.HasMaxLength(20)
.HasComment("收货人地址")
.HasColumnName("name");
entity.Property(e => e.Tag)
.HasMaxLength(20)
.HasComment("自定义标签:学校、家等")
.HasColumnName("tag");
entity.Property(e => e.Telephone)
.HasMaxLength(20)
.HasComment("联系电话")
.HasColumnName("telephone");
entity.Property(e => e.UserId)
.HasComment("用户表id")
.HasColumnName("user_id");
entity.HasOne(d => d.User).WithMany(p => p.Addresses)
.HasForeignKey(d => d.UserId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("fk_useraddress");
});
modelBuilder.Entity<Administrator>(entity =>
{
entity.HasKey(e => e.Id).HasName("administrator_pkey");
entity.ToTable("administrator", tb => tb.HasComment("管理员"));
entity.Property(e => e.Id)
.HasComment("主键")
.UseIdentityAlwaysColumn()
.HasColumnName("id");
entity.Property(e => e.Account)
.HasMaxLength(20)
.HasComment("登录账号")
.HasColumnName("account");
entity.Property(e => e.CreateTime)
.HasDefaultValueSql("CURRENT_TIMESTAMP")
.HasComment("创建时间")
.HasColumnType("timestamp without time zone")
.HasColumnName("create_time");
entity.Property(e => e.LastLoginTime)
.HasComment("最后登录时间")
.HasColumnType("timestamp without time zone")
.HasColumnName("last_login_time");
entity.Property(e => e.NickName)
.HasMaxLength(50)
.HasComment("昵称")
.HasColumnName("nick_name");
entity.Property(e => e.Password)
.HasMaxLength(128)
.HasComment("登录密码(已加密)")
.HasColumnName("password");
});
modelBuilder.Entity<Category>(entity =>
{
entity.HasKey(e => e.Id).HasName("category_pkey");
entity.ToTable("category", tb => tb.HasComment("商品分类"));
entity.Property(e => e.Id)
.HasComment("主键")
.UseIdentityAlwaysColumn()
.HasColumnName("id");
entity.Property(e => e.Deleted)
.HasComment("软删除标识")
.HasColumnName("deleted");
entity.Property(e => e.Level)
.HasComment("层级从1开始")
.HasColumnName("level");
entity.Property(e => e.Logo)
.HasMaxLength(50)
.HasComment("logo图片名后台生成地址")
.HasColumnName("logo");
entity.Property(e => e.Name)
.HasMaxLength(50)
.HasComment("名称")
.HasColumnName("name");
entity.Property(e => e.Order)
.HasComment("层级中序号")
.HasColumnName("order");
entity.Property(e => e.ParentId)
.HasComment("父级id顶级为0")
.HasColumnName("parent_id");
entity.Property(e => e.Path)
.HasMaxLength(50)
.HasComment("id路径枚举/1/2/3/")
.HasColumnName("path");
});
modelBuilder.Entity<District>(entity =>
{
entity.HasKey(e => e.Id).HasName("district_pkey");
entity.ToTable("district", tb => tb.HasComment("行政区划"));
entity.Property(e => e.Id)
.HasComment("主键")
.UseIdentityAlwaysColumn()
.HasColumnName("id");
entity.Property(e => e.Code)
.HasMaxLength(10)
.HasComment("编码")
.HasColumnName("code");
entity.Property(e => e.FullName)
.HasMaxLength(100)
.HasComment("全称")
.HasColumnName("full_name");
entity.Property(e => e.Latitude)
.HasMaxLength(20)
.HasComment("经度")
.HasColumnName("latitude");
entity.Property(e => e.Level)
.HasComment("层级1-省/直辖市2-市/直辖市无3-区4-街道")
.HasColumnName("level");
entity.Property(e => e.Longitude)
.HasMaxLength(20)
.HasComment("纬度")
.HasColumnName("longitude");
entity.Property(e => e.Name)
.HasMaxLength(20)
.HasComment("简称")
.HasColumnName("name");
entity.Property(e => e.Order)
.HasComment("层级中序号")
.HasColumnName("order");
entity.Property(e => e.ParentId)
.HasComment("父级id顶级时为0")
.HasColumnName("parent_id");
entity.Property(e => e.Pinyin)
.HasMaxLength(200)
.HasComment("名称拼音")
.HasColumnName("pinyin");
});
modelBuilder.Entity<Logistic>(entity =>
{
entity.HasKey(e => e.Id).HasName("logistics_pkey");
entity.ToTable("logistics", tb => tb.HasComment("物流"));
entity.Property(e => e.Id)
.HasComment("主键")
.UseIdentityAlwaysColumn()
.HasColumnName("id");
entity.Property(e => e.ArrivalTime)
.HasComment("到达时间")
.HasColumnType("timestamp without time zone")
.HasColumnName("arrival_time");
entity.Property(e => e.Company)
.HasMaxLength(30)
.HasComment("快递公司")
.HasColumnName("company");
entity.Property(e => e.Context)
.HasMaxLength(200)
.HasComment("详情")
.HasColumnName("context");
entity.Property(e => e.CreateTime)
.HasDefaultValueSql("CURRENT_TIMESTAMP")
.HasComment("入库时间")
.HasColumnType("timestamp without time zone")
.HasColumnName("create_time");
entity.Property(e => e.Location)
.HasMaxLength(100)
.HasComment("到达地点")
.HasColumnName("location");
entity.Property(e => e.OrderNo)
.HasMaxLength(20)
.HasComment("快递单号")
.HasColumnName("order_no");
entity.Property(e => e.RequestId)
.HasComment("需求id")
.HasColumnName("request_id");
entity.Property(e => e.Status)
.HasComment("物流状态1-揽收0-在途5-派件6-退回4-退签3-签收2-疑难7-转投8。。。-清关")
.HasColumnName("status");
});
modelBuilder.Entity<Message>(entity =>
{
entity.HasKey(e => e.Id).HasName("message_pkey");
entity.ToTable("message", tb => tb.HasComment("用户消息"));
entity.Property(e => e.Id)
.HasComment("主键")
.UseIdentityAlwaysColumn()
.HasColumnName("id");
entity.Property(e => e.Content)
.HasComment("内容")
.HasColumnName("content");
entity.Property(e => e.FromUserId)
.HasComment("发出用户id")
.HasColumnName("from_user_id");
entity.Property(e => e.Read)
.HasComment("是否已读")
.HasColumnName("read");
entity.Property(e => e.Recalled)
.HasComment("是否已撤回")
.HasColumnName("recalled");
entity.Property(e => e.SentTime)
.HasDefaultValueSql("CURRENT_TIMESTAMP")
.HasComment("发出时间")
.HasColumnType("timestamp without time zone")
.HasColumnName("sent_time");
entity.Property(e => e.ToUserId)
.HasComment("接收用户id")
.HasColumnName("to_user_id");
});
modelBuilder.Entity<Notice>(entity =>
{
entity.HasKey(e => e.Id).HasName("notice_pkey");
entity.ToTable("notice", tb => tb.HasComment("系统通知"));
entity.Property(e => e.Id)
.HasComment("主键")
.UseIdentityAlwaysColumn()
.HasColumnName("id");
entity.Property(e => e.Content)
.HasComment("内容")
.HasColumnName("content");
entity.Property(e => e.PublishTime)
.HasDefaultValueSql("CURRENT_TIMESTAMP")
.HasComment("发布时间")
.HasColumnType("timestamp without time zone")
.HasColumnName("publish_time");
entity.Property(e => e.Verified)
.HasComment("是否已审核")
.HasColumnName("verified");
});
modelBuilder.Entity<OperateLog>(entity =>
{
entity.HasKey(e => e.Id).HasName("operate_log_pkey");
entity.ToTable("operate_log", tb => tb.HasComment("操作日志"));
entity.Property(e => e.Id)
.HasComment("主键")
.UseIdentityAlwaysColumn()
.HasColumnName("id");
entity.Property(e => e.CreateTime)
.HasDefaultValueSql("CURRENT_TIMESTAMP")
.HasComment("入库时间")
.HasColumnType("timestamp without time zone")
.HasColumnName("create_time");
entity.Property(e => e.Description)
.HasMaxLength(500)
.HasComment("操作描述")
.HasColumnName("description");
entity.Property(e => e.OperateTime)
.HasDefaultValueSql("CURRENT_TIMESTAMP")
.HasComment("操作时间")
.HasColumnType("timestamp without time zone")
.HasColumnName("operate_time");
entity.Property(e => e.OperateType)
.HasMaxLength(1)
.HasComment("操作类型c-创建u-修改d-删除")
.HasColumnName("operate_type");
entity.Property(e => e.OperaterId)
.HasComment("管理员id")
.HasColumnName("operater_id");
entity.Property(e => e.RelatedId)
.HasComment("关联id目标表主键")
.HasColumnName("related_id");
entity.Property(e => e.TargetType)
.HasComment("目标类型0-行政区划1-商品分类。。。")
.HasColumnName("target_type");
});
modelBuilder.Entity<Product>(entity =>
{
entity.HasKey(e => e.Id).HasName("product_pkey");
entity.ToTable("product", tb => tb.HasComment("卖家商品表"));
entity.Property(e => e.Id)
.HasComment("主键")
.UseIdentityAlwaysColumn()
.HasColumnName("id");
entity.Property(e => e.CategoryId)
.HasComment("商品分类id")
.HasColumnName("category_id");
entity.Property(e => e.CreateTime)
.HasDefaultValueSql("CURRENT_TIMESTAMP")
.HasComment("添加时间")
.HasColumnType("timestamp without time zone")
.HasColumnName("create_time");
entity.Property(e => e.Deleted)
.HasComment("软删除标识")
.HasColumnName("deleted");
entity.Property(e => e.Description)
.HasMaxLength(200)
.HasComment("商品描述")
.HasColumnName("description");
entity.Property(e => e.Detail)
.HasComment("详情")
.HasColumnName("detail");
entity.Property(e => e.Logo)
.HasMaxLength(50)
.HasComment("商品图片")
.HasColumnName("logo");
entity.Property(e => e.MinimumUnit)
.HasMaxLength(20)
.HasComment("最小销售单元")
.HasColumnName("minimum_unit");
entity.Property(e => e.Name)
.HasMaxLength(100)
.HasComment("名称")
.HasColumnName("name");
entity.Property(e => e.SerialNo)
.HasMaxLength(20)
.HasComment("系统唯一编号")
.HasColumnName("serial_no");
entity.Property(e => e.SoldAmount)
.HasComment("已售数量")
.HasColumnName("sold_amount");
entity.Property(e => e.UnitPrice)
.HasPrecision(11, 2)
.HasComment("单价")
.HasColumnName("unit_price");
entity.Property(e => e.UserId)
.HasComment("用户id")
.HasColumnName("user_id");
entity.HasOne(d => d.Category).WithMany(p => p.Products)
.HasForeignKey(d => d.CategoryId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("fk_categoryproduct");
});
modelBuilder.Entity<RefreshToken>(entity =>
{
entity.HasKey(e => e.Id).HasName("refresh_token_pkey");
entity.ToTable("refresh_token", tb => tb.HasComment("刷新令牌"));
entity.Property(e => e.Id)
.HasComment("主键")
.UseIdentityAlwaysColumn()
.HasColumnName("id");
entity.Property(e => e.CreateTime)
.HasDefaultValueSql("CURRENT_TIMESTAMP")
.HasComment("创建时间")
.HasColumnType("timestamp without time zone")
.HasColumnName("create_time");
entity.Property(e => e.ExpiresAt)
.HasComment("失效时间")
.HasColumnType("timestamp without time zone")
.HasColumnName("expires_at");
entity.Property(e => e.SystemRole)
.HasMaxLength(1)
.HasComment("系统角色a-管理员u-用户")
.HasColumnName("system_role");
entity.Property(e => e.Token)
.HasMaxLength(50)
.HasComment("令牌")
.HasColumnName("token");
entity.Property(e => e.UserId)
.HasComment("用户/管理员id")
.HasColumnName("user_id");
});
modelBuilder.Entity<Reply>(entity =>
{
entity.HasKey(e => e.Id).HasName("reply_pkey");
entity.ToTable("reply", tb => tb.HasComment("竞标表"));
entity.Property(e => e.Id)
.HasComment("主键")
.UseIdentityAlwaysColumn()
.HasColumnName("id");
entity.Property(e => e.Amount)
.HasComment("数量")
.HasColumnName("amount");
entity.Property(e => e.Memo)
.HasMaxLength(200)
.HasComment("留言")
.HasColumnName("memo");
entity.Property(e => e.Price)
.HasPrecision(11, 2)
.HasComment("价格,自动计算的价格(product.unit_price * amount)之后的优惠价格")
.HasColumnName("price");
entity.Property(e => e.ProductId)
.HasComment("商品id")
.HasColumnName("product_id");
entity.Property(e => e.Rejected)
.HasComment("是否已拒绝")
.HasColumnName("rejected");
entity.Property(e => e.ReplyTime)
.HasDefaultValueSql("CURRENT_TIMESTAMP")
.HasComment("回应时间")
.HasColumnType("timestamp without time zone")
.HasColumnName("reply_time");
entity.Property(e => e.RequestId)
.HasComment("需求id")
.HasColumnName("request_id");
entity.Property(e => e.UserId)
.HasComment("竞标者id")
.HasColumnName("user_id");
entity.HasOne(d => d.Product).WithMany(p => p.Replies)
.HasForeignKey(d => d.ProductId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("fk_replyproduct");
entity.HasOne(d => d.Request).WithMany(p => p.Replies)
.HasForeignKey(d => d.RequestId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("fk_requestreply");
entity.HasOne(d => d.User).WithMany(p => p.Replies)
.HasForeignKey(d => d.UserId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("fk_replyuser");
});
modelBuilder.Entity<Request>(entity =>
{
entity.HasKey(e => e.Id).HasName("request_pkey");
entity.ToTable("request", tb => tb.HasComment("用户需求"));
entity.Property(e => e.Id)
.HasComment("主键")
.UseIdentityAlwaysColumn()
.HasColumnName("id");
entity.Property(e => e.CategoryId)
.HasComment("商品分类id")
.HasColumnName("category_id");
entity.Property(e => e.Deadline)
.HasComment("截止日期")
.HasColumnName("deadline");
entity.Property(e => e.Deleted)
.HasComment("是否已删除")
.HasColumnName("deleted");
entity.Property(e => e.Description)
.HasMaxLength(1000)
.HasComment("需求描述")
.HasColumnName("description");
entity.Property(e => e.Name)
.HasMaxLength(100)
.HasComment("名称")
.HasColumnName("name");
entity.Property(e => e.PublishTime)
.HasDefaultValueSql("CURRENT_TIMESTAMP")
.HasComment("发布时间")
.HasColumnType("timestamp without time zone")
.HasColumnName("publish_time");
entity.Property(e => e.PublisherId)
.HasComment("发布者id")
.HasColumnName("publisher_id");
entity.Property(e => e.SerialNo)
.HasMaxLength(20)
.HasComment("需求单号,系统唯一,后台生成")
.HasColumnName("serial_no");
entity.Property(e => e.Status)
.HasComment("状态0-发布1-有竞标2-待发货3-待收货4-已完成5-已评价")
.HasColumnName("status");
entity.HasOne(d => d.Category).WithMany(p => p.Requests)
.HasForeignKey(d => d.CategoryId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("fk_categoryrequest");
entity.HasOne(d => d.Publisher).WithMany(p => p.Requests)
.HasForeignKey(d => d.PublisherId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("fk_userrequest");
});
modelBuilder.Entity<User>(entity =>
{
entity.HasKey(e => e.Id).HasName("user_pkey");
entity.ToTable("user", tb => tb.HasComment("用户"));
entity.Property(e => e.Id)
.HasComment("主键")
.UseIdentityAlwaysColumn()
.HasColumnName("id");
entity.Property(e => e.Account)
.HasMaxLength(20)
.HasComment("登录账号")
.HasColumnName("account");
entity.Property(e => e.Avatar)
.HasMaxLength(50)
.HasComment("头像图片名,后台生成链接")
.HasColumnName("avatar");
entity.Property(e => e.CreateTime)
.HasDefaultValueSql("CURRENT_TIMESTAMP")
.HasComment("创建时间")
.HasColumnType("timestamp without time zone")
.HasColumnName("create_time");
entity.Property(e => e.CurrentRole)
.HasMaxLength(1)
.HasDefaultValueSql("'c'::bpchar")
.HasComment("当前角色c-买家s-卖家")
.HasColumnName("current_role");
entity.Property(e => e.LastLoginTime)
.HasComment("最后登录时间")
.HasColumnType("timestamp without time zone")
.HasColumnName("last_login_time");
entity.Property(e => e.NickName)
.HasMaxLength(50)
.HasComment("昵称")
.HasColumnName("nick_name");
entity.Property(e => e.Password)
.HasMaxLength(128)
.HasComment("密码(已加密)")
.HasColumnName("password");
entity.Property(e => e.Telephone)
.HasMaxLength(20)
.HasComment("电话")
.HasColumnName("telephone");
});
OnModelCreatingPartial(modelBuilder);
}
partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
}