mybatis-plus 不用QueryWrapper怎么实现自定义sql in查询
@Select("SELECT s.id submit_id,s.create_time,s.submit_content,s.rule_id,s.is_overtime,s.staff_id,t.staff_name,t.staff_avatar " +
"FROM application.report_submit s LEFT JOIN application.enterprise_staff t on t.staff_id = s.staff_id " +
"where s.id in (${coll})")
List<Map<String,Object>> testGetList(@Param(Constants.COLLECTION) List<Integer> ids);
这个生成的sql 后面 是这样where s.id in ([20, 21, 22])
或者
@Select("SELECT s.id submit_id,s.create_time,s.submit_content,s.rule_id,s.is_overtime,s.staff_id,t.staff_name,t.staff_avatar " +
"FROM application.report_submit s LEFT JOIN application.enterprise_staff t on t.staff_id = s.staff_id " +
"where s.id in " +
"<foreach collection=#{ids} item=id index=index" +
" open=\"(\" close=\")\" separator=\",\">" +
" #{id}" +
"</foreach>")
List<Map<String,Object>> testGetList(@Param("ids") List<Integer> ids);
这个就报错 id找不到 #{id}
因为wrapper好像只能传一个 所以 有些条件得这样写 或者说 可不可以传多个wrapper进查询
@Param(Constants.WRAPPER) Wrapper wrapper