product.js 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. 'use strict';
  2. const Schema = require('mongoose').Schema;
  3. const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
  4. // 产品图片表
  5. const images = new Schema({
  6. url: { type: String, required: true, maxLength: 500 }, // 图片路径
  7. });
  8. // 产品参数表
  9. const args = new Schema({
  10. arg_name: { type: String, required: true, maxLength: 200 }, // 参数名称
  11. memo: { type: String, required: true, maxLength: 200 }, // 内容
  12. });
  13. // 科技超市产品表
  14. const ProductSchema = {
  15. userid: { type: String, required: true, maxLength: 500 }, // 创建人id
  16. status: { type: String, required: false, maxLength: 200, default: "3" }, // 状态(0:待审核 1:通过审核 2:审核拒绝 3:草稿)
  17. is_del: { type: String, required: false, maxLength: 200 }, // 是否删除,0-否,1-是
  18. totaltype: { type: String, required: true, maxLength: 200 }, // 总分类(0.技术 1.产品 2.服务)
  19. is_display: { type: [String], required: false, maxLength: 2000 }, // 需要显示的字段
  20. name: { type: String, required: true, maxLength: 200 }, // 名称
  21. product_type_id: { type: String, required: false, maxLength: 200 }, // 类型id
  22. product_type_name: { type: String, required: false, maxLength: 200 }, // 类型名称
  23. introduction: { type: String, required: false }, // 简介
  24. phase: { type: String, required: false, maxLength: 200 }, // 研发阶段,0-阶段成果,1-最终成果
  25. price: { type: String, required: false, maxLength: 200 }, // 单价
  26. priceunit: { type: String, required: false, maxLength: 200 }, // 单位0-公斤1-套2-件
  27. image: { type: [images], select: true }, // 产品图片
  28. product_args: { type: [args], select: true }, // 产品参数
  29. field: { type: String, required: false, maxLength: 500 }, // 所属领域 0-先进制造1-新材料2-光电子3-信息技术4-文化和科技融合
  30. scope: { type: String, required: false, maxLength: 500 }, // 服务范围
  31. coopermode: { type: String, required: false, maxLength: 200 }, // 合作方式,0-技术转让1-技术服务2-技术许可3-技术融资4-其他
  32. business: { type: String, required: false, maxLength: 200 }, // 交易方式,0-公用,1-转让,2-竞价
  33. budget: { type: String, required: false, maxLength: 200 }, // 投入预算
  34. end_date: { type: String, required: false, maxLength: 200 }, // 需求截止日期
  35. difficult_problem: { type: String, required: false, maxLength: 500 }, // 难题及瓶颈问题
  36. demand: { type: String, required: false, maxLength: 500 }, // 企业解决需求
  37. company: { type: String, required: false, maxLength: 500 }, // 单位名称
  38. address: { type: String, required: false, maxLength: 500 }, // 单位地址
  39. team: { type: String, required: false, maxLength: 500 }, // 技术团队情况
  40. property: { type: String, required: false, maxLength: 500 }, // 知识产权情况
  41. mature: { type: String, required: false, maxLength: 200 }, // 技术成熟度 0-实验室1-小试2-中试3-成熟
  42. coopercompany: { type: String, required: false, maxLength: 300 }, // 合作企业
  43. other: { type: String, required: false, maxLength: 500 }, // 其他需求
  44. contact_user: { type: String, required: true, maxLength: 200 }, // 联系人
  45. contact_tel: { type: String, required: true, maxLength: 500 }, // 联系电话
  46. };
  47. const schema = new Schema(ProductSchema, { toJSON: { virtuals: true } });
  48. schema.index({ id: 1 });
  49. schema.plugin(metaPlugin);
  50. module.exports = app => {
  51. const { mongoose } = app;
  52. return mongoose.model('Product', schema, 'market_product');
  53. };