Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
T
travel-cloud
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
cloud
travel-cloud
Commits
a5cb54ac
提交
a5cb54ac
authored
11月 22, 2024
作者:
hzh
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
代码优化
上级
639e87e1
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
15 行增加
和
5 行删除
+15
-5
TrainController.java
.../org/dromara/server/controller/train/TrainController.java
+15
-5
没有找到文件。
ruoyi-modules/ruoyi-server/src/main/java/org/dromara/server/controller/train/TrainController.java
浏览文件 @
a5cb54ac
...
...
@@ -57,13 +57,17 @@ public class TrainController extends BaseController {
/**
* 火车站列表
*
* @param keyword 城市名、英文名、站点名、拼音检索模糊查询
*/
@GlobalTransactional
(
timeoutMills
=
600000
)
@GetMapping
(
"/stationList"
)
public
R
<
List
<
AllStationModel
>>
stationList
(
@RequestParam
(
"keyword"
)
String
keyword
)
{
List
<
AllStationModel
>
stationList
=
getStationList
();
return
R
.
ok
(
stationList
.
stream
().
filter
(
item
->
{
if
(
StringUtils
.
isEmpty
(
keyword
))
{
return
R
.
ok
(
stationList
);
}
AllStationModel
model
=
StreamUtils
.
findFirst
(
stationList
,
item
->
{
if
(
StringUtils
.
isNotEmpty
(
item
.
getCityName
())
&&
item
.
getCityName
().
contains
(
keyword
))
{
return
true
;
}
...
...
@@ -77,8 +81,11 @@ public class TrainController extends BaseController {
return
true
;
}
return
false
;
}).
collect
(
Collectors
.
toList
())
);
});
if
(
model
==
null
)
{
return
R
.
ok
(
new
ArrayList
<>());
}
return
R
.
ok
(
StreamUtils
.
filter
(
stationList
,
item
->
StringUtils
.
equals
(
item
.
getCityName
(),
model
.
getCityName
())));
}
private
List
<
AllStationModel
>
getStationList
()
{
...
...
@@ -161,12 +168,15 @@ public class TrainController extends BaseController {
/**
* 城市列表
*
* @param keyword 城市名称精确查询
* @return 城市数据
*/
@GlobalTransactional
(
timeoutMills
=
600000
)
@GetMapping
(
"/cityList"
)
public
R
<
List
<
CityModel
>>
list
(
@RequestParam
(
"keyword"
)
String
keyword
)
{
List
<
CityModel
>
cityList
=
getCityList
();
return
R
.
ok
(
cityList
.
stream
().
filter
(
item
->
StringUtils
.
equals
(
item
.
getCityName
(),
keyword
)).
collect
(
Collectors
.
toList
(
)));
return
R
.
ok
(
StreamUtils
.
filter
(
cityList
,
item
->
StringUtils
.
equals
(
item
.
getCityName
(),
keyword
)));
}
private
List
<
CityModel
>
getCityList
()
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论