package com.javaweb.platform.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.javaweb.common.annotation.Log; import com.javaweb.common.enums.BusinessType; import com.javaweb.platform.domain.StageInfo; import com.javaweb.platform.service.IStageInfoService; import com.javaweb.common.core.controller.BaseController; import com.javaweb.common.core.domain.AjaxResult; import com.javaweb.common.utils.poi.ExcelUtil; import com.javaweb.common.core.page.TableDataInfo; /** * 水位记录Controller * * @author zzf * @date 2022-03-25 */ @Controller @RequestMapping("/platform/stageinfo") public class StageInfoController extends BaseController { private String prefix = "platform/stageinfo"; @Autowired private IStageInfoService stageInfoService; @RequiresPermissions("platform:stageinfo:view") @GetMapping() public String stageinfo() { return prefix + "/stageinfo"; } /** * 查询水位记录列表 */ @RequiresPermissions("platform:stageinfo:list") @PostMapping("/list") @ResponseBody public TableDataInfo list(StageInfo stageInfo) { startPage(); List list = stageInfoService.selectStageInfoList(stageInfo); return getDataTable(list); } /** * 导出水位记录列表 */ @RequiresPermissions("platform:stageinfo:export") @Log(title = "水位记录", businessType = BusinessType.EXPORT) @PostMapping("/export") @ResponseBody public AjaxResult export(StageInfo stageInfo) { List list = stageInfoService.selectStageInfoList(stageInfo); ExcelUtil util = new ExcelUtil(StageInfo.class); return util.exportExcel(list, "stageinfo"); } /** * 新增水位记录 */ @GetMapping("/add") public String add() { return prefix + "/add"; } /** * 新增保存水位记录 */ @RequiresPermissions("platform:stageinfo:add") @Log(title = "水位记录", businessType = BusinessType.INSERT) @PostMapping("/add") @ResponseBody public AjaxResult addSave(StageInfo stageInfo) { return toAjax(stageInfoService.insertStageInfo(stageInfo)); } /** * 修改水位记录 */ @GetMapping("/edit/{id}") public String edit(@PathVariable("id") String id, ModelMap mmap) { StageInfo stageInfo = stageInfoService.selectStageInfoById(id); mmap.put("stageInfo", stageInfo); return prefix + "/edit"; } /** * 修改保存水位记录 */ @RequiresPermissions("platform:stageinfo:edit") @Log(title = "水位记录", businessType = BusinessType.UPDATE) @PostMapping("/edit") @ResponseBody public AjaxResult editSave(StageInfo stageInfo) { return toAjax(stageInfoService.updateStageInfo(stageInfo)); } /** * 删除水位记录 */ @RequiresPermissions("platform:stageinfo:remove") @Log(title = "水位记录", businessType = BusinessType.DELETE) @PostMapping( "/remove") @ResponseBody public AjaxResult remove(String ids) { return toAjax(stageInfoService.deleteStageInfoByIds(ids)); } }