<#list sortResourceTableColumns as column>
<#if column_index = 0>//第一条数据
<#if ((column.resourcecolumnIndexType??) && column.resourcecolumnIndexType == 1)>
order by ${column.resourcecolumnCode?replace("([a-z])([A-Z]+)","$1_$2","r")?lower_case} asc
<#elseif ((column.resourcecolumnIndexType??) && column.resourcecolumnIndexType == 2)>
order by ${column.resourcecolumnCode?replace("([a-z])([A-Z]+)","$1_$2","r")?lower_case} desc
</#if>
<#else>
<#if ((column.resourcecolumnIndexType??) && column.resourcecolumnIndexType == 1)>
,${column.resourcecolumnCode?replace("([a-z])([A-Z]+)","$1_$2","r")?lower_case} asc
<#elseif ((column.resourcecolumnIndexType??) && column.resourcecolumnIndexType == 2)>
,${column.resourcecolumnCode?replace("([a-z])([A-Z]+)","$1_$2","r")?lower_case} desc
</#if>
</#if>
</#list>
freemarker遍历list拼接字符串
数据库排序与索引优化
最新推荐文章于 2022-08-25 11:04:41 发布
这段代码用于生成SQL查询中的排序语句,根据资源列的索引类型决定升序或降序排列。当处理第一条数据时,会依据索引类型进行asc或desc排序,对于后续数据则作为额外的排序条件。此段代码对于数据库查询性能优化具有重要意义。
1820

被折叠的 条评论
为什么被折叠?



