package cn.alan.wms; import cn.alan.wms.async.Async; import cn.alan.wms.bean.User; import cn.alan.wms.listener.OnCompleteListener; import cn.alan.wms.tools.OperateSql; import cn.alan.wms.tools.Logger; import java.util.ArrayList; import java.util.List; public class Main { public static void main(String[] args) { new Async<List<User>>().create(new Async.AsyncTask<>() { @Override protected void subscribe(OnCompleteListener<List<User>> s) { List<User> list = new ArrayList<>(); OperateSql.of().connect() .statement("select * from user") .query(User.class,list::add) .close(); s.next(list); } }).subscribe(new OnCompleteListener<>() { @Override public void start() { } @Override public void next(List<User> list) { Logger.debug("list->"+list.size()); } @Override public void error(String error) { } @Override public void complete() { } }); new Async<Integer>().create(new Async.AsyncTask<Integer>() { @Override protected void subscribe(OnCompleteListener<Integer> s) { String name = String.valueOf(System.currentTimeMillis()); OperateSql.of() .connect() .statement("insert into user (name, sex) VALUES (?,?)",name,1) .update(s::next) .close(); } }).subscribe(new OnCompleteListener<Integer>() { @Override public void start() { } @Override public void next(Integer integer) { Logger.debug("新增结果code->"+integer); } @Override public void error(String error) { } @Override public void complete() { } }); } }
标签:11,cn,23,void,new,2023,Override,import,public From: https://www.cnblogs.com/wllovelmbforever/p/17852635.html