Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-zx-biz
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
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
Jobs
Commits
Open sidebar
项目统一框架
一体化_户用光伏项目代码
amos-boot-zx-biz
Commits
cd5fd404
Commit
cd5fd404
authored
Sep 25, 2024
by
hezhuozhi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化电站管理分页接口
parent
80dffa17
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
69 additions
and
11 deletions
+69
-11
HouseholdContractMapper.java
.../boot/module/hygf/api/mapper/HouseholdContractMapper.java
+5
-0
PowerStationEngineeringInfoMapper.java
...le/hygf/api/mapper/PowerStationEngineeringInfoMapper.java
+5
-0
HouseholdContractMapper.xml
...c/main/resources/mapper/mysql/HouseholdContractMapper.xml
+9
-0
PowerStationEngineeringInfoMapper.xml
...ources/mapper/mysql/PowerStationEngineeringInfoMapper.xml
+14
-0
PowerStationServiceImpl.java
...module/hygf/biz/service/impl/PowerStationServiceImpl.java
+36
-11
No files found.
amos-boot-system-jxiop/amos-boot-module-hygf-api/src/main/java/com/yeejoin/amos/boot/module/hygf/api/mapper/HouseholdContractMapper.java
View file @
cd5fd404
...
...
@@ -9,6 +9,9 @@ import com.yeejoin.amos.boot.module.hygf.api.dto.HouseholdContractPageDto;
import
com.yeejoin.amos.boot.module.hygf.api.entity.HouseholdContract
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
import
java.util.Map
;
/**
* Mapper 接口
*
...
...
@@ -21,4 +24,6 @@ public interface HouseholdContractMapper extends BaseMapper<HouseholdContract> {
IPage
<
HouseholdContract
>
selectPage
(
@Param
(
"dto"
)
HouseholdContractPageDto
dto
);
String
getHygfCommercialScale
(
String
peasantHouseholdNumber
);
List
<
Map
<
String
,
String
>>
getHygfCommercialScaleList
(
@Param
(
"list"
)
List
<
String
>
peasantHouseholdNumberList
);
}
amos-boot-system-jxiop/amos-boot-module-hygf-api/src/main/java/com/yeejoin/amos/boot/module/hygf/api/mapper/PowerStationEngineeringInfoMapper.java
View file @
cd5fd404
...
...
@@ -2,6 +2,10 @@ package com.yeejoin.amos.boot.module.hygf.api.mapper;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.yeejoin.amos.boot.module.hygf.api.entity.PowerStationEngineeringInfo
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
import
java.util.Map
;
/**
* 施工电站工程信息 Mapper 接口
...
...
@@ -12,4 +16,5 @@ import com.yeejoin.amos.boot.module.hygf.api.entity.PowerStationEngineeringInfo;
public
interface
PowerStationEngineeringInfoMapper
extends
BaseMapper
<
PowerStationEngineeringInfo
>
{
String
getRealScaleByPeasantHouseholdNo
(
String
peasantHouseholdNumber
);
List
<
Map
<
String
,
String
>>
getRealScaleByPeasantHouseholdNoList
(
@Param
(
"list"
)
List
<
String
>
peasantHouseholdNumberList
);
}
amos-boot-system-jxiop/amos-boot-module-hygf-api/src/main/resources/mapper/mysql/HouseholdContractMapper.xml
View file @
cd5fd404
...
...
@@ -62,4 +62,13 @@
<select
id=
"getHygfCommercialScale"
resultType=
"String"
>
select scale from hygf_commercial where survey_information_id = (select survey_information_id from hygf_peasant_household where peasant_household_no = #{peasantHouseholdNumber} )
</select>
<select
id=
"getHygfCommercialScaleList"
resultType=
"java.util.Map"
>
select hpg.peasant_household_no, hc.scale from hygf_commercial hc
left JOIN hygf_peasant_household hpg ON hpg.survey_information_id=hc.survey_information_id
where hpg.peasant_household_no in
<foreach
item=
"peasantHouseholdNumber"
collection=
"list"
open=
"("
separator=
","
close=
")"
>
#{peasantHouseholdNumber}
</foreach>
</select>
</mapper>
amos-boot-system-jxiop/amos-boot-module-hygf-api/src/main/resources/mapper/mysql/PowerStationEngineeringInfoMapper.xml
View file @
cd5fd404
...
...
@@ -13,4 +13,18 @@
hph.sequence_nbr = hwops.peasant_household_id and
hwops.sequence_nbr = hpsei.work_order_power_station_id
</select>
<select
id=
"getRealScaleByPeasantHouseholdNoList"
resultType=
"java.util.Map"
>
select
hph.peasant_household_no,hpsei.real_scale realScale
from
hygf_peasant_household hph
left join hygf_work_order_power_station hwops on hph.sequence_nbr = hwops.peasant_household_id
left join hygf_power_station_engineering_info hpsei on hwops.sequence_nbr = hpsei.work_order_power_station_id
where
hph.peasant_household_no in
<foreach
item=
"peasantHouseholdNo"
collection=
"list"
open=
"("
separator=
","
close=
")"
>
#{peasantHouseholdNo}
</foreach>
</select>
</mapper>
amos-boot-system-jxiop/amos-boot-module-hygf-biz/src/main/java/com/yeejoin/amos/boot/module/hygf/biz/service/impl/PowerStationServiceImpl.java
View file @
cd5fd404
...
...
@@ -36,10 +36,7 @@ import org.typroject.tyboot.core.rdbms.annotation.Operator;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
import
javax.annotation.Resource
;
import
java.util.Date
;
import
java.util.LinkedHashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.*
;
import
java.util.stream.Collectors
;
/**
...
...
@@ -124,17 +121,45 @@ public class PowerStationServiceImpl extends BaseService<PowerStationDto, PowerS
Page
<
PowerStationDto
>
powerStationDtoPage
=
this
.
queryPage
((
int
)
page
.
getCurrent
(),
(
int
)
page
.
getSize
(),
powerStationCode
,
ownersName
,
serviceAgent
,
regionalCompaniesName
,
processStatus
,
province
);
if
(
powerStationDtoPage
.
getRecords
()
!=
null
&&
powerStationDtoPage
.
getRecords
().
size
()
>
0
)
{
powerStationDtoPage
.
getRecords
().
forEach
(
e
->
{
// if(powerStationDtoPage.getRecords() != null && powerStationDtoPage.getRecords().size() > 0) {
// powerStationDtoPage.getRecords().forEach(e -> {
// if(e.getPowerStationCode() != null) {
// e.setScale(householdContractMapper.getHygfCommercialScale(e.getPowerStationCode()));
// e.setRealScale(powerStationEngineeringInfoMapper.getRealScaleByPeasantHouseholdNo(e.getPowerStationCode()));
// }
// });
//
// }
//优化代码
List
<
PowerStationDto
>
records
=
powerStationDtoPage
.
getRecords
();
if
(
CollectionUtil
.
isNotEmpty
(
records
))
{
List
<
String
>
powerStationCodeList
=
new
ArrayList
<>();
records
.
forEach
(
e
->
{
if
(
e
.
getPowerStationCode
()
!=
null
)
{
e
.
setScale
(
householdContractMapper
.
getHygfCommercialScale
(
e
.
getPowerStationCode
()));
e
.
setRealScale
(
powerStationEngineeringInfoMapper
.
getRealScaleByPeasantHouseholdNo
(
e
.
getPowerStationCode
()));
powerStationCodeList
.
add
(
e
.
getPowerStationCode
());
}
});
if
(
CollectionUtil
.
isNotEmpty
(
powerStationCodeList
)){
List
<
Map
<
String
,
String
>>
hygfCommercialScaleList
=
householdContractMapper
.
getHygfCommercialScaleList
(
powerStationCodeList
);
Map
<
String
,
String
>
scaleMap
=
new
HashMap
<>();
if
(
CollectionUtil
.
isNotEmpty
(
hygfCommercialScaleList
)){
for
(
Map
<
String
,
String
>
stringStringMap
:
hygfCommercialScaleList
)
{
scaleMap
.
put
(
stringStringMap
.
get
(
"peasant_household_no"
),
stringStringMap
.
get
(
"scale"
));
}
}
List
<
Map
<
String
,
String
>>
realScaleByPeasantHouseholdNoList
=
powerStationEngineeringInfoMapper
.
getRealScaleByPeasantHouseholdNoList
(
powerStationCodeList
);
Map
<
String
,
String
>
realScaleMap
=
new
HashMap
<>();
if
(
CollectionUtil
.
isNotEmpty
(
realScaleByPeasantHouseholdNoList
)){
for
(
Map
<
String
,
String
>
stringStringMap
:
realScaleByPeasantHouseholdNoList
)
{
realScaleMap
.
put
(
stringStringMap
.
get
(
"peasant_household_no"
),
stringStringMap
.
get
(
"real_scale"
));
}
}
records
.
forEach
(
e
->
{
e
.
setScale
(
scaleMap
.
get
(
e
.
getPowerStationCode
()));
e
.
setRealScale
(
realScaleMap
.
get
(
e
.
getPowerStationCode
()));
});
}
}
return
powerStationDtoPage
;
}
...
...
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