NoticeDemandController.java 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. package com.dgtly.notice.controller;
  2. import java.util.List;
  3. import org.apache.shiro.authz.annotation.RequiresPermissions;
  4. import org.springframework.beans.factory.annotation.Autowired;
  5. import org.springframework.stereotype.Controller;
  6. import org.springframework.ui.ModelMap;
  7. import org.springframework.web.bind.annotation.GetMapping;
  8. import org.springframework.web.bind.annotation.PathVariable;
  9. import org.springframework.web.bind.annotation.PostMapping;
  10. import org.springframework.web.bind.annotation.RequestMapping;
  11. import org.springframework.web.bind.annotation.ResponseBody;
  12. import com.dgtly.common.annotation.Log;
  13. import com.dgtly.common.enums.BusinessType;
  14. import com.dgtly.notice.domain.NoticeDemand;
  15. import com.dgtly.notice.service.INoticeDemandService;
  16. import com.dgtly.common.core.controller.BaseController;
  17. import com.dgtly.common.core.domain.AjaxResult;
  18. import com.dgtly.common.utils.poi.ExcelUtil;
  19. import com.dgtly.common.core.page.TableDataInfo;
  20. /**
  21. * 【请填写功能名称】Controller
  22. *
  23. * @author dgtly
  24. * @date 2020-02-13
  25. */
  26. @Controller
  27. @RequestMapping("/notice/demand")
  28. public class NoticeDemandController extends BaseController
  29. {
  30. private String prefix = "notice/demand";
  31. @Autowired
  32. private INoticeDemandService noticeDemandService;
  33. @RequiresPermissions("notice:demand:view")
  34. @GetMapping()
  35. public String demand()
  36. {
  37. return prefix + "/demand";
  38. }
  39. /**
  40. * 查询【请填写功能名称】列表
  41. */
  42. @RequiresPermissions("notice:demand:list")
  43. @PostMapping("/list")
  44. @ResponseBody
  45. public TableDataInfo list(NoticeDemand noticeDemand)
  46. {
  47. startPage();
  48. List<NoticeDemand> list = noticeDemandService.selectNoticeDemandList(noticeDemand);
  49. return getDataTable(list);
  50. }
  51. /**
  52. * 导出【请填写功能名称】列表
  53. */
  54. @RequiresPermissions("notice:demand:export")
  55. @PostMapping("/export")
  56. @ResponseBody
  57. public AjaxResult export(NoticeDemand noticeDemand)
  58. {
  59. List<NoticeDemand> list = noticeDemandService.selectNoticeDemandList(noticeDemand);
  60. ExcelUtil<NoticeDemand> util = new ExcelUtil<NoticeDemand>(NoticeDemand.class);
  61. return util.exportExcel(list, "demand");
  62. }
  63. /**
  64. * 新增【请填写功能名称】
  65. */
  66. @GetMapping("/add")
  67. public String add()
  68. {
  69. return prefix + "/add";
  70. }
  71. /**
  72. * 新增保存【请填写功能名称】
  73. */
  74. @RequiresPermissions("notice:demand:add")
  75. @Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT)
  76. @PostMapping("/add")
  77. @ResponseBody
  78. public AjaxResult addSave(NoticeDemand noticeDemand)
  79. {
  80. return toAjax(noticeDemandService.insertNoticeDemand(noticeDemand));
  81. }
  82. /**
  83. * 修改【请填写功能名称】
  84. */
  85. @GetMapping("/edit/{id}")
  86. public String edit(@PathVariable("id") Long id, ModelMap mmap)
  87. {
  88. NoticeDemand noticeDemand = noticeDemandService.selectNoticeDemandById(id);
  89. mmap.put("noticeDemand", noticeDemand);
  90. return prefix + "/edit";
  91. }
  92. /**
  93. * 修改【请填写功能名称】
  94. */
  95. @GetMapping("/see/{id}")
  96. public String see(@PathVariable("id") Long id, ModelMap mmap)
  97. {
  98. NoticeDemand noticeDemand = noticeDemandService.selectNoticeDemandById(id);
  99. mmap.put("noticeDemand", noticeDemand);
  100. return prefix + "/see";
  101. }
  102. /**
  103. * 修改保存【请填写功能名称】
  104. */
  105. @RequiresPermissions("notice:demand:edit")
  106. @Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE)
  107. @PostMapping("/edit")
  108. @ResponseBody
  109. public AjaxResult editSave(NoticeDemand noticeDemand)
  110. {
  111. return toAjax(noticeDemandService.updateNoticeDemand(noticeDemand));
  112. }
  113. /**
  114. * 删除【请填写功能名称】
  115. */
  116. @RequiresPermissions("notice:demand:remove")
  117. @Log(title = "【请填写功能名称】", businessType = BusinessType.DELETE)
  118. @PostMapping( "/remove")
  119. @ResponseBody
  120. public AjaxResult remove(String ids)
  121. {
  122. return toAjax(noticeDemandService.deleteNoticeDemandByIds(ids));
  123. }
  124. }