feat(product): add product list/detail/save/soldout/batch api support
All checks were successful
Build and Deploy TenantApi / build-and-deploy (push) Successful in 47s

This commit is contained in:
2026-02-21 17:23:48 +08:00
parent d41f69045f
commit f7c2ae4bac
24 changed files with 10302 additions and 6 deletions

View File

@@ -737,6 +737,13 @@ public sealed class TakeoutAppDbContext(
builder.Property(x => x.Unit).HasMaxLength(16);
builder.Property(x => x.Price).HasPrecision(18, 2);
builder.Property(x => x.OriginalPrice).HasPrecision(18, 2);
builder.Property(x => x.Kind).HasConversion<int>().HasDefaultValue(Domain.Products.Enums.ProductKind.Single);
builder.Property(x => x.SalesMonthly).HasDefaultValue(0);
builder.Property(x => x.TagsJson).HasColumnType("text").HasDefaultValue("[]");
builder.Property(x => x.SoldoutMode).HasConversion<int?>();
builder.Property(x => x.SoldoutReason).HasMaxLength(256);
builder.Property(x => x.SyncToPlatform).HasDefaultValue(true);
builder.Property(x => x.NotifyManager).HasDefaultValue(false);
builder.Property(x => x.CoverImage).HasMaxLength(256);
builder.Property(x => x.GalleryImages).HasMaxLength(1024);
builder.Property(x => x.Description).HasColumnType("text");

View File

@@ -0,0 +1,135 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace TakeoutSaaS.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class AddProductListAndSoldoutFields : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "Kind",
table: "products",
type: "integer",
nullable: false,
defaultValue: 0,
comment: "商品类型。");
migrationBuilder.AddColumn<bool>(
name: "NotifyManager",
table: "products",
type: "boolean",
nullable: false,
defaultValue: false,
comment: "是否通知店长。");
migrationBuilder.AddColumn<DateTime>(
name: "RecoverAt",
table: "products",
type: "timestamp with time zone",
nullable: true,
comment: "沽清恢复时间。");
migrationBuilder.AddColumn<int>(
name: "RemainStock",
table: "products",
type: "integer",
nullable: true,
comment: "沽清后剩余可售。");
migrationBuilder.AddColumn<int>(
name: "SalesMonthly",
table: "products",
type: "integer",
nullable: false,
defaultValue: 0,
comment: "月销量。");
migrationBuilder.AddColumn<int>(
name: "SoldoutMode",
table: "products",
type: "integer",
nullable: true,
comment: "沽清模式。");
migrationBuilder.AddColumn<string>(
name: "SoldoutReason",
table: "products",
type: "character varying(256)",
maxLength: 256,
nullable: true,
comment: "沽清原因。");
migrationBuilder.AddColumn<bool>(
name: "SyncToPlatform",
table: "products",
type: "boolean",
nullable: false,
defaultValue: true,
comment: "是否同步通知外卖平台。");
migrationBuilder.AddColumn<string>(
name: "TagsJson",
table: "products",
type: "text",
nullable: true,
defaultValue: "[]",
comment: "标签 JSON字符串数组。");
migrationBuilder.AddColumn<DateTime>(
name: "TimedOnShelfAt",
table: "products",
type: "timestamp with time zone",
nullable: true,
comment: "定时上架时间。");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "Kind",
table: "products");
migrationBuilder.DropColumn(
name: "NotifyManager",
table: "products");
migrationBuilder.DropColumn(
name: "RecoverAt",
table: "products");
migrationBuilder.DropColumn(
name: "RemainStock",
table: "products");
migrationBuilder.DropColumn(
name: "SalesMonthly",
table: "products");
migrationBuilder.DropColumn(
name: "SoldoutMode",
table: "products");
migrationBuilder.DropColumn(
name: "SoldoutReason",
table: "products");
migrationBuilder.DropColumn(
name: "SyncToPlatform",
table: "products");
migrationBuilder.DropColumn(
name: "TagsJson",
table: "products");
migrationBuilder.DropColumn(
name: "TimedOnShelfAt",
table: "products");
}
}
}

View File

@@ -3980,6 +3980,12 @@ namespace TakeoutSaaS.Infrastructure.Migrations
.HasColumnType("boolean")
.HasComment("是否热门推荐。");
b.Property<int>("Kind")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasDefaultValue(0)
.HasComment("商品类型。");
b.Property<int?>("MaxQuantityPerOrder")
.HasColumnType("integer")
.HasComment("最大每单限购。");
@@ -3990,6 +3996,12 @@ namespace TakeoutSaaS.Infrastructure.Migrations
.HasColumnType("character varying(128)")
.HasComment("商品名称。");
b.Property<bool>("NotifyManager")
.ValueGeneratedOnAdd()
.HasColumnType("boolean")
.HasDefaultValue(false)
.HasComment("是否通知店长。");
b.Property<decimal?>("OriginalPrice")
.HasPrecision(18, 2)
.HasColumnType("numeric(18,2)")
@@ -4000,6 +4012,29 @@ namespace TakeoutSaaS.Infrastructure.Migrations
.HasColumnType("numeric(18,2)")
.HasComment("现价。");
b.Property<DateTime?>("RecoverAt")
.HasColumnType("timestamp with time zone")
.HasComment("沽清恢复时间。");
b.Property<int?>("RemainStock")
.HasColumnType("integer")
.HasComment("沽清后剩余可售。");
b.Property<int>("SalesMonthly")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasDefaultValue(0)
.HasComment("月销量。");
b.Property<int?>("SoldoutMode")
.HasColumnType("integer")
.HasComment("沽清模式。");
b.Property<string>("SoldoutReason")
.HasMaxLength(256)
.HasColumnType("character varying(256)")
.HasComment("沽清原因。");
b.Property<string>("SpuCode")
.IsRequired()
.HasMaxLength(32)
@@ -4023,10 +4058,26 @@ namespace TakeoutSaaS.Infrastructure.Migrations
.HasColumnType("character varying(256)")
.HasComment("副标题/卖点。");
b.Property<bool>("SyncToPlatform")
.ValueGeneratedOnAdd()
.HasColumnType("boolean")
.HasDefaultValue(true)
.HasComment("是否同步通知外卖平台。");
b.Property<string>("TagsJson")
.ValueGeneratedOnAdd()
.HasColumnType("text")
.HasDefaultValue("[]")
.HasComment("标签 JSON字符串数组。");
b.Property<long>("TenantId")
.HasColumnType("bigint")
.HasComment("所属租户 ID。");
b.Property<DateTime?>("TimedOnShelfAt")
.HasColumnType("timestamp with time zone")
.HasComment("定时上架时间。");
b.Property<string>("Unit")
.HasMaxLength(16)
.HasColumnType("character varying(16)")