node package manager
Easy sharing. Manage teams and permissions with one click. Create a free org »

n2hws

n2hws框架

基于nodejs的MV/Socket框架 示例项目:https://gitee.com/xinyustudio/n2hws-simple

Relatoin用法

let r = new Relation('Goods','GoodsID,ClassID','GoodsID');
r.hasOne({
    name:'Class',
    table:'GoodsClass',
    fields:['ClassID','Title'],
    pk:'ClassID',
    fk:'ClassID'
}).hasMany({
    name:'Stock',
    table:'Stock',
    fields:'GoodsID,Amount,StoreID',
    where:{StoreID:1},
    pk:'GoodsID',
    fk:'GoodsID'
}).extend({
    name:'class',
    table:'GoodsClass',
    fields:['GoodsID',['Title','ClassTitle']],
    pk:'ClassID',
    fk:'ClassID'
}).objects([1,2]).then(r=>{
    this.success(r)
}).catch(err=>{
    this.error(err)
})