land.js 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. }, { _id: false })
  12. // 地区
  13. const regionSchema = new Schema({
  14. ID: Number,
  15. ParentID: Number,
  16. // 地区名称
  17. name: String,
  18. // 地区类型
  19. type: Number,
  20. // 街道
  21. street: String,
  22. // 耕地开垦单价
  23. unitPrice: Number,
  24. subList: { type: [subItem], default: [] },
  25. }, { _id: false });
  26. const modelSchema = {
  27. ID: String,
  28. // 标准名称
  29. libName: String,
  30. //编办ID
  31. compilationId: {
  32. type: String,
  33. index: true
  34. },
  35. compilationName: String,
  36. regions: { type: [regionSchema], default: [] },
  37. creator: String,
  38. createDate: Number,
  39. recentOpr: [oprSchema]
  40. };
  41. mongoose.model(collectionName, new Schema(modelSchema, { versionKey: false, collection: collectionName }));