hhb 5 月之前
父節點
當前提交
5d319b7ebe
共有 1 個文件被更改,包括 15 次插入0 次删除
  1. 15 0
      TEAMModelOS.SDK/Models/Service/ExamService.cs

+ 15 - 0
TEAMModelOS.SDK/Models/Service/ExamService.cs

@@ -234,6 +234,7 @@ namespace TEAMModelOS.SDK.Models.Service
                     sub = $" join A0 in c.subjects ";
                     sub = $" join A0 in c.subjects ";
                     subject = $" and A0.id = '{subjectId}'";
                     subject = $" and A0.id = '{subjectId}'";
                 }
                 }
+          
                 StringBuilder stringBuilder = new($"select c.id,c.name,c.code,c.period,c.startTime,c.endTime,c.stuCount,c.type,c.progress,c.examType,c.createTime,c.source, c.subjects, c.grades,c.owner, c.scope,c.classes, c.stuLists, c.sRate,c.lostStu,c.sStatus,c.qamode,c.school,c.cloudas from c {sub} where (c.status<>404 or IS_DEFINED(c.status) = false) and c.pk = 'Exam' {subject}");               
                 StringBuilder stringBuilder = new($"select c.id,c.name,c.code,c.period,c.startTime,c.endTime,c.stuCount,c.type,c.progress,c.examType,c.createTime,c.source, c.subjects, c.grades,c.owner, c.scope,c.classes, c.stuLists, c.sRate,c.lostStu,c.sStatus,c.qamode,c.school,c.cloudas from c {sub} where (c.status<>404 or IS_DEFINED(c.status) = false) and c.pk = 'Exam' {subject}");               
                 //开始时间,
                 //开始时间,
                 if (request.TryGetProperty("stime", out JsonElement stime))
                 if (request.TryGetProperty("stime", out JsonElement stime))
@@ -244,6 +245,7 @@ namespace TEAMModelOS.SDK.Models.Service
 
 
                     };
                     };
                 };
                 };
+
                 //默认当前时间
                 //默认当前时间
                 var etimestamp = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
                 var etimestamp = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
                 stringBuilder.Append($" and  c.startTime <= {etimestamp} ");
                 stringBuilder.Append($" and  c.startTime <= {etimestamp} ");
@@ -260,6 +262,19 @@ namespace TEAMModelOS.SDK.Models.Service
                 {
                 {
                     stringBuilder.Append($" and Contains( c.name , '{name}') =  true ");
                     stringBuilder.Append($" and Contains( c.name , '{name}') =  true ");
                 }
                 }
+                if (request.TryGetProperty("classId", out JsonElement classId) && !string.IsNullOrWhiteSpace($"{classId}"))
+                {
+                    if (request.TryGetProperty("classType", out JsonElement classType) && !string.IsNullOrWhiteSpace($"{classType}")) {
+                        if (classType.ToString().Equals("class"))
+                        {
+                            stringBuilder.Append($" and array_contains(c.classes, '{classId}')");
+                        }
+                        else {
+                            stringBuilder.Append($" and array_contains(c.stuLists, '{classId}')");
+                        }
+                    }
+                   
+                }
                 if (request.TryGetProperty("owner", out JsonElement owner) && !string.IsNullOrWhiteSpace($"{owner}"))
                 if (request.TryGetProperty("owner", out JsonElement owner) && !string.IsNullOrWhiteSpace($"{owner}"))
                 {
                 {
                     stringBuilder.Append($" and c.owner = '{owner}' ");
                     stringBuilder.Append($" and c.owner = '{owner}' ");