package com.ruoyi.project.reliability.controller; import java.util.List; 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.framework.aspectj.lang.annotation.Log; import com.ruoyi.framework.aspectj.lang.enums.BusinessType; import com.ruoyi.project.reliability.domain.TRelDevice; import com.ruoyi.project.reliability.service.ITRelDeviceService; import com.ruoyi.framework.web.controller.BaseController; import com.ruoyi.framework.web.domain.AjaxResult; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.framework.web.page.TableDataInfo; /** * 可靠性设备清单Controller * * @author ssy * @date 2025-10-13 */ @RestController @RequestMapping("/reliability/rel_device") public class TRelDeviceController extends BaseController { @Autowired private ITRelDeviceService tRelDeviceService; /** * 查询可靠性设备清单列表 */ @PreAuthorize("@ss.hasPermi('reliability:rel_device:list')") @GetMapping("/list") public TableDataInfo list(TRelDevice tRelDevice) { startPage(); List list = tRelDeviceService.selectTRelDeviceList(tRelDevice); return getDataTable(list); } /** * 导出可靠性设备清单列表 */ @PreAuthorize("@ss.hasPermi('reliability:rel_device:list')") @Log(title = "可靠性设备清单", businessType = BusinessType.EXPORT) @GetMapping("/export") public AjaxResult export(TRelDevice tRelDevice) { List list = tRelDeviceService.selectTRelDeviceList(tRelDevice); ExcelUtil util = new ExcelUtil(TRelDevice.class); return util.exportExcel(list, "rel_device"); } /** * 获取可靠性设备清单详细信息 */ @PreAuthorize("@ss.hasPermi('reliability:rel_device:query')") @GetMapping(value = "/{devId}") public AjaxResult getInfo(@PathVariable("devId") Long devId) { return AjaxResult.success(tRelDeviceService.selectTRelDeviceById(devId)); } /** * 新增可靠性设备清单 */ @PreAuthorize("@ss.hasPermi('reliability:rel_device:add')") @Log(title = "可靠性设备清单", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody TRelDevice tRelDevice) { return toAjax(tRelDeviceService.insertTRelDevice(tRelDevice)); } /** * 修改可靠性设备清单 */ @PreAuthorize("@ss.hasPermi('reliability:rel_device:edit')") @Log(title = "可靠性设备清单", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody TRelDevice tRelDevice) { return toAjax(tRelDeviceService.updateTRelDevice(tRelDevice)); } /** * 删除可靠性设备清单 */ @PreAuthorize("@ss.hasPermi('reliability:rel_device:remove')") @Log(title = "可靠性设备清单", businessType = BusinessType.DELETE) @DeleteMapping("/{devIds}") public AjaxResult remove(@PathVariable Long[] devIds) { return toAjax(tRelDeviceService.deleteTRelDeviceByIds(devIds)); } }