Commit 790fd9e1 authored by gaoliwei's avatar gaoliwei

修改项目评估查询总条数不准确问题,优化

parent 03e5e5d7
......@@ -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,15 +2,15 @@
<!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">
<select id="listProjectInformationByYear" resultType="map">
<sql id="listProjectInformationByYearSql">
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,
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
......@@ -23,6 +23,15 @@
</where>
GROUP BY
bp.PRO_ID,ecm.YEAR
</sql>
<select id="listProjectInformationByYear" resultType="map">
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