package com.dgtly.notice.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.dgtly.common.annotation.Log; import com.dgtly.common.enums.BusinessType; import com.dgtly.notice.domain.NoticeDemand; import com.dgtly.notice.service.INoticeDemandService; import com.dgtly.common.core.controller.BaseController; import com.dgtly.common.core.domain.AjaxResult; import com.dgtly.common.utils.poi.ExcelUtil; import com.dgtly.common.core.page.TableDataInfo; /** * 【请填写功能名称】Controller * * @author dgtly * @date 2020-02-13 */ @Controller @RequestMapping("/notice/demand") public class NoticeDemandController extends BaseController { private String prefix = "notice/demand"; @Autowired private INoticeDemandService noticeDemandService; @RequiresPermissions("notice:demand:view") @GetMapping() public String demand() { return prefix + "/demand"; } /** * 查询【请填写功能名称】列表 */ @RequiresPermissions("notice:demand:list") @PostMapping("/list") @ResponseBody public TableDataInfo list(NoticeDemand noticeDemand) { startPage(); List list = noticeDemandService.selectNoticeDemandList(noticeDemand); return getDataTable(list); } /** * 导出【请填写功能名称】列表 */ @RequiresPermissions("notice:demand:export") @PostMapping("/export") @ResponseBody public AjaxResult export(NoticeDemand noticeDemand) { List list = noticeDemandService.selectNoticeDemandList(noticeDemand); ExcelUtil util = new ExcelUtil(NoticeDemand.class); return util.exportExcel(list, "demand"); } /** * 新增【请填写功能名称】 */ @GetMapping("/add") public String add() { return prefix + "/add"; } /** * 新增保存【请填写功能名称】 */ @RequiresPermissions("notice:demand:add") @Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT) @PostMapping("/add") @ResponseBody public AjaxResult addSave(NoticeDemand noticeDemand) { return toAjax(noticeDemandService.insertNoticeDemand(noticeDemand)); } /** * 修改【请填写功能名称】 */ @GetMapping("/edit/{id}") public String edit(@PathVariable("id") Long id, ModelMap mmap) { NoticeDemand noticeDemand = noticeDemandService.selectNoticeDemandById(id); mmap.put("noticeDemand", noticeDemand); return prefix + "/edit"; } /** * 修改【请填写功能名称】 */ @GetMapping("/see/{id}") public String see(@PathVariable("id") Long id, ModelMap mmap) { NoticeDemand noticeDemand = noticeDemandService.selectNoticeDemandById(id); mmap.put("noticeDemand", noticeDemand); return prefix + "/see"; } /** * 修改保存【请填写功能名称】 */ @RequiresPermissions("notice:demand:edit") @Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE) @PostMapping("/edit") @ResponseBody public AjaxResult editSave(NoticeDemand noticeDemand) { return toAjax(noticeDemandService.updateNoticeDemand(noticeDemand)); } /** * 删除【请填写功能名称】 */ @RequiresPermissions("notice:demand:remove") @Log(title = "【请填写功能名称】", businessType = BusinessType.DELETE) @PostMapping( "/remove") @ResponseBody public AjaxResult remove(String ids) { return toAjax(noticeDemandService.deleteNoticeDemandByIds(ids)); } }