2025-03-26 18:15:56 +08:00
|
|
|
package com.ruoyi.web.app;
|
|
|
|
|
2025-03-27 07:32:13 +08:00
|
|
|
import com.ruoyi.bst.fault.domain.FaultVO;
|
2025-03-26 18:15:56 +08:00
|
|
|
import com.ruoyi.bst.fault.service.FaultService;
|
|
|
|
import com.ruoyi.common.core.domain.AjaxResult;
|
2025-03-27 07:32:13 +08:00
|
|
|
import com.ruoyi.common.utils.SecurityUtils;
|
2025-03-26 18:15:56 +08:00
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
import org.springframework.web.bind.annotation.PathVariable;
|
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
2025-03-27 07:32:13 +08:00
|
|
|
/**
|
|
|
|
* 用户查询自己提交的故障信息
|
|
|
|
*/
|
2025-03-26 18:15:56 +08:00
|
|
|
@RestController
|
2025-03-27 07:32:13 +08:00
|
|
|
@RequestMapping("/app/fault")
|
2025-03-26 18:15:56 +08:00
|
|
|
public class AppFaultController {
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
private FaultService faultService;
|
2025-03-27 07:32:13 +08:00
|
|
|
|
2025-03-26 18:15:56 +08:00
|
|
|
@GetMapping("/{id}")
|
|
|
|
public AjaxResult get(@PathVariable Long id) {
|
2025-03-27 07:32:13 +08:00
|
|
|
Long userId = SecurityUtils.getLoginUser().getUserId();
|
|
|
|
// 当用户查询的故障信息是自己的或当前用户是超级管理员时
|
|
|
|
if (userId.equals(id)|| userId == 1){
|
|
|
|
FaultVO faultVO = faultService.selectFaultById(id);
|
|
|
|
return AjaxResult.success(faultVO);
|
|
|
|
}
|
|
|
|
return AjaxResult.error("您的查询不合法!");
|
2025-03-26 18:15:56 +08:00
|
|
|
}
|
|
|
|
}
|