CrazyIter_Bin 3 rokov pred
rodič
commit
f7976dff1e

+ 3 - 1
TEAMModelOS.SDK/Models/Cosmos/Common/ExamClassResult.cs

@@ -64,7 +64,9 @@ namespace TEAMModelOS.SDK.Models
     public class ClassInfo {
         public string id { get; set; }
         public string name { get; set; }
-        public string from { get; set; }
+        public string periodId { get; set; }
+        public int year { get; set; }
+        //public string from { get; set; }
         //public string code { get; set; }
     }
 }

+ 25 - 18
TEAMModelOS.SDK/Models/Service/TriggerStuActivity.cs

@@ -104,34 +104,41 @@ namespace TEAMModelFunction
             }
             return ""; 
         }
-        
-        public static async Task<List<ClassListInfo>> GetClassInfo(CosmosClient client, DingDing _dingDing, List<string> classes, string school)
+        /// <summary>
+        /// 获取行政班接口
+        /// </summary>
+        /// <param name="client"></param>
+        /// <param name="_dingDing"></param>
+        /// <param name="classes"></param>
+        /// <param name="school"></param>
+        /// <returns></returns>
+        public static async Task<List<ClassInfo>> GetClassInfo(CosmosClient client, DingDing _dingDing, List<string> classes, string school)
         {
-            List<ClassListInfo> classInfos = new List<ClassListInfo>();
+            List<ClassInfo> classInfos = new List<ClassInfo>();
             List<string> sqlList = new List<string>();
             classes.ForEach(x => { sqlList.Add($" '{x}' "); });
             string sql = string.Join(" , ", sqlList);
             if (!string.IsNullOrEmpty(school)) {
-                await foreach (var item in client.GetContainer("TEAMModelOS", "School").GetItemQueryIterator<ClassListInfo>(queryText: $"select c.id,c.name from c where c.id in ({sql})",
+                await foreach (var item in client.GetContainer("TEAMModelOS", "School").GetItemQueryIterator<ClassInfo>(queryText: $"select c.id,c.name ,c.periodId,c.year from c where c.id in ({sql})",
                    requestOptions: new QueryRequestOptions() { PartitionKey = new Azure.Cosmos.PartitionKey($"Class-{school}") }))
                 {
-                    item.from = "ClsStuList";
+                   
                     classInfos.Add(item);
                 }
-                await foreach (var item in client.GetContainer("TEAMModelOS", "School").GetItemQueryIterator<ClassListInfo>(queryText: $"select c.id,c.name from c where c.id in ({sql})",
-                  requestOptions: new QueryRequestOptions() { PartitionKey = new Azure.Cosmos.PartitionKey($"StuList-{school}") }))
-                {
-                    item.from = "SchStuList";
-                    classInfos.Add(item);
-                }
-            }
-            List<StuList> tchLists = new List<StuList>();
-            await foreach (var item in client.GetContainer("TEAMModelOS", "Teacher").GetItemQueryIterator<ClassListInfo>(queryText: $"select c.id,c.name from c where c.id in ({sql})",
-                requestOptions: new QueryRequestOptions() { PartitionKey = new Azure.Cosmos.PartitionKey($"StuList") }))
-            {
-                item.from = "TchStuList";
-                classInfos.Add(item);
+                //await foreach (var item in client.GetContainer("TEAMModelOS", "School").GetItemQueryIterator<ClassListInfo>(queryText: $"select c.id,c.name from c where c.id in ({sql})",
+                //  requestOptions: new QueryRequestOptions() { PartitionKey = new Azure.Cosmos.PartitionKey($"StuList-{school}") }))
+                //{
+                //    item.from = "SchStuList";
+                //    classInfos.Add(item);
+                //}
             }
+            //List<StuList> tchLists = new List<StuList>();
+            //await foreach (var item in client.GetContainer("TEAMModelOS", "Teacher").GetItemQueryIterator<ClassListInfo>(queryText: $"select c.id,c.name from c where c.id in ({sql})",
+            //    requestOptions: new QueryRequestOptions() { PartitionKey = new Azure.Cosmos.PartitionKey($"StuList") }))
+            //{
+            //    item.from = "TchStuList";
+            //    classInfos.Add(item);
+            //}
             return classInfos;
         }
        

+ 1 - 1
TEAMModelOS/Controllers/Common/CommonController.cs

@@ -114,7 +114,7 @@ namespace TEAMModelOS.Controllers.Common
             }
         }
         /// <summary>
-        /// 根据名单id直接查找  from 返回有三种类型  行政班  ClsStuList, SchStuList 学校自定义名单,私人名单 TchStuList
+        ///  获取行政班接口
         /// </summary>
         /// <param name="element"></param>
         /// <returns></returns>