提交 ae4d3740 编写于 作者: zhouweidong's avatar zhouweidong

补充数据集排序

上级 4bcfa97e
......@@ -145,10 +145,23 @@ TARGET=PSDATAENTITY
<#if resultSet??>
<#list resultSet as singleSet>
<#if singleSet.getPSDEDataQueries()??>
<#assign enableOrderby=false>
<#if singleSet.getMajorSortPSDEField()?? || singleSet.getMinorSortPSDEField()??>
<#assign enableOrderby=true>
</#if>
<#assign enableGroup=false>
<#if singleSet.isEnableGroup()>
<#list singleSet.getPSDEDataSetGroupParams() as groupParam>
<#if groupParam.isEnableGroup()>
<#assign enableGroup=true>
<#break>
</#if>
</#list>
</#if>
<!--数据集合[${singleSet.getCodeName()}]-->
<select id="search${singleSet.getCodeName()}" parameterType="${pub.getPKGCodeName()}.core.${de.getPSSystemModule().getCodeName()?lower_case}.filter.${de.codeName}SearchContext" <#if singleSet.isEnableGroup()>resultType="java.util.HashMap"<#else>resultMap="${de.codeName}ResultMap"</#if>>
<#if singleSet.isEnableGroup()>
select <#list singleSet.getPSDEDataSetGroupParams() as groupParam><#if groupParam_index gt 0>,</#if><#if groupParam.isEnableGroup()><#if groupParam.getGroupCode()??>${groupParam.getGroupCode()}<#else>${groupParam.getName()}</#if><#else>${groupParam.getGroupCode()}</#if> as "${groupParam.getName()?lower_case}"</#list> from (
<#if enableGroup || enableOrderby>
select <#if enableGroup><@outputGroup singleSet/><#else>*</#if> from (
</#if>
select t1.* from (
<#list singleSet.getPSDEDataQueries() as dataQuery>
......@@ -160,9 +173,14 @@ TARGET=PSDATAENTITY
)t1
<where><if test="ew!=null and ew.sqlSegment!=null and !ew.emptyOfWhere"><#noparse>${ew.sqlSegment}</#noparse></if></where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere"><#noparse>${ew.sqlSegment}</#noparse></if>
<#if singleSet.isEnableGroup()>
) groupinfo
<#if enableGroup || enableOrderby>
)t1
<#if enableGroup>
group by <#assign groupIndex = 0 ><#list singleSet.getPSDEDataSetGroupParams() as groupParam><#if groupParam.isEnableGroup()><#if groupIndex gt 0>,</#if><#if groupParam.getGroupCode()??>${groupParam.getGroupCode()}<#else>${groupParam.getName()}</#if><#assign groupIndex = groupIndex + 1 ></#if></#list>
</#if>
<#if enableOrderby>
order by <#if singleSet.getMajorSortPSDEField()??>${singleSet.getMajorSortPSDEField().getName()?lower_case}</#if> <#if singleSet.getMajorSortDir()??> ${singleSet.getMajorSortDir()?lower_case}</#if> <#if singleSet.getMinorSortPSDEField()??>, ${singleSet.getMinorSortPSDEField().getName()?lower_case} </#if> <#if singleSet.getMinorSortDir()??> ${singleSet.getMinorSortDir()?lower_case}</#if>
</#if>
</#if>
</select>
......@@ -242,3 +260,8 @@ TARGET=PSDATAENTITY
</#if>
<#return false>
</#function>
<#comment>输出数据集分组</#comment>
<#macro outputGroup singleSet>
<#list singleSet.getPSDEDataSetGroupParams() as groupParam><#if groupParam_index gt 0>,</#if><#if groupParam.isEnableGroup()><#if groupParam.getGroupCode()??>${groupParam.getGroupCode()}<#else>${groupParam.getName()}</#if><#else>${groupParam.getGroupCode()}</#if> as "${groupParam.getName()?lower_case}"</#list>
</#macro>
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册