compilation.js 1.5 KB

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