opengoofy/crane4j

数据源容器支持“先从 A 找,找不到再从 B 找……”的场景

Opened this issue · 0 comments

在实际使用中,经常会面临 “先从 A 找,找不到再从 B 找……” 这类场景,希望从数据源容器的层面基于支持,比如:

@Assemble(
    container = "user", 
    candidateContainers = { "tenant", “organization” }, // 指定候补容器
    props = "name"
)
private Integer id;

在上述示例中,将先根据 ID 从 user 容器中查询,如果查不到再依次从 tenantorganization 容器中查询。

由于目前 AssembleOperationHandlerAbstractBeanOperationExecutor 都是以容器为单位执行操作的,因此需要考虑如何兼容这部分逻辑。