Sfoglia il codice sorgente

实体添加索引,设置主键自增

heteng 2 anni fa
parent
commit
0be9b3a0e9

+ 3 - 0
MicroServices/Business/Bussiness.Model/Production/OverallDemandPlanDtl.cs

@@ -2,6 +2,7 @@
 using System;
 using System.Collections.Generic;
 using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
@@ -12,6 +13,7 @@ namespace Business.Model.Production
     /// 整体需求计划明细表
     /// </summary>
     [Comment("整体需求计划明细表")]
+    [Index(nameof(Version),nameof(PlanDate), nameof(tenant_id), nameof(factory_id), IsUnique = true)]
     public class OverallDemandPlanDtl
     {
         /// <summary>
@@ -19,6 +21,7 @@ namespace Business.Model.Production
         /// </summary>
         [Comment("主键")]
         [Key]
+        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
         public long Id { get; set; }
 
         /// <summary>

+ 3 - 0
MicroServices/Business/Bussiness.Model/Production/OverallDemandPlanMain.cs

@@ -2,6 +2,7 @@
 using System;
 using System.Collections.Generic;
 using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
@@ -12,6 +13,7 @@ namespace Business.Model.Production
     /// 整体需求计划主表
     /// </summary>
     [Comment("整体需求计划主表")]
+    [Index(nameof(Version),nameof(tenant_id),nameof(factory_id),IsUnique = true)]
     public class OverallDemandPlanMain
     {
         /// <summary>
@@ -19,6 +21,7 @@ namespace Business.Model.Production
         /// </summary>
         [Comment("主键")]
         [Key]
+        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
         public long Id { get; set; }
 
         /// <summary>