compilation.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /**
  2. * 编办管理数据模型
  3. *
  4. * @author CaiAoLin
  5. * @date 2017/7/28
  6. * @version
  7. */
  8. import mongoose from "mongoose";
  9. let Schema = mongoose.Schema;
  10. let collectionName = 'compilation';
  11. let childrenSchema = new Schema({
  12. id:String,
  13. // 计价名称
  14. name: String,
  15. // 是否启用
  16. enable: {
  17. type: Boolean,
  18. default: false
  19. },
  20. // 类型
  21. type: {
  22. type: Number
  23. }
  24. },{_id: false});
  25. let modelSchema = {
  26. // 是否发布
  27. is_release: {
  28. type: Boolean,
  29. default: false
  30. },
  31. // 自增id
  32. id: {
  33. type: Number
  34. },
  35. // 清单计价规则
  36. bill_valuation: {
  37. type: [childrenSchema],
  38. default: []
  39. },
  40. // 定额计价规则
  41. ration_valuation: {
  42. type: [childrenSchema],
  43. default: []
  44. },
  45. // 名称
  46. name: String,
  47. // 创建时间
  48. create_time: Number,
  49. // 创建者id
  50. creator: String,
  51. //描述
  52. description: String,
  53. //代码覆盖路径
  54. overWriteUrl:String,
  55. //例题建设项目ID
  56. example: Array,
  57. // 版本号
  58. edition:String,
  59. // 发布时间
  60. release_time: {
  61. type: Number,
  62. default: 0
  63. },
  64. //价格属性
  65. priceProperties: {
  66. type: Array,
  67. default: []
  68. },
  69. //消耗量属性
  70. consumeAmtProperties: {
  71. type: Array,
  72. default: []
  73. },
  74. // cld 办事处id
  75. categoryID: {
  76. type: Number,
  77. default: 12 // 总部id
  78. }
  79. };
  80. mongoose.model(collectionName, new Schema(modelSchema, {versionKey: false, collection: collectionName}));