Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Z
zhny
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
王夏晖
zhny
Commits
790fd9e1
Commit
790fd9e1
authored
Apr 23, 2018
by
gaoliwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改项目评估查询总条数不准确问题,优化
parent
03e5e5d7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
28 deletions
+30
-28
ProjectEvaluateServiceImpl.java
...uate/project/service/impl/ProjectEvaluateServiceImpl.java
+0
-7
ProjectEvaluateMapper.xml
...rces/mapper/sys/evaluate/mapper/ProjectEvaluateMapper.xml
+30
-21
No files found.
src/main/java/org/rcisoft/business/evaluate/project/service/impl/ProjectEvaluateServiceImpl.java
View file @
790fd9e1
...
@@ -34,13 +34,6 @@ public class ProjectEvaluateServiceImpl implements ProjectEvaluateService {
...
@@ -34,13 +34,6 @@ public class ProjectEvaluateServiceImpl implements ProjectEvaluateService {
Integer
start
=
pageSize
*
(
pageNum
-
1
);
Integer
start
=
pageSize
*
(
pageNum
-
1
);
Integer
end
=
pageSize
*
pageNum
;
Integer
end
=
pageSize
*
pageNum
;
List
<
Map
<
String
,
Object
>>
maps
=
projectEvaluateRepository
.
listProjectInformationByYear
(
year
,
start
,
end
);
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
;
return
maps
;
}
}
}
}
src/main/resources/mapper/sys/evaluate/mapper/ProjectEvaluateMapper.xml
View file @
790fd9e1
...
@@ -2,27 +2,36 @@
...
@@ -2,27 +2,36 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<!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"
>
<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
id=
"listProjectInformationByYear"
resultType=
"map"
>
SELECT
SELECT
(select count(*) from bus_project) as total,
(SELECT count(*) FROM (
<include
refid=
"listProjectInformationByYearSql"
/>
) s) AS total,
PRO_NM,
t.*
BLD_LOCAL,
FROM (
bbt.BLD_TP_NM,
<include
refid=
"listProjectInformationByYearSql"
/>
bp.BLD_AREA,
) t
SUM( WATER + ELEC + GAS ) / bp.BLD_AREA AS energy,
LIMIT #{start},#{end}
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>
</mapper>
</mapper>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment