mysql/oracle操作
mysql/oracle查询
案例:http://dev.manateeai.com/interface?mode=edit&id=221
{"name" : "mysqlQuery",//组件名称"db" : "oracle",//多数据源时查询指定数据源,单数据源时不需要配置"table" : "student",//表名"columns" : "id,name",//要查询的列"queryParams" : { //设置查询条件},"selectOne":true,// 默认查询出list"selectTotalCount":true,//查询list的时候返回totalCount"camelCase":false,// 默认驼峰"condition":"name like ${name} and id >{id}", //sql 表达式"sort":{ // 排序"gmt_modified":"desc","id":"asc"},"in":{ // in查询"key" : "'id'", //要in查询的key"value" : "studentList", //in查询的集合"valueKey" : "id" //in查询集合中映射的key},"page":{ // 分页"pageNum":1,//第几页"pagesize":10//每页多少条},"join":[ //join关联查询{"table" : "project","columns" : "id,name","joinKey" : "project_id","beJoinedKey" : "id","joinType":"left join",//不填默认为 inner join"queryParams" : {"id":35,"condition" : "name = ${projectName}"//sql 表达式}}],"dataHandleBatch" : { //拿到的结果数据批量处理"phone" : "phone","userId" : "user_id"},// "dataHandle" : { //拿到的结果数据单个处理// "phone" : "phone",// "userId" : "user_id"// },"mergeFields":true,//是否将dataHandle后的字段与处理前的字段合并,默认不合并"valueTo" : "request", //放入上下文request,默认为response"returnkey" : "studentList" //数据处理完后选择输出到对象中}
mysql/oracle更新
案例:http://dev.manateeai.com/interface?mode=edit&id=223
{"name":"mysqlUpdate","db" : "oracle",//多数据源时查询指定数据源,单数据源时不需要配置"table":"student",//表名"queryParams":{//查询参数"id":"id"},"updateParams":{//更新参数"name":"name","gender":"gender"}}
mysql/oracle新增
单个新增案例:http://dev.manateeai.com/interface?mode=edit&id=269
批量新增案例:http://dev.manateeai.com/interface?mode=edit&id=222
//单个插入:{"name":"mysqlInsert","db" : "oracle",//多数据源时查询指定数据源,单数据源时不需要配置"table":"student",//表名"insertParams":{//单个插入参数处理"name":"name","gender":"gender"}}//批量插入:{"name" : "mysqlInsert","table" : "test_case","paramsKey":"caseList","insertParamsBatch" : {//批量插入参数处理"name":"strUpperCase(name)","description":"description"}}
mysql/oracle SQL 查询
案例:http://dev.manateeai.com/interface?mode=edit&id=266
{"name":"mysqlSql","db" : "oracle",//多数据源时查询指定数据源,单数据源时不需要配置"sql":"select nick,user_id from uic_user where city='${city}'","dataHandleBatch" : { //拿到的结果数据批量处理"phone" : "phone","userId" : "user_id"},// "dataHandle" : { //拿到的结果数据单个处理// "phone" : "phone",// "userId" : "user_id"// },"mergeFields":true,//是否将dataHandle后的字段与处理前的字段合并,默认不合并"returnkey" : "studentList", //数据处理完后选择输出到对象中"valueTo" : "request" //放入上下文request,默认为response}
mongo操作
mongoDB添加
{"name" : "mongoAdd","db" : "testLowCode","table" : "mongo_test","input" : {"c":"add(a,b)"}}
先执行mapping计算或者数据映射,得到的结果插入mongo中
mongoDB查询
{"name":"mongoQuery","table":"mongo_test","db":"testLowCode","input":{"userId":"60112006b4286d1057775394"},"mergeInput":"true","outputPackage":"data","output":{"d":"json(b)","c":"add(a,b)"}}
先从mongo中查询数据,然后通过output或者outputBatch进行数据处理(非必选)
{"name":"mongoQuery","table":"room","db":"warehouse","input":{"parkId":"60112006b4286d1057775394"},"join":[{"joinKey":"parkId","beJoinedKey":"id","table":"park","cache":"memoryCache","input":{"valid":true}}]}
当涉及到数据join进行如上配置
mongoDB更新
{"name" : "mongoUpdate","input" : "id,b","table" : "mongo_test","db" : "testLowCode"}
mongoDB统计数量
{"name" : "mongoQueryCount","input" : "a,b","table" : "mongo_test","db" : "testLowCode"}
mongo累加器
{"name" : "mongoIncrease","table" : "seller","db" : "supply_chain","input" : {"biz" : "duoduo","userId" : 101},"output" : {"c":"add(d,h)","score":"cal('a+b*5+c*3')"}}
在进行累计之前通过output中计算,最后一条配置如果为数字类型作为结果,写入mongo,param作为mongo的筛选项。
redis操作
单个查询 hash
{"name" : "redisHashFieldsQuery","mergeInput" : true,"key" : "testRedisHashFieldsAdd","input" : "a,b,c","output" : {"f":"arrayToList(a)"},"db" : 0}
单个模糊查询hash
{"name" : "redisHashFieldsFuzzyQuery","pattern" : "*","mergeInput" : true,"key" : "testRedisHashFieldsAdd","output" : {"z":"add(a,b)"},"db" : 0}
插入 hash
{"name" : "redisHashFieldsAdd","key" : "warehouse:banner","input" : {"c":"add(a,b)"},"db" : 0}
删除 hash
{"name" : "redisHashFieldsRemove","key" : "warehouse:banner","input" : "bannerName","db" : 0}
判断 key 是否存在
{"name" : "redisKeyIsExists","key" : "demoRedisStrKey","db" : 0}
模糊查询key
{"db" : 0,"name" : "redisKeysFuzzyQuery","pattern" : "test*"}
新增 key value
{"key" : "demoRedisStrKey","input" : "strValue","name" : "redisKeyValueAdd","db" : 0}
查询 key value
{"key" : "demoRedisStrKey","name" : "redisKeyValueQuery","db" : 0}
删除 key value
{"key" : "demoRedisStrKey","name" : "redisKeyValueRemove","db" : 0}
新增 list value
{"key" : "testRedisList","input" : "test","name" : "redisListValueAdd","db" : 0}
查询 list value
{"key" : "testRedisList","name" : "redisListQuery","db" : 0}
新增 set value
{"key" : "testRedisSet","input" : "test","name" : "redisSetValueAdd","db" : 0}
查询 set value
{"key" : "testRedisSet","name" : "redisSetQuery","db" : 0}
累加
{"name" : "redisValueIncrease","key" : "foo","db" : 0}
