//单体模板库
const mongoose = require('mongoose');
const Schema = mongoose.Schema;
const oprSchema = require('../all_schemas/opr_schema');
const billCodeLib = new Schema({
        ID:{type:String,index:true},
        creator: String,
        createDate: Number,
        recentOpr: [oprSchema],
        name: String,
        compilationID: String
    },
    {versionKey: false}
);

mongoose.model("std_bill_code_lib", billCodeLib,"std_bill_code_lib");



const billCodeItem = new Schema({
    ID:{type:String,index:true},
    libID: {type:String,index:true},
    code: {type:String},
    name: String,
    formatName: String,
    formatName2: String,
    unit: String,
    subArea: Boolean,
    startValue: Number,
    stepValue: Number,
    startCode: Number,
},
{versionKey: false}
);

billCodeItem.index({ libID: 1, code: 1 });
mongoose.model("std_bill_code_item", billCodeItem,"std_bill_code_item");