microbee-http 丨 软件开发框架

//调用模型对照表 McrbHttpClient.mdlst(viewList); function viewList(e){ console.log(e) } //查询列表(可分页) var md = "md72";//模型名称 var page = 1 //页码 var condition = [{lgc:1,ky:'id',oprt:'mcb_geq',vl:222},{lgc:1,ky:'rid',oprt:'mcb_geq',vl:55}]; McrbHttpClient.searchlst(lst,md,page,condition); function lst(e){ console.log(e) } //求和 var md = "md72";//模型名称 var sumby = "id" //求和的字段 var condition = [{lgc:1,ky:'id',oprt:'mcb_geq',vl:222}]; McrbHttpClient.sum(funcsum,md,sumby,condition); function funcsum(e){ console.log(e) } //查询总记录数 var md = "md72";//模型名称 var condition = [{lgc:1,ky:'id',oprt:'mcb_geq',vl:222}]; McrbHttpClient.getcount(funccount,md,condition); function funccount(e){ console.log(e) } //查询符合条件的一条记录 var md = "md72";//模型名称 var condition = [{lgc:1,ky:'id',oprt:'mcb_geq',vl:222}]; McrbHttpClient.gainOne(funcOne,md,condition); function funcOne(e){ console.log(e) } //插入数据 var md = "md72";//模型名称 var sets = {uname:"张三",oid:2,rtime:"1441784199"}; McrbHttpClient.save(ins,md,sets); function ins(e){ console.log(e) } //更新 var md = "md72";//模型名称 var sets = {uname:"张三11",oid:999,rtime:"1441784199"}; var condition = [{lgc:1,ky:'id',oprt:'mcb_eq',vl:243}]; McrbHttpClient.renew(update,md,sets,condition); function update(e){ console.log(e) } //查询所有+多条件 var md = "md87"; //模型名称 var page = 0 //页码 var condition = [ {lgc: 1,ky: 'task_id',oprt: 'mcb_eq',vl: "TK-1655882990080"}, {lgc: 1,ky: 'isdelete',oprt: 'mcb_eq',vl: 0}, ]; McrbHttpClient.searchlst(lst, md, page, condition); function lst(e) { console.log(e); } //根据id更新一条数据 var md = "md72";//模型名称 var sets = {uname:"张三11",oid:999,rtime:"1441784199"}; var id = 243; McrbHttpClient.renewbyid(update,md,sets,id); function update(e){ console.log(e) } //根据id查询一条数据 var md = "md72";//模型名称 var id= 243; McrbHttpClient.gainOneById(funcOne,md,id); function funcOne(e){ console.log(e) } //根据id删除一条数据(物理删除) var md = "md72";//模型名称 var id= 243; McrbHttpClient.removeById(delete,md,id); function delete(e){ console.log(e) } //按条件批量删除(易误删表中所有数据,谨慎使用) var md = "md72";//模型名称 var condition = [{lgc:1,ky:'oid',oprt:'mcb_eq',vl:2}]; // 删除条件 McrbHttpClient.delbycdt(delete,md,condition); function delete(e){ // 回调   console.log(e) } //批量插入数据 var md = "md72"; // 模型名称 var sets = [ // 批量插入的数据   {uname:"张三11",oid:999,rtime:"1441784199"},   {uname:"张三12",oid:999,rtime:"1441784198"} ]; McrbHttpClient.batchInsert(insdate,md,sets); function insdate(e){ // 回调方法   console.log(e) } //查询最大值 var md = "md72"; // 模型名称 var condition = [{lgc:1,ky:'oid',oprt:'mcb_leq',vl:999}]; // 查询条件 var gmaxby = 'id'; // 查询最大值字段名称 McrbHttpClient.gmax(getmax, md, condition, gmaxby); function getmax(e){ // 回调   console.log(e) } //查询最小值 var md = "md72"; // 模型名称 var condition = [{lgc:1,ky:'oid',oprt:'mcb_eq',vl:999}]; // 查询条件 var gminby = 'id'; // 查询最小值字段名称 McrbHttpClient.gmin(getmin, md, condition, gminby); function getmin(e){ // 回调   console.log(e) } //去重查询列表(可分页,可排序,可去重,可设置每页条数) // 简洁版 var md = "md72";//模型名称 var page = 1 //页码 var condition = [{lgc:1,ky:'oid',oprt:'mcb_geq',vl:1}];// 查询条件 McrbHttpClient.searchlstdstct(lst,md,page,condition); function lst(e){// 回调 console.log(e) } // 详细版 var md = "md72";//模型名称 var page = 1 //页码 var page_count = 1; // 每页请求几条数据 var condition = [{lgc:1,ky:'oid',oprt:'mcb_geq',vl:1}]; // 查询条件 var sequence = {id:0}; // 排序 var distinctby = 'oid' // 去重字段 McrbHttpClient.searchlstdstct(lst, md, page, condition, sequence, page_count, distinctby); function lst(e){ // 回调 console.log(e) } //去重查询总记录数 var md = "md72";//模型名称 var condition = [{lgc:1,ky:'oid',oprt:'mcb_geq',vl:1}]; // 查询条件 var distinctby = "oid"; // 去重字段 McrbHttpClient.countdstct(lst, md, condition, distinctby); function lst(e){ console.log(e) } /****高阶api调用***/ var data = {name:"张三",age:2}; McrbHttpClient.ho(funcho,"Test/te",data); function funcho(e){ console.log(e) }
回到
顶部