You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Map<String, Object> params = MapUtils.builder()
// 接收一个 SQL 片段作为参数值,$ 表示当前字段
.field(User::getId).sql("$1 in (select id from xxx)")
.build();
List<User> users = beanSearcher.searchList(User.class, params);
// select * from user u where u.id in (select id from xxx)
Map<String, Object> params = MapUtils.builder()
// 接收一个 SQL 片段作为参数值,$ 表示当前字段
.field(User::getId).sql("exsits (select 1 from xxx where user_id = $1)")
.build();
List<User> users = beanSearcher.searchList(User.class, params);
// select * from user u where exsits (select 1 from xxx where user_id = u.id)
同时操作多个字段:
Map<String, Object> params = MapUtils.builder()
// 接收一个 SQL 片段作为参数值,$ 表示当前字段
.field(User::getId, User::getName).sql("$1 in (10, 11) or $2 like '张%'")
.build();
List<User> users = beanSearcher.searchList(User.class, params);
// select * from user u where u.id in (10, 11) or u.name like '张%'
欢迎讨论
你是否有更好的语法,说说你的理由吧 ^_^
The text was updated successfully, but these errors were encountered:
目的(BeanSearcher Enhancement Proposal)
使用效果
同时操作多个字段:
欢迎讨论
你是否有更好的语法,说说你的理由吧 ^_^
The text was updated successfully, but these errors were encountered: