Browse Source

Close #50: Redesign Category entity based on EasyAbp.Abp.Trees module

pull/57/head
gdlcf88 6 years ago
parent
commit
354f1cb5f3
  1. 2
      integration/EasyAbp.EShop/common.props
  2. 2
      modules/EasyAbp.EShop.Baskets/common.props
  3. 2
      modules/EasyAbp.EShop.Orders/common.props
  4. 2
      modules/EasyAbp.EShop.Payments/common.props
  5. 2
      modules/EasyAbp.EShop.Products/common.props
  6. 1
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp.EShop.Products.Application.Contracts.csproj
  7. 8
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/EShopProductsApplicationContractsModule.cs
  8. 1
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application/EasyAbp.EShop.Products.Application.csproj
  9. 8
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application/EasyAbp/EShop/Products/EShopProductsApplicationModule.cs
  10. 1
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp.EShop.Products.Domain.Shared.csproj
  11. 6
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/EShopProductsDomainSharedModule.cs
  12. 6
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp.EShop.Products.Domain.csproj
  13. 25
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Categories/Category.cs
  14. 3
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Categories/ICategoryRepository.cs
  15. 6
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/EShopProductsDomainModule.cs
  16. 1
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.EntityFrameworkCore/EasyAbp.EShop.Products.EntityFrameworkCore.csproj
  17. 3
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.EntityFrameworkCore/EasyAbp/EShop/Products/Categories/CategoryRepository.cs
  18. 4
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.EntityFrameworkCore/EasyAbp/EShop/Products/EntityFrameworkCore/EShopProductsEntityFrameworkCoreModule.cs
  19. 2
      modules/EasyAbp.EShop.Stores/common.props
  20. 3
      modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application.Contracts/EasyAbp/EShop/Stores/Authorization/StoresPermissionDefinitionProvider.cs
  21. 3561
      samples/EShopSample/aspnet-core/src/EShopSample.EntityFrameworkCore.DbMigrations/Migrations/20200620145307_UsedEasyAbpTreesModule.Designer.cs
  22. 63
      samples/EShopSample/aspnet-core/src/EShopSample.EntityFrameworkCore.DbMigrations/Migrations/20200620145307_UsedEasyAbpTreesModule.cs
  23. 18
      samples/EShopSample/aspnet-core/src/EShopSample.EntityFrameworkCore.DbMigrations/Migrations/EShopSampleMigrationsDbContextModelSnapshot.cs

2
integration/EasyAbp.EShop/common.props

@ -1,7 +1,7 @@
<Project>
<PropertyGroup>
<LangVersion>latest</LangVersion>
<Version>0.2.7</Version>
<Version>0.3.0</Version>
<NoWarn>$(NoWarn);CS1591</NoWarn>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Authors>EasyAbp Team</Authors>

2
modules/EasyAbp.EShop.Baskets/common.props

@ -1,7 +1,7 @@
<Project>
<PropertyGroup>
<LangVersion>latest</LangVersion>
<Version>0.2.7</Version>
<Version>0.3.0</Version>
<NoWarn>$(NoWarn);CS1591</NoWarn>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Authors>EasyAbp Team</Authors>

2
modules/EasyAbp.EShop.Orders/common.props

@ -1,7 +1,7 @@
<Project>
<PropertyGroup>
<LangVersion>latest</LangVersion>
<Version>0.2.7</Version>
<Version>0.3.0</Version>
<NoWarn>$(NoWarn);CS1591</NoWarn>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Authors>EasyAbp Team</Authors>

2
modules/EasyAbp.EShop.Payments/common.props

@ -1,7 +1,7 @@
<Project>
<PropertyGroup>
<LangVersion>latest</LangVersion>
<Version>0.2.7</Version>
<Version>0.3.0</Version>
<NoWarn>$(NoWarn);CS1591</NoWarn>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Authors>EasyAbp Team</Authors>

2
modules/EasyAbp.EShop.Products/common.props

@ -1,7 +1,7 @@
<Project>
<PropertyGroup>
<LangVersion>latest</LangVersion>
<Version>0.2.7</Version>
<Version>0.3.0</Version>
<NoWarn>$(NoWarn);CS1591</NoWarn>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Authors>EasyAbp Team</Authors>

1
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp.EShop.Products.Application.Contracts.csproj

