浏览代码

學校使用者資訊資料庫欄位變更

jeff 5 年之前
父节点
当前提交
0c5f39d55f

+ 6 - 3
TEAMModelOS.Service/Models/Core/SchoolUser.cs

@@ -9,12 +9,13 @@ using TEAMModelOS.SDK.Module.AzureCosmosDBV3;
 
 namespace TEAMModelOS.Service.Models.Core
 {
-    [CosmosDB(RU = 400, Name = "SchoolUser")]
+    [CosmosDB(RU = 400, Name = "School")]
     public class SchoolUser:ID
     {
-        [PartitionKey]
-        public string schoolCode { get; set; }
         public string id { get; set; }
+        public string schoolCode { get; set; }
+        public string schoolName { get; set; }
+        public string userid { get; set; }
         public string name { get; set; }
         public string email { get; set; }
         public string mobile { get; set; }
@@ -29,6 +30,8 @@ namespace TEAMModelOS.Service.Models.Core
         public long crtDate { get; set; } = 0;
         public long remindDate { get; set; } = 0;
         public long joinDate { get; set; } = 0;
+        [PartitionKey]
+        public string code { get; set; }
         public int? ttl { get; set ; }
     }
 }

+ 3 - 2
TEAMModelOS/ClientApp/src/store/module/user.js

@@ -99,9 +99,10 @@ export default {
             return new Promise(
                 (resolve, reject) => {
                     if (typeof context.state.schoolCode !== 'undefined' && context.state.schoolCode !== undefined) {
+                        var partitionKey = context.state.schoolCode + "-schooluser";
                         apiTools.schoolUser.getSchoolUser({
-                            schoolCode: context.state.schoolCode
-                        }).then(
+                            code: partitionKey
+                        }, context.state.schoolCode).then(
                             res => {
                                 console.log('user.js setSchoolUser res:')
                                 console.log(res)

+ 1 - 1
TEAMModelOS/ClientApp/src/view/teachermgmt/components/userList/Index.vue

@@ -278,7 +278,7 @@ export default {
                 {
                     title: this.$t('teachermgmt.table.th1'),
                     width: 230,
-                    key: 'id',
+                    key: 'userid',
                     sortable: true
                 },
                 {

+ 2 - 1
TEAMModelOS/Controllers/Core/SchoolUserController.cs

@@ -39,7 +39,8 @@ namespace TEAMModelOS.Controllers.Core
         public async Task<BaseJosnRPCResponse> GetSchoolUser(JosnRPCRequest<Dictionary<string, object>> request)
         {
             JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
-            List<SchoolUser> su = await _cosmosrepository.FindByDict<SchoolUser>(request.@params); 
+            request.@params.TryGetValue("code", out object partitionKey);
+            List<SchoolUser> su = await _cosmosrepository.FindByDict<SchoolUser>(request.@params, partitionKey.ToString()); 
             return builder.Data(su).build();
         }