class Bus_bid {
private String cusId;
@One(field = "cusId")
private Bus_customer customer;
}
class Bus_customer {
private String name;
}
现在想查询Bus_customer中name like '%name%'的Bus_bid列表,我用NutzWk中的data查询,看了下代码有fetchLinks(list, linkName, cnd)方法,我试了一下,结果没有用,只是查询出所有的Bus_bid列表。
Cnd cnd = Cnd.NEW();// 自身的查询条件
Cnd linkCnd = Cnd.NEW();// 关联查询条件
linkCnd.and("name", "like", "%" + cusName + "%");
busBidService.data(length, start, draw, order, columns, cnd, "customer", linkCnd);
[DEBUG] 2017-12-26 09:48:18,879 org.nutz.dao.impl.sql.run.NutDaoExecutor.printSQL(NutDaoExecutor.java:388) - SELECT COUNT(*) FROM bus_bid WHERE subId=?
| 1 |
|----------------------------------|
| c272fb65a9e043fc892a7d0d2026123f |
For example:> "SELECT COUNT(*) FROM bus_bid WHERE subId='c272fb65a9e043fc892a7d0d2026123f'"
[DEBUG] 2017-12-26 09:48:18,882 org.nutz.dao.impl.sql.run.NutDaoExecutor.printSQL(NutDaoExecutor.java:388) - SELECT * FROM bus_bid WHERE subId=? ORDER BY bidAt DESC LIMIT 0, 10
| 1 |
|----------------------------------|
| c272fb65a9e043fc892a7d0d2026123f |
For example:> "SELECT * FROM bus_bid WHERE subId='c272fb65a9e043fc892a7d0d2026123f' ORDER BY bidAt DESC LIMIT 0, 10 "
[DEBUG] 2017-12-26 09:48:23,500 org.quartz.impl.jdbcjobstore.JobStoreSupport$ClusterManager.manage(JobStoreSupport.java:3923) - ClusterManager: Check-in complete.
[DEBUG] 2017-12-26 09:48:24,367 org.nutz.dao.impl.sql.run.NutDaoExecutor.printSQL(NutDaoExecutor.java:388) - SELECT * FROM bus_customer WHERE id=?
| 1 |
|----------------------------------|
| 77a5af6951d349be9902df0ffa3554b0 |
For example:> "SELECT * FROM bus_customer WHERE id='77a5af6951d349be9902df0ffa3554b0'"
请问是不是我使用有错误?如果写自定义SQL效率是不是要快些?