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