Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

表过滤怎么实现 #101

Open
kpub opened this issue Aug 30, 2024 · 1 comment
Open

表过滤怎么实现 #101

kpub opened this issue Aug 30, 2024 · 1 comment

Comments

@kpub
Copy link

kpub commented Aug 30, 2024

如题,在以下的示例中,如果我只需要查询 order, user 两张表中字段的信息,怎么排除 shop 表呢?还是说需要另外建一个实体类

@SearchBean(
    tables = "order o, shop s, user u",  // 三表关联
    where = "o.shop_id = s.id and o.buyer_id = u.id",  // 关联关系
    autoMapTo = "o"  // 未被 @DbField 注解的字段都映射到 order 表
)
public class OrderVO {
    private long id;         // 订单ID   o.id
    private String orderNo;  // 订单号   o.order_no
    private long amount;     // 订单金额 o.amount
    @DbField("s.name")
    private String shop;     // 店铺名   s.name
    @DbField("u.name")
    private String buyer;    // 买家名   u.name
    // 省略 Getter Setter
}
@troyzhxu
Copy link
Owner

troyzhxu commented Sep 2, 2024

推荐另建一个实体类

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants