Browse Source

区校班级数据结构

黄贺彬 6 years ago
parent
commit
918b1afce1
95 changed files with 2151 additions and 1727 deletions
  1. 0 54
      TEAMModelOS.Model/Analysis/Models/Classes.cs
  2. 0 46
      TEAMModelOS.Model/Analysis/Models/Grade.cs
  3. 0 41
      TEAMModelOS.Model/Analysis/Models/Period.cs
  4. 0 32
      TEAMModelOS.Model/Analysis/Models/School.cs
  5. 0 68
      TEAMModelOS.Model/Analysis/Models/Students.cs
  6. 0 50
      TEAMModelOS.Model/Analysis/Models/Teachers.cs
  7. 4 3
      TEAMModelOS.Model/Core/Models/RoleIdentity.cs
  8. 1 1
      TEAMModelOS.Model/Core/Models/JwtBlackRecord.cs
  9. 1 1
      TEAMModelOS.Model/Core/Models/LoginInfo.cs
  10. 5 6
      TEAMModelOS.Model/Syllabus/Models/Period.cs
  11. 1 1
      TEAMModelOS.Model/Core/Models/Product.cs
  12. 1 1
      TEAMModelOS.Model/Core/Models/Region.cs
  13. 1 1
      TEAMModelOS.Model/Core/Models/Role.cs
  14. 18 0
      TEAMModelOS.Model/Core/Models/RoleIdentityClaim.cs
  15. 0 15
      TEAMModelOS.Model/Core/Models/RoleSchool.cs
  16. 1 1
      TEAMModelOS.Model/Core/Models/RoleUser.cs
  17. 1 1
      TEAMModelOS.Model/Core/Models/School.cs
  18. 20 0
      TEAMModelOS.Model/Core/Models/SchoolArea.cs
  19. 34 0
      TEAMModelOS.Model/Core/Models/SchoolAreaMember.cs
  20. 2 2
      TEAMModelOS.Model/Core/Models/SchoolCampus.cs
  21. 56 2
      TEAMModelOS.Model/Core/Models/SchoolClass.cs
  22. 10 5
      TEAMModelOS.Model/Core/Models/SchoolGrade.cs
  23. 4 3
      TEAMModelOS.Model/Core/Models/SchoolGradeSubject.cs
  24. 13 12
      TEAMModelOS.Model/Core/Models/SchoolGradeTerm.cs
  25. 3 3
      TEAMModelOS.Model/Core/Models/SchoolPeriod.cs
  26. 21 0
      TEAMModelOS.Model/Core/Models/SchoolRole.cs
  27. 29 0
      TEAMModelOS.Model/Core/Models/SchoolSession.cs
  28. 19 0
      TEAMModelOS.Model/Core/Models/SchoolSubject.cs
  29. 19 0
      TEAMModelOS.Model/Core/Models/SchoolTerm.cs
  30. 16 0
      TEAMModelOS.Model/Core/Models/Subject.cs
  31. 1 1
      TEAMModelOS.Model/Core/Models/TeamModelUser.cs
  32. 34 0
      TEAMModelOS.Model/Syllabus/Models/KnowledgeBlock.cs
  33. 26 0
      TEAMModelOS.Model/Syllabus/Models/KnowledgeBlockPoint.cs
  34. 20 2
      TEAMModelOS.Model/Syllabus/Models/KnowledgePoint.cs
  35. 0 17
      TEAMModelOS.Model/Syllabus/Models/PeriodSubject.cs
  36. 0 16
      TEAMModelOS.Model/Syllabus/Models/PeriodSubjectEdition.cs
  37. 0 20
      TEAMModelOS.Model/Syllabus/Models/PeriodSubjectEditionTerm.cs
  38. 1 1
      TEAMModelOS.Model/Syllabus/Models/StandardTextbook.cs
  39. 1 1
      TEAMModelOS.Model/Syllabus/Models/TeacherTextbook.cs
  40. 1 0
      TEAMModelOS.Model/TEAMModelOS.Model.csproj
  41. 2 2
      TEAMModelOS.SDK/Context/Attributes/Table/PartitionAttribute.cs
  42. 1 1
      TEAMModelOS.SDK/Context/Attributes/Table/TableSpaceAttribute.cs
  43. 17 0
      TEAMModelOS.SDK/Extension/JsonPath/IJsonPathValueSystem.cs
  44. 62 0
      TEAMModelOS.SDK/Extension/JsonPath/JsonNetValueSystem.cs
  45. 442 0
      TEAMModelOS.SDK/Extension/JsonPath/JsonPath.cs
  46. 1 1
      TEAMModelOS.SDK/Extension/JwtAuth/Models/JwtBlackRecord.cs
  47. 2 0
      TEAMModelOS.SDK/Module/AzureCosmosDB/Configuration/AzureCosmosDBOptions.cs
  48. 6 1
      TEAMModelOS.SDK/Module/AzureCosmosDB/Configuration/CosmosDBClientSingleton.cs
  49. 466 208
      TEAMModelOS.SDK/Module/AzureCosmosDB/Implements/AzureCosmosDBRepository.cs
  50. 6 0
      TEAMModelOS.SDK/Module/AzureCosmosDB/Interfaces/IAzureCosmosDBRepository.cs
  51. 1 1
      TEAMModelOS.SDK/Module/AzureTable/Implements/AzureTableDBRepository.cs
  52. 3 1
      TEAMModelOS.SDK/TEAMModelOS.SDK.csproj
  53. 0 39
      TEAMModelOS.Service/BaseInfo/Implements/ClassService.cs
  54. 0 39
      TEAMModelOS.Service/BaseInfo/Implements/GradeService.cs
  55. 0 39
      TEAMModelOS.Service/BaseInfo/Implements/PeriodService.cs
  56. 0 39
      TEAMModelOS.Service/BaseInfo/Implements/SchoolService.cs
  57. 0 39
      TEAMModelOS.Service/BaseInfo/Implements/StudentsService.cs
  58. 0 39
      TEAMModelOS.Service/BaseInfo/Implements/TeacherService.cs
  59. 0 18
      TEAMModelOS.Service/BaseInfo/Interfaces/IClassService.cs
  60. 0 18
      TEAMModelOS.Service/BaseInfo/Interfaces/IGradeService.cs
  61. 0 18
      TEAMModelOS.Service/BaseInfo/Interfaces/IPeriodService.cs
  62. 0 18
      TEAMModelOS.Service/BaseInfo/Interfaces/ISchoolService.cs
  63. 0 18
      TEAMModelOS.Service/BaseInfo/Interfaces/IStudentsService.cs
  64. 0 18
      TEAMModelOS.Service/BaseInfo/Interfaces/ITeachersService.cs
  65. 57 0
      TEAMModelOS.Service/Core/Implements/GradeService.cs
  66. 57 0
      TEAMModelOS.Service/Core/Implements/PeriodService.cs
  67. 6 4
      TEAMModelOS.Service/Core/Implements/RoleService.cs
  68. 55 0
      TEAMModelOS.Service/Core/Implements/SubjectService.cs
  69. 17 0
      TEAMModelOS.Service/Core/Interfaces/IGradeService.cs
  70. 16 0
      TEAMModelOS.Service/Core/Interfaces/IPeriodService.cs
  71. 4 3
      TEAMModelOS.Service/Core/Interfaces/IRoleService.cs
  72. 17 0
      TEAMModelOS.Service/Core/Interfaces/ISubjectService.cs
  73. 1 95
      TEAMModelOS.Service/Syllabus/Implements/SyllabusService.cs
  74. 2 30
      TEAMModelOS.Service/Syllabus/Interfaces/ISyllabusService.cs
  75. 10 3
      TEAMModelOS.sln
  76. 42 0
      TEAMModelOS/Controllers/Core/GradeController.cs
  77. 19 12
      TEAMModelOS/Controllers/common/PeriodController.cs
  78. 0 48
      TEAMModelOS/Controllers/Core/StudentController.cs
  79. 54 0
      TEAMModelOS/Controllers/Core/SubjectController.cs
  80. 1 39
      TEAMModelOS/Controllers/Syllabus/SyllabusController.cs
  81. 1 2
      TEAMModelOS/Controllers/ValuesController.cs
  82. 0 47
      TEAMModelOS/Controllers/common/ClassesController.cs
  83. 0 47
      TEAMModelOS/Controllers/common/GradeController.cs
  84. 0 48
      TEAMModelOS/Controllers/common/SchoolController.cs
  85. 0 47
      TEAMModelOS/Controllers/common/TeacherController.cs
  86. 127 0
      TEAMModelOS/JsonFile/Core/RoleClaim.json
  87. 0 0
      TEAMModelOS/JsonFile/Core/area.json
  88. 0 27
      TEAMModelOS/JsonFile/RoleIdentity.json
  89. 16 0
      TEAMModelOS/SeedData/RoleClaim.cs
  90. 225 308
      TEAMModelOS/SeedData/SeedDataService.cs
  91. 2 0
      TEAMModelOS/TEAMModelOS.csproj
  92. 3 2
      TEAMModelOS/appsettings.Development.json
  93. 2 1
      TEAMModelOS/appsettings.json
  94. 32 0
      TeamModelOS.Test.JsonPath/Program.cs
  95. 12 0
      TeamModelOS.Test.JsonPath/TeamModelOS.Test.JsonPath.csproj

+ 0 - 54
TEAMModelOS.Model/Analysis/Models/Classes.cs

@@ -1,54 +0,0 @@
-using Microsoft.WindowsAzure.Storage.Table;
-using System;
-using System.Collections.Generic;
-using System.Text;
-using TEAMModelOS.SDK.Context.Attributes.Table;
-
-namespace TEAMModelOS.Model.Analysis.Models
-{
-    [TableSpaceAttribute(Name = "Common")]
-    public class Classes:TableEntity
-    {
-        /// <summary>
-        /// id
-        /// </summary>
-        public string Id { get; set; }
-        /// <summary>
-        /// 班级名称
-        /// 
-        /// </summary>
-        public string Name { get; set; }
-        /// <summary>
-        /// 所属年级Id
-        /// </summary>
-        public string GradeId { get; set; }
-        /// <summary>
-        /// 所属年级名称
-        /// </summary>
-        public string GradeName { get; set; }
-        /// <summary>
-        /// 所属学段Id
-        /// </summary>
-        public string PeriodId { get; set; }
-        /// <summary>
-        /// 所属学段
-        /// </summary>
-        public string PeriodName { get; set; }
-        /// <summary>
-        /// 所属学校Id
-        /// </summary>
-        public string SchoolId { get; set; }
-        /// <summary>
-        /// 所属学校
-        /// </summary>
-        public string SchoolName { get; set; }
-        /// <summary>
-        /// 类型
-        /// </summary>
-        public int State { get; set; }
-        /// <summary>
-        /// 备注
-        /// </summary>
-        public string Remark { get; set; }
-    }
-}

+ 0 - 46
TEAMModelOS.Model/Analysis/Models/Grade.cs

@@ -1,46 +0,0 @@
-using Microsoft.WindowsAzure.Storage.Table;
-using System;
-using System.Collections.Generic;
-using System.Text;
-using TEAMModelOS.SDK.Context.Attributes.Table;
-
-namespace TEAMModelOS.Model.Analysis.Models
-{
-    [TableSpaceAttribute(Name = "Common")]
-    public class Grade :TableEntity
-
-    {
-        /// <summary>
-        /// id
-        /// </summary>
-        public string Id { get; set; }
-        /// <summary>
-        /// 年级名称
-        /// </summary>
-        public string Name { get; set; } 
-        /// <summary>
-        /// 所属学段Id
-        /// </summary>
-        public string PeriodId { get; set; }
-        /// <summary>
-        /// 所属学段
-        /// </summary>
-        public string PeriodName { get; set; }
-        /// <summary>
-        /// 所属学校Id
-        /// </summary>
-        public string SchoolId { get; set; }
-        /// <summary>
-        /// 所属学校
-        /// </summary>
-        public string SchoolName { get; set; }
-        /// <summary>
-        /// 类型
-        /// </summary>
-        public int State { get; set; }
-        /// <summary>
-        /// 备注
-        /// </summary>
-        public string Remark { get; set; }
-    }
-}

+ 0 - 41
TEAMModelOS.Model/Analysis/Models/Period.cs

@@ -1,41 +0,0 @@
-using Microsoft.WindowsAzure.Storage.Table;
-using System;
-using System.Collections.Generic;
-using System.Text;
-using TEAMModelOS.SDK.Context.Attributes.Table;
-
-namespace TEAMModelOS.Model.Analysis.Models
-{
-    [TableSpaceAttribute(Name = "Common")]
-    public class Period:TableEntity
-    {
-        /// <summary>
-        /// id
-        /// </summary>
-        public string Id { get; set; }
-        /// <summary>
-        /// 学段名称
-        /// </summary>
-        public string Name { get; set; }
-        /// <summary>
-        /// 时间段
-        /// </summary>
-        public string Time { get; set; }
-        /// <summary>
-        /// 所属学校Id
-        /// </summary>
-        public string SchoolId { get; set; }
-        /// <summary>
-        /// 所属学校
-        /// </summary>
-        public string SchoolName { get; set; }
-        /// <summary>
-        /// 类型
-        /// </summary>
-        public int State { get; set; }
-        /// <summary>
-        /// 备注
-        /// </summary>
-        public string Remark { get; set; }
-    }
-}

+ 0 - 32
TEAMModelOS.Model/Analysis/Models/School.cs

@@ -1,32 +0,0 @@
-using Microsoft.WindowsAzure.Storage.Table;
-using System;
-using System.Collections.Generic;
-using System.Text;
-using TEAMModelOS.SDK.Context.Attributes.Table;
-
-namespace TEAMModelOS.Model.Analysis.Models
-{
-    [TableSpaceAttribute(Name = "Common")]
-    public class School:TableEntity
-    {
-
-        /// <summary>
-        /// id
-        /// </summary>
-        public string Id { get; set; }
-        /// <summary>
-        /// 学校名称
-        /// </summary>
-        public string Name { get; set; }
-        
-        public int State { get; set; }
-        /// <summary>
-        /// 备注
-        /// </summary>
-        public string Remark { get; set; }
-        /// <summary>
-        /// 学校资源编码
-        /// </summary>
-        public string Code { get; set; }
-    }
-}

+ 0 - 68
TEAMModelOS.Model/Analysis/Models/Students.cs

@@ -1,68 +0,0 @@
-using Microsoft.WindowsAzure.Storage.Table;
-using System;
-using System.Collections.Generic;
-using System.Text;
-using TEAMModelOS.SDK.Context.Attributes.Table;
-
-namespace TEAMModelOS.Model.Analysis.Models
-{
-    /// <summary>
-    /// 学生基本信息
-    /// </summary>
-    [TableSpaceAttribute(Name = "Common")]
-    public class Students: TableEntity
-    {
-        /// <summary>
-        /// id
-        /// </summary>
-        public string Id { get; set; }
-        /// <summary>
-        /// 姓名
-        /// </summary>
-        public string Name { get; set; }
-        /// <summary>
-        /// 性别
-        /// </summary>
-        public string Sex { get; set; }
-        /// <summary>
-        /// 所属班级Id
-        /// </summary>
-        public string ClassId { get; set; }
-        /// <summary>
-        /// 所属班级名称
-        /// </summary>
-        public string ClassName { get; set; }
-        /// <summary>
-        /// 所属年级Id
-        /// </summary>
-        public string GradeId { get; set; }
-        /// <summary>
-        /// 所属年级名称
-        /// </summary>
-        public string GradeName { get; set; }
-        /// <summary>
-        /// 所属学段Id
-        /// </summary>
-        public string PeriodId { get; set; }
-        /// <summary>
-        /// 所属学段
-        /// </summary>
-        public string PeriodName { get; set; }
-        /// <summary>
-        /// 所属学校Id
-        /// </summary>
-        public string SchoolId { get; set; }
-        /// <summary>
-        /// 所属学校
-        /// </summary>
-        public string SchoolName { get; set; }
-        /// <summary>
-        /// 类型
-        /// </summary>
-        public int State { get; set; }
-        /// <summary>
-        /// 备注
-        /// </summary>
-        public string Remark { get; set; }
-    }
-}

+ 0 - 50
TEAMModelOS.Model/Analysis/Models/Teachers.cs

@@ -1,50 +0,0 @@
-using Microsoft.WindowsAzure.Storage.Table;
-using System;
-using System.Collections.Generic;
-using System.Text;
-using TEAMModelOS.SDK.Context.Attributes.Table;
-
-namespace TEAMModelOS.Model.Analysis.Models
-{
-    [TableSpaceAttribute(Name = "Common")]
-    public class Teachers :TableEntity
-    {
-        /// <summary>
-        /// id
-        /// </summary>
-        public string Id { get; set; }
-        /// <summary>
-        /// 姓名
-        /// </summary>
-        public string Name { get; set; }
-        /// <summary>
-        /// 任教科目
-        /// </summary>
-        public string SubjectName { get; set; }
-
-        /// <summary>
-        /// 任教班级
-        /// </summary>
-        public string ClassName { get; set; }
-        /// <summary>
-        /// 任教年级
-        /// </summary>
-        public string GradeName { get; set; }
-        /// <summary>
-        /// 所属学校Id
-        /// </summary>
-        public string SchoolId { get; set; }
-        /// <summary>
-        /// 所属学校
-        /// </summary>
-        public string SchoolName { get; set; }
-        /// <summary>
-        /// 类型
-        /// </summary>
-        public int State { get; set; }
-        /// <summary>
-        /// 备注
-        /// </summary>
-        public string Remark { get; set; }
-    }
-}

+ 4 - 3
TEAMModelOS.Model/Core/Models/RoleIdentity.cs

@@ -2,13 +2,14 @@
 using System;
 using System.Collections.Generic;
 using System.Text;
-using TEAMModelOS.SDK.Context.Attributes.Table;
+using TEAMModelOS.SDK.Context.Attributes.Azure;
 
 namespace TEAMModelOS.Model.Core.Models
 {
     [TableSpace(Name = "Core")]
-    public class RoleIdentity :TableEntity
+    public class Grade :TableEntity
     {
-        //public string 
+        public string Name { get; set; }
+        public string Alias { get; set; }
     }
 }

+ 1 - 1
TEAMModelOS.Model/Core/Models/JwtBlackRecord.cs

@@ -2,7 +2,7 @@
 using System;
 using System.Collections.Generic;
 using System.Text;
