Commit 397be2fe23b7cb5c6a40d6925c6d64da16e12125
1 parent
9ccdb54b
查询上下游点位接口
Showing
3 changed files
with
37 additions
and
1 deletions
src/main/java/com/huaheng/pc/agv/controller/AgvPortController.java
... | ... | @@ -10,6 +10,8 @@ import com.huaheng.framework.web.page.PageDomain; |
10 | 10 | import com.huaheng.framework.web.page.TableDataInfo; |
11 | 11 | import com.huaheng.framework.web.page.TableSupport; |
12 | 12 | import com.huaheng.common.utils.StringUtils; |
13 | +import com.huaheng.pc.agv.service.IWorkStationFlowService; | |
14 | +import com.huaheng.pc.agv.service.IWorkStationService; | |
13 | 15 | import org.apache.shiro.authz.annotation.RequiresPermissions; |
14 | 16 | import org.springframework.beans.factory.annotation.Autowired; |
15 | 17 | import org.springframework.stereotype.Controller; |
... | ... | @@ -46,6 +48,12 @@ public class AgvPortController extends BaseController { |
46 | 48 | @Resource |
47 | 49 | private IAgvPortService agvPortService; |
48 | 50 | |
51 | + @Resource | |
52 | + private IWorkStationService workStationService; | |
53 | + | |
54 | + @Resource | |
55 | + private IWorkStationFlowService workStationFlowService; | |
56 | + | |
49 | 57 | @RequiresPermissions("agv:agvport:view") |
50 | 58 | @GetMapping() |
51 | 59 | public String agvPort() { |
... | ... | @@ -86,6 +94,23 @@ public class AgvPortController extends BaseController { |
86 | 94 | } |
87 | 95 | |
88 | 96 | /** |
97 | + * 取当前工位上下游工位点位 | |
98 | + * @return | |
99 | + */ | |
100 | + @RequiresPermissions("agv:agvport:view") | |
101 | + @PostMapping("/getAgvPortFlow") | |
102 | + @ResponseBody | |
103 | + public AjaxResult<List<AgvPort>> getAgvPortFlow(Long workStationId, String agvPortType) { | |
104 | + List<Long> ids = workStationFlowService.getWorkStationFlowIds(workStationId); | |
105 | + LambdaQueryWrapper<AgvPort> queryWrapper = new LambdaQueryWrapper<>(); | |
106 | + queryWrapper.in(AgvPort::getWorkStationId, ids) | |
107 | + .eq(StringUtils.isNotEmpty(agvPortType), AgvPort::getType, agvPortType) | |
108 | + .orderByAsc(AgvPort::getWorkStationId); | |
109 | + List<AgvPort> retList = agvPortService.list(queryWrapper); | |
110 | + return AjaxResult.success(retList); | |
111 | + } | |
112 | + | |
113 | + /** | |
89 | 114 | * 新增【请填写功能名称】 |
90 | 115 | */ |
91 | 116 | @GetMapping("/add") |
... | ... |
src/main/java/com/huaheng/pc/agv/service/IWorkStationFlowService.java
src/main/java/com/huaheng/pc/agv/service/impl/WorkStationFlowServiceImpl.java
1 | 1 | package com.huaheng.pc.agv.service.impl; |
2 | 2 | |
3 | +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |
3 | 4 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
4 | 5 | import com.huaheng.pc.agv.service.IWorkStationFlowService; |
5 | 6 | import com.huaheng.pc.agv.domain.WorkStationFlow; |
6 | 7 | import com.huaheng.pc.agv.mapper.WorkStationFlowMapper; |
7 | 8 | import org.springframework.stereotype.Service; |
8 | 9 | |
10 | +import java.util.List; | |
11 | +import java.util.stream.Collectors; | |
12 | + | |
9 | 13 | |
10 | 14 | /** |
11 | 15 | * 维护工位的上下游关系 服务层实现 |
... | ... | @@ -16,4 +20,11 @@ import org.springframework.stereotype.Service; |
16 | 20 | @Service |
17 | 21 | public class WorkStationFlowServiceImpl extends ServiceImpl<WorkStationFlowMapper, WorkStationFlow> implements IWorkStationFlowService { |
18 | 22 | |
23 | + @Override | |
24 | + public List<Long> getWorkStationFlowIds(Long workStationId) { | |
25 | + LambdaQueryWrapper<WorkStationFlow> queryWrapper = new LambdaQueryWrapper<>(); | |
26 | + queryWrapper.eq(WorkStationFlow::getWorkStationId, workStationId); | |
27 | + List<WorkStationFlow> list = list(queryWrapper); | |
28 | + return list.stream().map(WorkStationFlow::getWorkStationIdRelated).distinct().collect(Collectors.toList()); | |
29 | + } | |
19 | 30 | } |
... | ... |