@Select mybaties拼接in查询

管理员 73次浏览

摘要:in查询 @select

正文:

					
					    
@Override
public List<String> getCheckedList(List<String> nos) {
StringBuffer sb = new StringBuffer();
nos.stream().forEach(d -> {
sb.append("'" + d + "'").append(",");
});
String strNos = sb.substring(0, sb.length() - 1);
return baseMapper.getCheckedList(strNos);
}




@Select("SELECT\n" +

"\tf.`no` \n" +
"FROM\n" +
"\t( SELECT * FROM project_structure ps WHERE ps.`no` IN (${nos})) f\n" +
"\tLEFT JOIN ( SELECT * FROM project_structure ps WHERE ps.`no` IN (${nos})) ff ON f.`no` = ff.pid \n" +
"WHERE\n" +
"\tff.id IS NULL")
List<String> getCheckedList(@Param("nos") String nos);

表情

共0条评论