-using TEAMModelOS.SDK.Context.Attributes.Table;
+using TEAMModelOS.SDK.Context.Attributes.Azure;
 
 namespace TEAMModelOS.Model.Core.Models
 {

+ 1 - 1
TEAMModelOS.Model/Core/Models/LoginInfo.cs

@@ -2,7 +2,7 @@
 using System;
 using System.Collections.Generic;
 using System.Text;
-using TEAMModelOS.SDK.Context.Attributes.Table;
+using TEAMModelOS.SDK.Context.Attributes.Azure;
 
 namespace TEAMModelOS.Model.Core.Models
 {

+ 5 - 6
TEAMModelOS.Model/Syllabus/Models/Period.cs

@@ -2,11 +2,11 @@
 using System;
 using System.Collections.Generic;
 using System.Text;
-using TEAMModelOS.SDK.Context.Attributes.Table;
+using TEAMModelOS.SDK.Context.Attributes.Azure;
 
-namespace TEAMModelOS.Model.Syllabus.Models
+namespace TEAMModelOS.Model.Core.Models
 {
-    [TableSpace(Name = "Syllabus")]
+    [TableSpace(Name = "Core")]
     public  class Period : TableEntity
     {
 
@@ -15,10 +15,9 @@ namespace TEAMModelOS.Model.Syllabus.Models
         /// </summary>
         public string Name { get; set; }
         /// <summary>
-        /// 编码
+        /// 别名
         /// </summary>
-        //public string Code { get; set; }
-
+        public string Alias { get; set; }
         /// <summary>
         /// 类型
         /// </summary>

+ 1 - 1
TEAMModelOS.Model/Core/Models/Product.cs

@@ -2,7 +2,7 @@
 using System;
 using System.Collections.Generic;
 using System.Text;
-using TEAMModelOS.SDK.Context.Attributes.Table;
+using TEAMModelOS.SDK.Context.Attributes.Azure;
 
 namespace TEAMModelOS.Model.Core.Models
 {

+ 1 - 1
TEAMModelOS.Model/Core/Models/Region.cs

@@ -4,7 +4,7 @@ using Newtonsoft.Json;
 using System;
 using System.Collections.Generic;
 using System.Text;
-using TEAMModelOS.SDK.Context.Attributes.Table;
+using TEAMModelOS.SDK.Context.Attributes.Azure;
 
 namespace TEAMModelOS.Model.Core.Models
 {

+ 1 - 1
TEAMModelOS.Model/Core/Models/Role.cs

@@ -2,7 +2,7 @@
 using System;
 using System.Collections.Generic;
 using System.Text;
-using TEAMModelOS.SDK.Context.Attributes.Table;
+using TEAMModelOS.SDK.Context.Attributes.Azure;
 
 namespace TEAMModelOS.Model.Core.Models
 {

+ 18 - 0
TEAMModelOS.Model/Core/Models/RoleIdentityClaim.cs

@@ -0,0 +1,18 @@
+using Microsoft.WindowsAzure.Storage.Table;
+using System;
+using System.Collections.Generic;
+using System.Text;
+using TEAMModelOS.SDK.Context.Attributes.Azure;
+
+namespace TEAMModelOS.Model.Core.Models
+{
+    [TableSpace(Name = "Core")]
+    public class RoleIdentityClaim : TableEntity
+    {
+        public string RoleName { get; set; }
+        public string RoleCode { get; set; }
+        public int RoleLevel { get; set; }
+        public string RoleLevelName { get; set; }
+        public string ClaimType { get; set; }
+    }
+}

+ 0 - 15
TEAMModelOS.Model/Core/Models/RoleSchool.cs

@@ -1,15 +0,0 @@
-using Microsoft.WindowsAzure.Storage.Table;
-using System;
-using System.Collections.Generic;
-using System.Text;
-using TEAMModelOS.SDK.Context.Attributes.Table;
-
-namespace TEAMModelOS.Model.Core.Models
-{
-    [TableSpace(Name = "Core")]
-    public class RoleSchool :Role
-    {
-        public string SchoolCode { get; set; }
-        public string SchoolName { get; set; }
-    }
-}

+ 1 - 1
TEAMModelOS.Model/Core/Models/RoleUser.cs

@@ -3,7 +3,7 @@ using Microsoft.WindowsAzure.Storage.Table;
 using System;
 using System.Collections.Generic;
 using System.Text;
-using TEAMModelOS.SDK.Context.Attributes.Table;
+using TEAMModelOS.SDK.Context.Attributes.Azure;
 
 namespace TEAMModelOS.Model.Core.Models
 {

+ 1 - 1
TEAMModelOS.Model/Core/Models/School.cs

@@ -3,7 +3,7 @@ using Microsoft.WindowsAzure.Storage.Table;
 using System;
 using System.Collections.Generic;
 using System.Text;
-using TEAMModelOS.SDK.Context.Attributes.Table;
+using TEAMModelOS.SDK.Context.Attributes.Azure;
 
 namespace TEAMModelOS.Model.Core.Models
 {

+ 20 - 0
TEAMModelOS.Model/Core/Models/SchoolArea.cs

@@ -0,0 +1,20 @@
+using MessagePack;
+using Microsoft.WindowsAzure.Storage.Table;
+using System;
+using System.Collections.Generic;
+using System.Text;
+using TEAMModelOS.SDK.Context.Attributes.Azure;
+
+namespace TEAMModelOS.Model.Core.Models
+{
+    [TableSpace(Name = "Core")]
+    [MessagePackObject(keyAsPropertyName: true)]
+    public class SchoolArea :TableEntity
+    {
+        /// <summary>
+        /// 智慧学区名称
+        /// </summary>
+        public string Name { get; set; }
+        public int Code { get; set; }
+    }
+}

+ 34 - 0
TEAMModelOS.Model/Core/Models/SchoolAreaMember.cs

@@ -0,0 +1,34 @@
+using MessagePack;
+using Microsoft.WindowsAzure.Storage.Table;
+using System;
+using System.Collections.Generic;
+using System.Text;
+using TEAMModelOS.SDK.Context.Attributes.Azure;
+
+namespace TEAMModelOS.Model.Core.Models
+{
+    /// <summary>
+    /// 智慧学区成员学校
+    /// </summary>
+    [TableSpace(Name = "Core")]
+    [MessagePackObject(keyAsPropertyName: true)]
+    public  class SchoolAreaMember: TableEntity
+    {
+        /// <summary>
+        /// 智慧学区编码
+        /// </summary>
+        public string AreaCode { set; get; }
+        /// <summary>
+        /// 智慧学区名称
+        /// </summary>
+        public string AreaName { get; set; }
+        /// <summary>
+        /// 智慧学区成员学校编码
+        /// </summary>
+        public string SchoolCode { get; set; }
+        /// <summary>
+        /// 智慧学区成员学校名称
+        /// </summary>
+        public string SchoolName { get; set; }
+    }
+}

+ 2 - 2
TEAMModelOS.Model/Core/Models/SchoolCampus.cs

@@ -3,7 +3,7 @@ using Microsoft.WindowsAzure.Storage.Table;
 using System;
 using System.Collections.Generic;
 using System.Text;
-using TEAMModelOS.SDK.Context.Attributes.Table;
+using TEAMModelOS.SDK.Context.Attributes.Azure;
 
 namespace TEAMModelOS.Model.Core.Models
 {
@@ -12,7 +12,7 @@ namespace TEAMModelOS.Model.Core.Models
     public class SchoolCampus : TableEntity
     {
         public string Name { get; set; }
-        public string Code { get; set; }
+        public int Code { get; set; }
         public string SchoolCode { get; set; }
         public string SchoolName { get; set; }
     }

+ 56 - 2
TEAMModelOS.Model/Core/Models/SchoolClass.cs

@@ -3,23 +3,77 @@ using Microsoft.WindowsAzure.Storage.Table;
 using System;
 using System.Collections.Generic;
 using System.Text;
-using TEAMModelOS.SDK.Context.Attributes.Table;
+using TEAMModelOS.SDK.Context.Attributes.Azure;
 
 namespace TEAMModelOS.Model.Core.Models
 {
     [TableSpace(Name = "Core")]
     [MessagePackObject(keyAsPropertyName: true)]
-    public class SchoolClass :TableEntity
+    public class SchoolClass : TableEntity
     {
+        /// <summary>
+        /// 班级名称
+        /// </summary>
         public string Name { get; set; }
+        /// <summary>
+        /// 班级code
+        /// </summary>
         public string Code { get; set; }
+        /// <summary>
+        /// 学校编码
+        /// </summary>
         public string SchoolCode { get; set; }
+        /// <summary>
+        /// 学校名称
+        /// </summary>
         public string SchoolName { get; set; }
+        /// <summary>
+        /// 分校代码
+        /// </summary>
         public string CampusCode { get; set; }
+        /// <summary>
+        /// 分校名称
+        /// </summary>
         public string CampusName { get; set; }
+        /// <summary>
+        /// 学段编码
+        /// </summary>
         public string PeriodCode { get; set; }
+        /// <summary>
+        /// 学段名称
+        /// </summary>
         public string PeriodName { get; set; }
+        /// <summary>
+        /// 年级编码   1 2 3 4 5 6 
+        /// </summary>
         public string GradeCode { get; set; }
+        /// <summary>
+        /// 年级名称  一年级 二年级
+        /// </summary>
         public string GradeName { get; set; }
+        /// <summary>
+        /// 绑定 届数code  2019
+        /// </summary>
+        public string SessionCode { get; set; }
+        /// <summary>
+        /// 绑定 届数  2019届
+        /// </summary>
+        public string SessionName { get; set; }
+        /// <summary>
+        /// 绑定学期code
+        /// </summary>
+        public string TermCode { get; set; }
+        /// <summary>
+        /// 绑定学期名称
+        /// </summary>
+        public string TermName { get; set; }
+        /// <summary>
+        /// 选择开班时间201903  最小月份
+        /// </summary>
+        public int StartTime {get;set;}
+        /// <summary>
+        /// 选择结束时间201907  最小月份
+        /// </summary>
+        public int EndTime { get; set; }
     }
 }

+ 10 - 5
TEAMModelOS.Model/Core/Models/SchoolGrade.cs

@@ -3,7 +3,7 @@ using Microsoft.WindowsAzure.Storage.Table;
 using System;
 using System.Collections.Generic;
 using System.Text;
-using TEAMModelOS.SDK.Context.Attributes.Table;
+using TEAMModelOS.SDK.Context.Attributes.Azure;
 
 namespace TEAMModelOS.Model.Core.Models
 {
@@ -12,13 +12,18 @@ namespace TEAMModelOS.Model.Core.Models
     public class SchoolGrade:TableEntity
     {
         public string Name { get; set; }
-        public string Code { get; set; }
+        public int Code { get; set; }
         public string SchoolCode { get; set; }
         public string SchoolName { get; set; }
-        public string CampusCode { get; set; }
-        public string CampusName { get; set; }
         public string PeriodCode { get; set; }
         public string PeriodName { get; set; }
-
+        /// <summary>
+        /// 入学时间201909
+        /// </summary>
+        public int Enrollment { get; set; }
+        /// <summary>
+        /// 毕业时间202406
+        /// </summary>
+        public int Graduate { get; set; }
     }
 }

+ 4 - 3
TEAMModelOS.Model/Core/Models/SchoolGradeSubject.cs

@@ -3,10 +3,13 @@ using Microsoft.WindowsAzure.Storage.Table;
 using System;
 using System.Collections.Generic;
 using System.Text;
-using TEAMModelOS.SDK.Context.Attributes.Table;
+using TEAMModelOS.SDK.Context.Attributes.Azure;
 
 namespace TEAMModelOS.Model.Core.Models
 {
+    /// <summary>
+    /// 暂不使用
+    /// </summary>
     [TableSpace(Name = "Core")]
     [MessagePackObject(keyAsPropertyName: true)]
     public class SchoolGradeSubject :TableEntity
@@ -15,8 +18,6 @@ namespace TEAMModelOS.Model.Core.Models
         public string Code { get; set; }
         public string SchoolCode { get; set; }
         public string SchoolName { get; set; }
-        public string CampusCode { get; set; }
-        public string CampusName { get; set; }
         public string PeriodCode { get; set; }
         public string PeriodName { get; set; }
         public string GradeCode { get; set; }

+ 13 - 12
TEAMModelOS.Model/Core/Models/SchoolGradeTerm.cs

@@ -3,23 +3,24 @@ using Microsoft.WindowsAzure.Storage.Table;
 using System;
 using System.Collections.Generic;
 using System.Text;
-using TEAMModelOS.SDK.Context.Attributes.Table;
+using TEAMModelOS.SDK.Context.Attributes.Azure;
 
 namespace TEAMModelOS.Model.Core.Models
 {
+    /// <summary>
+    /// 暂不使用
+    /// </summary>
     [TableSpace(Name = "Core")]
     [MessagePackObject(keyAsPropertyName: true)]
-    public class SchoolGradeTerm :TableEntity
+    public  class SchoolGradeTerm :TableEntity
     {
-            public string Name { get; set; }
-            public string Code { get; set; }
-            public string SchoolCode { get; set; }
-            public string SchoolName { get; set; }
-            public string CampusCode { get; set; }
-            public string CampusName { get; set; }
-            public string PeriodCode { get; set; }
-            public string PeriodName { get; set; }
-            public string GradeCode { get; set; }
-            public string GradeName { get; set; }
+        public string Name { get; set; }
+        public string Code { get; set; }
+        public string SchoolCode { get; set; }
+        public string SchoolName { get; set; }
+        public string PeriodCode { get; set; }
+        public string PeriodName { get; set; }
+        public string GradeCode { get; set; }
+        public string GradeName { get; set; }
     }
 }

+ 3 - 3
TEAMModelOS.Model/Core/Models/SchoolPeriod.cs

@@ -3,7 +3,7 @@ using Microsoft.WindowsAzure.Storage.Table;
 using System;
 using System.Collections.Generic;
 using System.Text;
-using TEAMModelOS.SDK.Context.Attributes.Table;
+using TEAMModelOS.SDK.Context.Attributes.Azure;
 
 namespace TEAMModelOS.Model.Core.Models
 {
@@ -15,7 +15,7 @@ namespace TEAMModelOS.Model.Core.Models
         public string Code { get; set; }
         public string SchoolCode { get; set; }
         public string SchoolName { get; set; }
-        public string CampusCode { get; set; }
-        public string CampusName { get; set; }
+        public string PeriodType { get; set; }
+        public int PeriodCycle { get; set; }
     }
 }

+ 21 - 0
TEAMModelOS.Model/Core/Models/SchoolRole.cs

@@ -0,0 +1,21 @@
+using Microsoft.WindowsAzure.Storage.Table;
+using System;
+using System.Collections.Generic;
+using System.Text;
+using TEAMModelOS.SDK.Context.Attributes.Azure;
+
+namespace TEAMModelOS.Model.Core.Models
+{
+    [TableSpace(Name = "Core")]
+    public class SchoolRole : TableEntity
+    {
+        public string SchoolCode { get; set; }
+        public string SchoolName { get; set; }
+        public string RoleName { get; set; }
+        public string RoleCode { get; set; }
+        public int RoleLevel { get; set; }
+        public string RoleLevelName { get; set; }
+        public string Remarks { get; set; }
+        public int Status { get; set; }
+    }
+}

+ 29 - 0
TEAMModelOS.Model/Core/Models/SchoolSession.cs

@@ -0,0 +1,29 @@
+using MessagePack;
+using Microsoft.WindowsAzure.Storage.Table;
+using System;
+using System.Collections.Generic;
+using System.Text;
+using TEAMModelOS.SDK.Context.Attributes.Azure;
+
+namespace TEAMModelOS.Model.Core.Models
+{
+    [TableSpace(Name = "Core")]
+    [MessagePackObject(keyAsPropertyName: true)]
+    public class SchoolSession : TableEntity
+    {
+        public string Name { get; set; }
+        public int Code { get; set; }
+        public string SchoolCode { get; set; }
+        public string SchoolName { get; set; }
+        public string PeriodCode { get; set; }
+        public string PeriodName { get; set; }
+        /// <summary>
+        /// 入学时间201909
+        /// </summary>
+        public int Enrollment { get; set; }
+        /// <summary>
+        /// 毕业时间202406
+        /// </summary>
+        public int Graduate { get; set; }
+    }
+}

+ 19 - 0
TEAMModelOS.Model/Core/Models/SchoolSubject.cs

@@ -0,0 +1,19 @@
+using MessagePack;
+using Microsoft.WindowsAzure.Storage.Table;
+using System;
+using System.Collections.Generic;
+using System.Text;
+using TEAMModelOS.SDK.Context.Attributes.Azure;
+
+namespace TEAMModelOS.Model.Core.Models
+{
+    [TableSpace(Name = "Core")]
+    [MessagePackObject(keyAsPropertyName: true)]
+    public class SchoolSubject :TableEntity
+    {
+        public string Name { get; set; }
+        public string Code { get; set; }
+        public string SchoolCode { get; set; }
+        public string SchoolName { get; set; }
+    }
+}

+ 19 - 0
TEAMModelOS.Model/Core/Models/SchoolTerm.cs

@@ -0,0 +1,19 @@
+using MessagePack;
+using Microsoft.WindowsAzure.Storage.Table;
+using System;
+using System.Collections.Generic;
+using System.Text;
+using TEAMModelOS.SDK.Context.Attributes.Azure;
+
+namespace TEAMModelOS.Model.Core.Models
+{
+    [TableSpace(Name = "Core")]
+    [MessagePackObject(keyAsPropertyName: true)]
+    public class SchoolTerm :TableEntity
+    {
+        public string Name { get; set; }
+        public int Code { get; set; }
+        public string SchoolCode { get; set; }
+        public string SchoolName { get; set; }
+    }
+}

+ 16 - 0
TEAMModelOS.Model/Core/Models/Subject.cs

@@ -0,0 +1,16 @@
+using Microsoft.WindowsAzure.Storage.Table;
+using System;
+using System.Collections.Generic;
+using System.Text;
+using TEAMModelOS.SDK.Context.Attributes.Azure;
+
+namespace TEAMModelOS.Model.Core.Models
+{
+    [TableSpace(Name = "Core")]
+    public class Subject : TableEntity
+    {
+        public string Name { get; set; }
+        //public string Code { get; set; }
+        //public string Lang { get; set; }
+    }
+}

+ 1 - 1
TEAMModelOS.Model/Core/Models/TeamModelUser.cs

@@ -2,7 +2,7 @@
 using System;
 using System.Collections.Generic;
 using System.Text;
-using TEAMModelOS.SDK.Context.Attributes.Table;
+using TEAMModelOS.SDK.Context.Attributes.Azure;
 
 namespace TEAMModelOS.Model.Core.Models
 {

+ 34 - 0
TEAMModelOS.Model/Syllabus/Models/KnowledgeBlock.cs

@@ -0,0 +1,34 @@
+using Microsoft.WindowsAzure.Storage.Table;
+using System;
+using System.Collections.Generic;
+using System.Text;
+using TEAMModelOS.SDK.Context.Attributes.Azure;
+
+namespace TEAMModelOS.Model.Syllabus.Models
+{
+    public class KnowledgeBlock //: TableEntity
+    {
+        public string Id { get; set; }
+        public string Key { get; set; }
+        /// <summary>
+        /// 名称
+        /// </summary>
+        public string Name { get; set; }
+        /// <summary>
+        /// 描述
+        /// </summary>
+        public string Description { get; set; }
+        public string TeamModelId { get; set; }
+        /// <summary>
+        /// 学校编码
+        /// </summary>
+        public string SchoolCode { get; set; }
+        /// <summary>
+        /// 语言版本
+        /// </summary>
+        [PartitionKey]
+        public string Lang { get; set; }
+
+
+    }
+}

+ 26 - 0
TEAMModelOS.Model/Syllabus/Models/KnowledgeBlockPoint.cs

@@ -0,0 +1,26 @@
+using Microsoft.WindowsAzure.Storage.Table;
+using System;
+using System.Collections.Generic;
+using System.Text;
+using TEAMModelOS.SDK.Context.Attributes.Azure;
+
+namespace TEAMModelOS.Model.Syllabus.Models
+{
+    public class KnowledgeBlockPoint //: TableEntity
+    {
+        public string Id { get; set; }
+        public string PointId { get; set; }
+        /// <summary>
+        /// 原始名称
+        /// </summary>
+        public string Name { get; set; }
+        /// <summary>
+        /// 别名
+        /// </summary>
+        public string Alias { get; set; }
+        public string BlockId { get; set; }
+        [PartitionKey]
+        public string Lang { get; set; }
+        
+    }
+}

+ 20 - 2
TEAMModelOS.Model/Syllabus/Models/KnowledgePoint.cs

@@ -2,20 +2,38 @@
 using System;
 using System.Collections.Generic;
 using System.Text;
+using TEAMModelOS.SDK.Context.Attributes.Azure;
 
 namespace TEAMModelOS.Model.Syllabus.Models
 {
     /// <summary>
     /// 知识点
     /// </summary>
-    public class KnowledgePoint : TableEntity
+    public class KnowledgePoint //: TableEntity
     {
         public string Id { get; set; }
-        public string Pid { get; set; }
+        public string Key { get; set; }
+        /// <summary>
+        /// 名称
+        /// </summary>
         public string Name { get; set; }
         /// <summary>
+        /// 描述
+        /// </summary>
+        public string Description { get; set; }
+        /// <summary>
         /// 语言版本
         /// </summary>
+        [PartitionKey]
         public string Lang { get; set; }
+        /// <summary>
+        /// 学科
+        /// </summary>
+        public string SubjectCode { get; set; }
+        /// <summary>
+        /// 建议关联学段
+        /// </summary>
+        public string[] AdvicePeriodCode { get; set; }
+
     }
 }

+ 0 - 17
TEAMModelOS.Model/Syllabus/Models/PeriodSubject.cs

@@ -1,17 +0,0 @@
-using Microsoft.WindowsAzure.Storage.Table;
-using System;
-using System.Collections.Generic;
-using System.Text;
-using TEAMModelOS.SDK.Context.Attributes.Table;
-
-namespace TEAMModelOS.Model.Syllabus.Models
-{
-    [TableSpace(Name = "Syllabus")]
-    public  class PeriodSubject : Period
-    {
-        /// <summary>
-        /// 学段编码
-        /// </summary>
-        public string Pcode { get; set; }
-    }
-}

+ 0 - 16
TEAMModelOS.Model/Syllabus/Models/PeriodSubjectEdition.cs

@@ -1,16 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-using TEAMModelOS.SDK.Context.Attributes.Table;
-
-namespace TEAMModelOS.Model.Syllabus.Models
-{
-    [TableSpace(Name = "Syllabus")]
-    public class PeriodSubjectEdition : PeriodSubject
-    {
-        /// <summary>
-        /// 学段学科code
-        /// </summary>
-        public string Pscode { get; set; }
-    }
-}

+ 0 - 20
TEAMModelOS.Model/Syllabus/Models/PeriodSubjectEditionTerm.cs

@@ -1,20 +0,0 @@
-using Microsoft.WindowsAzure.Storage.Table;
-using System;
-using System.Collections.Generic;
-using System.Text;
-using TEAMModelOS.SDK.Context.Attributes.Table;
-
-namespace TEAMModelOS.Model.Syllabus.Models
-{
-    /// <summary>
-    /// 学段册别表
-    /// </summary>
-    [TableSpace(Name = "Syllabus")]
-    public class PeriodSubjectEditionTerm : PeriodSubjectEdition
-    {
-        /// <summary>
-        /// 版本code
-        /// </summary>
-        public string Psecode { get; set; }
-    }
-}

+ 1 - 1
TEAMModelOS.Model/Syllabus/Models/StandardTextbook.cs

@@ -3,7 +3,7 @@ using System;
 using System.Collections.Generic;
 using System.ComponentModel.DataAnnotations;
 using System.Text;
-using TEAMModelOS.SDK.Context.Attributes.Table;
+using TEAMModelOS.SDK.Context.Attributes.Azure;
 
 namespace TEAMModelOS.Model.Syllabus.Models
 {

+ 1 - 1
TEAMModelOS.Model/Syllabus/Models/TeacherTextbook.cs

@@ -1,7 +1,7 @@
 using System;
 using System.Collections.Generic;
 using System.Text;
-using TEAMModelOS.SDK.Context.Attributes.Table;
+using TEAMModelOS.SDK.Context.Attributes.Azure;
 
 namespace TEAMModelOS.Model.Syllabus.Models
 {

+ 1 - 0
TEAMModelOS.Model/TEAMModelOS.Model.csproj

@@ -6,6 +6,7 @@
 
   <ItemGroup>
     <Folder Include="Analysis\Dtos\" />
+    <Folder Include="Analysis\Models\" />
   </ItemGroup>
   <ItemGroup>
     <PackageReference Include="WindowsAzure.Storage" Version="9.3.3" />

+ 2 - 2
TEAMModelOS.SDK/Context/Attributes/Table/PartitionAttribute.cs

@@ -2,10 +2,10 @@
 using System.Collections.Generic;
 using System.Text;
 
-namespace TEAMModelOS.SDK.Context.Attributes.Table
+namespace TEAMModelOS.SDK.Context.Attributes.Azure
 {
     [AttributeUsage(AttributeTargets.Property)]
-    public class PartitionAttribute : Attribute
+    public class PartitionKeyAttribute : Attribute
     {
     }
 }

+ 1 - 1
TEAMModelOS.SDK/Context/Attributes/Table/TableSpaceAttribute.cs

@@ -2,7 +2,7 @@
 using System.Collections.Generic;
 using System.Text;
 
-namespace TEAMModelOS.SDK.Context.Attributes.Table
+namespace TEAMModelOS.SDK.Context.Attributes.Azure
 {
     [AttributeUsage(AttributeTargets.Class)]
     public class TableSpaceAttribute :Attribute

+ 17 - 0
TEAMModelOS.SDK/Extension/JsonPath/IJsonPathValueSystem.cs

@@ -0,0 +1,17 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Text;
+
+namespace TEAMModelOS.SDK.Extension.JsonPath
+{
+    public interface IJsonPathValueSystem
+    {
+        bool HasMember(object value, string member);
+        object GetMemberValue(object value, string member);
+        IEnumerable GetMembers(object value);
+        bool IsObject(object value);
+        bool IsArray(object value);
+        bool IsPrimitive(object value);
+    }
+}

+ 62 - 0
TEAMModelOS.SDK/Extension/JsonPath/JsonNetValueSystem.cs

@@ -0,0 +1,62 @@
+using System;
+using System.Collections;
+using System.Linq;
+using Newtonsoft.Json.Linq;
+
+namespace TEAMModelOS.SDK.Extension.JsonPath
+{
+    public sealed class JsonNetValueSystem : IJsonPathValueSystem
+    {
+        public bool HasMember(object value, string member)
+        {
+            if (value is JObject)
+            {
+                return (value as JObject).Properties().Any(property => property.Name == member);
+            }
+
+            if (value is JArray)
+            {
+                var index = ParseInt(member, -1);
+                return index >= 0 && index < (value as JArray).Count;
+            }
+            return false;
+        }
+
+        public object GetMemberValue(object value, string member)
+        {
+            if (value is JObject)
+            {
+                var memberValue = (value as JObject)[member];
+                return memberValue;
+            }
+            if (value is JArray)
+            {
+                var index = ParseInt(member, -1);
+                return (value as JArray)[index];
+            }
+            return null;
+        }
+
+        public IEnumerable GetMembers(object value)
+        {
+            var jobject = value as JObject;
+            return jobject?.Properties().Select(property => property.Name);
+        }
+
+        public bool IsObject(object value) => value is JObject;
+
+        public bool IsArray(object value) => value is JArray;
+
+        public bool IsPrimitive(object value)
+        {
+            if (value == null)
+            {
+                throw new ArgumentNullException("value");
+            }
+
+            return !(value is JObject) && !(value is JArray);
+        }
+
+        int ParseInt(string s, int defaultValue) => int.TryParse(s, out int result) ? result : defaultValue;
+    }
+}

+ 442 - 0
TEAMModelOS.SDK/Extension/JsonPath/JsonPath.cs

@@ -0,0 +1,442 @@
+using System;
+using System.Collections;
+using System.Diagnostics;
+using System.Globalization;
+using System.Text;
+using System.Text.RegularExpressions;
+
+namespace TEAMModelOS.SDK.Extension.JsonPath
+{
+    public delegate object JsonPathScriptEvaluator(string script, object value, string context);
+    public delegate void JsonPathResultAccumulator(object value, string[] indicies);
+
+    
+    [Serializable]
+    public sealed class JsonPathNode
+    {
+        private readonly object value;
+        private readonly string path;
+
+        public JsonPathNode(object value, string path)
+        {
+            if (path == null)
+                throw new ArgumentNullException("path");
+
+            if (path.Length == 0)
+                throw new ArgumentException("path");
+
+            this.value = value;
+            this.path = path;
+        }
+
+        public object Value
+        {
+            get { return value; }
+        }
+
+        public string Path
+        {
+            get { return path; }
+        }
+
+        public override string ToString()
+        {
+            return Path + " = " + Value;
+        }
+
+        public static object[] ValuesFrom(ICollection nodes)
+        {
+            object[] values = new object[nodes != null ? nodes.Count : 0];
+
+            if (values.Length > 0)
+            {
+                Debug.Assert(nodes != null);
+
+                int i = 0;
+                foreach (JsonPathNode node in nodes)
+                    values[i++] = node.Value;
+            }
+
+            return values;
+        }
+
+        public static string[] PathsFrom(ICollection nodes)
+        {
+            string[] paths = new string[nodes != null ? nodes.Count : 0];
+
+            if (paths.Length > 0)
+            {
+                Debug.Assert(nodes != null);
+
+                int i = 0;
+                foreach (JsonPathNode node in nodes)
+                    paths[i++] = node.Path;
+            }
+
+            return paths;
+        }
+    }
+
+    public sealed class JsonPathContext
+    {
+        public static readonly JsonPathContext Default = new JsonPathContext();
+
+        private JsonPathScriptEvaluator eval;
+        private IJsonPathValueSystem system;
+
+        public JsonPathScriptEvaluator ScriptEvaluator
+        {
+            get { return eval; }
+            set { eval = value; }
+        }
+
+        public IJsonPathValueSystem ValueSystem
+        {
+            get { return system; }
+            set { system = value; }
+        }
+
+        public void SelectTo(object obj, string expr, JsonPathResultAccumulator output)
+        {
+            if (obj == null)
+                throw new ArgumentNullException("obj");
+
+            if (output == null)
+                throw new ArgumentNullException("output");
+
+            Interpreter i = new Interpreter(output, ValueSystem, ScriptEvaluator);
+
+            expr = Normalize(expr);
+
+            if (expr.Length >= 1 && expr[0] == '$') // ^\$:?
+                expr = expr.Substring(expr.Length >= 2 && expr[1] == ';' ? 2 : 1);
+
+            i.Trace(expr, obj, "$");
+        }
+
+        public JsonPathNode[] SelectNodes(object obj, string expr)
+        {
+            ArrayList list = new ArrayList();
+            SelectNodesTo(obj, expr, list);
+            return (JsonPathNode[])list.ToArray(typeof(JsonPathNode));
+        }
+
+        public IList SelectNodesTo(object obj, string expr, IList output)
+        {
+            ListAccumulator accumulator = new ListAccumulator(output != null ? output : new ArrayList());
+            SelectTo(obj, expr, new JsonPathResultAccumulator(accumulator.Put));
+            return output;
+        }
+
+        private static Regex RegExp(string pattern)
+        {
+            return new Regex(pattern, RegexOptions.ECMAScript);
+        }
+
+        private static string Normalize(string expr)
+        {
+            NormalizationSwap swap = new NormalizationSwap();
+            expr = RegExp(@"[\['](\??\(.*?\))[\]']").Replace(expr, new MatchEvaluator(swap.Capture));
+            expr = RegExp(@"'?\.'?|\['?").Replace(expr, ";");
+            expr = RegExp(@";;;|;;").Replace(expr, ";..;");
+            expr = RegExp(@";$|'?\]|'$").Replace(expr, string.Empty);
+            expr = RegExp(@"#([0-9]+)").Replace(expr, new MatchEvaluator(swap.Yield));
+            return expr;
+        }
+
+        private sealed class NormalizationSwap
+        {
+            private readonly ArrayList subx = new ArrayList(4);
+
+            public string Capture(Match match)
+            {
+                Debug.Assert(match != null);
+
+                int index = subx.Add(match.Groups[1].Value);
+                return "[#" + index.ToString(CultureInfo.InvariantCulture) + "]";
+            }
+
+            public string Yield(Match match)
+            {
+                Debug.Assert(match != null);
+
+                int index = int.Parse(match.Groups[1].Value, CultureInfo.InvariantCulture);
+                return (string)subx[index];
+            }
+        }
+
+        public static string AsBracketNotation(string[] indicies)
+        {
+            if (indicies == null)
+                throw new ArgumentNullException("indicies");
+
+            StringBuilder sb = new StringBuilder();
+
+            foreach (string index in indicies)
+            {
+                if (sb.Length == 0)
+                {
+                    sb.Append('$');
+                }
+                else
+                {
+                    sb.Append('[');
+                    if (RegExp(@"^[0-9*]+$").IsMatch(index))
+                        sb.Append(index);
+                    else
+                        sb.Append('\'').Append(index).Append('\'');
+                    sb.Append(']');
+                }
+            }
+
+            return sb.ToString();
+        }
+
+        private static int ParseInt(string s)
+        {
+            return ParseInt(s, 0);
+        }
+
+        private static int ParseInt(string str, int defaultValue)
+        {
+            if (str == null || str.Length == 0)
+                return defaultValue;
+
+            try
+            {
+                return int.Parse(str, NumberStyles.None, CultureInfo.InvariantCulture);
+            }
+            catch (FormatException)
+            {
+                return defaultValue;
+            }
+        }
+
+        private sealed class Interpreter
+        {
+            private readonly JsonPathResultAccumulator output;
+            private readonly JsonPathScriptEvaluator eval;
+            private readonly IJsonPathValueSystem system;
+
+            private static readonly IJsonPathValueSystem defaultValueSystem = new BasicValueSystem();
+
+            private static readonly char[] colon = new char[] { ':' };
+            private static readonly char[] semicolon = new char[] { ';' };
+
+            private delegate void WalkCallback(object member, string loc, string expr, object value, string path);
+
+            public Interpreter(JsonPathResultAccumulator output, IJsonPathValueSystem valueSystem, JsonPathScriptEvaluator eval)
+            {
+                Debug.Assert(output != null);
+
+                this.output = output;
+                this.eval = eval != null ? eval : new JsonPathScriptEvaluator(NullEval);
+                this.system = valueSystem != null ? valueSystem : defaultValueSystem;
+            }
+
+            public void Trace(string expr, object value, string path)
+            {
+                if (expr == null || expr.Length == 0)
+                {
+                    Store(path, value);
+                    return;
+                }
+
+                int i = expr.IndexOf(';');
+                string atom = i >= 0 ? expr.Substring(0, i) : expr;
+                string tail = i >= 0 ? expr.Substring(i + 1) : string.Empty;
+
+                if (value != null && system.HasMember(value, atom))
+                {
+                    Trace(tail, Index(value, atom), path + ";" + atom);
+                }
+                else if (atom == "*")
+                {
+                    Walk(atom, tail, value, path, new WalkCallback(WalkWild));
+                }
+                else if (atom == "..")
+                {
+                    Trace(tail, value, path);
+                    Walk(atom, tail, value, path, new WalkCallback(WalkTree));
+                }
+                else if (atom.Length > 2 && atom[0] == '(' && atom[atom.Length - 1] == ')') // [(exp)]
+                {
+                    Trace(eval(atom, value, path.Substring(path.LastIndexOf(';') + 1)) + ";" + tail, value, path);
+                }
+                else if (atom.Length > 3 && atom[0] == '?' && atom[1] == '(' && atom[atom.Length - 1] == ')') // [?(exp)]
+                {
+                    Walk(atom, tail, value, path, new WalkCallback(WalkFiltered));
+                }
+                else if (RegExp(@"^(-?[0-9]*):(-?[0-9]*):?([0-9]*)$").IsMatch(atom)) // [start:end:step] Phyton slice syntax
+                {
+                    Slice(atom, tail, value, path);
+                }
+                else if (atom.IndexOf(',') >= 0) // [name1,name2,...]
+                {
+                    foreach (string part in RegExp(@"'?,'?").Split(atom))
+                        Trace(part + ";" + tail, value, path);
+                }
+            }
+
+            private void Store(string path, object value)
+            {
+                if (path != null)
+                    output(value, path.Split(semicolon));
+            }
+
+            private void Walk(string loc, string expr, object value, string path, WalkCallback callback)
+            {
+                if (system.IsPrimitive(value))
+                    return;
+
+                if (system.IsArray(value))
+                {
+                    IList list = (IList)value;
+                    for (int i = 0; i < list.Count; i++)
+                        callback(i, loc, expr, value, path);
+                }
+                else if (system.IsObject(value))
+                {
+                    foreach (string key in system.GetMembers(value))
+                        callback(key, loc, expr, value, path);
+                }
+            }
+
+            private void WalkWild(object member, string loc, string expr, object value, string path)
+            {
+                Trace(member + ";" + expr, value, path);
+            }
+
+            private void WalkTree(object member, string loc, string expr, object value, string path)
+            {
+                object result = Index(value, member.ToString());
+                if (result != null && !system.IsPrimitive(result))
+                    Trace("..;" + expr, result, path + ";" + member);
+            }
+
+            private void WalkFiltered(object member, string loc, string expr, object value, string path)
+            {
+                object result = eval(RegExp(@"^\?\((.*?)\)$").Replace(loc, "$1"),
+                    Index(value, member.ToString()), member.ToString());
+
+                if (Convert.ToBoolean(result, CultureInfo.InvariantCulture))
+                    Trace(member + ";" + expr, value, path);
+            }
+
+            private void Slice(string loc, string expr, object value, string path)
+            {
+                IList list = value as IList;
+
+                if (list == null)
+                    return;
+
+                int length = list.Count;
+                string[] parts = loc.Split(colon);
+                int start = ParseInt(parts[0]);
+                int end = ParseInt(parts[1], list.Count);
+                int step = parts.Length > 2 ? ParseInt(parts[2], 1) : 1;
+                start = (start < 0) ? Math.Max(0, start + length) : Math.Min(length, start);
+                end = (end < 0) ? Math.Max(0, end + length) : Math.Min(length, end);
+                for (int i = start; i < end; i += step)
+                    Trace(i + ";" + expr, value, path);
+            }
+
+            private object Index(object obj, string member)
+            {
+                return system.GetMemberValue(obj, member);
+            }
+
+            private static object NullEval(string expr, object value, string context)
+            {
+                //
+                // @ symbol in expr must be interpreted specially to resolve
+                // to value. In JavaScript, the implementation would look 
+                // like:
+                //
+                // return obj && value && eval(expr.replace(/@/g, "value"));
+                //
+
+                return null;
+            }
+        }
+
+        private sealed class BasicValueSystem : IJsonPathValueSystem
+        {
+            public bool HasMember(object value, string member)
+            {
+                if (IsPrimitive(value))
+                    return false;
+
+                IDictionary dict = value as IDictionary;
+                if (dict != null)
+                    return dict.Contains(member);
+
+                IList list = value as IList;
+                if (list != null)
+                {
+                    int index = ParseInt(member, -1);
+                    return index >= 0 && index < list.Count;
+                }
+
+                return false;
+            }
+
+            public object GetMemberValue(object value, string member)
+            {
+                if (IsPrimitive(value))
+                    throw new ArgumentException("value");
+
+                IDictionary dict = value as IDictionary;
+                if (dict != null)
+                    return dict[member];
+
+                IList list = (IList)value;
+                int index = ParseInt(member, -1);
+                if (index >= 0 && index < list.Count)
+                    return list[index];
+
+                return null;
+            }
+
+            public IEnumerable GetMembers(object value)
+            {
+                return ((IDictionary)value).Keys;
+            }
+
+            public bool IsObject(object value)
+            {
+                return value is IDictionary;
+            }
+
+            public bool IsArray(object value)
+            {
+                return value is IList;
+            }
+
+            public bool IsPrimitive(object value)
+            {
+                if (value == null)
+                    throw new ArgumentNullException("value");
+
+                return Type.GetTypeCode(value.GetType()) != TypeCode.Object;
+            }
+        }
+
+        private sealed class ListAccumulator
+        {
+            private readonly IList list;
+
+            public ListAccumulator(IList list)
+            {
+                Debug.Assert(list != null);
+
+                this.list = list;
+            }
+
+            public void Put(object value, string[] indicies)
+            {
+                list.Add(new JsonPathNode(value, JsonPathContext.AsBracketNotation(indicies)));
+            }
+        }
+    }
+}

+ 1 - 1
TEAMModelOS.SDK/Extension/JwtAuth/Models/JwtBlackRecord.cs

@@ -2,7 +2,7 @@
 using System;
 using System.Collections.Generic;
 using System.Text;
-using TEAMModelOS.SDK.Context.Attributes.Table;
+using TEAMModelOS.SDK.Context.Attributes.Azure;
 
 namespace TEAMModelOS.SDK.Extension.JwtAuth.Models
 {

+ 2 - 0
TEAMModelOS.SDK/Module/AzureCosmosDB/Configuration/AzureCosmosDBOptions.cs

@@ -10,6 +10,8 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDB.Configuration
         public string ConnectionKey { get; set; } = null;
         public string Database { get; set; } = null;
         public string AzureTableDialect { get; set; } = null;
+        public int CollectionThroughput { get; set; } = 400;
+        
         public AzureCosmosDBOptions()
         {
             //Azure Table Init

+ 6 - 1
TEAMModelOS.SDK/Module/AzureCosmosDB/Configuration/CosmosDBClientSingleton.cs

@@ -37,7 +37,12 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDB.Configuration
         {
             public static CosmosDBClientSingleton instance = new CosmosDBClientSingleton()
             {
-                CosmosClient = new DocumentClient(new Uri(_connectionUrl), _connectionKey)
+                CosmosClient = new DocumentClient(new Uri(_connectionUrl), _connectionKey, ConnectionPolicy)
+            };
+            private static readonly ConnectionPolicy ConnectionPolicy = new ConnectionPolicy
+            {
+                ConnectionMode = ConnectionMode.Direct,
+                ConnectionProtocol = Protocol.Tcp
             };
         }
     }

+ 466 - 208
TEAMModelOS.SDK/Module/AzureCosmosDB/Implements/AzureCosmosDBRepository.cs

@@ -11,289 +11,547 @@ using TEAMModelOS.SDK.Context.Exception;
 using Microsoft.Azure.Documents.Linq;
 using TEAMModelOS.SDK.Helper.Query.LinqHelper;
 using System.Reflection;
-using TEAMModelOS.SDK.Context.Attributes.Table;
+using Microsoft.Azure.CosmosDB.BulkExecutor;
+using Microsoft.Azure.CosmosDB.BulkExecutor.BulkImport;
+using System.Threading;
+using TEAMModelOS.SDK.Helper.Common.JsonHelper;
+using Microsoft.Azure.CosmosDB.BulkExecutor.BulkUpdate;
+using TEAMModelOS.SDK.Helper.Common.CollectionHelper;
+using Microsoft.Azure.CosmosDB.BulkExecutor.BulkDelete;
+using TEAMModelOS.SDK.Context.Attributes.Azure;
 
 namespace TEAMModelOS.SDK.Module.AzureCosmosDB.Implements
-{
-    /// <summary>
-    /// sdk 文档https://github.com/Azure/azure-cosmos-dotnet-v2/tree/master/samples
-    /// https://github.com/Azure/azure-cosmos-dotnet-v2/blob/530c8d9cf7c99df7300246da05206c57ce654233/samples/code-samples/DatabaseManagement/Program.cs#L72-L121
-    /// </summary>
+{ /// <summary>
+  /// sdk 文档https://github.com/Azure/azure-cosmos-dotnet-v2/tree/master/samples
+  /// https://github.com/Azure/azure-cosmos-dotnet-v2/blob/530c8d9cf7c99df7300246da05206c57ce654233/samples/code-samples/DatabaseManagement/Program.cs#L72-L121
+  /// </summary>
     public class AzureCosmosDBRepository : IAzureCosmosDBRepository
     {
+        /// <summary>
+        /// sdk 文档https://github.com/Azure/azure-cosmos-dotnet-v2/tree/master/samples
+        /// https://github.com/Azure/azure-cosmos-dotnet-v2/blob/530c8d9cf7c99df7300246da05206c57ce654233/samples/code-samples/DatabaseManagement/Program.cs#L72-L121
+        /// </summary>
+       
+
+            private readonly string china_con = "417A7572654368696E6120202020202020202020202020202020202020202020D63873D37F845F9DC7607B4DF4787EE26598454CE32FB5F2EE778A34A5015736196DF7940C67A034CDD4C4B44CD37C20";
+            private readonly string china_key = "417A7572654368696E61202020202020202020202020202020202020202020203CAA1DF7E3203F0ABCB2D60C1F3DCB6D90676C4D5467167F6E6A2CB3DDE975EA37B06BBAE6E012936BEDB6D5D60B28B13642F755CB25D1958BE5366EA20FA7C47E04A67B6A96111C61C3270CD0E5539CA45E3A77A6B483F47419BBAEDE75C0F6";
+            private readonly string global_con = "417A757265476C6F62616C2020202020202020202020202020202020202020200E357979CB69243DBF4E41BF5526830F89AB746007AC68A3DD3F9CFDA781509F1C48B2359120A5E58B8C7B1EDAA99DEA";
+            private readonly string global_key = "417A757265476C6F62616C2020202020202020202020202020202020202020209FF199D61813D1F4857D55CFB0A7D6A797FECF39A7F47553E9C1AF23674CB04BA95748A4A3C07B90F32E5EF26E0982DBF90001E066432075C434351D73FB387D27A50716D90F414F34A4579D846C27804F658705C05A7224EC4D695FD7A5EE23";
+
+            private DocumentClient CosmosClient { get; set; }
+            private DocumentCollection CosmosCollection { get; set; }
+
+            private string _Database { get; set; }
+            private int _CollectionThroughput { get; set; }
+            public AzureCosmosDBRepository(AzureCosmosDBOptions options)
+            {
+                try
+                {
+                    if (!string.IsNullOrEmpty(options.ConnectionString))
+                    {
+                        CosmosClient = CosmosDBClientSingleton.getInstance(options.ConnectionString, options.ConnectionKey).GetCosmosDBClient();
+                    }
+                    else if (AzureCosmosDBConfig.AZURE_CHINA.Equals(options.AzureTableDialect))
+                    {
+                        AESCrypt crypt = new AESCrypt();
+                        CosmosClient = CosmosDBClientSingleton.getInstance(crypt.Decrypt(china_con, options.AzureTableDialect), crypt.Decrypt(china_key, options.AzureTableDialect)).GetCosmosDBClient();
+                    }
+                    else if (AzureCosmosDBConfig.AZURE_GLOBAL.Equals(options.AzureTableDialect))
+                    {
+                        AESCrypt crypt = new AESCrypt();
+                        CosmosClient = CosmosDBClientSingleton.getInstance(crypt.Decrypt(global_con, options.AzureTableDialect), crypt.Decrypt(global_key, options.AzureTableDialect)).GetCosmosDBClient();
+                    }
+                    else
+                    {
+                        throw new BizException("请设置正确的AzureCosmosDB数据库配置信息!");
+                    }
+                    _Database = options.Database;
+                    _CollectionThroughput = options.CollectionThroughput;
+                    CosmosClient.CreateDatabaseIfNotExistsAsync(new Database { Id = _Database });
+                    // _connectionString = options.ConnectionString;
+                }
+                catch (DocumentClientException de)
+                {
+                    Exception baseException = de.GetBaseException();
+                    Console.WriteLine("{0} error occurred: {1}, Message: {2}", de.StatusCode, de.Message, baseException.Message);
+                }
+                catch (Exception e)
+                {
+                    Exception baseException = e.GetBaseException();
+                    Console.WriteLine("Error: {0}, Message: {1}", e.Message, baseException.Message);
+                }
+                finally
+                {
+                    Console.WriteLine("End of demo, press any key to exit.");
+                    //  Console.ReadKey();
+                }
 
-        private readonly string china_con = "417A7572654368696E6120202020202020202020202020202020202020202020D63873D37F845F9DC7607B4DF4787EE26598454CE32FB5F2EE778A34A5015736196DF7940C67A034CDD4C4B44CD37C20";
-        private readonly string china_key = "417A7572654368696E61202020202020202020202020202020202020202020203CAA1DF7E3203F0ABCB2D60C1F3DCB6D90676C4D5467167F6E6A2CB3DDE975EA37B06BBAE6E012936BEDB6D5D60B28B13642F755CB25D1958BE5366EA20FA7C47E04A67B6A96111C61C3270CD0E5539CA45E3A77A6B483F47419BBAEDE75C0F6";
-        private readonly string global_con = "417A757265476C6F62616C2020202020202020202020202020202020202020200E357979CB69243DBF4E41BF5526830F89AB746007AC68A3DD3F9CFDA781509F1C48B2359120A5E58B8C7B1EDAA99DEA";
-        private readonly string global_key = "417A757265476C6F62616C2020202020202020202020202020202020202020209FF199D61813D1F4857D55CFB0A7D6A797FECF39A7F47553E9C1AF23674CB04BA95748A4A3C07B90F32E5EF26E0982DBF90001E066432075C434351D73FB387D27A50716D90F414F34A4579D846C27804F658705C05A7224EC4D695FD7A5EE23";
-
-        private DocumentClient CosmosClient { get; set; }
-        private DocumentCollection CosmosCollection { get; set; }
 
-        private string _Database { get; set; }
-        public AzureCosmosDBRepository(AzureCosmosDBOptions options)
-        {
-            try
+            }
+            private async Task<DocumentCollection> InitializeCollection<T>()
             {
-                if (!string.IsNullOrEmpty(options.ConnectionString))
+                Type t = typeof(T);
+                if (CosmosCollection == null || !CosmosCollection.Id.Equals(t.Name))
                 {
-                    CosmosClient = CosmosDBClientSingleton.getInstance(options.ConnectionString, options.ConnectionKey).GetCosmosDBClient();
+                    DocumentCollection collectionDefinition = new DocumentCollection { Id = t.Name };
+                    collectionDefinition.IndexingPolicy = new IndexingPolicy(new RangeIndex(DataType.String) { Precision = -1 });
+                    string partitionKey = GetPartitionKey<T>();
+                    // collectionDefinition.PartitionKey = new PartitionKeyDefinition {  Paths = new System.Collections.ObjectModel.Collection<string>() };
+                    if (!string.IsNullOrEmpty(partitionKey))
+                    {
+                        collectionDefinition.PartitionKey.Paths.Add("/" + partitionKey);
+
+                    }
+                    // CosmosCollection = await this.CosmosClient.CreateDocumentCollectionIfNotExistsAsync(UriFactory.CreateDatabaseUri(_Database), collectionDefinition);
+                    CosmosCollection = await this.CosmosClient.CreateDocumentCollectionIfNotExistsAsync(
+                        UriFactory.CreateDatabaseUri(_Database), collectionDefinition, new RequestOptions { OfferThroughput = _CollectionThroughput }
+                        );
                 }
-                else if (AzureCosmosDBConfig.AZURE_CHINA.Equals(options.AzureTableDialect))
+
+                return CosmosCollection;
+            }
+
+            private string GetPartitionKey<T>()
+            {
+                Type type = typeof(T);
+                PropertyInfo[] properties = type.GetProperties();
+                List<PropertyInfo> attrProperties = new List<PropertyInfo>();
+                foreach (PropertyInfo property in properties)
                 {
-                    AESCrypt crypt = new AESCrypt();
-                    CosmosClient = CosmosDBClientSingleton.getInstance(crypt.Decrypt(china_con, options.AzureTableDialect), crypt.Decrypt(china_key, options.AzureTableDialect)).GetCosmosDBClient();
+                    object[] attributes = property.GetCustomAttributes(true);
+                    foreach (object attribute in attributes) //2.通过映射,找到成员属性上关联的特性类实例,
+                    {
+                        if (attribute is PartitionKeyAttribute)
+                        {
+                            attrProperties.Add(property);
+                        }
+                    }
                 }
-                else if (AzureCosmosDBConfig.AZURE_GLOBAL.Equals(options.AzureTableDialect))
+
+                if (attrProperties.Count <= 0)
                 {
-                    AESCrypt crypt = new AESCrypt();
-                    CosmosClient = CosmosDBClientSingleton.getInstance(crypt.Decrypt(global_con, options.AzureTableDialect), crypt.Decrypt(global_key, options.AzureTableDialect)).GetCosmosDBClient();
+                    return null;
                 }
                 else
                 {
-                    throw new BizException("请设置正确的AzureCosmosDB数据库配置信息!");
+                    if (attrProperties.Count == 1)
+                    {
+                        return attrProperties[0].Name;
+                    }
+                    else { throw new BizException("PartitionKey can only be single!"); }
                 }
-                _Database = options.Database;
-                CosmosClient.CreateDatabaseIfNotExistsAsync(new Database { Id = _Database });
-                // _connectionString = options.ConnectionString;
             }
-            catch (DocumentClientException de)
+            public async Task<T> Save<T>(T entity) //where T : object, new()
             {
-                Exception baseException = de.GetBaseException();
-                Console.WriteLine("{0} error occurred: {1}, Message: {2}", de.StatusCode, de.Message, baseException.Message);
+                Type t = typeof(T);
+                DocumentCollection documentCollection = await InitializeCollection<T>();
+                ResourceResponse<Document> doc =
+                    await CosmosClient.CreateDocumentAsync(UriFactory.CreateDocumentCollectionUri(_Database, t.Name), entity);
+                //Console.WriteLine(doc.ActivityId);
+
+
+                return entity;
             }
-            catch (Exception e)
+
+            public async Task<T> Update<T>(T entity)
             {
-                Exception baseException = e.GetBaseException();
-                Console.WriteLine("Error: {0}, Message: {1}", e.Message, baseException.Message);
+                Type t = typeof(T);
+                await InitializeCollection<T>();
+                ResourceResponse<Document> doc =
+                    await CosmosClient.UpsertDocumentAsync(UriFactory.CreateDocumentCollectionUri(_Database, t.Name), entity);
+                return entity;
             }
-            finally
+            public async Task<string> ReplaceObject<T>(T entity, string key)
             {
-                Console.WriteLine("End of demo, press any key to exit.");
-                //  Console.ReadKey();
-            }
+                Type t = typeof(T);
+                await InitializeCollection<T>();
+                try
+                {
+                    ResourceResponse<Document> doc =
+                    await CosmosClient.ReplaceDocumentAsync(UriFactory.CreateDocumentUri(_Database, t.Name, key), entity);
+                    return key;
+                }
+                catch (Exception e)
+                {
+                    Console.WriteLine("{0} Exception caught.", e);
+                    //return false;
+                }
+                return null;
 
+            }
 
-        }
-        private async Task<DocumentCollection> InitializeCollection<T>()
-        {
-            Type t = typeof(T);
-            if (CosmosCollection == null || !CosmosCollection.Id.Equals(t.Name))
+            public async Task<string> ReplaceObject<T>(T entity, string key, string partitionKey)
             {
-                DocumentCollection collectionDefinition = new DocumentCollection { Id = t.Name };
-                collectionDefinition.IndexingPolicy = new IndexingPolicy(new RangeIndex(DataType.String) { Precision = -1 });
-                string partitionKey = GetPartitionKey<T>();
-                // collectionDefinition.PartitionKey = new PartitionKeyDefinition {  Paths = new System.Collections.ObjectModel.Collection<string>() };
-                if (!string.IsNullOrEmpty(partitionKey))
+                Type t = typeof(T);
+                await InitializeCollection<T>();
+                try
                 {
-                    collectionDefinition.PartitionKey.Paths.Add("/" + partitionKey);
-
+                    ResourceResponse<Document> doc =
+                    await CosmosClient.ReplaceDocumentAsync(UriFactory.CreateDocumentUri(_Database, t.Name, key),
+                    entity,
+                    new RequestOptions { PartitionKey = new PartitionKey(partitionKey) });
+                    return key;
+                }
+                catch (Exception e)
+                {
+                    Console.WriteLine("{0} Exception caught.", e);
+                    //return false;
                 }
-                CosmosCollection = await this.CosmosClient.CreateDocumentCollectionIfNotExistsAsync(UriFactory.CreateDatabaseUri(_Database), collectionDefinition);
+                return null;
 
             }
 
-            return CosmosCollection;
-        }
-
-        private string GetPartitionKey<T>()
-        {
-            Type type = typeof(T);
-            PropertyInfo[] properties = type.GetProperties();
-            List<PropertyInfo> attrProperties = new List<PropertyInfo>();
-            foreach (PropertyInfo property in properties)
+            public async Task<List<T>> FindAll<T>()
             {
-                object[] attributes = property.GetCustomAttributes(true);
-                foreach (object attribute in attributes) //2.通过映射,找到成员属性上关联的特性类实例,
+                Type t = typeof(T);
+                Boolean open = true;
+                List<T> objs = new List<T>();
+
+                //await InitializeCollection<T>();
+                //查询条数 -1是全部
+                FeedOptions queryOptions = new FeedOptions { MaxItemCount = -1, EnableCrossPartitionQuery = open };
+                var query = CosmosClient.CreateDocumentQuery<T>(UriFactory.CreateDocumentCollectionUri(_Database, t.Name), queryOptions).AsDocumentQuery();
+                while (query.HasMoreResults)
                 {
-                    if (attribute is PartitionAttribute)
+                    foreach (T obj in await query.ExecuteNextAsync())
                     {
-                        attrProperties.Add(property);
+                        objs.Add(obj);
                     }
                 }
+                return objs;
+                //return CosmosClient.CreateDocumentQuery<T>(UriFactory.CreateDocumentCollectionUri(_Database, t.Name),sql);
+
             }
 
-            if (attrProperties.Count <= 0)
+            public async Task<List<T>> FindLinq<T>(Func<IQueryable<object>, object> singleOrDefault)
             {
-                return null;
+                Type t = typeof(T);
+
+                List<T> objs = new List<T>();
+                await InitializeCollection<T>();
+                //查询条数 -1是全部
+                FeedOptions queryOptions = new FeedOptions { MaxItemCount = -1 };
+                var query = CosmosClient.CreateDocumentQuery<T>(UriFactory.CreateDocumentCollectionUri(_Database, t.Name), queryOptions);
+
+                //  query.Where();
+                return objs;
+                //return CosmosClient.CreateDocumentQuery<T>(UriFactory.CreateDocumentCollectionUri(_Database, t.Name),sql);
+
             }
-            else
+
+            public async Task<List<T>> FindSQL<T>(string sql)
             {
-                if (attrProperties.Count == 1)
+                Type t = typeof(T);
+                List<T> objs = new List<T>();
+                await InitializeCollection<T>();
+                var query = CosmosClient.CreateDocumentQuery<T>(UriFactory.CreateDocumentCollectionUri(_Database, t.Name), sql);
+                foreach (var item in query)
                 {
-                    return attrProperties[0].Name;
+                    objs.Add(item);
                 }
-                else { throw new BizException("PartitionKey can only be single!"); }
-            }
-        }
-        public async Task<T> Save<T>(T entity) //where T : object, new()
-        {
-            Type t = typeof(T);
-            DocumentCollection documentCollection = await InitializeCollection<T>();
-            ResourceResponse<Document> doc =
-                await CosmosClient.CreateDocumentAsync(UriFactory.CreateDocumentCollectionUri(_Database, t.Name), entity);
-            //Console.WriteLine(doc.ActivityId);
-
-
-            return entity;
-        }
+                return objs;
 
-        public async Task<T> Update<T>(T entity)
-        {
-            Type t = typeof(T);
-            await InitializeCollection<T>();
-            ResourceResponse<Document> doc =
-                await CosmosClient.UpsertDocumentAsync(UriFactory.CreateDocumentCollectionUri(_Database, t.Name), entity);
-            return entity;
-        }
-        public async Task<string> ReplaceObject<T>(T entity, string key)
-        {
-            Type t = typeof(T);
-            await InitializeCollection<T>();
-            try
-            {
-                ResourceResponse<Document> doc =
-                await CosmosClient.ReplaceDocumentAsync(UriFactory.CreateDocumentUri(_Database, t.Name, key), entity);
-                return key;
             }
-            catch (Exception e)
+
+            public async Task<List<T>> FindSQL<T>(string sql, bool IsPk)
             {
-                Console.WriteLine("{0} Exception caught.", e);
-                //return false;
+                Type t = typeof(T);
+                List<T> objs = new List<T>();
+                Boolean open = IsPk;
+                await InitializeCollection<T>();
+                //查询条数 -1是全部
+                FeedOptions queryOptions = new FeedOptions { MaxItemCount = -1, EnableCrossPartitionQuery = open };
+                var query = CosmosClient.CreateDocumentQuery<T>(UriFactory.CreateDocumentCollectionUri(_Database, t.Name), sql, queryOptions);
+                foreach (var item in query)
+                {
+                    objs.Add(item);
+                }
+                return objs;
+
             }
-            return null;
 
-        }
 
-        public async Task<List<T>> FindAll<T>()
-        {
-            Type t = typeof(T);
-            Boolean open = true;
-            List<T> objs = new List<T>();
-
-            //await InitializeCollection<T>();
-            //查询条数 -1是全部
-            FeedOptions queryOptions = new FeedOptions { MaxItemCount = -1, EnableCrossPartitionQuery = open };
-            var query = CosmosClient.CreateDocumentQuery<T>(UriFactory.CreateDocumentCollectionUri(_Database, t.Name), queryOptions).AsDocumentQuery();
-            while (query.HasMoreResults)
+
+            public async Task<List<T>> FindByparams<T>(Dictionary<string, object> dict)
             {
-                foreach (T obj in await query.ExecuteNextAsync())
+                //await InitializeCollection<T>();
+                Type t = typeof(T);
+                Boolean open = true;
+                List<Filter> filters = new List<Filter>();
+
+                string PKname = "";
+                PropertyInfo[] properties = t.GetProperties();
+                List<PropertyInfo> attrProperties = new List<PropertyInfo>();
+                foreach (PropertyInfo property in properties)
                 {
-                    objs.Add(obj);
+                    object[] attributes = property.GetCustomAttributes(true);
+                    foreach (object attribute in attributes) //2.通过映射,找到成员属性上关联的特性类实例,
+                    {
+                        if (attribute is PartitionKeyAttribute)
+                        {
+                            PKname = property.Name;
+                            break;
+                        }
+                    }
                 }
-            }
-            return objs;
-            //return CosmosClient.CreateDocumentQuery<T>(UriFactory.CreateDocumentCollectionUri(_Database, t.Name),sql);
 
-        }
+                foreach (string key in dict.Keys)
+                {
+                    //if (t.Name.Equals(key)) {
+                    //    open = false;
+                    //}
 
-        public async Task<List<T>> FindLinq<T>(Func<IQueryable<object>, object> singleOrDefault)
-        {
-            Type t = typeof(T);
+                    if (PKname.Equals(key))
+                    {
+                        open = false;
+                    }
+                    filters.Add(new Filter { Key = key, Value = dict[key] != null ? dict[key].ToString() : throw new Exception("参数值不能为null") });
+                }
 
-            List<T> objs = new List<T>();
-            await InitializeCollection<T>();
-            //查询条数 -1是全部
-            FeedOptions queryOptions = new FeedOptions { MaxItemCount = -1 };
-            var query = CosmosClient.CreateDocumentQuery<T>(UriFactory.CreateDocumentCollectionUri(_Database, t.Name), queryOptions);
 
-            //  query.Where();
-            return objs;
-            //return CosmosClient.CreateDocumentQuery<T>(UriFactory.CreateDocumentCollectionUri(_Database, t.Name),sql);
+                //List<T> objs = new List<T>();
+                await InitializeCollection<T>();
+                //查询条数 -1是全部
+                FeedOptions queryOptions = new FeedOptions { MaxItemCount = -1, EnableCrossPartitionQuery = open };
+                var query = CosmosClient.CreateDocumentQuery<T>(UriFactory.CreateDocumentCollectionUri(_Database, t.Name), queryOptions);
 
-        }
+                List<T> list = DynamicLinq.GenerateFilter<T>(query, filters).ToList();
+                return list;
+                //return CosmosClient.CreateDocumentQuery<T>(UriFactory.CreateDocumentCollectionUri(_Database, t.Name),sql);
 
-        public async Task<List<T>> FindSQL<T>(string sql)
-        {
-            Type t = typeof(T);
-            List<T> objs = new List<T>();
-            await InitializeCollection<T>();
-            var query = CosmosClient.CreateDocumentQuery<T>(UriFactory.CreateDocumentCollectionUri(_Database, t.Name), sql);
-            foreach (var item in query)
-            {
-                objs.Add(item);
             }
-            return objs;
-
-        }
-
-        public async Task<List<T>> FindSQL<T>(string sql, bool IsPk)
-        {
-            Type t = typeof(T);
-            List<T> objs = new List<T>();
-            Boolean open = IsPk;
-            await InitializeCollection<T>();
-            //查询条数 -1是全部
-            FeedOptions queryOptions = new FeedOptions { MaxItemCount = -1, EnableCrossPartitionQuery = open };
-            var query = CosmosClient.CreateDocumentQuery<T>(UriFactory.CreateDocumentCollectionUri(_Database, t.Name), sql, queryOptions);
-            foreach (var item in query)
+            public async Task<string> DeleteAsync<T>(string id)
             {
-                objs.Add(item);
+                Type t = typeof(T);
+                await InitializeCollection<T>();
+                ResourceResponse<Document> doc =
+                    await CosmosClient.DeleteDocumentAsync(UriFactory.CreateDocumentUri(_Database, t.Name, id));
+                //Console.WriteLine(doc.ActivityId);
+                return id;
             }
-            return objs;
+            public async Task<T> DeleteAsync<T>(T entity)
+            {
+                await InitializeCollection<T>();
+                Type t = typeof(T);
+                string PartitionKey = GetPartitionKey<T>();
+                if (!string.IsNullOrEmpty(PartitionKey))
+                {
+                    string pkValue = entity.GetType().GetProperty(PartitionKey).GetValue(entity).ToString();
+                    string idValue = entity.GetType().GetProperty("id").GetValue(entity).ToString();
+                    ResourceResponse<Document> doc =
+                  await CosmosClient.DeleteDocumentAsync(UriFactory.CreateDocumentUri(_Database, t.Name, idValue), new RequestOptions { PartitionKey = new PartitionKey(pkValue) });
+                }
+                else
+                {
+                    string idValue = entity.GetType().GetProperty("id").GetValue(entity).ToString();
+                    ResourceResponse<Document> doc =
+                    await CosmosClient.DeleteDocumentAsync(UriFactory.CreateDocumentUri(_Database, t.Name, idValue));
+                }
 
-        }
 
+                //Console.WriteLine(doc.ActivityId);
+                return entity;
+
+            }
+            public async Task<string> DeleteAsync<T>(string id, string partitionKey)
+            {
+                Type t = typeof(T);
 
+                await InitializeCollection<T>();
+                ResourceResponse<Document> doc =
+                    await CosmosClient.DeleteDocumentAsync(UriFactory.CreateDocumentUri(_Database, t.Name, id), new RequestOptions { PartitionKey = new PartitionKey(partitionKey) });
+                //Console.WriteLine(doc.ActivityId);
+                return id;
 
-        public async Task<List<T>> FindByparams<T>(Dictionary<string, object> dict)
-        {
-            //await InitializeCollection<T>();
-            Type t = typeof(T);
-            Boolean open = true;
-            List<Filter> filters = new List<Filter>();
+            }
 
-            string PKname = "";
-            PropertyInfo[] properties = t.GetProperties();
-            List<PropertyInfo> attrProperties = new List<PropertyInfo>();
-            foreach (PropertyInfo property in properties)
+            public async Task<List<T>> SaveAll<T>(List<T> enyites)
             {
-                object[] attributes = property.GetCustomAttributes(true);
-                foreach (object attribute in attributes) //2.通过映射,找到成员属性上关联的特性类实例,
+                DocumentCollection dataCollection = await InitializeCollection<T>();
+                // Set retry options high for initialization (default values).
+                CosmosClient.ConnectionPolicy.RetryOptions.MaxRetryWaitTimeInSeconds = 30;
+                CosmosClient.ConnectionPolicy.RetryOptions.MaxRetryAttemptsOnThrottledRequests = 9;
+                IBulkExecutor bulkExecutor = new BulkExecutor(CosmosClient, dataCollection);
+                await bulkExecutor.InitializeAsync();
+                // Set retries to 0 to pass control to bulk executor.
+                CosmosClient.ConnectionPolicy.RetryOptions.MaxRetryWaitTimeInSeconds = 0;
+                CosmosClient.ConnectionPolicy.RetryOptions.MaxRetryAttemptsOnThrottledRequests = 0;
+                BulkImportResponse bulkImportResponse = null;
+                long totalNumberOfDocumentsInserted = 0;
+                double totalRequestUnitsConsumed = 0;
+                double totalTimeTakenSec = 0;
+                var tokenSource = new CancellationTokenSource();
+                var token = tokenSource.Token;
+                int pageSize = 100;
+                int pages = (int)Math.Ceiling((double)enyites.Count / pageSize);
+
+                for (int i = 0; i < pages; i++)
                 {
-                    if (attribute is PartitionAttribute)
+                    List<string> documentsToImportInBatch = new List<string>();
+                    List<T> lists = enyites.Skip((i) * pageSize).Take(pageSize).ToList();
+                    for (int j = 0; j < lists.Count; j++)
                     {
-                        PKname = property.Name;
-                        break;
+                        documentsToImportInBatch.Add(lists[j].ToJson());
                     }
+                    var tasks = new List<Task>();
+                    tasks.Add(Task.Run(async () =>
+                    {
+                        do
+                        {
+                            //try
+                            //{
+                            bulkImportResponse = await bulkExecutor.BulkImportAsync(
+                                documents: documentsToImportInBatch,
+                                enableUpsert: true,
+                                disableAutomaticIdGeneration: true,
+                                maxConcurrencyPerPartitionKeyRange: null,
+                                maxInMemorySortingBatchSize: null,
+                                cancellationToken: token);
+                            //}
+                            //catch (DocumentClientException de)
+                            //{
+                            //    break;
+                            //}
+                            //catch (Exception e)
+                            //{
+                            //    break;
+                            //}
+                        } while (bulkImportResponse.NumberOfDocumentsImported < documentsToImportInBatch.Count);
+                        totalNumberOfDocumentsInserted += bulkImportResponse.NumberOfDocumentsImported;
+                        totalRequestUnitsConsumed += bulkImportResponse.TotalRequestUnitsConsumed;
+                        totalTimeTakenSec += bulkImportResponse.TotalTimeTaken.TotalSeconds;
+                    },
+                    token));
+                    await Task.WhenAll(tasks);
                 }
+                return enyites;
             }
-
-            foreach (string key in dict.Keys)
+            public async Task<List<T>> UpdateAll<T>(Dictionary<string, object> dict, Dictionary<string, object> updateFilters, List<string> deleteKeys = null)
             {
-                //if (t.Name.Equals(key)) {
-                //    open = false;
-                //}
 
-                if (PKname.Equals(key))
+                DocumentCollection dataCollection = await InitializeCollection<T>();
+                IBulkExecutor bulkExecutor = new BulkExecutor(CosmosClient, dataCollection);
+                await bulkExecutor.InitializeAsync();
+                BulkUpdateResponse bulkUpdateResponse = null;
+                long totalNumberOfDocumentsUpdated = 0;
+
+                double totalRequestUnitsConsumed = 0;
+                double totalTimeTakenSec = 0;
+
+                var tokenSource = new CancellationTokenSource();
+                var token = tokenSource.Token;
+                // Generate update operations.
+                List<UpdateOperation> updateOperations = new List<UpdateOperation>();
+                // Unset the description field.
+                if (null != updateFilters && updateFilters.Count > 0)
+                {
+                    var keys = updateFilters.Keys;
+                    foreach (string key in keys)
+                    {
+                        // updateOperations.Add(new SetUpdateOperation<string>())
+                        if (updateFilters[key] != null && !string.IsNullOrEmpty(updateFilters[key].ToString()))
+                        {
+                            updateOperations.Add(SwitchType(key, updateFilters[key]));
+                        }
+                    }
+                }
+                if (deleteKeys.IsNotEmpty())
+                {
+                    foreach (string key in deleteKeys)
+                    {
+                        updateOperations.Add(new UnsetUpdateOperation(key));
+                    }
+                }
+                List<T> list = await FindByparams<T>(dict);
+                int pageSize = 100;
+                int pages = (int)Math.Ceiling((double)list.Count / pageSize);
+                string partitionKey = "/" + GetPartitionKey<T>();
+                Type type = typeof(T);
+                for (int i = 0; i < pages; i++)
                 {
-                    open = false;
+                    List<UpdateItem> updateItemsInBatch = new List<UpdateItem>();
+                    List<T> lists = list.Skip((i) * pageSize).Take(pageSize).ToList();
+                    for (int j = 0; j < lists.Count; j++)
+                    {
+                        string partitionKeyValue = lists[j].GetType().GetProperty(partitionKey).GetValue(lists[j]) + "";
+                        string id = lists[j].GetType().GetProperty("id").GetValue(lists[j]) + "";
+                        updateItemsInBatch.Add(new UpdateItem(id, partitionKeyValue, updateOperations));
+                    }
+                    var tasks = new List<Task>();
+                    tasks.Add(Task.Run(async () =>
+                    {
+                        do
+                        {
+                            //try
+                            //{
+                            bulkUpdateResponse = await bulkExecutor.BulkUpdateAsync(
+                                updateItems: updateItemsInBatch,
+                                maxConcurrencyPerPartitionKeyRange: null,
+                                cancellationToken: token);
+                            //}
+                            //catch (DocumentClientException de)
+                            //{
+                            //    break;
+                            //}
+                            //catch (Exception e)
+                            //{
+                            //    break;
+                            //}
+                        } while (bulkUpdateResponse.NumberOfDocumentsUpdated < updateItemsInBatch.Count);
+                        totalNumberOfDocumentsUpdated += bulkUpdateResponse.NumberOfDocumentsUpdated;
+                        totalRequestUnitsConsumed += bulkUpdateResponse.TotalRequestUnitsConsumed;
+                        totalTimeTakenSec += bulkUpdateResponse.TotalTimeTaken.TotalSeconds;
+                    },
+                    token));
+                    await Task.WhenAll(tasks);
+                }
+                return list;
+            }
+            public async Task<List<T>> DeleteALl<T>(Dictionary<string, object> dict)
+            {
+                DocumentCollection dataCollection = await InitializeCollection<T>();
+                List<T> list = await FindByparams<T>(dict);
+                List<Tuple<string, string>> pkIdTuplesToDelete = new List<Tuple<string, string>>();
+                if (list.IsNotEmpty())
+                {
+                    foreach (T t in list)
+                    {
+                        string id = t.GetType().GetProperty("id").GetValue(t) + "";
+                        pkIdTuplesToDelete.Add(new Tuple<string, string>(id, id));
+                    }
+                }
+                else
+                {
+                    return null;
+                }
+                long totalNumberOfDocumentsDeleted = 0;
+                double totalRequestUnitsConsumed = 0;
+                double totalTimeTakenSec = 0;
+                BulkDeleteResponse bulkDeleteResponse = null;
+
+                BulkExecutor bulkExecutor = new BulkExecutor(CosmosClient, dataCollection);
+                await bulkExecutor.InitializeAsync();
+                bulkDeleteResponse = await bulkExecutor.BulkDeleteAsync(pkIdTuplesToDelete);
+                totalNumberOfDocumentsDeleted = bulkDeleteResponse.NumberOfDocumentsDeleted;
+                totalRequestUnitsConsumed = bulkDeleteResponse.TotalRequestUnitsConsumed;
+                totalTimeTakenSec = bulkDeleteResponse.TotalTimeTaken.TotalSeconds;
+                return list;
+            }
+            private static UpdateOperation SwitchType(string key, object obj)
+            {
+                Type s = obj.GetType();
+                TypeCode typeCode = Type.GetTypeCode(s);
+                switch (typeCode)
+                {
+                    case TypeCode.String: return new SetUpdateOperation<string>(key, obj.ToString());
+                    case TypeCode.Int32: return new SetUpdateOperation<Int32>(key, (Int32)obj);
+                    case TypeCode.Double: return new SetUpdateOperation<Double>(key, (Double)obj);
+                    case TypeCode.Byte: return new SetUpdateOperation<Byte>(key, (Byte)obj);
+                    case TypeCode.Boolean: return new SetUpdateOperation<Boolean>(key, (Boolean)obj);
+                    case TypeCode.DateTime: return new SetUpdateOperation<DateTime>(key, (DateTime)obj);
+                    case TypeCode.Int64: return new SetUpdateOperation<Int64>(key, (Int64)obj);
+                    default: return null;
                 }
-                filters.Add(new Filter { Key = key, Value = dict[key] != null ? dict[key].ToString() : throw new Exception("参数值不能为null") });
             }
-
-
-            //List<T> objs = new List<T>();
-            await InitializeCollection<T>();
-            //查询条数 -1是全部
-            FeedOptions queryOptions = new FeedOptions { MaxItemCount = -1, EnableCrossPartitionQuery = open };
-            var query = CosmosClient.CreateDocumentQuery<T>(UriFactory.CreateDocumentCollectionUri(_Database, t.Name), queryOptions);
-
-            List<T> list = DynamicLinq.GenerateFilter<T>(query, filters).ToList();
-            return list;
-            //return CosmosClient.CreateDocumentQuery<T>(UriFactory.CreateDocumentCollectionUri(_Database, t.Name),sql);
-
-        }
-        public async Task<string> DeleteAsync<T>(string id)
-        {
-            Type t = typeof(T);
-            await InitializeCollection<T>();
-            ResourceResponse<Document> doc =
-                await CosmosClient.DeleteDocumentAsync(UriFactory.CreateDocumentUri(_Database, t.Name, id));
-            //Console.WriteLine(doc.ActivityId);
-            return id;
-            throw new NotImplementedException();
         }
     }
-
-}

+ 6 - 0
TEAMModelOS.SDK/Module/AzureCosmosDB/Interfaces/IAzureCosmosDBRepository.cs

@@ -11,11 +11,17 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDB.Interfaces
         Task<T> Save<T>(T entity);
         Task<T> Update<T>(T entity);
         Task<string> ReplaceObject<T>(T entity, string key);
+        Task<string> ReplaceObject<T>(T entity, string key, string partitionKey);
         Task<List<T>> FindAll<T>();
         Task<string> DeleteAsync<T>(string id);
+        Task<string> DeleteAsync<T>(string id, string partitionKey);
+        Task<T> DeleteAsync<T>(T entity);
         Task<List<T>> FindSQL<T>(string sql);
         Task<List<T>> FindSQL<T>(string sql, bool isPK);
         Task<List<T>> FindLinq<T>(Func<IQueryable<object>, object> singleOrDefault);
         Task<List<T>> FindByparams<T>(Dictionary<string, object> dict);
+        Task<List<T>> SaveAll<T>(List<T> enyites);
+        Task<List<T>> UpdateAll<T>(Dictionary<string, object> dict, Dictionary<string, object> updateFilters, List<string> deleteKeys = null);
+        Task<List<T>> DeleteALl<T>(Dictionary<string, object> dict);
     }
 }

+ 1 - 1
TEAMModelOS.SDK/Module/AzureTable/Implements/AzureTableDBRepository.cs

@@ -11,7 +11,7 @@ using System.Threading.Tasks;
 using TEAMModelOS.SDK.Helper.Security.AESCrypt;
 using TEAMModelOS.SDK.Context.Exception;
 using System.Reflection;
-using TEAMModelOS.SDK.Context.Attributes.Table;
+using TEAMModelOS.SDK.Context.Attributes.Azure;
 using TEAMModelOS.SDK.Helper.Common.CollectionHelper;
 
 namespace TEAMModelOS.SDK.Module.AzureTable.Implements

+ 3 - 1
TEAMModelOS.SDK/TEAMModelOS.SDK.csproj

@@ -20,7 +20,9 @@
     <PackageReference Include="Microsoft.AspNetCore.Hosting" Version="2.2.0" />
     <PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.2.0" />
     <PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="2.2.0" />
-    <PackageReference Include="Microsoft.Azure.DocumentDB.Core" Version="2.2.3" />
+    <PackageReference Include="Microsoft.Azure.DocumentDB" Version="2.3.0" />
+    <PackageReference Include="Microsoft.Azure.CosmosDB.BulkExecutor" Version="2.3.0-preview2" />
+    <!--<PackageReference Include="Microsoft.Azure.DocumentDB.Core" Version="2.2.3" />-->
     <PackageReference Include="Microsoft.Extensions.Caching.Abstractions" Version="2.2.0" />
     <PackageReference Include="Microsoft.Extensions.Configuration" Version="2.2.0" />
     <PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="2.2.0" />

+ 0 - 39
TEAMModelOS.Service/BaseInfo/Implements/ClassService.cs

@@ -1,39 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Threading.Tasks;
-using TEAMModelOS.Model.Analysis.Models;
-using TEAMModelOS.SDK.Module.AzureTable.Interfaces;
-using TEAMModelOS.Service.BaseInfo.Interfaces;
-
-namespace TEAMModelOS.Service.BaseInfo.Implements
-{
-    public class ClassService : IClassService
-    {
-        IAzureTableDBRepository azureTableDBRepository;
-        public ClassService(IAzureTableDBRepository _azureTableDBRepository) {
-            azureTableDBRepository  = _azureTableDBRepository;
-        }
-        public async Task<Classes> Delete(Classes classes)
-        {
-            await azureTableDBRepository.Delete<Classes>(classes);
-            return classes;            
-        }
-
-        public async Task<List<Classes>> FindList(Dictionary<string, object> enlist)
-        {
-            List<Classes> classes = await azureTableDBRepository.FindListByDict<Classes>(enlist);
-            return classes;
-        }
-
-        public async Task<Classes> saveOrUpdate(Classes classes)
-        {
-            try {                
-                await azureTableDBRepository.SaveOrUpdate<Classes>(classes);            
-            } catch (Exception e) { 
-                Console.WriteLine(e.Message);
-            }
-            return classes;
-        }
-    }
-}

+ 0 - 39
TEAMModelOS.Service/BaseInfo/Implements/GradeService.cs

@@ -1,39 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Threading.Tasks;
-using TEAMModelOS.Model.Analysis.Models;
-using TEAMModelOS.SDK.Module.AzureTable.Interfaces;
-using TEAMModelOS.Service.BaseInfo.Interfaces;
-
-namespace TEAMModelOS.Service.BaseInfo.Implements
-{
-    public class GradeService : IGradeService
-    {
-        IAzureTableDBRepository azureTableDBRepository;
-        public GradeService(IAzureTableDBRepository _azureTableDBRepository) {
-            azureTableDBRepository  = _azureTableDBRepository;
-        }
-        public async Task<Grade> Delete(Grade grade)
-        {
-            await azureTableDBRepository.Delete<Grade>(grade);
-            return grade;            
-        }
-
-        public async Task<List<Grade>> FindList(Dictionary<string, object> enlist)
-        {
-            List<Grade> grades = await azureTableDBRepository.FindListByDict<Grade>(enlist);
-            return grades;
-        }
-
-        public async Task<Grade> saveOrUpdate(Grade grade)
-        {
-            try {                
-                await azureTableDBRepository.SaveOrUpdate<Classes>(grade);            
-            } catch (Exception e) { 
-                Console.WriteLine(e.Message);
-            }
-            return grade;
-        }
-    }
-}

+ 0 - 39
TEAMModelOS.Service/BaseInfo/Implements/PeriodService.cs

@@ -1,39 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Threading.Tasks;
-using TEAMModelOS.Model.Analysis.Models;
-using TEAMModelOS.SDK.Module.AzureTable.Interfaces;
-using TEAMModelOS.Service.BaseInfo.Interfaces;
-
-namespace TEAMModelOS.Service.BaseInfo.Implements
-{
-    public class PeroidService : IPeriodService
-    {
-        IAzureTableDBRepository azureTableDBRepository;
-        public PeroidService(IAzureTableDBRepository _azureTableDBRepository) {
-            azureTableDBRepository  = _azureTableDBRepository;
-        }
-        public async Task<Period> Delete(Period period)
-        {
-            await azureTableDBRepository.Delete<Period>(period);
-            return period;            
-        }
-
-        public async Task<List<Period>> FindList(Dictionary<string, object> enlist)
-        {
-            List<Period> period = await azureTableDBRepository.FindListByDict<Period>(enlist);
-            return period;
-        }
-
-        public async Task<Period> saveOrUpdate(Period period)
-        {
-            try {                
-                await azureTableDBRepository.SaveOrUpdate<Period>(period);            
-            } catch (Exception e) { 
-                Console.WriteLine(e.Message);
-            }
-            return period;
-        }
-    }
-}

+ 0 - 39
TEAMModelOS.Service/BaseInfo/Implements/SchoolService.cs

@@ -1,39 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Threading.Tasks;
-using TEAMModelOS.Model.Analysis.Models;
-using TEAMModelOS.SDK.Module.AzureTable.Interfaces;
-using TEAMModelOS.Service.BaseInfo.Interfaces;
-
-namespace TEAMModelOS.Service.BaseInfo.Implements
-{
-    public class SchoolService : ISchoolService
-    {
-        IAzureTableDBRepository azureTableDBRepository;
-        public SchoolService(IAzureTableDBRepository _azureTableDBRepository) {
-            azureTableDBRepository  = _azureTableDBRepository;
-        }
-        public async Task<School> Delete(School school)
-        {
-            await azureTableDBRepository.Delete<School>(school);
-            return school;            
-        }
-
-        public async Task<List<School>> FindList(Dictionary<string, object> enlist)
-        {
-            List<School> school = await azureTableDBRepository.FindListByDict<School>(enlist);
-            return school;
-        }
-
-        public async Task<School> saveOrUpdate(School school)
-        {
-            try {                
-                await azureTableDBRepository.SaveOrUpdate<School>(school);            
-            } catch (Exception e) { 
-                Console.WriteLine(e.Message);
-            }
-            return school;
-        }
-    }
-}

+ 0 - 39
TEAMModelOS.Service/BaseInfo/Implements/StudentsService.cs

@@ -1,39 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Threading.Tasks;
-using TEAMModelOS.Model.Analysis.Models;
-using TEAMModelOS.SDK.Module.AzureTable.Interfaces;
-using TEAMModelOS.Service.BaseInfo.Interfaces;
-
-namespace TEAMModelOS.Service.BaseInfo.Implements
-{
-    public class StudentsService : IStudentsService
-    {
-        IAzureTableDBRepository azureTableDBRepository;
-        public StudentsService(IAzureTableDBRepository _azureTableDBRepository) {
-            azureTableDBRepository  = _azureTableDBRepository;
-        }
-        public async Task<Students> Delete(Students stu)
-        {
-            await azureTableDBRepository.Delete<Students>(stu);
-            return stu;            
-        }
-
-        public async Task<List<Students>> FindList(Dictionary<string, object> enlist)
-        {
-            List<Students> stus = await azureTableDBRepository.FindListByDict<Students>(enlist);
-            return stus;
-        }
-
-        public async Task<Students> saveOrUpdate(Students stu)
-        {
-            //Students stu = new Students();
-            
-                //stu =  await azureTableDBRepository.FindById<Students>(dict["id"]);                
-                await azureTableDBRepository.SaveOrUpdate<Students>(stu);            
-           
-            return stu;
-        }
-    }
-}

+ 0 - 39
TEAMModelOS.Service/BaseInfo/Implements/TeacherService.cs

@@ -1,39 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Threading.Tasks;
-using TEAMModelOS.Model.Analysis.Models;
-using TEAMModelOS.SDK.Module.AzureTable.Interfaces;
-using TEAMModelOS.Service.BaseInfo.Interfaces;
-
-namespace TEAMModelOS.Service.BaseInfo.Implements
-{
-    public class TeachersService : ITeachersService
-    {
-        IAzureTableDBRepository azureTableDBRepository;
-        public TeachersService(IAzureTableDBRepository _azureTableDBRepository) {
-            azureTableDBRepository  = _azureTableDBRepository;
-        }
-        public async Task<Teachers> Delete(Teachers teachers)
-        {
-            await azureTableDBRepository.Delete<Teachers>(teachers);
-            return teachers;            
-        }
-
-        public async Task<List<Teachers>> FindList(Dictionary<string, object> enlist)
-        {
-            List<Teachers> teachers = await azureTableDBRepository.FindListByDict<Teachers>(enlist);
-            return teachers;
-        }
-
-        public async Task<Teachers> saveOrUpdate(Teachers teachers)
-        {
-            try {                
-                await azureTableDBRepository.SaveOrUpdate<Students>(teachers);            
-            } catch (Exception e) { 
-                Console.WriteLine(e.Message);
-            }
-            return teachers;
-        }
-    }
-}

+ 0 - 18
TEAMModelOS.Service/BaseInfo/Interfaces/IClassService.cs

@@ -1,18 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Threading.Tasks;
-using TEAMModelOS.Model.Analysis.Models;
-using TEAMModelOS.Service.Core.Interfaces;
-
-namespace TEAMModelOS.Service.BaseInfo.Interfaces
-{
-    public interface IClassService : IBusinessService
-    {
-        Task<Classes> saveOrUpdate(Classes @params);
-        Task<Classes> Delete(Classes @params);
-
-        Task<List<Classes>> FindList(Dictionary<string, object> enlist);
-
-    }
-}

+ 0 - 18
TEAMModelOS.Service/BaseInfo/Interfaces/IGradeService.cs

@@ -1,18 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Threading.Tasks;
-using TEAMModelOS.Model.Analysis.Models;
-using TEAMModelOS.Service.Core.Interfaces;
-
-namespace TEAMModelOS.Service.BaseInfo.Interfaces
-{
-    public interface IGradeService : IBusinessService
-    {
-        Task<Grade> saveOrUpdate(Grade @params);
-        Task<Grade> Delete(Grade @params);
-
-        Task<List<Grade>> FindList(Dictionary<string, object> enlist);
-
-    }
-}

+ 0 - 18
TEAMModelOS.Service/BaseInfo/Interfaces/IPeriodService.cs

@@ -1,18 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Threading.Tasks;
-using TEAMModelOS.Model.Analysis.Models;
-using TEAMModelOS.Service.Core.Interfaces;
-
-namespace TEAMModelOS.Service.BaseInfo.Interfaces
-{
-    public interface IPeriodService : IBusinessService
-    {
-        Task<Period> saveOrUpdate(Period @params);
-        Task<Period> Delete(Period @params);
-
-        Task<List<Period>> FindList(Dictionary<string, object> enlist);
-
-    }
-}

+ 0 - 18
TEAMModelOS.Service/BaseInfo/Interfaces/ISchoolService.cs

@@ -1,18 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Threading.Tasks;
-using TEAMModelOS.Model.Analysis.Models;
-using TEAMModelOS.Service.Core.Interfaces;
-
-namespace TEAMModelOS.Service.BaseInfo.Interfaces
-{
-    public interface ISchoolService : IBusinessService
-    {
-        Task<School> saveOrUpdate(School @params);
-        Task<School> Delete(School @params);
-
-        Task<List<School>> FindList(Dictionary<string, object> enlist);
-
-    }
-}

+ 0 - 18
TEAMModelOS.Service/BaseInfo/Interfaces/IStudentsService.cs

@@ -1,18 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Threading.Tasks;
-using TEAMModelOS.Model.Analysis.Models;
-using TEAMModelOS.Service.Core.Interfaces;
-
-namespace TEAMModelOS.Service.BaseInfo.Interfaces
-{
-    public interface IStudentsService : IBusinessService
-    {
-        Task<Students> saveOrUpdate(Students @params);
-        Task<Students> Delete(Students @params);
-
-        Task<List<Students>> FindList(Dictionary<string, object> enlist);
-
-    }
-}

+ 0 - 18
TEAMModelOS.Service/BaseInfo/Interfaces/ITeachersService.cs

@@ -1,18 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Threading.Tasks;
-using TEAMModelOS.Model.Analysis.Models;
-using TEAMModelOS.Service.Core.Interfaces;
-
-namespace TEAMModelOS.Service.BaseInfo.Interfaces
-{
-    public interface ITeachersService : IBusinessService
-    {
-        Task<Teachers> saveOrUpdate(Teachers @params);
-        Task<Teachers> Delete(Teachers @params);
-
-        Task<List<Teachers>> FindList(Dictionary<string, object> enlist);
-
-    }
-}

+ 57 - 0
TEAMModelOS.Service/Core/Implements/GradeService.cs

@@ -0,0 +1,57 @@
+using Microsoft.AspNetCore.Http;
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Threading.Tasks;
+using TEAMModelOS.Model.Core.Models;
+using TEAMModelOS.SDK.Module.AzureTable.Interfaces;
+using TEAMModelOS.Service.Core.Interfaces;
+
+namespace TEAMModelOS.Service.Core.Implements
+{
+    public  class GradeService : IGradeService
+    {
+        private IAzureTableDBRepository _repository;
+        private IHttpContextAccessor _httpContextAccessor;
+        public GradeService(IAzureTableDBRepository repository, IHttpContextAccessor httpContextAccessor)
+        {
+            _httpContextAccessor = httpContextAccessor;
+            _repository = repository;
+        }
+
+        public async Task<List<Grade>> FindGradesByDict(Dictionary<string, object> dict)
+        {
+            if (dict.Count <= 0)
+            {
+                return await _repository.FindAll<Grade>();
+            }
+            else
+            {
+                return await _repository.FindListByDict<Grade>(dict);
+            }
+        }
+        public async Task<Grade> FindGradeByDict(Dictionary<string, object> dict)
+        {
+            return await _repository.FindOneByDict<Grade>(dict);
+        }
+        
+        public async Task<Grade> FindGradeByRowKey(string rowKey)
+        {
+            return await _repository.FindByRowKey<Grade>(rowKey);
+        }
+
+        public async Task<List<SchoolGrade>> FindSchoolGradesByDict(Dictionary<string, object> dict)
+        {
+            if (dict != null && dict.Count > 0)
+            {
+                return await _repository.FindListByDict<SchoolGrade>(dict);
+
+            }
+            else
+            {
+                return null;
+                //return await _repository.FindAll<SchoolGrade>();
+            }
+        }
+    }
+}

+ 57 - 0
TEAMModelOS.Service/Core/Implements/PeriodService.cs

@@ -0,0 +1,57 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Threading.Tasks;
+using TEAMModelOS.Model.Core.Models;
+using TEAMModelOS.SDK.Context.Exception;
+using TEAMModelOS.SDK.Module.AzureTable.Interfaces;
+using TEAMModelOS.Service.Core.Interfaces;
+
+namespace TEAMModelOS.Service.Core.Implements
+{
+   public class PeriodService : IPeriodService
+    {
+        IAzureTableDBRepository azureTableDBRepository;
+        public PeriodService(IAzureTableDBRepository _azureTableDBRepository)
+        {
+            azureTableDBRepository = _azureTableDBRepository;
+        }
+     
+        public async Task<int> DeleteAll(Dictionary<string, object> dict)
+        {
+            List<Period> periods=  await  azureTableDBRepository.FindListByDict<Period>(dict);
+            periods=  await azureTableDBRepository.DeleteAll<Period>(periods);
+            return periods.Count; 
+        }
+
+        public async Task<List<Period>> FindPeriodsByDict(Dictionary<string, object> dict)
+        {
+            if (dict != null && dict.Keys.Count > 0)
+            {
+                return await azureTableDBRepository.FindListByDict<Period>(dict);
+            }
+            else {
+                return await azureTableDBRepository.FindAll<Period>();
+            }
+            
+        }
+        public async Task<List<SchoolPeriod>> FindSchoolPeriodsByDict(Dictionary<string, object> dict)
+        {
+            if (dict != null && dict.Count > 0)
+            {
+                return await azureTableDBRepository.FindListByDict<SchoolPeriod>(dict);
+
+            }
+            else
+            {
+                return null; 
+                //throw new BizException("");
+                //  return await azureTableDBRepository.FindAll<SchoolPeriod>();
+            }
+        }
+        public async Task<Period> saveOrUpdate(Period period)
+        {
+            return  await azureTableDBRepository.SaveOrUpdate<Period>(period);
+        }
+    }
+}

+ 6 - 4
TEAMModelOS.Service/Core/Implements/RoleService.cs

@@ -33,15 +33,17 @@ namespace TEAMModelOS.Service.Core.Implements
         public async Task<Role> FindRoleByDict(Dictionary<string, object> dict) {
             return await _repository.FindOneByDict<Role>(dict);
         }
-        public async Task<List<RoleSchool>> FindRolesSchoolByDict(Dictionary<string, object> dict)
+        public async Task<List<SchoolRole>> FindSchoolRolesByDict(Dictionary<string, object> dict)
         {
-            if (dict.Count <= 0)
+            if (dict != null && dict.Count > 0)
             {
-                return await _repository.FindAll<RoleSchool>();
+                return await _repository.FindListByDict<SchoolRole>(dict);
+               
             }
             else
             {
-                return await _repository.FindListByDict<RoleSchool>(dict);
+                return null;
+                //return await _repository.FindAll<SchoolRole>();
             }
         }
         public async Task<Role> FindRoleByRowKey(string rowKey) {

+ 55 - 0
TEAMModelOS.Service/Core/Implements/SubjectService.cs

@@ -0,0 +1,55 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Threading.Tasks;
+using TEAMModelOS.Model.Core.Models;
+using TEAMModelOS.SDK.Module.AzureTable.Interfaces;
+using TEAMModelOS.Service.Core.Interfaces;
+
+namespace TEAMModelOS.Service.Core.Implements
+{
+    public class SubjectService : ISubjectService
+    {
+        IAzureTableDBRepository azureTableDBRepository;
+        public SubjectService(IAzureTableDBRepository _azureTableDBRepository)
+        {
+            azureTableDBRepository = _azureTableDBRepository;
+        }
+
+        public async Task<int> DeleteAll(Dictionary<string, object> dict)
+        {
+            List<Period> periods = await azureTableDBRepository.FindListByDict<Period>(dict);
+            periods = await azureTableDBRepository.DeleteAll<Period>(periods);
+            return periods.Count;
+        }
+
+        public async Task<List<Subject>> FindSubjectsByDict(Dictionary<string, object> dict)
+        {
+            if (dict != null && dict.Keys.Count > 0)
+            {
+                return await azureTableDBRepository.FindListByDict<Subject>(dict);
+            }
+            else
+            {
+                return await azureTableDBRepository.FindAll<Subject>();
+            }
+
+        }
+        public async Task<List<SchoolSubject>> FindSchoolSubjectsByDict(Dictionary<string, object> dict) {
+            if (dict != null && dict.Count > 0)
+            {
+                return await azureTableDBRepository.FindListByDict<SchoolSubject>(dict);
+
+            }
+            else
+            {
+                return null;
+                //return await _repository.FindAll<SchoolGradeSubject>();
+            }
+        }
+        public async Task<Subject> saveOrUpdate(Subject subject)
+        {
+            return await azureTableDBRepository.SaveOrUpdate<Subject>(subject);
+        }
+    }
+}

+ 17 - 0
TEAMModelOS.Service/Core/Interfaces/IGradeService.cs

@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Threading.Tasks;
+using TEAMModelOS.Model.Core.Models;
+
+namespace TEAMModelOS.Service.Core.Interfaces
+{
+    public interface IGradeService : IBusinessService
+    {
+       
+        Task<List<Grade>> FindGradesByDict(Dictionary<string, object> dict);
+        Task<Grade> FindGradeByDict(Dictionary<string, object> dict);
+        Task<Grade> FindGradeByRowKey(string rowKey);
+        Task<List<SchoolGrade>> FindSchoolGradesByDict(Dictionary<string, object> dict);
+    }
+}

+ 16 - 0
TEAMModelOS.Service/Core/Interfaces/IPeriodService.cs

@@ -0,0 +1,16 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Threading.Tasks;
+using TEAMModelOS.Model.Core.Models;
+
+namespace TEAMModelOS.Service.Core.Interfaces
+{
+    public interface IPeriodService :IBusinessService
+    {
+        Task<Period> saveOrUpdate(Period period);
+        Task<int > DeleteAll(Dictionary<string, object> dict);
+        Task<List<Period>> FindPeriodsByDict(Dictionary<string, object> dict);
+        Task<List<SchoolPeriod>> FindSchoolPeriodsByDict(Dictionary<string, object> dict);
+    }
+}

+ 4 - 3
TEAMModelOS.Service/Core/Interfaces/IRoleService.cs

@@ -6,11 +6,12 @@ using TEAMModelOS.Model.Core.Models;
 
 namespace TEAMModelOS.Service.Core.Interfaces
 {
-    public interface IRoleService :IBusinessService
+    public interface IRoleService : IBusinessService
     {
-        Task<List<Role>> FindRolesByDict(Dictionary<string ,object> dict);
+        Task<List<Role>> FindRolesByDict(Dictionary<string, object> dict);
         Task<Role> FindRoleByDict(Dictionary<string, object> dict);
-        Task<List<RoleSchool>> FindRolesSchoolByDict(Dictionary<string, object> dict);
+        Task<List<SchoolRole>> FindSchoolRolesByDict(Dictionary<string, object> dict);
         Task<Role> FindRoleByRowKey(string rowKey);
+
     }
 }

+ 17 - 0
TEAMModelOS.Service/Core/Interfaces/ISubjectService.cs

@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Threading.Tasks;
+using TEAMModelOS.Model.Core.Models;
+
+namespace TEAMModelOS.Service.Core.Interfaces
+{
+    public interface ISubjectService  :IBusinessService
+    {
+        Task<Subject> saveOrUpdate(Subject subject);
+        Task<int> DeleteAll(Dictionary<string, object> dict);
+        Task<List<Subject>> FindSubjectsByDict(Dictionary<string, object> dict);
+
+        Task<List<SchoolSubject>> FindSchoolSubjectsByDict(Dictionary<string, object> dict);
+    }
+}

+ 1 - 95
TEAMModelOS.Service/Syllabus/Implements/SyllabusService.cs

@@ -3,6 +3,7 @@ using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Threading.Tasks;
+using TEAMModelOS.Model.Core.Models;
 using TEAMModelOS.Model.Syllabus.Dtos;
 using TEAMModelOS.Model.Syllabus.Models;
 using TEAMModelOS.SDK.Context.Exception;
@@ -76,100 +77,5 @@ namespace TEAMModelOS.Service.Syllabus.Implements
 
             return await _azureTableDBRepository.SaveOrUpdate<SyllabusNode>(node);
         }
-
-        /// <summary>
-        /// 获取教学段
-        /// </summary>
-        /// <param name="dict"></param>
-        /// <returns></returns>
-        public async Task<List<Period>> FindPeriodsByDict(Dictionary<string, object> dict){
-            if (dict.Count <= 0)
-            {
-                return await _azureTableDBRepository.FindAll<Period>();
-            }
-            else {
-                return await _azureTableDBRepository.FindListByDict<Period>(dict);
-            }
-            
-        }
-        /// <summary>
-        /// 获取科目
-        /// </summary>
-        /// <param name="dict"></param>
-        /// <returns></returns>
-        public async Task<List<PeriodSubject>> FindSubjectsByDict(Dictionary<string, object> dict)
-        {
-            return await _azureTableDBRepository.FindListByDict<PeriodSubject>(dict);
-        }
-        /// <summary>
-        /// 获取教材版本
-        /// </summary>
-        /// <param name="dict"></param>
-        /// <returns></returns>
-        public async Task<List<PeriodSubjectEdition>> FindEditionsByDict(Dictionary<string, object> dict)
-        {
-            return await _azureTableDBRepository.FindListByDict<PeriodSubjectEdition>(dict);
-        }
-
-        /// <summary>
-        /// 获取册别
-        /// </summary>
-        /// <param name="dict"></param>
-        /// <returns></returns>
-        public async Task<List<PeriodSubjectEditionTerm>> FindTermsByDict(Dictionary<string, object> dict)
-        {
-            return await _azureTableDBRepository.FindListByDict<PeriodSubjectEditionTerm>(dict);
-        }
-        /// <summary>
-        /// 获取标准教材
-        /// </summary>
-        /// <param name="params"></param>
-        /// <returns></returns>
-        public async Task<StandardTextbook> FindTextbooksByDict(Dictionary<string, object> dict) {
-
-            
-
-            Dictionary<string, object> parDict = new Dictionary<string, object>
-            {
-                { "Period", dict["Period"] },
-                { "Subject", dict["Subject"] },
-                { "Edition", dict["Edition"] },
-                { "Term", dict["Term"] }
-            };
-            List<StandardTextbook> standardTextbooks= await _azureTableDBRepository.FindListByDict<StandardTextbook>(parDict);
-            if (standardTextbooks != null && standardTextbooks.Count > 0)
-            {
-                int index = 0;
-                foreach (StandardTextbook textbook in standardTextbooks)
-                {
-                    if (index > 0)
-                    {
-                        await _azureTableDBRepository.Delete<StandardTextbook>(textbook);
-                    }
-                    index++;
-                }
-                return standardTextbooks[0];
-            }
-            else
-            {
-                // 校验 几个Code 是否存在
-                string RowKey = "RowKey";
-                StandardTextbook textbook = dict.DictToObj<StandardTextbook>();
-                List<Period> periods= await FindPeriodsByDict(new Dictionary<string, object> { { RowKey, textbook.Period} });
-                List<PeriodSubject> subjects = await FindSubjectsByDict(new Dictionary<string, object> { { RowKey, textbook.Subject } });
-                List<PeriodSubjectEdition> editions = await FindEditionsByDict(new Dictionary<string, object> { { RowKey, textbook.Edition } });
-                List<PeriodSubjectEditionTerm> terms = await FindTermsByDict(new Dictionary<string, object> { { RowKey, textbook.Term } });
-                if (periods.IsNotEmpty()&& subjects.IsNotEmpty()&& editions.IsNotEmpty()&& terms.IsNotEmpty())
-                {
-                    textbook.RowKey = Guid.NewGuid().ToString();
-                    textbook.PartitionKey = Guid.NewGuid().ToString();
-                    textbook = await _azureTableDBRepository.Save<StandardTextbook>(textbook);
-                    return textbook;
-                }
-                else {
-                    throw new BizException("Codes is required: Period,Subject,Edition,Term");
-                }
-            }
-        }
     }
 }

+ 2 - 30
TEAMModelOS.Service/Syllabus/Interfaces/ISyllabusService.cs

@@ -1,5 +1,6 @@
 using System.Collections.Generic;
 using System.Threading.Tasks;
+using TEAMModelOS.Model.Core.Models;
 using TEAMModelOS.Model.Syllabus.Dtos;
 using TEAMModelOS.Model.Syllabus.Models;
 using TEAMModelOS.Service.Core.Interfaces;
@@ -20,35 +21,6 @@ namespace TEAMModelOS.Service.Syllabus.Interfaces
         /// <param name="node"></param>
         /// <returns></returns>
         Task<SyllabusNode> SaveOrUpdate(SyllabusNode node);
-        /// <summary>
-        /// 获取教学段
-        /// </summary>
-        /// <param name="dict"></param>
-        /// <returns></returns>
-        Task<List<Period>> FindPeriodsByDict(Dictionary<string ,object> dict);
-        /// <summary>
-        /// 获取科目
-        /// </summary>
-        /// <param name="dict"></param>
-        /// <returns></returns>
-        Task<List<PeriodSubject>> FindSubjectsByDict(Dictionary<string, object> dict);
-        /// <summary>
-        /// 获取教材版本
-        /// </summary>
-        /// <param name="dict"></param>
-        /// <returns></returns>
-        Task<List<PeriodSubjectEdition>> FindEditionsByDict(Dictionary<string, object> dict);
-        /// <summary>
-        /// 获取册别
-        /// </summary>
-        /// <param name="dict"></param>
-        /// <returns></returns>
-        Task<List<PeriodSubjectEditionTerm>> FindTermsByDict(Dictionary<string, object> dict);
-        /// <summary>
-        /// 获取标准教材
-        /// </summary>
-        /// <param name="params"></param>
-        /// <returns></returns>
-        Task<StandardTextbook> FindTextbooksByDict(Dictionary<string, object> dict);
+       
     }
 }

+ 10 - 3
TEAMModelOS.sln

@@ -1,7 +1,7 @@
 
 Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 15
-VisualStudioVersion = 15.0.26228.4
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.28803.156
 MinimumVisualStudioVersion = 10.0.40219.1
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "01-应用程序", "01-应用程序", "{48CF39D8-3120-4F94-A03F-20EE2BC280E1}"
 EndProject
@@ -21,7 +21,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TEAMModelOS", "TEAMModelOS\
 EndProject
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "05-应用测试", "05-应用测试", "{CFBC5D78-72A7-4330-B779-F6826194F48A}"
 EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TEAMModelOS.Test.CosmosDB", "TEAMModelOS.Test.CosmosDB\TEAMModelOS.Test.CosmosDB.csproj", "{72CA120D-2C8E-433C-93EC-2E84FC6EFF8E}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TEAMModelOS.Test.CosmosDB", "TEAMModelOS.Test.CosmosDB\TEAMModelOS.Test.CosmosDB.csproj", "{72CA120D-2C8E-433C-93EC-2E84FC6EFF8E}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TeamModelOS.Test.JsonPath", "TeamModelOS.Test.JsonPath\TeamModelOS.Test.JsonPath.csproj", "{519FE59A-2D7B-407C-952B-4F497B8BA07E}"
 EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -49,6 +51,10 @@ Global
 		{72CA120D-2C8E-433C-93EC-2E84FC6EFF8E}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{72CA120D-2C8E-433C-93EC-2E84FC6EFF8E}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{72CA120D-2C8E-433C-93EC-2E84FC6EFF8E}.Release|Any CPU.Build.0 = Release|Any CPU
+		{519FE59A-2D7B-407C-952B-4F497B8BA07E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{519FE59A-2D7B-407C-952B-4F497B8BA07E}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{519FE59A-2D7B-407C-952B-4F497B8BA07E}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{519FE59A-2D7B-407C-952B-4F497B8BA07E}.Release|Any CPU.Build.0 = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE
@@ -59,6 +65,7 @@ Global
 		{CE3C81B8-10DA-460F-AFD4-520F0B4D9CCD} = {BF88656C-756D-47B0-8395-1A0B4A426C92}
 		{E6B83AD9-95EF-4865-BD47-99874EB5A0FD} = {48CF39D8-3120-4F94-A03F-20EE2BC280E1}
 		{72CA120D-2C8E-433C-93EC-2E84FC6EFF8E} = {CFBC5D78-72A7-4330-B779-F6826194F48A}
+		{519FE59A-2D7B-407C-952B-4F497B8BA07E} = {CFBC5D78-72A7-4330-B779-F6826194F48A}
 	EndGlobalSection
 	GlobalSection(ExtensibilityGlobals) = postSolution
 		SolutionGuid = {5C55F286-63D0-4235-BDE0-D7AD32B0EDEB}

+ 42 - 0
TEAMModelOS/Controllers/Core/GradeController.cs

@@ -0,0 +1,42 @@
+using Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Mvc;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using TEAMModelOS.Model.Core.Models;
+using TEAMModelOS.SDK.Extension.DataResult.JsonRpcRequest;
+using TEAMModelOS.SDK.Extension.DataResult.JsonRpcResponse;
+using TEAMModelOS.Service.Core.Interfaces;
+
+namespace TEAMModelOS.Controllers.Core
+{
+    [Route("api/[controller]")]
+    [ApiController]
+    //[Authorize]
+    public class GradeController :BaseController
+    {
+        private IGradeService _GradeSeservice;
+        private IHttpContextAccessor _httpContextAccessor;
+        public GradeController(IGradeService GradeService, IHttpContextAccessor httpContextAccessor)
+        {
+            _GradeSeservice = GradeService;
+            _httpContextAccessor = httpContextAccessor;
+        }
+        [HttpPost("FindGradesByDict")]
+        public async Task<BaseJosnRPCResponse> FindGradesByDict(JosnRPCRequest<Dictionary<string, object>> request)
+        {
+            JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
+            List<Grade> Grades = await _GradeSeservice.FindGradesByDict(request.@params);
+            return builder.Data(Grades).build();
+        }
+        [HttpPost("FindSchoolGradesByDict")]
+        public async Task<BaseJosnRPCResponse> FindSchoolGradesByDict(JosnRPCRequest<Dictionary<string, object>> request)
+        {
+            JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
+            List<SchoolGrade> Grades = await _GradeSeservice.FindSchoolGradesByDict(request.@params);
+            return builder.Data(Grades).build();
+        }
+    }
+}

+ 19 - 12
TEAMModelOS/Controllers/common/PeriodController.cs

@@ -3,20 +3,20 @@ using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Threading.Tasks;
-using TEAMModelOS.Model.Analysis.Models;
+using TEAMModelOS.Model.Core.Models;
 using TEAMModelOS.SDK.Extension.DataResult.JsonRpcRequest;
 using TEAMModelOS.SDK.Extension.DataResult.JsonRpcResponse;
-using TEAMModelOS.Service.BaseInfo.Interfaces;
+using TEAMModelOS.Service.Core.Interfaces;
 
-namespace TEAMModelOS.Controllers.common
+namespace TEAMModelOS.Controllers.Core
 {
     [Route("api/[controller]")]
     [ApiController]
-    public class PeriodController : Controller
+    public class PeriodController :BaseController
     {
-
         public IPeriodService _periodService;
-        public PeriodController(IPeriodService periodService) {
+        public PeriodController(IPeriodService periodService)
+        {
             _periodService = periodService;
         }
 
@@ -28,20 +28,27 @@ namespace TEAMModelOS.Controllers.common
             return builder.Data(data).build();
         }
         [HttpPost("DeleteInfo")]
-        public async Task<BaseJosnRPCResponse> Delete(JosnRPCRequest<Period> request)
+        public async Task<BaseJosnRPCResponse> Delete(JosnRPCRequest<Dictionary<string, object>> request)
         {
             JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
-            Period data = await _periodService.Delete(request.@params);
-            return builder.Data(data).build();
+            int count  = await _periodService.DeleteAll(request.@params);
+            return builder.Data(count).build();
         }
 
-        [HttpPost("Find")]
-        public async Task<BaseJosnRPCResponse> Find(JosnRPCRequest<Dictionary<string, object>> request)
+        [HttpPost("FindPeriodsByDict")]
+        public async Task<BaseJosnRPCResponse> FindPeriodsByDict(JosnRPCRequest<Dictionary<string, object>> request)
         {
             JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
-            List<Period> data = await _periodService.FindList(request.@params);
+            List<Period> data = await _periodService.FindPeriodsByDict(request.@params);
             return builder.Data(data).build();
         }
 
+        [HttpPost("FindSchoolPeriodsByDict")]
+        public async Task<BaseJosnRPCResponse> FindSchoolPeriodsByDict(JosnRPCRequest<Dictionary<string, object>> request)
+        {
+            JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
+            List<SchoolPeriod> data = await _periodService.FindSchoolPeriodsByDict(request.@params);
+            return builder.Data(data).build();
+        }
     }
 }

+ 0 - 48
TEAMModelOS/Controllers/Core/StudentController.cs

@@ -1,48 +0,0 @@
-using Microsoft.AspNetCore.Mvc;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
-using TEAMModelOS.Model.Analysis.Models;
-using TEAMModelOS.SDK.Extension.DataResult.JsonRpcRequest;
-using TEAMModelOS.SDK.Extension.DataResult.JsonRpcResponse;
-using TEAMModelOS.Service.BaseInfo.Interfaces;
-
-namespace TEAMModelOS.Controllers.Core
-{
-    [Route("api/[controller]")]
-    [ApiController]
-    public class StudentController : BaseController
-    {
-        public IStudentsService _studentsService;
-        public StudentController(IStudentsService studentsService)
-        {
-            _studentsService = studentsService;
-        }
-
-        [HttpPost("SaveOrUpdate")]
-        public async Task<BaseJosnRPCResponse> SaveOrUpdate(JosnRPCRequest<Students> request)
-        {
-            JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
-            Students data = await _studentsService.saveOrUpdate(request.@params);
-            return builder.Data(data).build();
-        }
-        [HttpPost("DeleteInfo")]
-        public async Task<BaseJosnRPCResponse> Delete(JosnRPCRequest<Students> request)
-        {
-            JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
-            Students data = await _studentsService.Delete(request.@params);
-            return builder.Data(data).build();
-        }
-
-        [HttpPost("Find")]
-        public async Task<BaseJosnRPCResponse> Find(JosnRPCRequest<Dictionary<string, object>> request)
-        {
-            JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
-            List<Students> data = await _studentsService.FindList(request.@params);
-            return builder.Data(data).build();
-
-        }
-
-    }
-}

+ 54 - 0
TEAMModelOS/Controllers/Core/SubjectController.cs

@@ -0,0 +1,54 @@
+using Microsoft.AspNetCore.Mvc;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using TEAMModelOS.Model.Core.Models;
+using TEAMModelOS.SDK.Extension.DataResult.JsonRpcRequest;
+using TEAMModelOS.SDK.Extension.DataResult.JsonRpcResponse;
+using TEAMModelOS.Service.Core.Interfaces;
+
+namespace TEAMModelOS.Controllers.Core
+{
+    [Route("api/[controller]")]
+    [ApiController]
+    public class SubjectController :BaseController
+    {
+        public ISubjectService  _subjectService;
+        public SubjectController(ISubjectService subjectService)
+        {
+            _subjectService = subjectService;
+        }
+
+        [HttpPost("SaveOrUpdate")]
+        public async Task<BaseJosnRPCResponse> SaveOrUpdate(JosnRPCRequest<Subject> request)
+        {
+            JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
+            Subject data = await _subjectService.saveOrUpdate(request.@params);
+            return builder.Data(data).build();
+        }
+        [HttpPost("DeleteInfo")]
+        public async Task<BaseJosnRPCResponse> Delete(JosnRPCRequest<Dictionary<string, object>> request)
+        {
+            JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
+            int count = await _subjectService.DeleteAll(request.@params);
+            return builder.Data(count).build();
+        }
+
+        [HttpPost("FindSubjectsByDict")]
+        public async Task<BaseJosnRPCResponse> FindList(JosnRPCRequest<Dictionary<string, object>> request)
+        {
+            JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
+            List<Subject> data = await _subjectService.FindSubjectsByDict(request.@params);
+            return builder.Data(data).build();
+        }
+
+        [HttpPost("FindSchoolGradesByDict")]
+        public async Task<BaseJosnRPCResponse> FindSchoolGradesByDict(JosnRPCRequest<Dictionary<string, object>> request)
+        {
+            JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
+            List<SchoolSubject> Grades = await _subjectService.FindSchoolSubjectsByDict(request.@params);
+            return builder.Data(Grades).build();
+        }
+    }
+}

+ 1 - 39
TEAMModelOS/Controllers/Syllabus/SyllabusController.cs

@@ -3,13 +3,11 @@ using System;
 using System.Collections.Generic;
 using System.Reflection;
 using System.Threading.Tasks;
+using TEAMModelOS.Model.Core.Models;
 using TEAMModelOS.Model.Syllabus.Dtos;
 using TEAMModelOS.Model.Syllabus.Models;
-using TEAMModelOS.SDK.Context.Attributes.Table;
 using TEAMModelOS.SDK.Extension.DataResult.JsonRpcRequest;
 using TEAMModelOS.SDK.Extension.DataResult.JsonRpcResponse;
-using TEAMModelOS.SDK.Extension.JwtAuth.JwtHelper;
-using TEAMModelOS.SDK.Helper.Common.JsonHelper;
 using TEAMModelOS.Service.Syllabus.Interfaces;
 
 namespace TEAMModelOS.Controllers.Syllabus
@@ -39,41 +37,5 @@ namespace TEAMModelOS.Controllers.Syllabus
             SyllabusNode data = await syllabusService.SaveOrUpdate(request.@params);
             return builder.Data(data).build();
         }
-        [HttpPost("FindPeriods")]
-        public async Task<BaseJosnRPCResponse> FindPeriods(JosnRPCRequest<Dictionary<string,object>> request)
-        {
-            JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
-            List<Period> data = await syllabusService.FindPeriodsByDict(request.@params);
-            return builder.Data(data).build();
-        }
-        [HttpPost("FindSubjects")]
-        public async Task<BaseJosnRPCResponse> FindSubjectsByDict(JosnRPCRequest<Dictionary<string, object>> request)
-        {
-            JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
-            List<PeriodSubject> data = await syllabusService.FindSubjectsByDict(request.@params);
-            return builder.Data(data).build();
-        }
-        [HttpPost("FindEditions")]
-        public async Task<BaseJosnRPCResponse> FindEditionsByDict(JosnRPCRequest<Dictionary<string, object>> request)
-        {
-            JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
-            List<PeriodSubjectEdition> data = await syllabusService.FindEditionsByDict(request.@params);
-            return builder.Data(data).build();
-        }
-        [HttpPost("FindTerms")]
-        public async Task<BaseJosnRPCResponse> FindTermsByDict(JosnRPCRequest<Dictionary<string, object>> request)
-        {
-            JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
-            List<PeriodSubjectEditionTerm> data = await syllabusService.FindTermsByDict(request.@params);
-            return builder.Data(data).build();
-        }
-
-        [HttpPost("FindTextbooks")]
-        public async Task<BaseJosnRPCResponse> FindTextbooksByDict(JosnRPCRequest<Dictionary<string, object>> request)
-        {
-            JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
-            StandardTextbook data = await syllabusService.FindTextbooksByDict(request.@params);
-            return builder.Data(data).build();
-        }
     }
 }

+ 1 - 2
TEAMModelOS/Controllers/ValuesController.cs

@@ -5,8 +5,7 @@ using System.Reflection;
 using System.Threading.Tasks;
 using Microsoft.AspNetCore.Http;
 using Microsoft.AspNetCore.Mvc;
-using TEAMModelOS.Model.Syllabus.Models;
-using TEAMModelOS.SDK.Context.Attributes.Table;
+using TEAMModelOS.SDK.Context.Attributes.Azure;
 
 namespace TEAMModelOS.Controllers
 {

+ 0 - 47
TEAMModelOS/Controllers/common/ClassesController.cs

@@ -1,47 +0,0 @@
-using Microsoft.AspNetCore.Mvc;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
-using TEAMModelOS.Model.Analysis.Models;
-using TEAMModelOS.SDK.Extension.DataResult.JsonRpcRequest;
-using TEAMModelOS.SDK.Extension.DataResult.JsonRpcResponse;
-using TEAMModelOS.Service.BaseInfo.Interfaces;
-
-namespace TEAMModelOS.Controllers.common
-{
-    [Route("api/[controller]")]
-    [ApiController]
-    public class ClassController : Controller
-    {
-
-        public IClassService _classService;
-        public ClassController(IClassService classService) {
-            _classService = classService;
-        }
-
-        [HttpPost("SaveOrUpdate")]
-        public async Task<BaseJosnRPCResponse> SaveOrUpdate(JosnRPCRequest<Classes> request)
-        {
-            JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
-            Classes data = await _classService.saveOrUpdate(request.@params);
-            return builder.Data(data).build();
-        }
-        [HttpPost("DeleteInfo")]
-        public async Task<BaseJosnRPCResponse> Delete(JosnRPCRequest<Classes> request)
-        {
-            JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
-            Classes data = await _classService.Delete(request.@params);
-            return builder.Data(data).build();
-        }
-
-        [HttpPost("Find")]
-        public async Task<BaseJosnRPCResponse> Find(JosnRPCRequest<Dictionary<string, object>> request)
-        {
-            JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
-            List<Classes> data = await _classService.FindList(request.@params);
-            return builder.Data(data).build();
-        }
-
-    }
-}

+ 0 - 47
TEAMModelOS/Controllers/common/GradeController.cs

@@ -1,47 +0,0 @@
-using Microsoft.AspNetCore.Mvc;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
-using TEAMModelOS.Model.Analysis.Models;
-using TEAMModelOS.SDK.Extension.DataResult.JsonRpcRequest;
-using TEAMModelOS.SDK.Extension.DataResult.JsonRpcResponse;
-using TEAMModelOS.Service.BaseInfo.Interfaces;
-
-namespace TEAMModelOS.Controllers.common
-{
-    [Route("api/[controller]")]
-    [ApiController]
-    public class GradeController : Controller
-    {
-
-        public IGradeService _gradeService;
-        public GradeController(IGradeService gradeService) {
-            _gradeService = gradeService;
-        }
-
-        [HttpPost("SaveOrUpdate")]
-        public async Task<BaseJosnRPCResponse> SaveOrUpdate(JosnRPCRequest<Grade> request)
-        {
-            JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
-            Grade data = await _gradeService.saveOrUpdate(request.@params);
-            return builder.Data(data).build();
-        }
-        [HttpPost("DeleteInfo")]
-        public async Task<BaseJosnRPCResponse> Delete(JosnRPCRequest<Grade> request)
-        {
-            JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
-            Grade data = await _gradeService.Delete(request.@params);
-            return builder.Data(data).build();
-        }
-
-        [HttpPost("Find")]
-        public async Task<BaseJosnRPCResponse> Find(JosnRPCRequest<Dictionary<string, object>> request)
-        {
-            JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
-            List<Grade> data = await _gradeService.FindList(request.@params);
-            return builder.Data(data).build();
-        }
-
-    }
-}

+ 0 - 48
TEAMModelOS/Controllers/common/SchoolController.cs

@@ -1,48 +0,0 @@
-using Microsoft.AspNetCore.Mvc;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
-using TEAMModelOS.Model.Analysis.Models;
-using TEAMModelOS.SDK.Extension.DataResult.JsonRpcRequest;
-using TEAMModelOS.SDK.Extension.DataResult.JsonRpcResponse;
-using TEAMModelOS.Service.BaseInfo.Interfaces;
-
-namespace TEAMModelOS.Controllers.common
-{
-    [Route("api/[controller]")]
-    [ApiController]
-    public class SchoolController : Controller
-    {
-
-        public ISchoolService _schoolService;
-        public SchoolController(ISchoolService schoolService) {
-            _schoolService = schoolService;
-        }
-
-        [HttpPost("SaveOrUpdate")]
-        public async Task<BaseJosnRPCResponse> SaveOrUpdate(JosnRPCRequest<School> request)
-        {
-            JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
-            School data = await _schoolService.saveOrUpdate(request.@params);
-            return builder.Data(data).build();
-        }
-        [HttpPost("DeleteInfo")]
-        public async Task<BaseJosnRPCResponse> Delete(JosnRPCRequest<School> request)
-        {
-            JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
-            School data = await _schoolService.Delete(request.@params);
-            return builder.Data(data).build();
-        }
-
-        [HttpPost("Find")]
-        public async Task<BaseJosnRPCResponse> Find(JosnRPCRequest<Dictionary<string, object>> request)
-        {
-            JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
-            List<School> data = await _schoolService.FindList(request.@params);
-            return builder.Data(data).build();
-
-        }
-
-    }
-}

+ 0 - 47
TEAMModelOS/Controllers/common/TeacherController.cs

@@ -1,47 +0,0 @@
-using Microsoft.AspNetCore.Mvc;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
-using TEAMModelOS.Model.Analysis.Models;
-using TEAMModelOS.SDK.Extension.DataResult.JsonRpcRequest;
-using TEAMModelOS.SDK.Extension.DataResult.JsonRpcResponse;
-using TEAMModelOS.Service.BaseInfo.Interfaces;
-
-namespace TEAMModelOS.Controllers.common
-{
-    [Route("api/[controller]")]
-    [ApiController]
-    public class TeacherController : Controller
-    {
-
-        public ITeachersService _teacherService;
-        public TeacherController(ITeachersService teachersService) {
-            _teacherService = teachersService;
-        }
-
-        [HttpPost("SaveOrUpdate")]
-        public async Task<BaseJosnRPCResponse> SaveOrUpdate(JosnRPCRequest<Teachers> request)
-        {
-            JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
-            Teachers data = await _teacherService.saveOrUpdate(request.@params);
-            return builder.Data(data).build();
-        }
-        [HttpPost("DeleteInfo")]
-        public async Task<BaseJosnRPCResponse> Delete(JosnRPCRequest<Teachers> request)
-        {
-            JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
-            Teachers data = await _teacherService.Delete(request.@params);
-            return builder.Data(data).build();
-        }
-
-        [HttpPost("Find")]
-        public async Task<BaseJosnRPCResponse> Find(JosnRPCRequest<Dictionary<string, object>> request)
-        {
-            JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
-            List<Teachers> data = await _teacherService.FindList(request.@params);
-            return builder.Data(data).build();
-        }
-
-    }
-}

+ 127 - 0
TEAMModelOS/JsonFile/Core/RoleClaim.json

@@ -0,0 +1,127 @@
+[
+  {
+    "RoleLevelName": "校级",
+    "RoleLevel": 10801,
+    "ClaimType": "TeamModelId"
+  },
+  {
+    "RoleLevelName": "校级",
+    "RoleLevel": 10801,
+    "ClaimType": "RoleCode"
+  },
+  {
+    "RoleLevelName": "校级",
+    "RoleLevel": 10801,
+    "ClaimType": "SchoolCode"
+  },
+  {
+    "RoleLevelName": "校区",
+    "RoleLevel": 10901,
+    "ClaimType": "TeamModelId"
+  },
+  {
+    "RoleLevelName": "校区",
+    "RoleLevel": 10901,
+    "ClaimType": "RoleCode"
+  },
+  {
+    "RoleLevelName": "校区",
+    "RoleLevel": 10901,
+    "ClaimType": "SchoolCode"
+  },
+  {
+    "RoleLevelName": "校区",
+    "RoleLevel": 10901,
+    "ClaimType": "CampusCode"
+  },
+  {
+    "RoleLevelName": "学段",
+    "RoleLevel": 11001,
+    "ClaimType": "TeamModelId"
+  },
+  {
+    "RoleLevelName": "学段",
+    "RoleLevel": 11001,
+    "ClaimType": "RoleCode"
+  },
+  {
+    "RoleLevelName": "学段",
+    "RoleLevel": 11001,
+    "ClaimType": "SchoolCode"
+  },
+  {
+    "RoleLevelName": "学段",
+    "RoleLevel": 11001,
+    "ClaimType": "CampusCode"
+  },
+  {
+    "RoleLevelName": "学段",
+    "RoleLevel": 11001,
+    "ClaimType": "PeriodCode"
+  },
+  {
+    "RoleLevelName": "年级",
+    "RoleLevel": 11101,
+    "ClaimType": "TeamModelId"
+  },
+  {
+    "RoleLevelName": "年级",
+    "RoleLevel": 11101,
+    "ClaimType": "RoleCode"
+  },
+  {
+    "RoleLevelName": "年级",
+    "RoleLevel": 11101,
+    "ClaimType": "SchoolCode"
+  },
+  {
+    "RoleLevelName": "年级",
+    "RoleLevel": 11101,
+    "ClaimType": "CampusCode"
+  },
+  {
+    "RoleLevelName": "年级",
+    "RoleLevel": 11101,
+    "ClaimType": "PeriodCode"
+  },
+  {
+    "RoleLevelName": "年级",
+    "RoleLevel": 11101,
+    "ClaimType": "GradeCode"
+  },
+  {
+    "RoleLevelName": "班级",
+    "RoleLevel": 11201,
+    "ClaimType": "TeamModelId"
+  },
+  {
+    "RoleLevelName": "班级",
+    "RoleLevel": 11201,
+    "ClaimType": "RoleCode"
+  },
+  {
+    "RoleLevelName": "班级",
+    "RoleLevel": 11201,
+    "ClaimType": "SchoolCode"
+  },
+  {
+    "RoleLevelName": "班级",
+    "RoleLevel": 11201,
+    "ClaimType": "CampusCode"
+  },
+  {
+    "RoleLevelName": "班级",
+    "RoleLevel": 11201,
+    "ClaimType": "PeriodCode"
+  },
+  {
+    "RoleLevelName": "班级",
+    "RoleLevel": 11201,
+    "ClaimType": "GradeCode"
+  },
+  {
+    "RoleLevelName": "班级",
+    "RoleLevel": 11201,
+    "ClaimType": "ClassCode"
+  }
+]

TEAMModelOS/JsonFile/area.json → TEAMModelOS/JsonFile/Core/area.json


+ 0 - 27
TEAMModelOS/JsonFile/RoleIdentity.json

@@ -1,27 +0,0 @@
-[
-{"RoleLevelName":"校级","RoleLevel":"10801","Code":"TeamModelId"},
-{"RoleLevelName":"校级","RoleLevel":"10801","Code":"RoleCode"},
-{"RoleLevelName":"校级","RoleLevel":"10801","Code":"SchoolCode"},
-{"RoleLevelName":"校区","RoleLevel":"10901","Code":"TeamModelId"},
-{"RoleLevelName":"校区","RoleLevel":"10901","Code":"RoleCode"},
-{"RoleLevelName":"校区","RoleLevel":"10901","Code":"SchoolCode"},
-{"RoleLevelName":"校区","RoleLevel":"10901","Code":"CampusCode"},
-{"RoleLevelName":"学段","RoleLevel":"11001","Code":"TeamModelId"},
-{"RoleLevelName":"学段","RoleLevel":"11001","Code":"RoleCode"},
-{"RoleLevelName":"学段","RoleLevel":"11001","Code":"SchoolCode"},
-{"RoleLevelName":"学段","RoleLevel":"11001","Code":"CampusCode"},
-{"RoleLevelName":"学段","RoleLevel":"11001","Code":"PeriodCode"},
-{"RoleLevelName":"年级","RoleLevel":"11101","Code":"TeamModelId"},
-{"RoleLevelName":"年级","RoleLevel":"11101","Code":"RoleCode"},
-{"RoleLevelName":"年级","RoleLevel":"11101","Code":"SchoolCode"},
-{"RoleLevelName":"年级","RoleLevel":"11101","Code":"CampusCode"},
-{"RoleLevelName":"年级","RoleLevel":"11101","Code":"PeriodCode"},
-{"RoleLevelName":"年级","RoleLevel":"11101","Code":"GradeCode"},
-{"RoleLevelName":"班级","RoleLevel":"11201","Code":"TeamModelId"},
-{"RoleLevelName":"班级","RoleLevel":"11201","Code":"RoleCode"},
-{"RoleLevelName":"班级","RoleLevel":"11201","Code":"SchoolCode"},
-{"RoleLevelName":"班级","RoleLevel":"11201","Code":"CampusCode"},
-{"RoleLevelName":"班级","RoleLevel":"11201","Code":"PeriodCode"},
-{"RoleLevelName":"班级","RoleLevel":"11201","Code":"GradeCode"},
-{"RoleLevelName":"班级","RoleLevel":"11201","Code":"ClassCode"}
-]

+ 16 - 0
TEAMModelOS/SeedData/RoleClaim.cs

@@ -0,0 +1,16 @@
+using MessagePack;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace TEAMModelOS.SeedData
+{
+    [MessagePackObject(keyAsPropertyName: true)]
+    public class RoleClaim  
+    {
+        public string ClaimType { get; set; }
+        public int RoleLevel { get; set; }
+        public string RoleLevelName { get; set; }
+    }
+}

+ 225 - 308
TEAMModelOS/SeedData/SeedDataService.cs

@@ -8,6 +8,7 @@ using TEAMModelOS.Model.Core.Dtos;
 using TEAMModelOS.Model.Core.Models;
 using TEAMModelOS.Model.Syllabus.Models;
 using TEAMModelOS.SDK.Context.Configuration;
+using TEAMModelOS.SDK.Helper.Common.CollectionHelper;
 using TEAMModelOS.SDK.Helper.Common.FileHelper;
 using TEAMModelOS.SDK.Helper.Common.JsonHelper;
 using TEAMModelOS.SDK.Module.AzureTable.Interfaces;
@@ -15,36 +16,217 @@ using TEAMModelOS.Service.Core.Interfaces;
 
 namespace TEAMModelOS.SeedData
 {
-    public   class SeedDataService :IBusinessService
+    public class SeedDataService : IBusinessService
     {
-
-        private readonly IAzureTableDBRepository _azureTableDBRepository; 
+        string Lang = "zh-cn";
+        private readonly IAzureTableDBRepository _azureTableDBRepository;
         public SeedDataService(IAzureTableDBRepository azureTableDBRepository) {
             _azureTableDBRepository = azureTableDBRepository;
         }
 
-        public  void SeedData()
+        public void SeedData()
         {
             SeedRootAdmin();
             SeedRole();
             SeedSchool();
             SeedTextBook();
+            SeedRoleClaim();
             //SeedArea();
+            SeedSchoolRole();
+            SeedSubject();
+            SeedGrade();
+            SeedOrgStructure();
+        }
+
+        public async void SeedSubject() {
+            List<Subject> subjects = new List<Subject> {
+                new Subject{ RowKey="Subject_Chinese",PartitionKey=Lang,Name="语文" },
+                new Subject{ RowKey="Subject_Math",PartitionKey=Lang,Name="数学" },
+                new Subject{ RowKey="Subject_English",PartitionKey=Lang,Name="英语" },
+                new Subject{ RowKey="Subject_Physics",PartitionKey=Lang,Name="物理" },
+                new Subject{ RowKey="Subject_Chemistry",PartitionKey=Lang,Name="化学" },
+                new Subject{ RowKey="Subject_Biology",PartitionKey=Lang,Name="生物" },
+                new Subject{ RowKey="Subject_Politics",PartitionKey=Lang,Name="政治" },
+                new Subject{ RowKey="Subject_History",PartitionKey=Lang,Name="历史" },
+                new Subject{ RowKey="Subject_Geography",PartitionKey=Lang,Name="地理" },
+                new Subject{ RowKey="Subject_Science",PartitionKey=Lang,Name="科学" },
+                new Subject{ RowKey="Subject_Information",PartitionKey=Lang,Name="信息" }
+            };
+            await _azureTableDBRepository.SaveOrUpdateAll<Subject>(subjects);
         }
 
+        public async void SeedGrade()
+        {
+            List<Grade> grades = new List<Grade> {
+                new Grade{ RowKey="1",PartitionKey=Lang,Name="一年级",Alias="一年级" },
+                new Grade{ RowKey="2",PartitionKey=Lang,Name="二年级" ,Alias="二年级"},
+                new Grade{ RowKey="3",PartitionKey=Lang,Name="三年级" ,Alias="三年级"},
+                new Grade{ RowKey="4",PartitionKey=Lang,Name="四年级" ,Alias="四年级"},
+                new Grade{ RowKey="5",PartitionKey=Lang,Name="五年级" ,Alias="五年级"},
+                new Grade{ RowKey="6",PartitionKey=Lang,Name="六年级" ,Alias="六年级"},
+                new Grade{ RowKey="7",PartitionKey=Lang,Name="七年级" ,Alias="七年级"},
+                new Grade{ RowKey="8",PartitionKey=Lang,Name="八年级" ,Alias="八年级"},
+                new Grade{ RowKey="9",PartitionKey=Lang,Name="九年级" ,Alias="九年级"},
+                new Grade{ RowKey="10",PartitionKey=Lang,Name="高中一年级" ,Alias="十年级"},
+                new Grade{ RowKey="11",PartitionKey=Lang,Name="高中二年级" ,Alias="十一年级"},
+                new Grade{ RowKey="12",PartitionKey=Lang,Name="高中三年级" ,Alias="十二年级" }
+            };
+            await _azureTableDBRepository.SaveOrUpdateAll<Grade>(grades);
+        }
+        public async void SeedSchool()
+        {
+            List<School> schools = new List<School>();
+            string[] schoos = {
+                "{\"code\":\"2151022409\",\"name\":\"成都高新区芳草小学\",\"countryId\":\"CN\",\"countryName\":\"中国\",\"provinceId\":\"51\",\"provinceName\":\"四川\",\"cityId\":\"510100\",\"cityName\":\"成都\",\"address\":null,\"typeId\":\"21\",\"typeName\":\"小学\",\"source\":\"S\",\"distId\":null,\"distName\":null,\"schoolDist\":null,\"aliasName\":null,\"shortCode\":null,\"partitionKey\":null,\"rowKey\":null,\"eTag\":null}",
+                "{\"code\":\"2151002664\",\"name\":\"成都师范银都紫藤小学\",\"countryId\":\"CN\",\"countryName\":\"中国\",\"provinceId\":\"51\",\"provinceName\":\"四川\",\"cityId\":\"510100\",\"cityName\":\"成都\",\"address\":null,\"typeId\":\"21\",\"typeName\":\"小学\",\"source\":\"S\",\"distId\":null,\"distName\":null,\"schoolDist\":null,\"aliasName\":null,\"shortCode\":null,\"partitionKey\":null,\"rowKey\":null,\"eTag\":null}"
+            };
+            foreach (string sc in schoos)
+            {
+                School school = MessagePackHelper.JsonToObject<School>(sc);
+                schools.Add(school);
+            }
+            schools.ForEach(m => {
+                m.RowKey = m.code + "";
+                m.PartitionKey = m.countryId + "";
+            });
+            await _azureTableDBRepository.SaveOrUpdateAll<School>(schools);
+        }
+
+        public async void SeedOrgStructure()
+        { 
+            List<Period> periods = new List<Period> {
+                new Period { PartitionKey= Lang ,Alias="小学", Name="小学",RowKey="Period_21",Type="Period",Lang=Lang },
+                new Period { PartitionKey= Lang ,Alias="初中", Name="初级中学",RowKey="Period_31",Type="Period",Lang=Lang },
+                new Period { PartitionKey= Lang ,Alias="高中", Name="高级中学",RowKey="Period_34",Type="Period",Lang=Lang },
+                new Period { PartitionKey= Lang ,Alias="中职", Name="中等职业学校",RowKey="Period_36",Type="Period",Lang=Lang },
+                new Period { PartitionKey= Lang ,Alias="高职", Name="普通高等学校",RowKey="Period_41",Type="Period",Lang=Lang },
+                //new Period { PartitionKey= Lang , Name="早教",RowKey="Period_11",Type="Period",Lang=Lang },
+                //new Period { PartitionKey= Lang , Name="特殊教育",RowKey="Period_99",Type="Period",Lang=Lang },
+
+                //new Period { PartitionKey= "zh-tw" ,Alias="國小", Name="國民小學",RowKey="Period_21",Type="Period",Lang=Lang },
+                //new Period { PartitionKey= "zh-tw" ,Alias="國中", Name="國民中學",RowKey="Period_31",Type="Period",Lang=Lang },
+                //new Period { PartitionKey= "zh-tw" ,Alias="高中", Name="高級中學",RowKey="Period_34",Type="Period",Lang=Lang },
+                
+            };
+            await _azureTableDBRepository.SaveOrUpdateAll<Period>(periods);
+            ///创建智慧学区
+            List<SchoolArea> schoolAreas = new List<SchoolArea> { new SchoolArea { PartitionKey = Lang,RowKey= "SchoolArea100001", Name="成都市高新区醍摩豆智慧学区" ,Code=100001} };
+            await _azureTableDBRepository.SaveOrUpdateAll<SchoolArea>(schoolAreas);
+            ///创建智慧学区成员学校
+            List<SchoolAreaMember> schoolAreaMembers = new List<SchoolAreaMember> {
+                new SchoolAreaMember {RowKey= "100001-2151002664" ,PartitionKey=Lang,AreaCode="100001",AreaName="成都市高新区醍摩豆智慧学区",SchoolCode="2151002664",SchoolName="成都师范银都紫藤小学" },
+                new SchoolAreaMember {RowKey= "100001-2151022409" ,PartitionKey=Lang,AreaCode="100001",AreaName="成都市高新区醍摩豆智慧学区",SchoolCode="2151022409",SchoolName="成都高新区芳草小学" }
+            };
+            await _azureTableDBRepository.SaveOrUpdateAll<SchoolAreaMember>(schoolAreaMembers);
+            ///创建学校的分校区
+            List<SchoolCampus> schoolCampuses = new List<SchoolCampus> {
+                new SchoolCampus {RowKey ="2151002664C1",PartitionKey=Lang, SchoolCode= "2151002664", SchoolName= "成都师范银都紫藤小学", Code=1,Name="南校区" },
+                new SchoolCampus {RowKey ="2151002664C2",PartitionKey=Lang, SchoolCode= "2151002664", SchoolName= "成都师范银都紫藤小学", Code=2,Name="北校区" },
+                new SchoolCampus {RowKey ="2151022409C1",PartitionKey=Lang, SchoolCode= "2151022409", SchoolName= "成都高新区芳草小学", Code=1,Name="南校区" },
+                new SchoolCampus {RowKey ="2151022409C2",PartitionKey=Lang, SchoolCode= "2151022409", SchoolName= "成都高新区芳草小学", Code=2,Name="北校区" },
+            };
+            await _azureTableDBRepository.SaveOrUpdateAll<SchoolCampus>(schoolCampuses);
+            ///学校开学学期规则
+            List<SchoolTerm> schoolTerms = new List<SchoolTerm> {
+                new SchoolTerm {RowKey ="2151002664T1",PartitionKey=Lang, SchoolCode= "2151002664",SchoolName= "成都师范银都紫藤小学", Code=1,Name="上学期" },
+                new SchoolTerm {RowKey ="2151002664T2",PartitionKey=Lang, SchoolCode= "2151002664",SchoolName= "成都师范银都紫藤小学", Code=2,Name="下学期" },
+                new SchoolTerm {RowKey ="2151022409T1",PartitionKey=Lang, SchoolCode= "2151022409",SchoolName= "成都高新区芳草小学", Code=1,Name="上学期" },
+                new SchoolTerm {RowKey ="2151022409T2",PartitionKey=Lang, SchoolCode= "2151022409",SchoolName= "成都高新区芳草小学",Code=2,Name="下学期" },
+            };
+            await _azureTableDBRepository.SaveOrUpdateAll<SchoolTerm>(schoolTerms);
+            ///学校包含的学段 可新增别的学段
+            List<SchoolPeriod> schoolPeriods = new List<SchoolPeriod> {
+                new SchoolPeriod {RowKey ="2151002664Period_21",PartitionKey=Lang, SchoolCode= "2151002664", SchoolName= "成都师范银都紫藤小学", Code="Period_21",Name="小学" },
+                new SchoolPeriod {RowKey ="2151022409Period_21",PartitionKey=Lang, SchoolCode= "2151022409", SchoolName= "成都高新区芳草小学", Code="Period_21",Name="小学" },
+            };
+            await _azureTableDBRepository.SaveOrUpdateAll<SchoolPeriod>(schoolPeriods);
+
+            ///
+
+            ///学校学段年级划分
+            List<SchoolGrade> schoolGrades = new List<SchoolGrade> {
+                //紫藤
+                new SchoolGrade {RowKey ="2151002664Period_21G01",PartitionKey=Lang, SchoolCode= "2151002664", SchoolName= "成都师范银都紫藤小学", Code=1,Name="一年级",PeriodCode="Period_21",PeriodName="小学"},
+                new SchoolGrade {RowKey ="2151002664Period_21G02",PartitionKey=Lang, SchoolCode= "2151002664", SchoolName= "成都师范银都紫藤小学", Code=2,Name="二年级" ,PeriodCode="Period_21",PeriodName="小学"},
+                new SchoolGrade {RowKey ="2151002664Period_21G03",PartitionKey=Lang, SchoolCode= "2151002664", SchoolName= "成都师范银都紫藤小学", Code=3,Name="三年级",PeriodCode="Period_21",PeriodName="小学"},
+                new SchoolGrade {RowKey ="2151002664Period_21G04",PartitionKey=Lang, SchoolCode= "2151002664", SchoolName= "成都师范银都紫藤小学", Code=4,Name="四年级" ,PeriodCode="Period_21",PeriodName="小学" },
+                new SchoolGrade {RowKey ="2151002664Period_21G05",PartitionKey=Lang, SchoolCode= "2151002664", SchoolName= "成都师范银都紫藤小学", Code=5,Name="五年级",PeriodCode="Period_21",PeriodName="小学"},
+                new SchoolGrade {RowKey ="2151002664Period_21G06",PartitionKey=Lang, SchoolCode= "2151002664", SchoolName= "成都师范银都紫藤小学", Code=6,Name="六年级",PeriodCode="Period_21",PeriodName="小学" },
+                //芳草
+                new SchoolGrade {RowKey ="2151022409Period_21G01",PartitionKey=Lang, SchoolCode= "2151022409", SchoolName= "成都高新区芳草小学", Code=1,Name="一年级",PeriodCode="Period_21",PeriodName="小学"},
+                new SchoolGrade {RowKey ="2151022409Period_21G02",PartitionKey=Lang, SchoolCode= "2151022409", SchoolName= "成都高新区芳草小学", Code=2,Name="二年级",PeriodCode="Period_21",PeriodName="小学"},
+                new SchoolGrade {RowKey ="2151022409Period_21G03",PartitionKey=Lang, SchoolCode= "2151022409", SchoolName= "成都高新区芳草小学", Code=3,Name="三年级",PeriodCode="Period_21",PeriodName="小学"},
+                new SchoolGrade {RowKey ="2151022409Period_21G04",PartitionKey=Lang, SchoolCode= "2151022409", SchoolName= "成都高新区芳草小学", Code=4,Name="四年级",PeriodCode="Period_21",PeriodName="小学"},
+                new SchoolGrade {RowKey ="2151022409Period_21G05",PartitionKey=Lang, SchoolCode= "2151022409", SchoolName= "成都高新区芳草小学", Code=5,Name="五年级",PeriodCode="Period_21",PeriodName="小学"},
+                new SchoolGrade {RowKey ="2151022409Period_21G06",PartitionKey=Lang, SchoolCode= "2151022409", SchoolName= "成都高新区芳草小学", Code=6,Name="六年级",PeriodCode="Period_21",PeriodName="小学"}
+            };
+            await _azureTableDBRepository.SaveOrUpdateAll<SchoolGrade>(schoolGrades);
+            ///学校 学生行政届数划分模拟
+            List<SchoolSession> schoolSessions = new List<SchoolSession> {
+                //紫藤
+                new SchoolSession {RowKey ="2151002664Period_21S2019",PartitionKey=Lang, SchoolCode= "2151002664", SchoolName= "成都师范银都紫藤小学", Code=2019,Name="2019级",PeriodCode="Period_21",PeriodName="小学",Enrollment=201309,Graduate=201907},
+                new SchoolSession {RowKey ="2151002664Period_21S2020",PartitionKey=Lang, SchoolCode= "2151002664", SchoolName= "成都师范银都紫藤小学", Code=2020,Name="2020级" ,PeriodCode="Period_21",PeriodName="小学",Enrollment=201409,Graduate=201907},
+                new SchoolSession {RowKey ="2151002664Period_21S2021",PartitionKey=Lang, SchoolCode= "2151002664", SchoolName= "成都师范银都紫藤小学", Code=2021,Name="2021级",PeriodCode="Period_21",PeriodName="小学",Enrollment=201509,Graduate=201907},
+                new SchoolSession {RowKey ="2151002664Period_21S2022",PartitionKey=Lang, SchoolCode= "2151002664", SchoolName= "成都师范银都紫藤小学", Code=2022,Name="2022级" ,PeriodCode="Period_21",PeriodName="小学",Enrollment=201609 ,Graduate=201907},
+                new SchoolSession {RowKey ="2151002664Period_21S2023",PartitionKey=Lang, SchoolCode= "2151002664", SchoolName= "成都师范银都紫藤小学", Code=2023,Name="2023级",PeriodCode="Period_21",PeriodName="小学",Enrollment=201709,Graduate=201907},
+                new SchoolSession {RowKey ="2151002664Period_21S2024",PartitionKey=Lang, SchoolCode= "2151002664", SchoolName= "成都师范银都紫藤小学", Code=2024,Name="2024级",PeriodCode="Period_21",PeriodName="小学",Enrollment=201809,Graduate=201907},
+                //芳草
+                new SchoolSession {RowKey ="2151022409Period_21S2019",PartitionKey=Lang, SchoolCode= "2151022409", SchoolName= "成都高新区芳草小学", Code=2019,Name="2019级",PeriodCode="Period_21",PeriodName="小学",Enrollment=201309,Graduate=201907},
+                new SchoolSession {RowKey ="2151022409Period_21S2020",PartitionKey=Lang, SchoolCode= "2151022409", SchoolName= "成都高新区芳草小学", Code=2020,Name="2020级",PeriodCode="Period_21",PeriodName="小学",Enrollment=201409,Graduate=201907},
+                new SchoolSession {RowKey ="2151022409Period_21S2021",PartitionKey=Lang, SchoolCode= "2151022409", SchoolName= "成都高新区芳草小学", Code=2021,Name="2021级",PeriodCode="Period_21",PeriodName="小学",Enrollment=201509,Graduate=201907},
+                new SchoolSession {RowKey ="2151022409Period_21S2022",PartitionKey=Lang, SchoolCode= "2151022409", SchoolName= "成都高新区芳草小学", Code=2022,Name="2022级",PeriodCode="Period_21",PeriodName="小学",Enrollment=201609 ,Graduate=201907},
+                new SchoolSession {RowKey ="2151022409Period_21S2023",PartitionKey=Lang, SchoolCode= "2151022409", SchoolName= "成都高新区芳草小学", Code=2023,Name="2023级",PeriodCode="Period_21",PeriodName="小学",Enrollment=201709,Graduate=201907},
+                new SchoolSession {RowKey ="2151022409Period_21S2024",PartitionKey=Lang, SchoolCode= "2151022409", SchoolName= "成都高新区芳草小学", Code=2024,Name="2024级",PeriodCode="Period_21",PeriodName="小学",Enrollment=201809,Graduate=201907}
+            };
+            await _azureTableDBRepository.SaveOrUpdateAll<SchoolSession>(schoolSessions);
+            ///学校 班级模拟
+        }
         public async void SeedArea()
         {
 
-            string path =  BaseConfigModel.ContentRootPath+ "/JsonFile/area.json" ;
-            string areaString =   FileHelper.FileToString(path);
+            string path = BaseConfigModel.ContentRootPath + "/JsonFile/Core/area.json";
+            string areaString = FileHelper.FileToString(path);
             List<Region> regions = MessagePackHelper.JsonToObject<List<Region>>(areaString);
-            regions.ForEach(m=> {
+            regions.ForEach(m => {
                 m.RowKey = m.SysAddID + "";
                 m.PartitionKey = m.CountryId + "";
             });
-           await _azureTableDBRepository.SaveOrUpdateAll<Region>(regions);
+            await _azureTableDBRepository.SaveOrUpdateAll<Region>(regions);
+        }
+        
+        public async void SeedRoleClaim()
+        {
+            string path = BaseConfigModel.ContentRootPath + "/JsonFile/Core/RoleClaim.json";
+            string areaString = FileHelper.FileToString(path);
+            List<RoleClaim> claims = MessagePackHelper.JsonToObject<List<RoleClaim>>(areaString);
+            foreach (RoleClaim claim in claims) {
+                Dictionary<string, object> dict = new Dictionary<string, object>();
+                dict.Add("RoleLevel",claim.RoleLevel);
+                dict.Add("ClaimType", claim.ClaimType);
+                List<RoleIdentityClaim> identityClaims = await _azureTableDBRepository.FindListByDict<RoleIdentityClaim>(dict);
+                await _azureTableDBRepository.DeleteAll<RoleIdentityClaim>(identityClaims);
+            }
+            List<RoleIdentityClaim> roleIdentityClaims = new List<RoleIdentityClaim>();
+            List<Role> roles = await _azureTableDBRepository.FindAll<Role>();
+            foreach (Role role in roles) {
+                List<RoleClaim>  roleClaims=  claims.Where(c => c.RoleLevel == role.Level).ToList();
+                if (roleClaims.IsNotEmpty()) {
+                    foreach (RoleClaim roleClaim in roleClaims) {
+                        RoleIdentityClaim identityClaim = new RoleIdentityClaim {
+                            RowKey = Guid.NewGuid().ToString(),
+                            PartitionKey = Lang,
+                            RoleCode = role.RowKey,
+                            RoleName = role.Name,
+                            RoleLevel = roleClaim.RoleLevel,
+                            RoleLevelName= roleClaim.RoleLevelName,
+                            ClaimType=roleClaim.ClaimType
+                        };
+                        roleIdentityClaims.Add(identityClaim);
+                    }
+                }
+            }
+          await _azureTableDBRepository.SaveOrUpdateAll(roleIdentityClaims);
         }
-
 
         public async void SeedRootAdmin()
         {
@@ -102,25 +284,42 @@ namespace TEAMModelOS.SeedData
             await _azureTableDBRepository.SaveOrUpdateAll<RoleUser>(usersSchoolAdmin);
         }
 
-        public async void SeedSchool() {
-            List<School> schools = new List<School>();
-            string[]schoos = {
-                "{\"code\":\"2151022409\",\"name\":\"成都高新区芳草小学\",\"countryId\":\"CN\",\"countryName\":\"中国\",\"provinceId\":\"51\",\"provinceName\":\"四川\",\"cityId\":\"510100\",\"cityName\":\"成都\",\"address\":null,\"typeId\":\"21\",\"typeName\":\"小学\",\"source\":\"S\",\"distId\":null,\"distName\":null,\"schoolDist\":null,\"aliasName\":null,\"shortCode\":null,\"partitionKey\":null,\"rowKey\":null,\"eTag\":null}",
-                "{\"code\":\"2151002664\",\"name\":\"成都师范银都紫藤小学\",\"countryId\":\"CN\",\"countryName\":\"中国\",\"provinceId\":\"51\",\"provinceName\":\"四川\",\"cityId\":\"510100\",\"cityName\":\"成都\",\"address\":null,\"typeId\":\"21\",\"typeName\":\"小学\",\"source\":\"S\",\"distId\":null,\"distName\":null,\"schoolDist\":null,\"aliasName\":null,\"shortCode\":null,\"partitionKey\":null,\"rowKey\":null,\"eTag\":null}"
+     
+
+        public async void SeedSchoolRole()
+        {
+            List<SchoolRole> roles = new List<SchoolRole> {
+                //芳草小学
+                new SchoolRole {RowKey="2151022409-SchoolAdmin",RoleName="学校管理员",RoleCode="SchoolAdmin",RoleLevel=10801,RoleLevelName="校级",Remarks="",Status=1 ,PartitionKey=Lang ,SchoolCode="2151022409" ,SchoolName="成都高新区芳草小学" },
+                new SchoolRole {RowKey="2151022409-SchoolLeader",RoleName="校长",RoleCode="SchoolLeader",RoleLevel=10801,RoleLevelName="校级",Remarks="",Status=1 ,PartitionKey=Lang ,SchoolCode="2151022409" ,SchoolName="成都高新区芳草小学" },
+                new SchoolRole {RowKey="2151022409-CampusAdmin",RoleName="校区管理员",RoleCode="CampusAdmin",RoleLevel=10901,RoleLevelName="校区",Remarks="",Status=1 ,PartitionKey=Lang ,SchoolCode="2151022409" ,SchoolName="成都高新区芳草小学" },
+                new SchoolRole {RowKey="2151022409-CampusLeader",RoleName="校区领导",RoleCode="CampusLeader",RoleLevel=10901,RoleLevelName="校区",Remarks="",Status=1 ,PartitionKey=Lang ,SchoolCode="2151022409" ,SchoolName="成都高新区芳草小学" },
+                new SchoolRole {RowKey="2151022409-PeriodAdmin",RoleName="学段管理员",RoleCode="PeriodAdmin",RoleLevel=11001,RoleLevelName="学段",Remarks="",Status=1 ,PartitionKey=Lang ,SchoolCode="2151022409" ,SchoolName="成都高新区芳草小学" },
+                new SchoolRole {RowKey="2151022409-PeriodLeader",RoleName="学段分管领导",RoleCode="PeriodLeader",RoleLevel=11001,RoleLevelName="学段",Remarks="",Status=1 ,PartitionKey=Lang ,SchoolCode="2151022409" ,SchoolName="成都高新区芳草小学" },
+                new SchoolRole {RowKey="2151022409-DirectorLeader",RoleName="教务主任",RoleCode="DirectorLeader",RoleLevel=11001,RoleLevelName="学段",Remarks="",Status=1 ,PartitionKey=Lang ,SchoolCode="2151022409" ,SchoolName="成都高新区芳草小学" },
+                new SchoolRole {RowKey="2151022409-SubjectLeader",RoleName="学科主任",RoleCode="SubjectLeader",RoleLevel=11001,RoleLevelName="学段",Remarks="",Status=1 ,PartitionKey=Lang ,SchoolCode="2151022409" ,SchoolName="成都高新区芳草小学" },
+                new SchoolRole {RowKey="2151022409-GradeLeader",RoleName="年级组长",RoleCode="GradeLeader",RoleLevel=11101,RoleLevelName="年级",Remarks="",Status=1 ,PartitionKey=Lang ,SchoolCode="2151022409" ,SchoolName="成都高新区芳草小学" },
+                new SchoolRole {RowKey="2151022409-GradeSubject",RoleName="年级学科组长",RoleCode="GradeSubject",RoleLevel=11101,RoleLevelName="年级",Remarks="",Status=1 ,PartitionKey=Lang ,SchoolCode="2151022409" ,SchoolName="成都高新区芳草小学" },
+                new SchoolRole {RowKey="2151022409-ClassAdmin",RoleName="班主任",RoleCode="ClassAdmin",RoleLevel=11201,RoleLevelName="班级",Remarks="",Status=1 ,PartitionKey=Lang ,SchoolCode="2151022409" ,SchoolName="成都高新区芳草小学" },
+                new SchoolRole {RowKey="2151022409-Teacher",RoleName="科任教师",RoleCode="Teacher",RoleLevel=11201,RoleLevelName="班级",Remarks="",Status=1 ,PartitionKey=Lang ,SchoolCode="2151022409" ,SchoolName="成都高新区芳草小学" },
+                //紫藤小学
+                new SchoolRole {RowKey="2151002664-SchoolAdmin",RoleName="学校管理员",RoleCode="SchoolAdmin",RoleLevel=10801,RoleLevelName="校级",Remarks="",Status=1 ,PartitionKey=Lang ,SchoolCode="2151002664" ,SchoolName="成都师范银都紫藤小学" },
+                new SchoolRole {RowKey="2151002664-SchoolLeader",RoleName="校长",RoleCode="SchoolLeader",RoleLevel=10801,RoleLevelName="校级",Remarks="",Status=1 ,PartitionKey=Lang ,SchoolCode="2151002664" ,SchoolName="成都师范银都紫藤小学" },
+                new SchoolRole {RowKey="2151002664-CampusLeader",RoleName="校区领导",RoleCode="CampusLeader",RoleLevel=10901,RoleLevelName="校区",Remarks="",Status=1 ,PartitionKey=Lang ,SchoolCode="2151002664" ,SchoolName="成都师范银都紫藤小学" },
+                new SchoolRole {RowKey="2151002664-PeriodLeader",RoleName="学段分管领导",RoleCode="PeriodLeader",RoleLevel=11001,RoleLevelName="学段",Remarks="",Status=1 ,PartitionKey=Lang ,SchoolCode="2151002664" ,SchoolName="成都师范银都紫藤小学" },
+                new SchoolRole {RowKey="2151002664-DirectorLeader",RoleName="教务主任",RoleCode="DirectorLeader",RoleLevel=11001,RoleLevelName="学段",Remarks="",Status=1 ,PartitionKey=Lang ,SchoolCode="2151002664" ,SchoolName="成都师范银都紫藤小学" },
+                new SchoolRole {RowKey="2151002664-SubjectLeader",RoleName="学科主任",RoleCode="SubjectLeader",RoleLevel=11001,RoleLevelName="学段",Remarks="",Status=1 ,PartitionKey=Lang ,SchoolCode="2151002664" ,SchoolName="成都师范银都紫藤小学" },
+                new SchoolRole {RowKey="2151002664-GradeLeader",RoleName="年级组长",RoleCode="GradeLeader",RoleLevel=11101,RoleLevelName="年级",Remarks="",Status=1 ,PartitionKey=Lang ,SchoolCode="2151002664" ,SchoolName="成都师范银都紫藤小学" },
+                new SchoolRole {RowKey="2151002664-GradeSubject",RoleName="年级学科组长",RoleCode="GradeSubject",RoleLevel=11101,RoleLevelName="年级",Remarks="",Status=1 ,PartitionKey=Lang ,SchoolCode="2151002664" ,SchoolName="成都师范银都紫藤小学" },
+                new SchoolRole {RowKey="2151002664-ClassAdmin",RoleName="班主任",RoleCode="ClassAdmin",RoleLevel=11201,RoleLevelName="班级",Remarks="",Status=1 ,PartitionKey=Lang ,SchoolCode="2151002664" ,SchoolName="成都师范银都紫藤小学" },
+                new SchoolRole {RowKey="2151002664-Teacher",RoleName="科任教师",RoleCode="Teacher",RoleLevel=11201,RoleLevelName="班级",Remarks="",Status=1 ,PartitionKey=Lang ,SchoolCode="2151002664" ,SchoolName="成都师范银都紫藤小学" }
             };
-            foreach (string sc in schoos) {
-                School school = MessagePackHelper.JsonToObject<School>(sc);
-                schools.Add(school);
-            }
-            schools.ForEach(m => {
-                m.RowKey = m.code + "";
-                m.PartitionKey = m.countryId + "";
-            });
-            await _azureTableDBRepository.SaveOrUpdateAll<School>(schools);
+            await _azureTableDBRepository.SaveOrUpdateAll(roles);
+
         }
 
+
         public void SeedRole() {
-            string Lang = "zh-cn";
             List<Role> roles = new List<Role> {
                 new Role {Name="超级管理员",RowKey="Root",Level=10101,LevelName="全部",Remarks="",Status=1 ,PartitionKey=Lang },
                 new Role {Name="普通管理员",RowKey="Admin",Level=10101,LevelName="全部",Remarks="",Status=1 ,PartitionKey=Lang },
@@ -151,290 +350,8 @@ namespace TEAMModelOS.SeedData
      
         public  void SeedTextBook()
         {
-            string Lang = "zh-cn";
-            List<Period> periods = new List<Period> {
-                new Period { PartitionKey= Lang , Name="小学",RowKey="Period_21",Type="Period",Lang=Lang },
-                new Period { PartitionKey= Lang , Name="初中",RowKey="Period_31",Type="Period",Lang=Lang },
-                new Period { PartitionKey= Lang , Name="高中",RowKey="Period_34",Type="Period",Lang=Lang },
-                new Period { PartitionKey= Lang , Name="中等职业学校",RowKey="Period_36",Type="Period",Lang=Lang },
-                new Period { PartitionKey= Lang , Name="普通高等学校",RowKey="Period_41",Type="Period",Lang=Lang },
-                //new Period { PartitionKey= Lang , Name="早教",RowKey="Period_11",Type="Period",Lang=Lang },
-                //new Period { PartitionKey= Lang , Name="特殊教育",RowKey="Period_99",Type="Period",Lang=Lang },
-            };
-            _azureTableDBRepository.SaveOrUpdateAll<Period>(periods);
-            //List<PeriodGread> greads = new List<PeriodGread> {
-            //    ///小学
-            //    new PeriodGread { PartitionKey= Lang , Name="一年级",RowKey="Gread_2101",Type="Gread",Lang=Lang, Pcode="Period_21"},
-            //    new PeriodGread { PartitionKey= Lang , Name="二年级",RowKey="Gread_2102",Type="Gread",Lang=Lang, Pcode="Period_21"},
-            //    new PeriodGread { PartitionKey= Lang , Name="三年级",RowKey="Gread_2103",Type="Gread",Lang=Lang, Pcode="Period_21"},
-            //    new PeriodGread { PartitionKey= Lang , Name="四年级",RowKey="Gread_2104",Type="Gread",Lang=Lang, Pcode="Period_21"},
-            //    new PeriodGread { PartitionKey= Lang , Name="五年级",RowKey="Gread_2105",Type="Gread",Lang=Lang, Pcode="Period_21"},
-            //    new PeriodGread { PartitionKey= Lang , Name="六年级",RowKey="Gread_2106",Type="Gread",Lang=Lang, Pcode="Period_21"},
-            //    //初中
-            //    new PeriodGread { PartitionKey= Lang , Name="六年级(五四制)",RowKey="Gread_3101",Type="Gread",Lang=Lang , Pcode="Period_31"},
-            //    new PeriodGread { PartitionKey= Lang , Name="七年级",RowKey="Gread_3102",Type="Gread",Lang=Lang , Pcode="Period_31"},
-            //    new PeriodGread { PartitionKey= Lang , Name="八年级",RowKey="Gread_3103",Type="Gread",Lang=Lang , Pcode="Period_31"},
-            //    new PeriodGread { PartitionKey= Lang , Name="九年级",RowKey="Gread_3104",Type="Gread",Lang=Lang , Pcode="Period_31"},
-            //    //高中
-            //    new PeriodGread { PartitionKey= Lang , Name="一年级",RowKey="Gread_3401",Type="Gread",Lang=Lang , Pcode="Period_34"},
-            //    new PeriodGread { PartitionKey= Lang , Name="二年级",RowKey="Gread_3402",Type="Gread",Lang=Lang , Pcode="Period_34"},
-            //    new PeriodGread { PartitionKey= Lang , Name="三年级",RowKey="Gread_3403",Type="Gread",Lang=Lang , Pcode="Period_34"},
-            //     //中等职业学校
-            //    new PeriodGread { PartitionKey= Lang , Name="一年级",RowKey="Gread_3601",Type="Gread",Lang=Lang , Pcode="Period_36"},
-            //    new PeriodGread { PartitionKey= Lang , Name="二年级",RowKey="Gread_3602",Type="Gread",Lang=Lang , Pcode="Period_36"},
-            //    new PeriodGread { PartitionKey= Lang , Name="三年级",RowKey="Gread_3603",Type="Gread",Lang=Lang , Pcode="Period_36"},
-            //     //普通高等学校
-            //    new PeriodGread { PartitionKey= Lang , Name="一年级",RowKey="Gread_4101",Type="Gread",Lang=Lang , Pcode="Period_41"},
-            //    new PeriodGread { PartitionKey= Lang , Name="二年级",RowKey="Gread_4102",Type="Gread",Lang=Lang , Pcode="Period_41"},
-            //    new PeriodGread { PartitionKey= Lang , Name="三年级",RowKey="Gread_4103",Type="Gread",Lang=Lang , Pcode="Period_41"},
-            //};
-
-            List<PeriodSubject> subjects = new List<PeriodSubject> {
-                ///小学
-                new PeriodSubject { PartitionKey= Lang , Name="语文",RowKey="Subject_2101",Type="Subject",Lang=Lang, Pcode="Period_21"},
-                new PeriodSubject { PartitionKey= Lang , Name="数学",RowKey="Subject_2102",Type="Subject",Lang=Lang, Pcode="Period_21"},
-                new PeriodSubject { PartitionKey= Lang , Name="英语",RowKey="Subject_2103",Type="Subject",Lang=Lang, Pcode="Period_21"},
-                new PeriodSubject { PartitionKey= Lang , Name="思想品德",RowKey="Subject_2104",Type="Subject",Lang=Lang, Pcode="Period_21"},
-                //初中
-                new PeriodSubject { PartitionKey= Lang , Name="语文",RowKey="Subject_3101",Type="Subject",Lang=Lang , Pcode="Period_31"},
-                new PeriodSubject { PartitionKey= Lang , Name="数学",RowKey="Subject_3102",Type="Subject",Lang=Lang , Pcode="Period_31"},
-                new PeriodSubject { PartitionKey= Lang , Name="英语",RowKey="Subject_3103",Type="Subject",Lang=Lang , Pcode="Period_31"},
-                new PeriodSubject { PartitionKey= Lang , Name="物理",RowKey="Subject_3104",Type="Subject",Lang=Lang , Pcode="Period_31"},
-                new PeriodSubject { PartitionKey= Lang , Name="化学",RowKey="Subject_3105",Type="Subject",Lang=Lang , Pcode="Period_31"},
-                new PeriodSubject { PartitionKey= Lang , Name="生物",RowKey="Subject_3106",Type="Subject",Lang=Lang , Pcode="Period_31"},
-                new PeriodSubject { PartitionKey= Lang , Name="思想品德",RowKey="Subject_3107",Type="Subject",Lang=Lang , Pcode="Period_31"},
-                new PeriodSubject { PartitionKey= Lang , Name="历史",RowKey="Subject_3108",Type="Subject",Lang=Lang , Pcode="Period_31"},
-                new PeriodSubject { PartitionKey= Lang , Name="地理",RowKey="Subject_3109",Type="Subject",Lang=Lang , Pcode="Period_31"},
-                //高中
-                new PeriodSubject { PartitionKey= Lang , Name="语文",RowKey="Subject_3401",Type="Subject",Lang=Lang , Pcode="Period_34"},
-                new PeriodSubject { PartitionKey= Lang , Name="数学",RowKey="Subject_3402",Type="Subject",Lang=Lang , Pcode="Period_34"},
-                new PeriodSubject { PartitionKey= Lang , Name="英语",RowKey="Subject_3403",Type="Subject",Lang=Lang , Pcode="Period_34"},
-                new PeriodSubject { PartitionKey= Lang , Name="物理",RowKey="Subject_3404",Type="Subject",Lang=Lang , Pcode="Period_34"},
-                new PeriodSubject { PartitionKey= Lang , Name="化学",RowKey="Subject_3405",Type="Subject",Lang=Lang , Pcode="Period_34"},
-                new PeriodSubject { PartitionKey= Lang , Name="生物",RowKey="Subject_3406",Type="Subject",Lang=Lang , Pcode="Period_34"},
-                new PeriodSubject { PartitionKey= Lang , Name="政治",RowKey="Subject_3407",Type="Subject",Lang=Lang , Pcode="Period_34"},
-                new PeriodSubject { PartitionKey= Lang , Name="历史",RowKey="Subject_3408",Type="Subject",Lang=Lang , Pcode="Period_34"},
-                new PeriodSubject { PartitionKey= Lang , Name="地理",RowKey="Subject_3409",Type="Subject",Lang=Lang , Pcode="Period_34"},
-                 //中等职业学校
-                new PeriodSubject { PartitionKey= Lang , Name="语文",RowKey="Subject_3601",Type="Subject",Lang=Lang , Pcode="Period_36"},
-                new PeriodSubject { PartitionKey= Lang , Name="数学",RowKey="Subject_3602",Type="Subject",Lang=Lang , Pcode="Period_36"},
-                new PeriodSubject { PartitionKey= Lang , Name="英语",RowKey="Subject_3603",Type="Subject",Lang=Lang , Pcode="Period_36"},
-                 //普通高等学校
-                new PeriodSubject { PartitionKey= Lang , Name="语文",RowKey="Subject_4101",Type="Subject",Lang=Lang , Pcode="Period_41"},
-                new PeriodSubject { PartitionKey= Lang , Name="数学",RowKey="Subject_4102",Type="Subject",Lang=Lang , Pcode="Period_41"},
-                new PeriodSubject { PartitionKey= Lang , Name="英语",RowKey="Subject_4103",Type="Subject",Lang=Lang , Pcode="Period_41"},
-            };
-
-            _azureTableDBRepository.SaveOrUpdateAll<PeriodSubject>(subjects);
-
-            List<PeriodSubjectEdition> editions = new List<PeriodSubjectEdition> {
-                ///小学
-                new PeriodSubjectEdition { PartitionKey= Lang , Name="人教课标版",RowKey="Edition_210101",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2101"},
-                new PeriodSubjectEdition { PartitionKey= Lang , Name="人教课标版",RowKey="Edition_210201",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2102"},
-                new PeriodSubjectEdition { PartitionKey= Lang , Name="人教课标版",RowKey="Edition_210301",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2103"},
-                new PeriodSubjectEdition { PartitionKey= Lang , Name="人教课标版",RowKey="Edition_210401",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2104"},
-
-                new PeriodSubjectEdition { PartitionKey= Lang , Name="北师大课标版",RowKey="Edition_210102",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2101"},
-                new PeriodSubjectEdition { PartitionKey= Lang , Name="北师大课标版",RowKey="Edition_210202",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2102"},
-                new PeriodSubjectEdition { PartitionKey= Lang , Name="北师大课标版",RowKey="Edition_210302",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2103"},
-                new PeriodSubjectEdition { PartitionKey= Lang , Name="北师大课标版",RowKey="Edition_210402",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2104"},
-                //初中
-                new PeriodSubjectEdition { PartitionKey= Lang , Name="人教课标版",RowKey="Edition_310101",Type="Edition",Lang=Lang , Pcode="Period_31",Pscode="Subject_3101"},
-                new PeriodSubjectEdition { PartitionKey= Lang , Name="人教课标版",RowKey="Edition_310201",Type="Edition",Lang=Lang , Pcode="Period_31",Pscode="Subject_3102"},
-                new PeriodSubjectEdition { PartitionKey= Lang , Name="人教课标版",RowKey="Edition_310301",Type="Edition",Lang=Lang , Pcode="Period_31",Pscode="Subject_3103"},
-                new PeriodSubjectEdition { PartitionKey= Lang , Name="人教课标版",RowKey="Edition_310401",Type="Edition",Lang=Lang , Pcode="Period_31",Pscode="Subject_3104"},
-                new PeriodSubjectEdition { PartitionKey= Lang , Name="人教课标版",RowKey="Edition_310501",Type="Edition",Lang=Lang , Pcode="Period_31",Pscode="Subject_3105"},
-                new PeriodSubjectEdition { PartitionKey= Lang , Name="人教课标版",RowKey="Edition_310601",Type="Edition",Lang=Lang , Pcode="Period_31",Pscode="Subject_3106"},
-                new PeriodSubjectEdition { PartitionKey= Lang , Name="人教课标版",RowKey="Edition_310701",Type="Edition",Lang=Lang , Pcode="Period_31",Pscode="Subject_3107"},
-                new PeriodSubjectEdition { PartitionKey= Lang , Name="人教课标版",RowKey="Edition_310801",Type="Edition",Lang=Lang , Pcode="Period_31",Pscode="Subject_3108"},
-                new PeriodSubjectEdition { PartitionKey= Lang , Name="人教课标版",RowKey="Edition_310901",Type="Edition",Lang=Lang , Pcode="Period_31",Pscode="Subject_3109"},
-
-                new PeriodSubjectEdition { PartitionKey= Lang , Name="北师大课标版",RowKey="Edition_310102",Type="Edition",Lang=Lang , Pcode="Period_31",Pscode="Subject_3101"},
-                new PeriodSubjectEdition { PartitionKey= Lang , Name="北师大课标版",RowKey="Edition_310202",Type="Edition",Lang=Lang , Pcode="Period_31",Pscode="Subject_3102"},
-                new PeriodSubjectEdition { PartitionKey= Lang , Name="北师大课标版",RowKey="Edition_310302",Type="Edition",Lang=Lang , Pcode="Period_31",Pscode="Subject_3103"},
-                new PeriodSubjectEdition { PartitionKey= Lang , Name="北师大课标版",RowKey="Edition_310402",Type="Edition",Lang=Lang , Pcode="Period_31",Pscode="Subject_3104"},
-                new PeriodSubjectEdition { PartitionKey= Lang , Name="北师大课标版",RowKey="Edition_310502",Type="Edition",Lang=Lang , Pcode="Period_31",Pscode="Subject_3105"},
-                new PeriodSubjectEdition { PartitionKey= Lang , Name="北师大课标版",RowKey="Edition_310603",Type="Edition",Lang=Lang , Pcode="Period_31",Pscode="Subject_3106"},
-                new PeriodSubjectEdition { PartitionKey= Lang , Name="北师大课标版",RowKey="Edition_310702",Type="Edition",Lang=Lang , Pcode="Period_31",Pscode="Subject_3107"},
-                new PeriodSubjectEdition { PartitionKey= Lang , Name="北师大课标版",RowKey="Edition_310802",Type="Edition",Lang=Lang , Pcode="Period_31",Pscode="Subject_3108"},
-                new PeriodSubjectEdition { PartitionKey= Lang , Name="北师大课标版",RowKey="Edition_310902",Type="Edition",Lang=Lang , Pcode="Period_31",Pscode="Subject_3109"},
-
-                //高中
-                new PeriodSubjectEdition { PartitionKey= Lang , Name="人教课标版",RowKey="Edition_340101",Type="Edition",Lang=Lang , Pcode="Period_34",Pscode="Subject_3401"},
-                new PeriodSubjectEdition { PartitionKey= Lang , Name="人教课标版",RowKey="Edition_340201",Type="Edition",Lang=Lang , Pcode="Period_34",Pscode="Subject_3402"},
-                new PeriodSubjectEdition { PartitionKey= Lang , Name="人教课标版",RowKey="Edition_340301",Type="Edition",Lang=Lang , Pcode="Period_34",Pscode="Subject_3403"},
-                new PeriodSubjectEdition { PartitionKey= Lang , Name="人教课标版",RowKey="Edition_340401",Type="Edition",Lang=Lang , Pcode="Period_34",Pscode="Subject_3404"},
-                new PeriodSubjectEdition { PartitionKey= Lang , Name="人教课标版",RowKey="Edition_340501",Type="Edition",Lang=Lang , Pcode="Period_34",Pscode="Subject_3405"},
-                new PeriodSubjectEdition { PartitionKey= Lang , Name="人教课标版",RowKey="Edition_340601",Type="Edition",Lang=Lang , Pcode="Period_34",Pscode="Subject_3406"},
-                new PeriodSubjectEdition { PartitionKey= Lang , Name="人教课标版",RowKey="Edition_340701",Type="Edition",Lang=Lang , Pcode="Period_34",Pscode="Subject_3407"},
-                new PeriodSubjectEdition { PartitionKey= Lang , Name="人教课标版",RowKey="Edition_340801",Type="Edition",Lang=Lang , Pcode="Period_34",Pscode="Subject_3408"},
-                new PeriodSubjectEdition { PartitionKey= Lang , Name="人教课标版",RowKey="Edition_340901",Type="Edition",Lang=Lang , Pcode="Period_34",Pscode="Subject_3409"},
-                 //中等职业学校
-                new PeriodSubjectEdition { PartitionKey= Lang , Name="人教课标版",RowKey="Edition_360101",Type="Edition",Lang=Lang , Pcode="Period_36",Pscode="Subject_3601"},
-                new PeriodSubjectEdition { PartitionKey= Lang , Name="人教课标版",RowKey="Edition_360201",Type="Edition",Lang=Lang , Pcode="Period_36",Pscode="Subject_3602"},
-                new PeriodSubjectEdition { PartitionKey= Lang , Name="人教课标版",RowKey="Edition_360301",Type="Edition",Lang=Lang , Pcode="Period_36",Pscode="Subject_3603"},
-                 //普通高等学校
-                new PeriodSubjectEdition { PartitionKey= Lang , Name="人教课标版",RowKey="Edition_410101",Type="Edition",Lang=Lang , Pcode="Period_41",Pscode="Subject_4101"},
-                new PeriodSubjectEdition { PartitionKey= Lang , Name="人教课标版",RowKey="Edition_410201",Type="Edition",Lang=Lang , Pcode="Period_41",Pscode="Subject_4102"},
-                new PeriodSubjectEdition { PartitionKey= Lang , Name="人教课标版",RowKey="Edition_410301",Type="Edition",Lang=Lang , Pcode="Period_41",Pscode="Subject_4103"}
-            };
-
-            _azureTableDBRepository.SaveOrUpdateAll<PeriodSubjectEdition>(editions);
-            List<PeriodSubjectEditionTerm> terms = new List<PeriodSubjectEditionTerm> {
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21010110101",Name="一年级上册",Psecode="Edition_210101",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2101"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21010110201",Name="二年级上册",Psecode="Edition_210101",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2101"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21010110301",Name="三年级上册",Psecode="Edition_210101",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2101"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21010110401",Name="四年级上册",Psecode="Edition_210101",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2101"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21010110501",Name="五年级上册",Psecode="Edition_210101",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2101"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21010110601",Name="六年级上册",Psecode="Edition_210101",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2101"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21020110101",Name="一年级上册",Psecode="Edition_210201",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2102"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21020110201",Name="二年级上册",Psecode="Edition_210201",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2102"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21020110301",Name="三年级上册",Psecode="Edition_210201",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2102"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21020110401",Name="四年级上册",Psecode="Edition_210201",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2102"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21020110501",Name="五年级上册",Psecode="Edition_210201",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2102"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21020110601",Name="六年级上册",Psecode="Edition_210201",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2102"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21030110101",Name="一年级上册",Psecode="Edition_210301",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2103"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21030110201",Name="二年级上册",Psecode="Edition_210301",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2103"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21030110301",Name="三年级上册",Psecode="Edition_210301",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2103"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21030110401",Name="四年级上册",Psecode="Edition_210301",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2103"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21030110501",Name="五年级上册",Psecode="Edition_210301",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2103"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21030110601",Name="六年级上册",Psecode="Edition_210301",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2103"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21040110101",Name="一年级上册",Psecode="Edition_210401",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2104"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21040110201",Name="二年级上册",Psecode="Edition_210401",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2104"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21040110301",Name="三年级上册",Psecode="Edition_210401",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2104"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21040110401",Name="四年级上册",Psecode="Edition_210401",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2104"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21040110501",Name="五年级上册",Psecode="Edition_210401",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2104"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21040110601",Name="六年级上册",Psecode="Edition_210401",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2104"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21010110102",Name="一年级下册",Psecode="Edition_210101",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2101"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21010110202",Name="二年级下册",Psecode="Edition_210101",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2101"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21010110302",Name="三年级下册",Psecode="Edition_210101",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2101"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21010110402",Name="四年级下册",Psecode="Edition_210101",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2101"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21010110502",Name="五年级下册",Psecode="Edition_210101",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2101"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21010110602",Name="六年级下册",Psecode="Edition_210101",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2101"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21020110102",Name="一年级下册",Psecode="Edition_210201",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2102"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21020110202",Name="二年级下册",Psecode="Edition_210201",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2102"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21020110302",Name="三年级下册",Psecode="Edition_210201",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2102"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21020110402",Name="四年级下册",Psecode="Edition_210201",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2102"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21020110502",Name="五年级下册",Psecode="Edition_210201",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2102"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21020110602",Name="六年级下册",Psecode="Edition_210201",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2102"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21030110102",Name="一年级下册",Psecode="Edition_210301",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2103"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21030110202",Name="二年级下册",Psecode="Edition_210301",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2103"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21030110302",Name="三年级下册",Psecode="Edition_210301",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2103"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21030110402",Name="四年级下册",Psecode="Edition_210301",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2103"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21030110502",Name="五年级下册",Psecode="Edition_210301",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2103"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21030110602",Name="六年级下册",Psecode="Edition_210301",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2103"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21040110102",Name="一年级下册",Psecode="Edition_210401",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2104"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21040110202",Name="二年级下册",Psecode="Edition_210401",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2104"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21040110302",Name="三年级下册",Psecode="Edition_210401",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2104"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21040110402",Name="四年级下册",Psecode="Edition_210401",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2104"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21040110502",Name="五年级下册",Psecode="Edition_210401",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2104"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21040110602",Name="六年级下册",Psecode="Edition_210401",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2104"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21010210101",Name="一年级上册",Psecode="Edition_210102",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2101"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21010210201",Name="二年级上册",Psecode="Edition_210102",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2101"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21010210301",Name="三年级上册",Psecode="Edition_210102",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2101"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21010210401",Name="四年级上册",Psecode="Edition_210102",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2101"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21010210501",Name="五年级上册",Psecode="Edition_210102",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2101"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21010210601",Name="六年级上册",Psecode="Edition_210102",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2101"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21020210101",Name="一年级上册",Psecode="Edition_210202",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2102"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21020210201",Name="二年级上册",Psecode="Edition_210202",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2102"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21020210301",Name="三年级上册",Psecode="Edition_210202",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2102"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21020210401",Name="四年级上册",Psecode="Edition_210202",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2102"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21020210501",Name="五年级上册",Psecode="Edition_210202",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2102"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21020210601",Name="六年级上册",Psecode="Edition_210202",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2102"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21030210101",Name="一年级上册",Psecode="Edition_210302",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2103"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21030210201",Name="二年级上册",Psecode="Edition_210302",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2103"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21030210301",Name="三年级上册",Psecode="Edition_210302",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2103"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21030210401",Name="四年级上册",Psecode="Edition_210302",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2103"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21030210501",Name="五年级上册",Psecode="Edition_210302",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2103"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21030210601",Name="六年级上册",Psecode="Edition_210302",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2103"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21040210101",Name="一年级上册",Psecode="Edition_210402",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2104"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21040210201",Name="二年级上册",Psecode="Edition_210402",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2104"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21040210301",Name="三年级上册",Psecode="Edition_210402",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2104"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21040210401",Name="四年级上册",Psecode="Edition_210402",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2104"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21040210501",Name="五年级上册",Psecode="Edition_210402",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2104"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21040210601",Name="六年级上册",Psecode="Edition_210402",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2104"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21010210102",Name="一年级下册",Psecode="Edition_210102",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2101"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21010210202",Name="二年级下册",Psecode="Edition_210102",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2101"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21010210302",Name="三年级下册",Psecode="Edition_210102",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2101"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21010210402",Name="四年级下册",Psecode="Edition_210102",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2101"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21010210502",Name="五年级下册",Psecode="Edition_210102",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2101"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21010210602",Name="六年级下册",Psecode="Edition_210102",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2101"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21020210102",Name="一年级下册",Psecode="Edition_210202",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2102"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21020210202",Name="二年级下册",Psecode="Edition_210202",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2102"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21020210302",Name="三年级下册",Psecode="Edition_210202",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2102"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21020210402",Name="四年级下册",Psecode="Edition_210202",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2102"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21020210502",Name="五年级下册",Psecode="Edition_210202",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2102"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21020210602",Name="六年级下册",Psecode="Edition_210202",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2102"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21030210102",Name="一年级下册",Psecode="Edition_210302",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2103"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21030210202",Name="二年级下册",Psecode="Edition_210302",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2103"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21030210302",Name="三年级下册",Psecode="Edition_210302",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2103"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21030210402",Name="四年级下册",Psecode="Edition_210302",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2103"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21030210502",Name="五年级下册",Psecode="Edition_210302",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2103"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21030210602",Name="六年级下册",Psecode="Edition_210302",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2103"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21040210102",Name="一年级下册",Psecode="Edition_210402",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2104"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21040210202",Name="二年级下册",Psecode="Edition_210402",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2104"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21040210302",Name="三年级下册",Psecode="Edition_210402",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2104"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21040210402",Name="四年级下册",Psecode="Edition_210402",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2104"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21040210502",Name="五年级下册",Psecode="Edition_210402",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2104"},
-                new PeriodSubjectEditionTerm { PartitionKey= Lang ,  RowKey="Term_21040210602",Name="六年级下册",Psecode="Edition_210402",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2104"}
-
-
-
-
-                /////小学
-                //new PeriodSubjectEditionTerm { PartitionKey= Lang , Name="人教课标版",Psecode="Edition_210101",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2101" },
-                //new PeriodSubjectEditionTerm { PartitionKey= Lang , Name="人教课标版",Psecode="Edition_210201",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2102"},
-                //new PeriodSubjectEditionTerm { PartitionKey= Lang , Name="人教课标版",Psecode="Edition_210301",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2103"},
-                //new PeriodSubjectEditionTerm { PartitionKey= Lang , Name="人教课标版",Psecode="Edition_210401",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2104"},
-
-                //new PeriodSubjectEditionTerm { PartitionKey= Lang , Name="北师大课标版",Psecode="Edition_210102",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2101"},
-                //new PeriodSubjectEditionTerm { PartitionKey= Lang , Name="北师大课标版",Psecode="Edition_210202",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2102"},
-                //new PeriodSubjectEditionTerm { PartitionKey= Lang , Name="北师大课标版",Psecode="Edition_210302",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2103"},
-                //new PeriodSubjectEditionTerm { PartitionKey= Lang , Name="北师大课标版",Psecode="Edition_210402",Type="Edition",Lang=Lang, Pcode="Period_21",Pscode="Subject_2104"},
-                ////初中
-                //new PeriodSubjectEditionTerm { PartitionKey= Lang , Name="人教课标版",Psecode="Edition_310101",Type="Edition",Lang=Lang , Pcode="Period_31",Pscode="Subject_3101"},
-                //new PeriodSubjectEditionTerm { PartitionKey= Lang , Name="人教课标版",Psecode="Edition_310201",Type="Edition",Lang=Lang , Pcode="Period_31",Pscode="Subject_3102"},
-                //new PeriodSubjectEditionTerm { PartitionKey= Lang , Name="人教课标版",Psecode="Edition_310301",Type="Edition",Lang=Lang , Pcode="Period_31",Pscode="Subject_3103"},
-                //new PeriodSubjectEditionTerm { PartitionKey= Lang , Name="人教课标版",Psecode="Edition_310401",Type="Edition",Lang=Lang , Pcode="Period_31",Pscode="Subject_3104"},
-                //new PeriodSubjectEditionTerm { PartitionKey= Lang , Name="人教课标版",Psecode="Edition_310501",Type="Edition",Lang=Lang , Pcode="Period_31",Pscode="Subject_3105"},
-                //new PeriodSubjectEditionTerm { PartitionKey= Lang , Name="人教课标版",Psecode="Edition_310601",Type="Edition",Lang=Lang , Pcode="Period_31",Pscode="Subject_3106"},
-                //new PeriodSubjectEditionTerm { PartitionKey= Lang , Name="人教课标版",Psecode="Edition_310701",Type="Edition",Lang=Lang , Pcode="Period_31",Pscode="Subject_3107"},
-                //new PeriodSubjectEditionTerm { PartitionKey= Lang , Name="人教课标版",Psecode="Edition_310801",Type="Edition",Lang=Lang , Pcode="Period_31",Pscode="Subject_3108"},
-                //new PeriodSubjectEditionTerm { PartitionKey= Lang , Name="人教课标版",Psecode="Edition_310901",Type="Edition",Lang=Lang , Pcode="Period_31",Pscode="Subject_3109"},
-
-                //new PeriodSubjectEditionTerm { PartitionKey= Lang , Name="北师大课标版",Psecode="Edition_310102",Type="Edition",Lang=Lang , Pcode="Period_31",Pscode="Subject_3101"},
-                //new PeriodSubjectEditionTerm { PartitionKey= Lang , Name="北师大课标版",Psecode="Edition_310202",Type="Edition",Lang=Lang , Pcode="Period_31",Pscode="Subject_3102"},
-                //new PeriodSubjectEditionTerm { PartitionKey= Lang , Name="北师大课标版",Psecode="Edition_310302",Type="Edition",Lang=Lang , Pcode="Period_31",Pscode="Subject_3103"},
-                //new PeriodSubjectEditionTerm { PartitionKey= Lang , Name="北师大课标版",Psecode="Edition_310402",Type="Edition",Lang=Lang , Pcode="Period_31",Pscode="Subject_3104"},
-                //new PeriodSubjectEditionTerm { PartitionKey= Lang , Name="北师大课标版",Psecode="Edition_310502",Type="Edition",Lang=Lang , Pcode="Period_31",Pscode="Subject_3105"},
-                //new PeriodSubjectEditionTerm { PartitionKey= Lang , Name="北师大课标版",Psecode="Edition_310603",Type="Edition",Lang=Lang , Pcode="Period_31",Pscode="Subject_3106"},
-                //new PeriodSubjectEditionTerm { PartitionKey= Lang , Name="北师大课标版",Psecode="Edition_310702",Type="Edition",Lang=Lang , Pcode="Period_31",Pscode="Subject_3107"},
-                //new PeriodSubjectEditionTerm { PartitionKey= Lang , Name="北师大课标版",Psecode="Edition_310802",Type="Edition",Lang=Lang , Pcode="Period_31",Pscode="Subject_3108"},
-                //new PeriodSubjectEditionTerm { PartitionKey= Lang , Name="北师大课标版",Psecode="Edition_310902",Type="Edition",Lang=Lang , Pcode="Period_31",Pscode="Subject_3109"},
-
-                ////高中
-                //new PeriodSubjectEditionTerm { PartitionKey= Lang , Name="人教课标版",Psecode="Edition_340101",Type="Edition",Lang=Lang , Pcode="Period_34",Pscode="Subject_3401"},
-                //new PeriodSubjectEditionTerm { PartitionKey= Lang , Name="人教课标版",Psecode="Edition_340201",Type="Edition",Lang=Lang , Pcode="Period_34",Pscode="Subject_3402"},
-                //new PeriodSubjectEditionTerm { PartitionKey= Lang , Name="人教课标版",Psecode="Edition_340301",Type="Edition",Lang=Lang , Pcode="Period_34",Pscode="Subject_3403"},
-                //new PeriodSubjectEditionTerm { PartitionKey= Lang , Name="人教课标版",Psecode="Edition_340401",Type="Edition",Lang=Lang , Pcode="Period_34",Pscode="Subject_3404"},
-                //new PeriodSubjectEditionTerm { PartitionKey= Lang , Name="人教课标版",Psecode="Edition_340501",Type="Edition",Lang=Lang , Pcode="Period_34",Pscode="Subject_3405"},
-                //new PeriodSubjectEditionTerm { PartitionKey= Lang , Name="人教课标版",Psecode="Edition_340601",Type="Edition",Lang=Lang , Pcode="Period_34",Pscode="Subject_3406"},
-                //new PeriodSubjectEditionTerm { PartitionKey= Lang , Name="人教课标版",Psecode="Edition_340701",Type="Edition",Lang=Lang , Pcode="Period_34",Pscode="Subject_3407"},
-                //new PeriodSubjectEditionTerm { PartitionKey= Lang , Name="人教课标版",Psecode="Edition_340801",Type="Edition",Lang=Lang , Pcode="Period_34",Pscode="Subject_3408"},
-                //new PeriodSubjectEditionTerm { PartitionKey= Lang , Name="人教课标版",Psecode="Edition_340901",Type="Edition",Lang=Lang , Pcode="Period_34",Pscode="Subject_3409"},
-                // //中等职业学校
-                //new PeriodSubjectEditionTerm { PartitionKey= Lang , Name="人教课标版",Psecode="Edition_360101",Type="Edition",Lang=Lang , Pcode="Period_36",Pscode="Subject_3601"},
-                //new PeriodSubjectEditionTerm { PartitionKey= Lang , Name="人教课标版",Psecode="Edition_360201",Type="Edition",Lang=Lang , Pcode="Period_36",Pscode="Subject_3602"},
-                //new PeriodSubjectEditionTerm { PartitionKey= Lang , Name="人教课标版",Psecode="Edition_360301",Type="Edition",Lang=Lang , Pcode="Period_36",Pscode="Subject_3603"},
-                // //普通高等学校
-                //new PeriodSubjectEditionTerm { PartitionKey= Lang , Name="人教课标版",Psecode="Edition_410101",Type="Edition",Lang=Lang , Pcode="Period_41",Pscode="Subject_4101"},
-                //new PeriodSubjectEditionTerm { PartitionKey= Lang , Name="人教课标版",Psecode="Edition_410201",Type="Edition",Lang=Lang , Pcode="Period_41",Pscode="Subject_4102"},
-                //new PeriodSubjectEditionTerm { PartitionKey= Lang , Name="人教课标版",Psecode="Edition_410301",Type="Edition",Lang=Lang , Pcode="Period_41",Pscode="Subject_4103"}
-
-
-            };
-
-            _azureTableDBRepository.SaveOrUpdateAll<PeriodSubjectEditionTerm>(terms);
+          
+           
         }
     }
 }

+ 2 - 0
TEAMModelOS/TEAMModelOS.csproj

@@ -29,8 +29,10 @@
     <!-- Files not to publish (note that the 'dist' subfolders are re-added below) -->
   </ItemGroup>
   <ItemGroup>
+    <Folder Include="JsonFile\Core\" />
     <Folder Include="Models\" />
     <Folder Include="wwwroot\" />
+    <Folder Include="wwwroot\dist\" />
   </ItemGroup>
   <ItemGroup>
     <ProjectReference Include="..\TEAMModelOS.Model\TEAMModelOS.Model.csproj" />

+ 3 - 2
TEAMModelOS/appsettings.Development.json

@@ -9,7 +9,7 @@
   "AllowedHosts": "*",
   "Azure": {
     "Table": {
-      "ConnectionString": "AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;DefaultEndpointsProtocol=http;BlobEndpoint=http://127.0.0.1:10000/devstoreaccount1;QueueEndpoint=http://127.0.0.1:10001/devstoreaccount1;TableEndpoint=http://127.0.0.1:10002/devstoreaccount1;",
+      "ConnectionString": "AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;DefaultEndpointsProtocol=http;BlobEndpoint=http://192.168.8.192:10000/devstoreaccount1;QueueEndpoint=http://192.168.8.192:10001/devstoreaccount1;TableEndpoint=http://192.168.8.192:10002/devstoreaccount1;",
       "AzureTableDialect": ""
     },
     "Blob": {
@@ -21,7 +21,8 @@
       "ConnectionString": "https://localhost:8081",
       "ConnectionKey": "C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==",
       "Database": "TEAMModelOS",
-      "AzureTableDialect": ""
+      "AzureTableDialect": "",
+      "CollectionThroughput": 400
     }
   },
   "HaBookAuth": {

+ 2 - 1
TEAMModelOS/appsettings.json

@@ -21,7 +21,8 @@
       "ConnectionString": "",
       "ConnectionKey": "",
       "Database": "TEAMModelOS",
-      "AzureTableDialect": "AzureChina"
+      "AzureTableDialect": "AzureChina",
+      "CollectionThroughput": 400
     }
   },
   "HaBookAuth": {

File diff suppressed because it is too large
+ 32 - 0
TeamModelOS.Test.JsonPath/Program.cs


+ 12 - 0
TeamModelOS.Test.JsonPath/TeamModelOS.Test.JsonPath.csproj

@@ -0,0 +1,12 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+  <PropertyGroup>
+    <OutputType>Exe</OutputType>
+    <TargetFramework>netcoreapp2.2</TargetFramework>
+  </PropertyGroup>
+
+  <ItemGroup>
+    <ProjectReference Include="..\TEAMModelOS.SDK\TEAMModelOS.SDK.csproj" />
+  </ItemGroup>
+
+</Project>