102 lines
2.8 KiB
Java
102 lines
2.8 KiB
Java
![]() |
package com.ruoyi.web.bst;
|
||
|
|
||
|
import com.ruoyi.bst.fault.domain.Fault;
|
||
|
import com.ruoyi.bst.fault.domain.FaultQuery;
|
||
|
import com.ruoyi.bst.fault.domain.FaultVO;
|
||
|
import com.ruoyi.bst.fault.service.FaultService;
|
||
|
import com.ruoyi.common.annotation.Log;
|
||
|
import com.ruoyi.common.core.controller.BaseController;
|
||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||
|
import com.ruoyi.common.enums.BusinessType;
|
||
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||
|
import org.springframework.web.bind.annotation.*;
|
||
|
|
||
|
import javax.servlet.http.HttpServletResponse;
|
||
|
import java.util.List;
|
||
|
|
||
|
/**
|
||
|
* 故障Controller
|
||
|
*
|
||
|
* @author ruoyi
|
||
|
* @date 2025-03-26
|
||
|
*/
|
||
|
@RestController
|
||
|
@RequestMapping("/bst/fault")
|
||
|
public class FaultController extends BaseController
|
||
|
{
|
||
|
@Autowired
|
||
|
private FaultService faultService;
|
||
|
|
||
|
/**
|
||
|
* 查询故障列表
|
||
|
*/
|
||
|
@PreAuthorize("@ss.hasPermi('bst:fault:list')")
|
||
|
@GetMapping("/list")
|
||
|
public TableDataInfo list(FaultQuery query)
|
||
|
{
|
||
|
startPage();
|
||
|
startOrderBy();
|
||
|
List<FaultVO> list = faultService.selectFaultList(query);
|
||
|
return getDataTable(list);
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* 导出故障列表
|
||
|
*/
|
||
|
@PreAuthorize("@ss.hasPermi('bst:fault:export')")
|
||
|
@Log(title = "故障", businessType = BusinessType.EXPORT)
|
||
|
@PostMapping("/export")
|
||
|
public void export(HttpServletResponse response, FaultQuery query)
|
||
|
{
|
||
|
List<FaultVO> list = faultService.selectFaultList(query);
|
||
|
ExcelUtil<FaultVO> util = new ExcelUtil<FaultVO>(FaultVO.class);
|
||
|
util.exportExcel(response, list, "故障数据");
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* 获取故障详细信息
|
||
|
*/
|
||
|
@PreAuthorize("@ss.hasPermi('bst:fault:query')")
|
||
|
@GetMapping(value = "/{id}")
|
||
|
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||
|
{
|
||
|
return success(faultService.selectFaultById(id));
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* 新增故障
|
||
|
*/
|
||
|
@PreAuthorize("@ss.hasPermi('bst:fault:add')")
|
||
|
@Log(title = "故障", businessType = BusinessType.INSERT)
|
||
|
@PostMapping
|
||
|
public AjaxResult add(@RequestBody Fault fault)
|
||
|
{
|
||
|
return toAjax(faultService.insertFault(fault));
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* 修改故障
|
||
|
*/
|
||
|
@PreAuthorize("@ss.hasPermi('bst:fault:edit')")
|
||
|
@Log(title = "故障", businessType = BusinessType.UPDATE)
|
||
|
@PutMapping
|
||
|
public AjaxResult edit(@RequestBody Fault fault)
|
||
|
{
|
||
|
return toAjax(faultService.updateFault(fault));
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* 删除故障
|
||
|
*/
|
||
|
@PreAuthorize("@ss.hasPermi('bst:fault:remove')")
|
||
|
@Log(title = "故障", businessType = BusinessType.DELETE)
|
||
|
@DeleteMapping("/{ids}")
|
||
|
public AjaxResult remove(@PathVariable Long[] ids)
|
||
|
{
|
||
|
return toAjax(faultService.deleteFaultByIds(ids));
|
||
|
}
|
||
|
}
|