昆明有多少做网站的公司,建凡网站,网站开发 环境,个域名的网站建设方案书mybatis查询in的字段有索引#xff0c;比如说是主键查询#xff0c; 但是in的字段过多导致索引失效#xff0c;
这个时候可以考虑将in的数量变少#xff0c; 200以内都可以#xff0c; 在数据库方面采用 foreach unionall 的方式将数据集合查询出来
Service层:
List…mybatis查询in的字段有索引比如说是主键查询 但是in的字段过多导致索引失效
这个时候可以考虑将in的数量变少 200以内都可以 在数据库方面采用 foreach unionall 的方式将数据集合查询出来
Service层:
ListListString zffsDdbhList Lists.partition(ddbhList, MagicNumber.INT200);Dao层:
ListHotelKhSjzfxx getListByDdbhArray(Param(ywdh) ListListString ywdh);sql.xml:
select idgetListByDdbhArray resultTypecn.vetech.center.hotel.entity.HotelKhSjzfxxSELECT * from (foreach collectionywdh itemddbhArray indexindex separatorunion allSELECT * FROM hotel_kh_sjzfxxWHERE ywdh inforeach collectionddbhArray itemddbh open( separator, close)#{ddbh}/foreach/foreach) t/select