JFinal SQL in 查询排序

SQL in 查询会默认把顺序打乱,在JFinal中,可以用case when then end来解决。

代码模板如下:

    select * from table where id in(
	  #for(x:cond)
		#(for.index == 0 ? "" : ",") #para(x)
	    #end
	)
	order by case id
	#for(x:cond)
	     when #para(x) then #(for.index)
	#end
	     end

  

原文地址:https://www.cnblogs.com/sxf2017/p/9002732.html