@ -8,6 +8,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="EasyAbp.Abp.Trees.Application.Contracts" Version="0.290.2" />
<PackageReference Include="Volo.Abp.Ddd.Application.Contracts" Version="2.9.0" />
<PackageReference Include="Volo.Abp.Authorization" Version="2.9.0" />
<ProjectReference Include="..\EasyAbp.EShop.Products.Domain.Shared\EasyAbp.EShop.Products.Domain.Shared.csproj" />

8
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/EShopProductsApplicationContractsModule.cs

@ -1,4 +1,5 @@
using Volo.Abp.Application;
using EasyAbp.Abp.Trees;
using Volo.Abp.Application;
using Volo.Abp.Modularity;
using Volo.Abp.VirtualFileSystem;
using Volo.Abp.Authorization;
@ -8,8 +9,9 @@ namespace EasyAbp.EShop.Products
[DependsOn(
typeof(EShopProductsDomainSharedModule),
typeof(AbpDddApplicationContractsModule),
typeof(AbpAuthorizationModule)
)]
typeof(AbpAuthorizationModule),
typeof(AbpTreesApplicationContractsModule)
)]
public class EShopProductsApplicationContractsModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)

1
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application/EasyAbp.EShop.Products.Application.csproj

@ -8,6 +8,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="EasyAbp.Abp.Trees.Application" Version="0.290.2" />
<PackageReference Include="Volo.Abp.AutoMapper" Version="2.9.0" />
<PackageReference Include="Volo.Abp.Ddd.Application" Version="2.9.0" />
<ProjectReference Include="..\EasyAbp.EShop.Products.Application.Contracts\EasyAbp.EShop.Products.Application.Contracts.csproj" />

8
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application/EasyAbp/EShop/Products/EShopProductsApplicationModule.cs

@ -1,4 +1,5 @@
using Microsoft.Extensions.DependencyInjection;
using EasyAbp.Abp.Trees;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.AutoMapper;
using Volo.Abp.Modularity;
using Volo.Abp.Application;
@ -9,8 +10,9 @@ namespace EasyAbp.EShop.Products
typeof(EShopProductsDomainModule),
typeof(EShopProductsApplicationContractsModule),
typeof(AbpDddApplicationModule),
typeof(AbpAutoMapperModule)
)]
typeof(AbpAutoMapperModule),
typeof(AbpTreesApplicationModule)
)]
public class EShopProductsApplicationModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)

1
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp.EShop.Products.Domain.Shared.csproj

@ -8,6 +8,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="EasyAbp.Abp.Trees.Domain.Shared" Version="0.290.2" />
<PackageReference Include="Volo.Abp.Validation" Version="2.9.0" />
</ItemGroup>

6
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/EShopProductsDomainSharedModule.cs

