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

  

posted @ 2018-05-07 14:55  小码农2017  阅读(367)  评论(0编辑  收藏  举报