Commit 5486cc67 authored by WangXinYu's avatar WangXinYu

Merge remote-tracking branch 'origin/develop' into develop

parents c5180537 29f23585
......@@ -34,13 +34,6 @@ public class ProjectEvaluateServiceImpl implements ProjectEvaluateService {
Integer start = pageSize * (pageNum - 1);
Integer end = pageSize * pageNum;
List<Map<String, Object>> maps = projectEvaluateRepository.listProjectInformationByYear(year, start, end);
if (maps.size() > 0){
for (Map<String, Object> map : maps){
if((double)map.get("energyPotential") < 0){
map.put("energyPotential", 0);
}
}
}
return maps;
}
}
......@@ -2,27 +2,36 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.rcisoft.business.evaluate.project.dao.ProjectEvaluateRepository">
<sql id="listProjectInformationByYearSql">
SELECT
PRO_NM,
BLD_LOCAL,
bbt.BLD_TP_NM,
bp.BLD_AREA,
SUM( WATER + ELEC + GAS ) / bp.BLD_AREA AS energy,
CASE WHEN SUM(WATER + ELEC + GAS) / bp.BLD_AREA - bp.ENERGY_POTENTIAL > 0
THEN SUM(WATER + ELEC + GAS) / bp.BLD_AREA - bp.ENERGY_POTENTIAL ELSE 0 END AS energyPotential,
ecm.YEAR
FROM
bus_project bp
LEFT JOIN energy_count_m ecm ON bp.PRO_ID = ecm.PRO_ID
LEFT JOIN bus_build_tp bbt ON bp.BLD_TP_ID = bbt.BLD_TP_ID
<where>
<if test="year != null and year != '' ">
ecm.YEAR = #{year}
</if>
</where>
GROUP BY
bp.PRO_ID,ecm.YEAR
</sql>
<select id="listProjectInformationByYear" resultType="map">
SELECT
(select count(*) from bus_project) as total,
PRO_NM,
BLD_LOCAL,
bbt.BLD_TP_NM,
bp.BLD_AREA,
SUM( WATER + ELEC + GAS ) / bp.BLD_AREA AS energy,
SUM( WATER + ELEC + GAS ) / bp.BLD_AREA - bp.ENERGY_POTENTIAL AS energyPotential,
ecm.YEAR
FROM
bus_project bp
LEFT JOIN energy_count_m ecm ON bp.PRO_ID = ecm.PRO_ID
LEFT JOIN bus_build_tp bbt ON bp.BLD_TP_ID = bbt.BLD_TP_ID
<where>
<if test="year != null and year != '' ">
ecm.YEAR = #{year}
</if>
</where>
GROUP BY
bp.PRO_ID,ecm.YEAR
LIMIT #{start},#{end}
SELECT
(SELECT count(*) FROM ( <include refid="listProjectInformationByYearSql"/>) s) AS total,
t.*
FROM (
<include refid="listProjectInformationByYearSql"/>
) t
LIMIT #{start},#{end}
</select>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment