land.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. // 土地补偿
  2. import mongoose from "mongoose";
  3. const Schema = mongoose.Schema;
  4. const collectionName = 'std_land_libs';
  5. const oprSchema = require('../all_schemas/opr_schema');
  6. const subItem = new Schema({
  7. // 土地类型
  8. name: String,
  9. // 土地补偿标准单价
  10. unitPrice: Number,
  11. // 安置补助标准
  12. resettlementPrice: Number,
  13. }, { _id: false })
  14. // 地区
  15. const regionSchema = new Schema({
  16. ID: Number,
  17. ParentID: Number,
  18. // 地区名称
  19. name: String,
  20. // 地区类型
  21. type: Number,
  22. // 街道
  23. street: String,
  24. // 耕地开垦单价
  25. unitPrice: Number,
  26. subList: { type: [subItem], default: [] },
  27. }, { _id: false });
  28. const modelSchema = {
  29. ID: String,
  30. // 标准名称
  31. libName: String,
  32. //编办ID
  33. compilationId: {
  34. type: String,
  35. index: true
  36. },
  37. compilationName: String,
  38. regions: { type: [regionSchema], default: [] },
  39. creator: String,
  40. createDate: Number,
  41. recentOpr: [oprSchema]
  42. };
  43. mongoose.model(collectionName, new Schema(modelSchema, { versionKey: false, collection: collectionName }));