using CMS.Plugin.HIAWms.Domain; using CMS.Plugin.HIAWms.Domain.WmsStores; using CMS.Plugin.HIAWms.Domain.Shared.WmsStores; using Microsoft.EntityFrameworkCore; using Volo.Abp; using Volo.Abp.EntityFrameworkCore.Modeling; namespace CMS.Plugin.HIAWms.EntityFrameworkCore.Extensions; /// /// EfCore扩展 /// public static partial class CMSPluginEfCoreExtensions { /// /// Includes the details. /// /// The queryable. /// if set to true [include]. /// public static IQueryable IncludeDetails(this IQueryable queryable, bool include = true) { if (!include) { return queryable; } return queryable; } /// /// Configures the wmsstore. /// /// The builder. public static void ConfigureWmsStore(this ModelBuilder builder) { Check.NotNull(builder, nameof(builder)); builder.Entity(b => { // Configure table & schema name b.ToTable((CMSPluginDbProperties.DbTablePrefix + "_WmsStores").ToLower(), CMSPluginDbProperties.DbSchema).HasComment("仓库信息表"); b.ConfigureByConvention(); // Properties b.Property(x => x.StoreCode).HasMaxLength(WmsStoreConsts.MaxStoreCodeLength).IsRequired(false).HasComment("仓库代码"); b.Property(x => x.StoreName).HasMaxLength(WmsStoreConsts.MaxStoreNameLength).IsRequired(false).HasComment("仓库名称"); b.Property(x => x.RedundantField1).HasMaxLength(WmsStoreConsts.MaxRedundantFieldLength).IsRequired(false).HasComment("冗余字段1 - 预留扩展用途"); b.Property(x => x.RedundantField2).HasMaxLength(WmsStoreConsts.MaxRedundantFieldLength).IsRequired(false).HasComment("冗余字段2 - 预留扩展用途"); b.Property(x => x.RedundantField3).HasMaxLength(WmsStoreConsts.MaxRedundantFieldLength).IsRequired(false).HasComment("冗余字段3 - 预留扩展用途"); b.Property(x => x.Remark).HasMaxLength(WmsStoreConsts.MaxRemarkLength).IsRequired(false).HasComment("备注"); b.Property(x => x.Sort).HasComment("排序"); b.Property(x => x.IsDisabled).IsRequired(false).HasComment("是否禁用"); // Indexes b.HasIndex(u => u.StoreName); // Apply object extension mappings b.ApplyObjectExtensionMappings(); }); } }