A模型有B模型的关联对象,但我查询的时候搜索条件是B的字段?怎么实现?
那如果写sql的话你会怎么写?
来自炫酷的 NutzCN
SELECT customer_nickNameFROM xy_customer WHERE customer_id IN (SELECT order_fk_customer_id FROM xy_order WHERE order_status = 2);
参考自定义SQL的文档,类似下面的方式(未参数化)
String name = dao.execute(Sqls.fetchString("SELECT customer_nickName FROM xy_customer WHERE customer_id IN (SELECT order_fk_customer_id FROM xy_order WHERE order_status = 2)")).getString();