- This repository contains some classes about DataSet used in the KeyHub project.
<dependency>
<groupId>io.github.keyhub-projects</groupId>
<artifactId>kh-data</artifactId>
<version>2.0.1</version>
</dependency>
implementation 'io.github.keyhub-projects:kh-data:2.0.1'
- Almost setter made by fluent interface.
- It returns the instance itself.
- It means that you can chain methods.
- For example,
tbl.where("b", EQUAL, 10).selectAll()
.
- You can use the
Tbl.from()
method to convert the List<Map<String, Object>>
to Tbl
.
- You can use the
toRowMapList()
method to convert the Tbl
to List<Map<String, Object>>
.
- This is an example of how to use the
Tbl
class.
public List<OrderDetailView> findOrderedDetailViewList(String userId) throws IllegalAccessException {
List<Order> orderList = orderJpaRepository.findByUserId(userId);
List<PgView> pgViewList = pgClient.findPgViewListByUserId(userId);
List<WmsView> wmsViewList = wmsClient.findWmsViewListByUserId(userId);
Tbl orderTbl = Tbl.from(orderList);
Tbl pgTbl = Tbl.from(pgViewList);
Tbl wmsTbl = Tbl.from(wmsViewList);
Tbl result = orderTbl.innerJoin(pgTbl)
.on("id", "orderId")
.selectAll()
.toTbl()
.innerJoin(wmsTbl)
.on("id", "orderId")
.selectAll()
.toTbl();
List<Map<String, Object>> mapList = result.toRowMapList();
return mapList.stream()
.map(OrderDetailView::fromRowMap)
.toList();
}