123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- /**
- * Created by jimiz on 2017/5/12.
- */
- var mongoose = require("mongoose");
- var db = require("../db/unitPriceFile_db");
- var Schema = mongoose.Schema;
- var deleteSchema = require('../../../public/models/delete_schema');
- var consts = require('../../main/models/projectConsts');
- var projectConsts = consts.projectConst;
- var commonConsts = consts.commonConst;
- var GLJList = require('./GLJList');
- var unitPriceFileSchema = new Schema({
- ID: Number,
- name: String,
- version: Number,
- projects: Array,
- deleteInfo: deleteSchema
- });
- var unitPriceFile = db.model("unitPriceFile", unitPriceFileSchema, "unitPriceFile");
- var unitPriceFileDAO = function(){};
- unitPriceFileDAO.prototype.getData = function(fileID, callback){
- unitPriceFile.find({'$or': [{fileID: fileID, deleteInfo: null}, {fileID: fileID, 'deleteInfo.deleted': {$in: [null, false]}}]}, '-_id', function(err, datas){
- if (!err) {
- callback(0, projectConsts.UNITPRICEFILE, datas);
- } else {
- callback(1, '', null);
- }
- });
- };
- unitPriceFileDAO.prototype.save = function(fileId, datas, callback){
- function changed(err, changedDatas){
- sync(fileId, changedDatas, callback);
- }
- GLJList.save(fileID, datas, changed);
- };
- unitPriceFileDAO.prototype.sync = function(fileId, datas, callback){
- };
- unitPriceFileDAO.prototype.newFile = function(data, callback){
- };
- unitPriceFileDAO.prototype.add = function(count, callback){
- GLJList.add(count, callback);
- };
- module.exports = new unitPriceFileDAO();
|