参考:
我:
// 自定义排序
List<String> barCodeList = this.getBarCodeListByImageSearchKey();
entityWrapper.in("bar_code",barCodeList);
StringBuilder builder = new StringBuilder();
int length = barCodeList.size();
for(int i=0; i<length; i++){
if(i==0){
builder.append(barCodeList.get(i));
}else{
builder.append(",")
.append(barCodeList.get(i));
}
}
// 拼接成这样:order by field(bar_code,001,002,003,004)
entityWrapper.orderBy("FIELD(bar_code,"+ builder.toString() +")");
版权声明:本文为baidu_36583119原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。