Explorar el Código

班级表内增加计划id

liuyu hace 5 años
padre
commit
d2cb36aa1a
Se han modificado 3 ficheros con 8 adiciones y 4 borrados
  1. 3 0
      app/controller/.class.js
  2. 1 0
      app/model/class.js
  3. 4 4
      app/service/trainplan.js

+ 3 - 0
app/controller/.class.js

@@ -5,6 +5,7 @@ module.exports = {
       'number',
       'batchid',
       'termid',
+      'planid',
       'headteacherid',
       'lyteacherid',
       'yclocationid',
@@ -26,6 +27,7 @@ module.exports = {
       'number',
       'batchid',
       'termid',
+      'planid',
       'headteacherid',
       'lyteacherid',
       'yclocationid',
@@ -49,6 +51,7 @@ module.exports = {
         number  :'number',
         batchid:'batchid',
         termid: 'termid',
+        planid: 'planid',
         headteacherid : 'headteacherid',
         lyteacherid : 'lyteacherid',
         yclocationid:'yclocationid',

+ 1 - 0
app/model/class.js

@@ -8,6 +8,7 @@ const ClassSchema = {
   number: { type: String, required: false, maxLength: 200 }, // 人数
   batchid: { type: String, required: false, maxLength: 200 }, // 批次
   termid: { type: String, required: false, maxLength: 200 }, // 期
+  planid: { type: String, required: false, maxLength: 200 }, // 计划
   headteacherid: { type: String, required: false, maxLength: 200 }, // 班主任id
   lyteacherid: { type: String, required: false, maxLength: 200 }, // 礼仪课老师id
   yclocationid: { type: String, required: false, maxLength: 200 }, // 用餐地点id

+ 4 - 4
app/service/trainplan.js

@@ -120,7 +120,7 @@ class TrainplanService extends CrudService {
           // 取得当前批次的班级数
           const classnum = batchnum.class;
           for (let i = 1; i <= classnum; i++) {
-            const newdata = { name: i + '班', number: batchnum.number, batchid: batchnum.id, termid: el.id };
+            const newdata = { name: i + '班', number: batchnum.number, batchid: batchnum.id, termid: el.id, planid: res.id };
             await this.clamodel.create(newdata);
           }
         }
@@ -146,7 +146,7 @@ class TrainplanService extends CrudService {
             // 取得当前批次的班级数
             const classnum = batchnum.class;
             for (let i = 1; i <= classnum; i++) {
-              const newdata = { name: i + '班', number: batchnum.number, batchid: batchnum.id, termid: el.id };
+              const newdata = { name: i + '班', number: batchnum.number, batchid: batchnum.id, termid: el.id, planid: res.id };
               await this.clamodel.create(newdata);
             }
           } else {
@@ -161,7 +161,7 @@ class TrainplanService extends CrudService {
               } else {
                 const classnum = batchnum.class;
                 for (let i = 1; i <= classnum; i++) {
-                  const newdata = { name: i + '班', number: batchnum.number, batchid: batchnum.id, termid: el.id };
+                  const newdata = { name: i + '班', number: batchnum.number, batchid: batchnum.id, termid: el.id, planid: res.id };
                   await this.clamodel.create(newdata);
                 }
               }
@@ -171,7 +171,7 @@ class TrainplanService extends CrudService {
               await this.clamodel.deleteMany({ termid: el.id, batchid: batchnum.id });
               const classnum = batchnum.class;
               for (let i = 1; i <= classnum; i++) {
-                const newdata = { name: i + '班', number: batchnum.number, batchid: batchnum.id, termid: el.id };
+                const newdata = { name: i + '班', number: batchnum.number, batchid: batchnum.id, termid: el.id, planid: res.id };
                 await this.clamodel.create(newdata);
               }
             }