参考:
我:
// 自定义排序
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() +")");