Commit 519a2e5a65d86136348e6b68b0799bf7d4c874e0

Authored by 周峰
1 parent aa2fd0b4

根据用户名查工位信息

src/main/java/com/huaheng/pc/agv/controller/WorkStationController.java
... ... @@ -162,4 +162,26 @@ public class WorkStationController extends BaseController {
162 162 iUserService.updateUserInfo(user);
163 163 return AjaxResult.success(loginName + "成功绑定到" + workStation.getName() + "工位");
164 164 }
  165 +
  166 + @RequiresPermissions("agv:workStation:view")
  167 + @Log(title = "查询绑定工位", action = BusinessType.GRANT)
  168 + @PostMapping("/getBindWorkStation")
  169 + @ResponseBody
  170 + public AjaxResult getBindWorkStation(String loginName){
  171 + User user = iUserService.selectUserByLoginName(loginName);
  172 + if(user == null){
  173 + return AjaxResult.error("用户" + loginName + "不存在");
  174 + }
  175 +
  176 + if(user.getWorkStationId() == null){
  177 + return AjaxResult.success("用户" + loginName + "还没有绑定工位");
  178 + }
  179 +
  180 + WorkStation workStation = workStationService.getById(user.getWorkStationId());
  181 + if(workStation == null){
  182 + return AjaxResult.error("工位ID" + user.getWorkStationId() + "不存在");
  183 + }
  184 +
  185 + return AjaxResult.success(workStation);
  186 + }
165 187 }
... ...