@ -1,4 +1,5 @@
using Volo.Abp.Modularity;
using EasyAbp.Abp.Trees;
using Volo.Abp.Modularity;
using Volo.Abp.Localization;
using EasyAbp.EShop.Products.Localization;
using Volo.Abp.Localization.ExceptionHandling;
@ -9,7 +10,8 @@ using Volo.Abp.VirtualFileSystem;
namespace EasyAbp.EShop.Products
{
[DependsOn(
typeof(AbpValidationModule)
typeof(AbpValidationModule),
typeof(AbpTreesDomainSharedModule)
)]
public class EShopProductsDomainSharedModule : AbpModule
{

6
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp.EShop.Products.Domain.csproj

@ -8,13 +8,11 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="EasyAbp.Abp.Trees.Domain" Version="0.290.2" />
<PackageReference Include="Volo.Abp.Ddd.Domain" Version="2.9.0" />
<ProjectReference Include="..\..\..\EasyAbp.EShop.Orders\src\EasyAbp.EShop.Orders.Domain.Shared\EasyAbp.EShop.Orders.Domain.Shared.csproj" />
<ProjectReference Include="..\EasyAbp.EShop.Products.Domain.Shared\EasyAbp.EShop.Products.Domain.Shared.csproj" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\EasyAbp.EShop.Stores\src\EasyAbp.EShop.Stores.Domain.Shared\EasyAbp.EShop.Stores.Domain.Shared.csproj" />
<ProjectReference Include="..\EasyAbp.EShop.Products.Domain.Shared\EasyAbp.EShop.Products.Domain.Shared.csproj" />
</ItemGroup>
</Project>

25
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Categories/Category.cs

@ -1,19 +1,18 @@
using System;
using System.Collections.Generic;
using EasyAbp.Abp.Trees;
using JetBrains.Annotations;
using Volo.Abp.Domain.Entities.Auditing;
using Volo.Abp.MultiTenancy;
namespace EasyAbp.EShop.Products.Categories
{
public class Category : FullAuditedAggregateRoot<Guid>, IMultiTenant
public class Category : FullAuditedAggregateRoot<Guid>, ITree<Category>, IMultiTenant
{
public virtual Guid? TenantId { get; protected set; }
public virtual Guid? ParentCategoryId { get; protected set; }
[NotNull]
public virtual string DisplayName { get; protected set; }
[CanBeNull]
public virtual string Description { get; protected set; }
@ -22,6 +21,24 @@ namespace EasyAbp.EShop.Products.Categories
public virtual bool IsHidden { get; protected set; }
#region Properties of ITree
[NotNull]
public virtual string DisplayName { get; set; }
[NotNull]
public virtual string Code { get; set; }
public virtual int Level { get; set; }
public virtual Guid? ParentId { get; set; }
public virtual Category Parent { get; set; }
public virtual ICollection<Category> Children { get; set; }
#endregion
protected Category()
{
}

3
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Categories/ICategoryRepository.cs

@ -1,9 +1,10 @@
using System;
using EasyAbp.Abp.Trees;
using Volo.Abp.Domain.Repositories;
namespace EasyAbp.EShop.Products.Categories
{
public interface ICategoryRepository : IRepository<Category, Guid>
public interface ICategoryRepository : ITreeRepository<Category>
{
}
}

6
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/EShopProductsDomainModule.cs

@ -1,11 +1,13 @@
using EasyAbp.EShop.Stores;
using EasyAbp.Abp.Trees;
using EasyAbp.EShop.Stores;
using Volo.Abp.Modularity;
namespace EasyAbp.EShop.Products
{
[DependsOn(
typeof(EShopProductsDomainSharedModule),
typeof(EShopStoresDomainSharedModule)
typeof(EShopStoresDomainSharedModule),
typeof(AbpTreesDomainModule)
)]
public class EShopProductsDomainModule : AbpModule
{

1
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.EntityFrameworkCore/EasyAbp.EShop.Products.EntityFrameworkCore.csproj

@ -8,6 +8,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="EasyAbp.Abp.Trees.EntityFrameworkCore" Version="0.290.2" />
<PackageReference Include="Volo.Abp.EntityFrameworkCore" Version="2.9.0" />
<ProjectReference Include="..\EasyAbp.EShop.Products.Domain\EasyAbp.EShop.Products.Domain.csproj" />
</ItemGroup>

3
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.EntityFrameworkCore/EasyAbp/EShop/Products/Categories/CategoryRepository.cs

@ -1,11 +1,12 @@
using System;
using EasyAbp.Abp.Trees;
using EasyAbp.EShop.Products.EntityFrameworkCore;
using Volo.Abp.Domain.Repositories.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore;
namespace EasyAbp.EShop.Products.Categories
{
public class CategoryRepository : EfCoreRepository<ProductsDbContext, Category, Guid>, ICategoryRepository
public class CategoryRepository : EfCoreTreeRepository<ProductsDbContext, Category>, ICategoryRepository
{
public CategoryRepository(IDbContextProvider<ProductsDbContext> dbContextProvider) : base(dbContextProvider)
{

4
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.EntityFrameworkCore/EasyAbp/EShop/Products/EntityFrameworkCore/EShopProductsEntityFrameworkCoreModule.cs

@ -1,3 +1,4 @@
using EasyAbp.Abp.Trees.EntityFrameworkCore;
using EasyAbp.EShop.Products.ProductDetailHistories;
using EasyAbp.EShop.Products.ProductHistories;
using EasyAbp.EShop.Products.ProductStores;
@ -14,7 +15,8 @@ namespace EasyAbp.EShop.Products.EntityFrameworkCore
{
[DependsOn(
typeof(EShopProductsDomainModule),
typeof(AbpEntityFrameworkCoreModule)
typeof(AbpEntityFrameworkCoreModule),
typeof(AbpTreesEntityFrameworkCoreModule)
)]
public class EShopProductsEntityFrameworkCoreModule : AbpModule
{

2
modules/EasyAbp.EShop.Stores/common.props

@ -1,7 +1,7 @@
<Project>
<PropertyGroup>
<LangVersion>latest</LangVersion>
<Version>0.2.7</Version>
<Version>0.3.0</Version>
<NoWarn>$(NoWarn);CS1591</NoWarn>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Authors>EasyAbp Team</Authors>

3
modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application.Contracts/EasyAbp/EShop/Stores/Authorization/StoresPermissionDefinitionProvider.cs

@ -1,6 +1,7 @@
using EasyAbp.EShop.Stores.Localization;
using Volo.Abp.Authorization.Permissions;
using Volo.Abp.Localization;
using Volo.Abp.MultiTenancy;
namespace EasyAbp.EShop.Stores.Authorization
{
@ -13,7 +14,7 @@ namespace EasyAbp.EShop.Stores.Authorization
var stores = moduleGroup.AddPermission(StoresPermissions.Stores.Default, L("Permission:Store"));
stores.AddChild(StoresPermissions.Stores.Create, L("Permission:Create"));
stores.AddChild(StoresPermissions.Stores.Update, L("Permission:Update"));
stores.AddChild(StoresPermissions.Stores.Delete, L("Permission:Delete"));
stores.AddChild(StoresPermissions.Stores.Delete, L("Permission:Delete"), MultiTenancySides.Host);
}
private static LocalizableString L(string name)

3561
samples/EShopSample/aspnet-core/src/EShopSample.EntityFrameworkCore.DbMigrations/Migrations/20200620145307_UsedEasyAbpTreesModule.Designer.cs

File diff suppressed because it is too large

63
samples/EShopSample/aspnet-core/src/EShopSample.EntityFrameworkCore.DbMigrations/Migrations/20200620145307_UsedEasyAbpTreesModule.cs

@ -0,0 +1,63 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace EShopSample.Migrations
{
public partial class UsedEasyAbpTreesModule : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "Code",
table: "EShopProductsCategories",
nullable: true);
migrationBuilder.AddColumn<int>(
name: "Level",
table: "EShopProductsCategories",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<Guid>(
name: "ParentId",
table: "EShopProductsCategories",
nullable: true);
migrationBuilder.CreateIndex(
name: "IX_EShopProductsCategories_ParentId",
table: "EShopProductsCategories",
column: "ParentId");
migrationBuilder.AddForeignKey(
name: "FK_EShopProductsCategories_EShopProductsCategories_ParentId",
table: "EShopProductsCategories",
column: "ParentId",
principalTable: "EShopProductsCategories",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_EShopProductsCategories_EShopProductsCategories_ParentId",
table: "EShopProductsCategories");
migrationBuilder.DropIndex(
name: "IX_EShopProductsCategories_ParentId",
table: "EShopProductsCategories");
migrationBuilder.DropColumn(
name: "Code",
table: "EShopProductsCategories");
migrationBuilder.DropColumn(
name: "Level",
table: "EShopProductsCategories");
migrationBuilder.DropColumn(
name: "ParentId",
table: "EShopProductsCategories");
}
}
}

18
samples/EShopSample/aspnet-core/src/EShopSample.EntityFrameworkCore.DbMigrations/Migrations/EShopSampleMigrationsDbContextModelSnapshot.cs

@ -455,6 +455,9 @@ namespace EShopSample.Migrations
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("Code")
.HasColumnType("nvarchar(max)");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnName("ConcurrencyStamp")
@ -503,18 +506,26 @@ namespace EShopSample.Migrations
.HasColumnName("LastModifierId")
.HasColumnType("uniqueidentifier");
b.Property<int>("Level")
.HasColumnType("int");
b.Property<string>("MediaResources")
.HasColumnType("nvarchar(max)");
b.Property<Guid?>("ParentCategoryId")
.HasColumnType("uniqueidentifier");
b.Property<Guid?>("ParentId")
.HasColumnType("uniqueidentifier");
b.Property<Guid?>("TenantId")
.HasColumnName("TenantId")
.HasColumnType("uniqueidentifier");
b.HasKey("Id");
b.HasIndex("ParentId");
b.ToTable("EShopProductsCategories");
});
@ -3258,6 +3269,13 @@ namespace EShopSample.Migrations
.HasForeignKey("PaymentId");
});
modelBuilder.Entity("EasyAbp.EShop.Products.Categories.Category", b =>
{
b.HasOne("EasyAbp.EShop.Products.Categories.Category", "Parent")
.WithMany("Children")
.HasForeignKey("ParentId");
});
modelBuilder.Entity("EasyAbp.EShop.Products.Products.ProductAttribute", b =>
{
b.HasOne("EasyAbp.EShop.Products.Products.Product", null)

Loading…
Cancel
Save