Просмотр исходного кода

后端自动删除用户子目关联信息

zhangweicheng 7 лет назад
Родитель
Сommit
0202504261
2 измененных файлов с 31 добавлено и 0 удалено
  1. 26 0
      modules/all_models/ration_template.js
  2. 5 0
      modules/sys_tools/models/sys_model.js

+ 26 - 0
modules/all_models/ration_template.js

@@ -0,0 +1,26 @@
+/**
+ * Created by zhang on 2018/11/26.
+ */
+
+var mongoose = require('mongoose'),
+    Schema = mongoose.Schema;
+
+let ration_template =  new Schema({
+    ID:String,
+    projectID: Number,
+    rationID:String,
+    createLocation:Number,//提取位置
+    templateList:[new Schema({
+        code:String,
+        name:String,
+        type:String,
+        billsLocation:String,//这个是清单编号
+        fxID:String,//这个是分项对应的ID
+        unit:String,
+        quantity:String,
+        coe:String,
+        billID:String//记取位置对应的清单ID
+    },{ _id: false })]
+},{versionKey:false});
+
+mongoose.model('ration_template', ration_template,"ration_template");

+ 5 - 0
modules/sys_tools/models/sys_model.js

@@ -22,6 +22,7 @@ const rationGljModel = mongoose.model('ration_glj');
 const rationCoeMolde = mongoose.model('ration_coe');
 const installationModel = mongoose.model('installation_fee');
 const rationInstallationModel = mongoose.model('ration_installation');
+const rationTemplateModel  = mongoose.model('ration_template')
 const quantityDetailModel = mongoose.model('quantity_detail');
 const unitPriceFileModel = mongoose.model('unit_price_file');
 const unitPriceModel = mongoose.model('unit_price');
@@ -79,6 +80,10 @@ async function clearJunkData(callback){
         functions.push(function(cb){
             rationInstallationModel.remove({projectID: {$in: junkProjIds}}, cb);
         });
+        //清除ration_installation
+        functions.push(function(cb){
+            rationTemplateModel.remove({projectID: {$in: junkProjIds}}, cb);
+        });
         //清除quantity_detail
         functions.push(function(cb){
             quantityDetailModel.remove({projectID: {$in: junkProjIds}}, cb);