| package com.ruoyi.alarmpoints.tube.controller; | 
|   | 
|   | 
| import javax.annotation.Resource; | 
| import javax.servlet.http.HttpServletResponse; | 
|   | 
| import com.ruoyi.alarmpoints.tube.domain.ArdTubes; | 
| import com.ruoyi.alarmpoints.tube.domain.ArdTubesParam; | 
| import com.ruoyi.alarmpoints.tube.service.IArdTubesService; | 
| import com.ruoyi.common.core.domain.entity.SysUser; | 
| import com.ruoyi.common.utils.SecurityUtils; | 
| import com.ruoyi.common.utils.poi.ExcelUtil; | 
| import com.ruoyi.system.service.ISysDeptService; | 
| import com.ruoyi.system.service.ISysUserService; | 
| import com.ruoyi.utils.result.Results; | 
| import io.swagger.annotations.Api; | 
| import io.swagger.annotations.ApiOperation; | 
| import org.springframework.security.access.prepost.PreAuthorize; | 
| import org.springframework.beans.factory.annotation.Autowired; | 
| import org.springframework.web.bind.annotation.GetMapping; | 
| import org.springframework.web.bind.annotation.PostMapping; | 
| import org.springframework.web.bind.annotation.PutMapping; | 
| import org.springframework.web.bind.annotation.DeleteMapping; | 
| import org.springframework.web.bind.annotation.PathVariable; | 
| import org.springframework.web.bind.annotation.RequestBody; | 
| import org.springframework.web.bind.annotation.RequestMapping; | 
| import org.springframework.web.bind.annotation.RestController; | 
| import com.ruoyi.common.annotation.Log; | 
| import com.ruoyi.common.core.controller.BaseController; | 
| import com.ruoyi.common.core.domain.AjaxResult; | 
| import com.ruoyi.common.enums.BusinessType; | 
| import com.ruoyi.common.core.page.TableDataInfo; | 
|   | 
| import java.util.List; | 
|   | 
| /** | 
|  * 管线管理Controller | 
|  *  | 
|  * @author 刘苏义 | 
|  * @date 2023-03-13 | 
|  */ | 
| @RestController | 
| @RequestMapping("/alarmpoints/tubes") | 
| @Api(tags = "管线接口") | 
| public class ArdTubesController extends BaseController | 
| { | 
|     @Resource | 
|     private IArdTubesService ardTubesService; | 
|   | 
|     @Autowired | 
|     private ISysUserService sysUserService; | 
|   | 
|     @Autowired | 
|     private ISysDeptService sysDeptService; | 
|   | 
|     /** | 
|      * 查询管线管理列表 | 
|      */ | 
|     @PreAuthorize("@ss.hasPermi('alarmpoints:tubes:list')") | 
|     @GetMapping("/list") | 
|     @ApiOperation("查询管线管理列表") | 
|     public TableDataInfo list(ArdTubes ardTubes) | 
|     { | 
|         startPage(); | 
|         List<ArdTubes> list = ardTubesService.selectArdTubesList(ardTubes); | 
|         return getDataTable(list); | 
|     } | 
|   | 
|     /** | 
|      * 导出管线管理列表 | 
|      */ | 
|     @PreAuthorize("@ss.hasPermi('alarmpoints:tubes:export')") | 
|     @Log(title = "管线管理", businessType = BusinessType.EXPORT) | 
|     @PostMapping("/export") | 
|     @ApiOperation("导出管线管理列表") | 
|     public void export(HttpServletResponse response, ArdTubes ardTubes) | 
|     { | 
|         List<ArdTubes> list = ardTubesService.selectArdTubesList(ardTubes); | 
|         ExcelUtil<ArdTubes> util = new ExcelUtil<ArdTubes>(ArdTubes.class); | 
|         util.exportExcel(response, list, "管线管理数据"); | 
|     } | 
|   | 
|     /** | 
|      * 获取管线管理详细信息 | 
|      */ | 
|     @PreAuthorize("@ss.hasPermi('alarmpoints:tubes:query')") | 
|     @GetMapping(value = "/{id}") | 
|     @ApiOperation("通过ID获取管线管理详细信息") | 
|     public AjaxResult getInfo(@PathVariable("id") String id) | 
|     { | 
|         return success(ardTubesService.selectArdTubesById(id)); | 
|     } | 
|   | 
|     /** | 
|      * 新增管线管理 | 
|      */ | 
|     @PreAuthorize("@ss.hasPermi('alarmpoints:tubes:add')") | 
|     @Log(title = "管线管理", businessType = BusinessType.INSERT) | 
|     @PostMapping | 
|     @ApiOperation("新增管线管理") | 
|     public AjaxResult add(@RequestBody ArdTubes ardTubes) | 
|     { | 
|         return toAjax(ardTubesService.insertArdTubes(ardTubes)); | 
|     } | 
|   | 
|     /** | 
|      * 修改管线管理 | 
|      */ | 
|     @PreAuthorize("@ss.hasPermi('alarmpoints:tubes:edit')") | 
|     @Log(title = "管线管理", businessType = BusinessType.UPDATE) | 
|     @PutMapping | 
|     @ApiOperation("修改管线管理") | 
|     public AjaxResult edit(@RequestBody ArdTubes ardTubes) | 
|     { | 
|         return toAjax(ardTubesService.updateArdTubes(ardTubes)); | 
|     } | 
|   | 
|     /** | 
|      * 删除管线管理 | 
|      */ | 
|     @PreAuthorize("@ss.hasPermi('alarmpoints:tubes:remove')") | 
|     @Log(title = "管线管理", businessType = BusinessType.DELETE) | 
|     @DeleteMapping("/{ids}") | 
|     @ApiOperation("删除管线管理") | 
|     public AjaxResult remove(@PathVariable String[] ids) | 
|     { | 
|         return toAjax(ardTubesService.deleteArdTubesByIds(ids)); | 
|     } | 
|   | 
|   | 
|     /** | 
|      * 查询单条管线数据 | 
|      */ | 
|     @GetMapping("/one/{id}") | 
|     @ApiOperation("查询单条管线数据") | 
|     public Results one(@PathVariable String id) { | 
|         return ardTubesService.tubeById(id); | 
|     } | 
|   | 
|     /** | 
|      * 查询权限下全部管线数据 | 
|      */ | 
|     @GetMapping("/tobeList") | 
|     @ApiOperation("查询权限下全部管线数据") | 
|     public Results tobeList() { | 
|         String usersId = SecurityUtils.getUserId(); | 
|         //根据userId查询部门Id | 
|         SysUser sysUser = sysUserService.selectUserById(usersId); | 
|         //根据当前deptId或者当前及所属下级的所有deptId | 
|         List<Long> deptList = sysDeptService.deptIdBySub(sysUser.getDeptId()); | 
|         //根据deptList获取所有管线数据 | 
|         return ardTubesService.tobeList(deptList); | 
|     } | 
|   | 
|     /** | 
|      * 查询并筛选权限下所有管线数据 | 
|      */ | 
|     @GetMapping("/conditionList") | 
|     @ApiOperation("查询并筛选权限下所有管线数据") | 
|     public Results conditionList(ArdTubesParam ardTubesParam) { | 
|         String usersId = SecurityUtils.getUserId(); | 
|         //根据userId查询部门Id | 
|         SysUser sysUser = sysUserService.selectUserById(usersId); | 
|         //根据当前deptId或者当前及所属下级的所有deptId | 
|         List<Long> deptList = sysDeptService.deptIdBySub(sysUser.getDeptId()); | 
|         ardTubesParam.setDeptList(deptList); | 
|         return ardTubesService.conditionList(ardTubesParam); | 
|     } | 
|   | 
| } |