.
This commit is contained in:
@@ -1,18 +1,28 @@
|
||||
import net.tccn.qtask.E;
|
||||
import net.tccn.qtask.QRuner;
|
||||
import com.google.gson.Gson;
|
||||
import net.tccn.base.Kv;
|
||||
import net.tccn.base.RealType;
|
||||
import net.tccn.dbq.fbean.FBean;
|
||||
import net.tccn.dbq.fbean.ParseMysql;
|
||||
import net.tccn.dbq.jdbc.api.DbAccount;
|
||||
import net.tccn.dbq.jdbc.api.DbKit;
|
||||
import net.tccn.qtask.QRuner;
|
||||
import net.tccn.qtask.Task;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author: liangxianyou at 2019/1/20 12:43.
|
||||
*/
|
||||
public class RunTest<T> {
|
||||
|
||||
public static E A = new E("mysql", "select * from user where userid=#(userid)", "查询用户列表", Kv.of("userid", 1));
|
||||
public static E B = new E("method", "User.say", "user调用", Kv.of("name", "张三").set("age", 13));
|
||||
public static E C = new E("http", "http://127.0.0.1/meta/db_plat_list?platToken=3421432", "查询数据平台列表", Kv.of("abx", "abx111"));
|
||||
public static E d = new E("es", "http://192.168.91.5:9200/_sql?", "查询数据平台列表", Kv.of("sql", "select * from basic_iotdevice_all limit 10"));
|
||||
public static E e = new E("http", "http://192.168.91.5:9200/_sql?sql=select%20*%20from%20basic_iotdevice_all%20limit%2010", "查询数据平台列表", Kv.of());
|
||||
public static Task A = new Task("mysql", "select * from user where userid=#(userid)", "查询用户列表", Kv.of("userid", 1));
|
||||
public static Task B = new Task("method", "User.say", "user调用", Kv.of("name", "张三").set("age", 13));
|
||||
public static Task C = new Task("http", "http://127.0.0.1/meta/db_plat_list?platToken=3421432", "查询数据平台列表", Kv.of("abx", "abx111"));
|
||||
public static Task d = new Task("es", "http://192.168.91.5:9200/_sql?", "查询数据平台列表", Kv.of("sql", "select * from basic_iotdevice_all limit 10"));
|
||||
public static Task e = new Task("http", "http://192.168.91.5:9200/_sql?sql=select%20*%20from%20basic_iotdevice_all%20limit%2010", "查询数据平台列表", Kv.of());
|
||||
|
||||
//@Test
|
||||
public void t() {
|
||||
@@ -26,4 +36,66 @@ public class RunTest<T> {
|
||||
|
||||
//System.out.println(query.getClass());
|
||||
}
|
||||
ParseMysql parser = new ParseMysql();
|
||||
@Test
|
||||
public void t2() {
|
||||
FBean fBean = new Gson().fromJson("{name:'user_service', filters:[{col:'a.username',type:'like',value:'lxy'}], orders:[{col:a.`id`,desc: -1},{col:a.`deptName`,desc: 1}], limit:{ps:2,pn:10}}", FBean.class);
|
||||
|
||||
String[] parse = parser.parse(fBean);
|
||||
|
||||
System.out.println("count:" + parse[0]);
|
||||
System.out.println("list:" + parse[1]);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void jdbcTest() {
|
||||
//DbAccount jdbcAccount = new DbAccount("jdbc:mysql://192.168.202.11:3306/gxbii_dev", "root", "eversec123098");
|
||||
DbAccount dbAccount = new DbAccount();
|
||||
dbAccount.setCate("mysql");
|
||||
dbAccount.setUrl("jdbc:mysql://192.168.202.11:3306/gxbii_dev");
|
||||
dbAccount.setUser("root");
|
||||
dbAccount.setPwd("eversec123098");
|
||||
|
||||
DbKit dbKit = new DbKit(dbAccount);
|
||||
|
||||
// find list
|
||||
List<Map> list = dbKit.findList("select * from basic_concat limit 1", Map.class);
|
||||
System.out.println(list.get(0));
|
||||
|
||||
|
||||
//find count
|
||||
/*long total = dbKit.queryColumn("select count(1) from basic_device", long.class);
|
||||
System.out.println(total);
|
||||
System.out.println(int.class);*/
|
||||
}
|
||||
|
||||
@Test
|
||||
public void toAsTest() {
|
||||
Date date = Kv.toAs("2019-03-17 12:11:12", Date.class);
|
||||
System.out.println(date);
|
||||
System.out.println("--------------");
|
||||
Long aLong = Kv.toAs("34132213", Long.class);
|
||||
System.out.println(aLong);
|
||||
|
||||
System.out.println("--------------");
|
||||
Integer integer = Kv.toAs("34132213", Integer.class);
|
||||
System.out.println(integer);
|
||||
|
||||
System.out.println("--------------");
|
||||
Short aShort = Kv.toAs("121", short.class);
|
||||
System.out.println(aShort);
|
||||
|
||||
System.out.println("--------------");
|
||||
Double aDouble = Kv.toAs("4658132213", double.class);
|
||||
System.out.println(aDouble);
|
||||
|
||||
System.out.println("--------------");
|
||||
String s = Kv.toAs("4658132213", String.class);
|
||||
System.out.println(s);
|
||||
|
||||
System.out.println("--------------");
|
||||
Date date1 = Kv.toAs("Sun Mar 17 12:11:12 CST 2019", Date.class);
|
||||
System.out.println(date1);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user