1.0.8 • Published 5 years ago

lightning-yzh v1.0.8

Weekly downloads
9
License
ISC
Repository
-
Last release
5 years ago

用法简单介绍

1.建模 数据类型 只有 Number String 2.模块 find 支持字符串+对象 2种格式

Order.find({
    transaction: 1, //是否使用事务
    sqlKey: '', //事务key
},'id=111 and create_time<=1555298037',...)
Order.find(req,{
    id:'111',
    create_time: [{ $gte: 1555298037 }, { $lte: 1555298037 }],
    $or:{
        code:'339',
        name:{$like:'339'}
    },
    order_id:{$in:[1,2,3]}, //$nin
    order_id:{$ne:1},
}, {  //更多限制 可选
    left:{ //支持数组(多表关联)和对象2种格式
        table:'medic_doctor',
        select:['real_name','code','doctor_from','mobile'], //查询属性 必填,不配置则为表所有字段查询
        leftId: 'medic_doctor_id'  //关联字段 可选,不配置则为主表主键
        rightId: 'medic_doctor_id'  //关联字段 可选,不配置则和leftId一样
    },
    pageSize: 10,
    pageNum: 0
})

3.模块 count 4.模块 findOne 5.模块 insert 6.模块 update

Department.update(req, { medic_department_id: body.medic_department_id }, body, cb_auto)

7.类 query 8.类 count 9.类 queryOne 10.类 rollBack 11.类 commit 12.9类 getSqlKey 13.模块 batchUpdate

 TemplateDistributionArea.batchUpdate({
                headers: req.headers,
                transaction:true,
                sqlKey: result.sqlKey
            },{
                medic_template_distribution_area_id: {
                    $in: updateList.map(item => item.medic_template_distribution_area_id)
                }
            }, {
                  data: updateList.map(item => {
                    return {
                        medic_template_distribution_area_id: item.medic_template_distribution_area_id,
                        name: item.cityname,
                        first_piece: item.firstNum,
                        first_freight: item.firstPrice,
                        full_free: item.fullSubPrice,
                        is_full_free: item.fullSubStatus,
                        follow_piece: item.moreNum,
                        follow_freight: item.morePrice,
                        province_array: item.cityList.join(',')
                    }
                  })
                }, cb_auto);

注意,数据库设计规范,所有id必须是table名+_id的格式,create_time 和 modify_time 必须要+int(10)格式

//todo 联表操作 筛选 各种函数操作 as 聚合运算 //更新日志 增加了事务参数 增加了不等于

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago