Skip to content

Commit

Permalink
update/add test case or example
Browse files Browse the repository at this point in the history
  • Loading branch information
automvc committed Sep 23, 2024
1 parent 3e343ba commit 30dd3dd
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,26 +43,29 @@ public static void test() {
orders1.setUserid(1L);

// //一库一表
// List<Myorders> list1 = moreTable.select(orders1, 0, 10); //select 查询前10条记录
// Logger.info("size of records:"+list1.size() + "");
// Printer.printList(list1);
List<Myorders> list1 = moreTable.select(orders1, 0, 10); //select 查询前10条记录
Logger.info("size of records:"+list1.size() + "");
Printer.printList(list1);


//一库多表
Condition condition = BF.getCondition();
condition
// .op("orders.Userid", Op.eq, 2)
.op("userid", Op.eq, 2)
.start(0).size(10) //分页
;
// BF.getSuidRich().select(orders1, 0, 10);


// //一库多表
// Condition condition = BF.getCondition();
// condition
//// .op("orders.Userid", Op.eq, 2)
// .op("userid", Op.eq, 2)
// .start(0).size(10) //分页
// ;

Ordersdetail ordersdetail=new Ordersdetail();
// ordersdetail.setRemark("aaa");
orders1.setOrdersdetail(ordersdetail);

List<Myorders> list2 = moreTable.select(orders1, condition); //select
Logger.info("size of records:"+list2.size() + "");
Printer.printList(list2);
// List<Myorders> list2 = moreTable.select(orders1, condition); //select
// Logger.info("size of records:"+list2.size() + "");
// Printer.printList(list2);


// //全域查询. 但分页不准确. 数量,排序 TODO
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ public static void test() {
MoreTable moreTable = BeeFactory.getHoneyFactory().getMoreTable();

Myorders orders1 = new Myorders();
orders1.setUserid(2L);
// orders1.setUserid(2L);

//一库多表
Condition condition = BF.getCondition();
condition
.op("myorders.userid", Op.eq, 2)
.op("myorders.userid", Op.eq, 3)
// .op("myorders.userid", Op.eq, 1)
// .op("ordersdetail.userid", Op.eq, 1)
// .op("userid", Op.eq, 2)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
import org.teasoft.bee.osql.api.Condition;
import org.teasoft.bee.osql.api.MoreTable;
import org.teasoft.exam.bee.osql.moretable.entity.Assignexam;
import org.teasoft.exam.bee.osql.sharding.InitSameDsUtil;
import org.teasoft.exam.bee.osql.sharding.ShardingInitData;
import org.teasoft.exam.comm.Printer;
import org.teasoft.honey.osql.core.BeeFactory;
import org.teasoft.honey.osql.core.BeeFactoryHelper;
Expand All @@ -24,14 +26,18 @@
public class MoreTableFun {

public static void main(String[] args) {

ShardingInitData.init(); // 分片
InitSameDsUtil.initDS();

test();
}

public static void test() {
try {
MoreTable moreTable = BeeFactory.getHoneyFactory().getMoreTable();
Condition distinctCondition0 = BeeFactoryHelper.getCondition();
distinctCondition0.selectDistinctField("assignexam.id")
distinctCondition0.selectDistinctField("assignexam.id")
// .selectFun(FunctionType.MAX, "assignexam.id")
// .selectField("assignexam.id")
;
Expand Down

0 comments on commit 30dd3dd

Please sign in to comment.