package com.ruoyi.project.tr.troubleshootList.controller; import java.util.List; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import com.ruoyi.framework.aspectj.lang.annotation.Log; import com.ruoyi.framework.aspectj.lang.enums.BusinessType; import com.ruoyi.project.tr.troubleshootList.domain.TroubleshootList; import com.ruoyi.project.tr.troubleshootList.service.ITroubleshootListService; 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 wm * @date 2020-05-05 */ @Controller @RequestMapping("/tr/troubleshootList") public class TroubleshootListController extends BaseController { private String prefix = "tr/troubleshootList"; @Autowired private ITroubleshootListService troubleshootListService; @RequiresPermissions("tr:troubleshootList:view") @GetMapping() public String troubleshootList() { return prefix + "/troubleshootList"; } /** * 查询隐患排查列表 */ @RequiresPermissions("tr:troubleshootList:list") @PostMapping("/list") @ResponseBody public TableDataInfo list(TroubleshootList troubleshootList) { startPage(); List list = troubleshootListService.selectTroubleshootListList(troubleshootList); return getDataTable(list); } /** * 导出隐患排查列表 */ @RequiresPermissions("tr:troubleshootList:export") @Log(title = "隐患排查", businessType = BusinessType.EXPORT) @PostMapping("/export") @ResponseBody public AjaxResult export(TroubleshootList troubleshootList) { List list = troubleshootListService.selectTroubleshootListList(troubleshootList); ExcelUtil util = new ExcelUtil(TroubleshootList.class); return util.exportExcel(list, "troubleshootList"); } /** * 新增隐患排查 */ @GetMapping("/add") public String add() { return prefix + "/add"; } /** * 新增保存隐患排查 */ @RequiresPermissions("tr:troubleshootList:add") @Log(title = "隐患排查", businessType = BusinessType.INSERT) @PostMapping("/add") @ResponseBody public AjaxResult addSave(TroubleshootList troubleshootList) { return toAjax(troubleshootListService.insertTroubleshootList(troubleshootList)); } /** * 修改隐患排查 */ @GetMapping("/edit/{troubleshootId}") public String edit(@PathVariable("troubleshootId") Long troubleshootId, ModelMap mmap) { TroubleshootList troubleshootList = troubleshootListService.selectTroubleshootListById(troubleshootId); mmap.put("troubleshootList", troubleshootList); return prefix + "/edit"; } /** * 修改保存隐患排查 */ @RequiresPermissions("tr:troubleshootList:edit") @Log(title = "隐患排查", businessType = BusinessType.UPDATE) @PostMapping("/edit") @ResponseBody public AjaxResult editSave(TroubleshootList troubleshootList) { return toAjax(troubleshootListService.updateTroubleshootList(troubleshootList)); } /** * 删除隐患排查 */ @RequiresPermissions("tr:troubleshootList:remove") @Log(title = "隐患排查", businessType = BusinessType.DELETE) @PostMapping( "/remove") @ResponseBody public AjaxResult remove(String ids) { return toAjax(troubleshootListService.deleteTroubleshootListByIds(ids)); } }