<select id="GetSnCityDataByYear" parameterType="java.util.Map" resultMap="BaseResultMap">
select * from (
(
SELECT c.CityID,c.CityName,y.YearDimID,y.YearName,i.IndicatorID,i.IndicatorName,ey.Total,ey.Ranking,ey.GrownPercent,ey.GrownRanking
FROM indicator i LEFT JOIN economicdatayear ey ON i.IndicatorID = ey.IndicatorID
LEFT JOIN yeardim y on y.YearDimID = ey.YearDimID
LEFT JOIN city c ON c.CityID = ey.CityID
where i.IndicatorStatus = 1 and c.IsShengneiCity = 1 and c.IsCityArea = 0 and c.CityID = 1
and i.IndicatorID = #{zbId}
and y.YearDimID = #{year}
)
union all
(
SELECT c.CityID,c.CityName,y.YearDimID,y.YearName,i.IndicatorID,i.IndicatorName,ey.Total,ey.Ranking,ey.GrownPercent,ey.GrownRanking
FROM indicator i LEFT JOIN economicdatayear ey ON i.IndicatorID = ey.IndicatorID
LEFT JOIN yeardim y on y.YearDimID = ey.YearDimID
LEFT JOIN city c ON c.CityID = ey.CityID
where i.IndicatorStatus = 1 and c.IsShengneiCity = 1 and c.IsCityArea = 0 and c.CityID != 1
and i.IndicatorID = #{zbId}
and y.YearDimID = #{year}
)
) t
order by CityID = 1 desc
<if test="con==0">
,Total desc
</if>
<if test="con==1">
,Ranking
</if>
<if test="con==2">
,Ranking desc
</if>
<if test="con==3">
,GrownRanking
</if>
<if test="con==4">
,GrownRanking desc
</if>
</select>
更多内容请访问:IT源点
注意:本文归作者所有,未经作者允许,不得转载