Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
H
hzsomms
Project
Project
Details
Activity
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
ZTGK
hzsomms
Commits
3fae48b1
Commit
3fae48b1
authored
Jul 11, 2023
by
hkl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:1.更新线路管理
parent
1b7860ed
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
27 deletions
+22
-27
TrainStationEditDTO.java
.../jeecg/modules/subwayNetwork/dto/TrainStationEditDTO.java
+2
-2
SubwaySectionMapper.xml
.../modules/subwayNetwork/mapper/xml/SubwaySectionMapper.xml
+1
-0
SubwaySectionServiceImpl.java
.../subwayNetwork/service/impl/SubwaySectionServiceImpl.java
+19
-25
No files found.
jeecg-module-system/src/main/java/org/jeecg/modules/subwayNetwork/dto/TrainStationEditDTO.java
View file @
3fae48b1
...
@@ -22,8 +22,8 @@ public class TrainStationEditDTO {
...
@@ -22,8 +22,8 @@ public class TrainStationEditDTO {
@ApiModelProperty
(
value
=
"车站编码"
)
@ApiModelProperty
(
value
=
"车站编码"
)
private
String
stationCode
;
private
String
stationCode
;
@ApiModelProperty
(
value
=
"线别
Code
"
)
@ApiModelProperty
(
value
=
"线别
id
"
)
private
String
lineAlias
Code
;
private
String
lineAlias
Id
;
@ApiModelProperty
(
value
=
"起始里程"
)
@ApiModelProperty
(
value
=
"起始里程"
)
private
BigDecimal
startingMileage
;
private
BigDecimal
startingMileage
;
...
...
jeecg-module-system/src/main/java/org/jeecg/modules/subwayNetwork/mapper/xml/SubwaySectionMapper.xml
View file @
3fae48b1
...
@@ -16,6 +16,7 @@
...
@@ -16,6 +16,7 @@
(SELECT line_alias_name FROM t_sn_line_alias WHERE id = t1.line_alias_id limit 1) line_alias_name,
(SELECT line_alias_name FROM t_sn_line_alias WHERE id = t1.line_alias_id limit 1) line_alias_name,
t1.section_starting_mileage,
t1.section_starting_mileage,
t1.section_end_mileage,
t1.section_end_mileage,
t1.section_starting_mileage-t1.section_end_mileage sectionMileage,
t1.remark
t1.remark
FROM
FROM
t_sn_subway_section t1 LEFT JOIN t_sn_light_rail t2 ON t1.light_rail_id = t2.id
t_sn_subway_section t1 LEFT JOIN t_sn_light_rail t2 ON t1.light_rail_id = t2.id
...
...
jeecg-module-system/src/main/java/org/jeecg/modules/subwayNetwork/service/impl/SubwaySectionServiceImpl.java
View file @
3fae48b1
...
@@ -48,24 +48,31 @@ public class SubwaySectionServiceImpl extends ServiceImpl<SubwaySectionMapper, S
...
@@ -48,24 +48,31 @@ public class SubwaySectionServiceImpl extends ServiceImpl<SubwaySectionMapper, S
@Override
@Override
public
void
edit
(
SubwaySectionEditDTO
dto
)
{
public
void
edit
(
SubwaySectionEditDTO
dto
)
{
// 1.查询[起,始]站信息
TrainStation
startTrainStation
=
trainStationMapper
.
selectById
(
dto
.
getStartTrainStationId
());
TrainStation
endTrainStation
=
trainStationMapper
.
selectById
(
dto
.
getEndTrainStationId
());
// 2.设置区间信息
SubwaySection
subwaySection
=
BeanUtil
.
copyProperties
(
dto
,
SubwaySection
.
class
);
SubwaySection
subwaySection
=
BeanUtil
.
copyProperties
(
dto
,
SubwaySection
.
class
);
LightRail
rail
=
lightRailMapper
.
selectById
(
dto
.
getLightRailId
());
LightRail
rail
=
lightRailMapper
.
selectById
(
dto
.
getLightRailId
());
// 线路id
subwaySection
.
setLightRailName
(
rail
.
getRailLineName
());
subwaySection
.
setLightRailName
(
rail
.
getRailLineName
());
// 线路昵称
subwaySection
.
setSectionStartingMileage
(
startTrainStation
.
getStartingMileage
());
// 区间起始里程
subwaySection
.
setSectionEndMileage
(
endTrainStation
.
getEndMileage
());
// 区间结束里程
if
(
ObjectUtil
.
isEmpty
(
dto
.
getId
()))
{
if
(
ObjectUtil
.
isEmpty
(
dto
.
getId
()))
{
this
.
save
(
subwaySection
);
this
.
save
(
subwaySection
);
}
else
{
}
else
{
this
.
updateById
(
subwaySection
);
this
.
updateById
(
subwaySection
);
}
}
// 先删除
// 3.设置区间-车站关联信息
// 3.1 先删除关联信息
LambdaQueryWrapper
<
SectionStationMap
>
ssmQueryWrapper
=
new
LambdaQueryWrapper
<>();
LambdaQueryWrapper
<
SectionStationMap
>
ssmQueryWrapper
=
new
LambdaQueryWrapper
<>();
ssmQueryWrapper
.
eq
(
SectionStationMap:
:
getSectionId
,
subwaySection
.
getId
());
ssmQueryWrapper
.
eq
(
SectionStationMap:
:
getSectionId
,
subwaySection
.
getId
());
sectionStationMapMapper
.
delete
(
ssmQueryWrapper
);
sectionStationMapMapper
.
delete
(
ssmQueryWrapper
);
// 3.2 查询这个单行区间的车站
// 查询这个区间的车站
TrainStation
startTrainStation
=
trainStationMapper
.
selectById
(
subwaySection
.
getStartTrainStationId
());
TrainStation
endTrainStation
=
trainStationMapper
.
selectById
(
subwaySection
.
getEndTrainStationId
());
QueryWrapper
<
TrainStation
>
tsQueryWrapper
=
new
QueryWrapper
<>();
QueryWrapper
<
TrainStation
>
tsQueryWrapper
=
new
QueryWrapper
<>();
tsQueryWrapper
.
lambda
().
ge
(
TrainStation:
:
getSeq
,
startTrainStation
.
getSeq
())
tsQueryWrapper
.
lambda
().
ge
(
TrainStation:
:
getSeq
,
startTrainStation
.
getSeq
())
.
eq
(
TrainStation:
:
getLineAliasId
,
dto
.
getLineAliasId
())
.
eq
(
TrainStation:
:
getLineAliasId
,
dto
.
getLineAliasId
())
...
@@ -74,8 +81,7 @@ public class SubwaySectionServiceImpl extends ServiceImpl<SubwaySectionMapper, S
...
@@ -74,8 +81,7 @@ public class SubwaySectionServiceImpl extends ServiceImpl<SubwaySectionMapper, S
List
<
TrainStation
>
trainStations
=
trainStationMapper
.
selectList
(
tsQueryWrapper
);
List
<
TrainStation
>
trainStations
=
trainStationMapper
.
selectList
(
tsQueryWrapper
);
LightRail
lightRail
=
lightRailMapper
.
selectById
(
subwaySection
.
getLightRailId
());
LightRail
lightRail
=
lightRailMapper
.
selectById
(
subwaySection
.
getLightRailId
());
// 3.3 保存关联关系
// 后新增
for
(
TrainStation
trainStation
:
trainStations
)
{
for
(
TrainStation
trainStation
:
trainStations
)
{
SectionStationMap
sectionStationMap
=
new
SectionStationMap
();
SectionStationMap
sectionStationMap
=
new
SectionStationMap
();
sectionStationMap
.
setLightRailId
(
lightRail
.
getId
());
// 车站id
sectionStationMap
.
setLightRailId
(
lightRail
.
getId
());
// 车站id
...
@@ -84,9 +90,12 @@ public class SubwaySectionServiceImpl extends ServiceImpl<SubwaySectionMapper, S
...
@@ -84,9 +90,12 @@ public class SubwaySectionServiceImpl extends ServiceImpl<SubwaySectionMapper, S
sectionStationMap
.
setSectionName
(
subwaySection
.
getSectionName
());
// 区间名称
sectionStationMap
.
setSectionName
(
subwaySection
.
getSectionName
());
// 区间名称
sectionStationMap
.
setStationId
(
trainStation
.
getId
());
// 车站id
sectionStationMap
.
setStationId
(
trainStation
.
getId
());
// 车站id
sectionStationMap
.
setStationName
(
trainStation
.
getStationName
());
// 车站名称
sectionStationMap
.
setStationName
(
trainStation
.
getStationName
());
// 车站名称
sectionStationMap
.
setLightRailId
(
dto
.
getLightRailId
());
sectionStationMap
.
setStationStartingMileage
(
trainStation
.
getStartingMileage
());
// 车站起始里程
sectionStationMap
.
setStationCenterMileage
(
trainStation
.
getCenterMileage
());
// 车站中心里程
sectionStationMap
.
setStationEndMileage
(
trainStation
.
getEndMileage
());
// 车站结束里程
sectionStationMapMapper
.
insert
(
sectionStationMap
);
sectionStationMapMapper
.
insert
(
sectionStationMap
);
}
}
}
}
@Override
@Override
...
@@ -94,22 +103,7 @@ public class SubwaySectionServiceImpl extends ServiceImpl<SubwaySectionMapper, S
...
@@ -94,22 +103,7 @@ public class SubwaySectionServiceImpl extends ServiceImpl<SubwaySectionMapper, S
// 分页查询
// 分页查询
IPage
<
SubwaySectionVO
>
page
=
new
Page
<>(
dto
.
getPageNo
(),
dto
.
getPageSize
());
IPage
<
SubwaySectionVO
>
page
=
new
Page
<>(
dto
.
getPageNo
(),
dto
.
getPageSize
());
page
=
this
.
baseMapper
.
queryPageList
(
page
,
dto
.
getQuery
());
page
=
this
.
baseMapper
.
queryPageList
(
page
,
dto
.
getQuery
());
for
(
SubwaySectionVO
record
:
page
.
getRecords
())
{
// 计算区间里程
TrainStation
startTrainStation
=
trainStationMapper
.
selectById
(
record
.
getStartTrainStationId
());
TrainStation
endTrainStation
=
trainStationMapper
.
selectById
(
record
.
getEndTrainStationId
());
BigDecimal
sectionMileage
=
endTrainStation
.
getEndMileage
().
subtract
(
startTrainStation
.
getEndMileage
());
record
.
setSectionMileage
(
sectionMileage
);
// 车站数量
int
trainStationNum
=
endTrainStation
.
getSeq
()
-
startTrainStation
.
getSeq
()
+
1
;
record
.
setTrainStationNum
(
trainStationNum
);
}
return
page
;
return
page
;
}
}
@Override
@Override
...
...
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