1、引入lombok支持,重构JavaBean 将 常规getter/setter去除
2、去除Gson 依赖
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
import com.google.gson.Gson;
|
||||
import net.tccn.base.FileKit;
|
||||
import net.tccn.base.Kv;
|
||||
import net.tccn.base.MetaKit;
|
||||
@@ -7,11 +6,13 @@ import net.tccn.dbq.fbean.FBean;
|
||||
import net.tccn.dbq.jdbc.api.DbAccount;
|
||||
import net.tccn.dbq.jdbc.api.DbKit;
|
||||
import net.tccn.dbq.parser.ParseMysql;
|
||||
import net.tccn.meta.MetaService;
|
||||
import net.tccn.meta.MetaTable;
|
||||
import net.tccn.qtask.TaskEntity;
|
||||
import net.tccn.qtask.TaskKit;
|
||||
import net.tccn.user.User;
|
||||
import org.junit.Test;
|
||||
import org.redkale.convert.json.JsonConvert;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Date;
|
||||
@@ -25,6 +26,7 @@ import static java.util.Arrays.asList;
|
||||
* @author: liangxianyou at 2019/1/20 12:43.
|
||||
*/
|
||||
public class RunTest<T> {
|
||||
JsonConvert convert = JsonConvert.root();
|
||||
|
||||
/*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));
|
||||
@@ -48,7 +50,11 @@ public class RunTest<T> {
|
||||
ParseMysql parser = new ParseMysql();
|
||||
//@Test
|
||||
public void parseFBeanTest() {
|
||||
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 str = "{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 fBean = new Gson().fromJson(str, FBean.class);
|
||||
FBean fBean = convert.convertFrom(FBean.class, str);
|
||||
|
||||
String[] parse = parser.parse(fBean);
|
||||
|
||||
@@ -228,8 +234,27 @@ public class RunTest<T> {
|
||||
TaskEntity entity = TaskEntity.dao.findByKey("23074420");
|
||||
|
||||
if (entity != null) {
|
||||
System.out.printf("------------------------%n%s%n------------------------%n", new Gson().toJson(TaskKit.taskRun(entity)));
|
||||
System.out.printf("------------------------%n%s%n------------------------%n", convert.convertTo(TaskKit.taskRun(entity)));
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void dataToFileTest() {
|
||||
|
||||
List<MetaService> metaServices = MetaService.dao.find();
|
||||
|
||||
|
||||
JsonConvert convert = JsonConvert.root();
|
||||
System.out.println(convert.convertTo(metaServices));
|
||||
|
||||
MetaService metaService = new MetaService();
|
||||
|
||||
|
||||
/*try {
|
||||
FileKit.strToFile(gson.toJson(metaServices), file);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}*/
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user