例如:public List<model> getlistbyid( int [ ] ids )
{
stringbuilder sql=new stringbuilder (@" select * from A left join B on a.sid=b.sid where a.cid is not null ")
if(ids !=null )
sql.append( @" and a.sid in {0} ",string .join ("," , ids) );
............
}
注:以上的sql语句是表示根据sid来链表查询, 然后根据传进来的这个 ids 的集合来查询相对应的几条记录。