compilation.js 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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. release_time: {
  59. type: Number,
  60. default: 0
  61. },
  62. //价格属性
  63. priceProperties: {
  64. type: Array,
  65. default: []
  66. },
  67. //消耗量属性
  68. consumeAmtProperties: {
  69. type: Array,
  70. default: []
  71. },
  72. // cld 办事处id
  73. categoryID: {
  74. type: Number,
  75. default: 12 // 总部id
  76. }
  77. };
  78. mongoose.model(collectionName, new Schema(modelSchema, {versionKey: false, collection: collectionName}));