Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
traffic-signal-platform
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
signal
traffic-signal-platform
Commits
bdcab911
Commit
bdcab911
authored
Feb 02, 2023
by
hanbing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
方案管理-渠化配置,测试删除进口方向
parent
1a85c2f5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
12 deletions
+37
-12
CrossDirInfoMapper.java
.../java/net/wanji/web/mapper/scheme/CrossDirInfoMapper.java
+4
-0
CrossConfigServiceImpl.java
...wanji/web/service/scheme/impl/CrossConfigServiceImpl.java
+26
-12
CrossDirInfoMapper.xml
...e/src/main/resources/mapper/scheme/CrossDirInfoMapper.xml
+7
-0
No files found.
signal-control-service/src/main/java/net/wanji/web/mapper/scheme/CrossDirInfoMapper.java
View file @
bdcab911
...
...
@@ -4,6 +4,8 @@ import net.wanji.web.po.scheme.CrossDirInfoPO;
import
org.apache.ibatis.annotations.Param
;
import
org.springframework.stereotype.Repository
;
import
java.util.List
;
/**
* @author Kent HAN
* @date 2022/12/20 10:32
...
...
@@ -17,4 +19,6 @@ public interface CrossDirInfoMapper {
void
updateIsPedestrian
(
@Param
(
"isPersonCross"
)
Integer
isPersonCross
,
@Param
(
"id"
)
String
id
);
CrossDirInfoPO
selectByCrossIdAndDirType
(
@Param
(
"crossId"
)
String
crossId
,
@Param
(
"dirType"
)
Integer
dirType
);
List
<
CrossDirInfoPO
>
selectByCrossId
(
String
crossId
);
}
signal-control-service/src/main/java/net/wanji/web/service/scheme/impl/CrossConfigServiceImpl.java
View file @
bdcab911
...
...
@@ -267,8 +267,18 @@ public class CrossConfigServiceImpl implements CrossConfigService {
private
void
handleLaneData
(
SaveLaneInfoDTO
saveLaneInfoDTO
)
{
String
crossId
=
saveLaneInfoDTO
.
getCrossId
();
List
<
DirListElement
>
dirList
=
saveLaneInfoDTO
.
getDirList
();
List
<
CrossDirInfoPO
>
crossDirInfoPOList
=
crossDirInfoMapper
.
selectByCrossId
(
crossId
);
List
<
Integer
>
dirListFromDb
=
crossDirInfoPOList
.
stream
()
.
map
(
CrossDirInfoPO:
:
getDirType
)
.
collect
(
Collectors
.
toList
());
// 删除数据库中有,前端对象中没有的数据
for
(
Integer
dirFromDb
:
dirListFromDb
)
{
if
(!
dirList
.
contains
(
dirFromDb
))
{
List
<
LaneInfoPO
>
laneInfoPOList
=
laneInfoMapper
.
selectByCrossIdAndDir
(
crossId
,
dirFromDb
);
cleanDataBase
(
crossId
,
dirFromDb
,
laneInfoPOList
);
}
}
for
(
DirListElement
dirListElement
:
dirList
)
{
// 获取数据库中已有数据
Integer
dir
=
dirListElement
.
getDir
();
List
<
LaneInfoPO
>
laneInfoPOList
=
laneInfoMapper
.
selectByCrossIdAndDir
(
crossId
,
dir
);
// 按车道代码排序
...
...
@@ -278,17 +288,7 @@ public class CrossConfigServiceImpl implements CrossConfigService {
laneListFromDb
.
sort
((
x
,
y
)
->
String
.
CASE_INSENSITIVE_ORDER
.
compare
(
x
.
getName
(),
y
.
getName
()));
// 比较入参数据与已有数据
if
(!
laneListFromClient
.
equals
(
laneListFromDb
))
{
// 删除车道表数据
laneInfoMapper
.
deleteByCrossIdAndDir
(
crossId
,
dir
);
// 删除路口方向表数据
crossDirInfoMapper
.
deleteInByDirType
(
crossId
,
dir
);
List
<
String
>
laneIds
=
getLaneIds
(
laneInfoPOList
);
if
(
laneIds
.
size
()!=
0
){
// 删除灯组-车道关系表数据
crossLaneLightsMapper
.
deleteByLaneIds
(
laneIds
);
// 删除车道状态表数据
laneSegmentMapper
.
deleteByLaneIds
(
laneIds
);
}
cleanDataBase
(
crossId
,
dir
,
laneInfoPOList
);
// 插入进口信息
List
<
LaneInfoPO
>
laneInfoPOListForInsert
=
getLaneInfoPOListForInsert
(
crossId
,
dirListElement
,
dir
,
laneListFromClient
);
...
...
@@ -305,6 +305,20 @@ public class CrossConfigServiceImpl implements CrossConfigService {
}
}
private
void
cleanDataBase
(
String
crossId
,
Integer
dir
,
List
<
LaneInfoPO
>
laneInfoPOList
)
{
// 删除车道表数据
laneInfoMapper
.
deleteByCrossIdAndDir
(
crossId
,
dir
);
// 删除路口方向表数据
crossDirInfoMapper
.
deleteInByDirType
(
crossId
,
dir
);
List
<
String
>
laneIds
=
getLaneIds
(
laneInfoPOList
);
if
(
laneIds
.
size
()!=
0
){
// 删除灯组-车道关系表数据
crossLaneLightsMapper
.
deleteByLaneIds
(
laneIds
);
// 删除车道状态表数据
laneSegmentMapper
.
deleteByLaneIds
(
laneIds
);
}
}
@Override
public
SaveLaneInfoDTO
listLaneInfo
(
CrossIdDTO
crossIdDTO
)
{
String
crossId
=
crossIdDTO
.
getCrossId
();
...
...
signal-control-service/src/main/resources/mapper/scheme/CrossDirInfoMapper.xml
View file @
bdcab911
...
...
@@ -36,4 +36,11 @@
from t_base_cross_dir_info
where cross_id = #{crossId} and dir_type = #{dirType}
</select>
<select
id=
"selectByCrossId"
resultType=
"net.wanji.web.po.scheme.CrossDirInfoPO"
>
select
id,dir_type,in_out_type,cross_id,length,is_pedestrian,gmt_create,gmt_modified
from t_base_cross_dir_info
where cross_id = #{crossId}
</select>
</mapper>
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