MesSopWayController.java 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. package com.jeesite.modules.mes.web;
  2. import java.util.List;
  3. import javax.servlet.http.HttpServletRequest;
  4. import javax.servlet.http.HttpServletResponse;
  5. import com.jeesite.modules.mes.entity.MesSop;
  6. import com.jeesite.modules.mes.service.MesSopService;
  7. import org.apache.shiro.authz.annotation.RequiresPermissions;
  8. import org.springframework.beans.factory.annotation.Autowired;
  9. import org.springframework.stereotype.Controller;
  10. import org.springframework.ui.Model;
  11. import org.springframework.validation.annotation.Validated;
  12. import org.springframework.web.bind.annotation.ModelAttribute;
  13. import org.springframework.web.bind.annotation.PostMapping;
  14. import org.springframework.web.bind.annotation.RequestMapping;
  15. import org.springframework.web.bind.annotation.ResponseBody;
  16. import com.jeesite.common.config.Global;
  17. import com.jeesite.common.entity.Page;
  18. import com.jeesite.common.web.BaseController;
  19. import com.jeesite.modules.mes.entity.MesSopWay;
  20. import com.jeesite.modules.mes.service.MesSopWayService;
  21. /**
  22. * 指导书Controller
  23. * @author hzd
  24. * @version 2023-07-17
  25. */
  26. @Controller
  27. @RequestMapping(value = "${adminPath}/mes/mesSopWay")
  28. public class MesSopWayController extends BaseController {
  29. @Autowired
  30. private MesSopWayService mesSopWayService;
  31. @Autowired
  32. private MesSopService mesSopService;
  33. /**
  34. * 获取数据
  35. */
  36. @ModelAttribute
  37. public MesSopWay get(String id, boolean isNewRecord) {
  38. return mesSopWayService.get(id, isNewRecord);
  39. }
  40. /**
  41. * 查询列表
  42. */
  43. @RequiresPermissions("mes:mesSop:edit")
  44. @RequestMapping(value = {"list", ""})
  45. public String list(MesSopWay mesSopWay, Model model) {
  46. model.addAttribute("mesSopWay", mesSopWay);
  47. MesSop mesSop = mesSopService.get(mesSopWay.getSopId());
  48. model.addAttribute("mesSop", mesSop);
  49. return "modules/mes/mesSopWayList";
  50. }
  51. /**
  52. * 查询列表数据
  53. */
  54. @RequiresPermissions("mes:mesSop:edit")
  55. @RequestMapping(value = "listData")
  56. @ResponseBody
  57. public Page<MesSopWay> listData(MesSopWay mesSopWay, HttpServletRequest request, HttpServletResponse response) {
  58. mesSopWay.setPage(new Page<>(request, response));
  59. Page<MesSopWay> page = mesSopWayService.findPage(mesSopWay);
  60. return page;
  61. }
  62. /**
  63. * 查看编辑表单
  64. */
  65. @RequiresPermissions("mes:mesSop:edit")
  66. @RequestMapping(value = "form")
  67. public String form(MesSopWay mesSopWay, Model model) {
  68. model.addAttribute("mesSopWay", mesSopWay);
  69. return "modules/mes/mesSopWayForm";
  70. }
  71. /**
  72. * 保存数据
  73. */
  74. @RequiresPermissions("mes:mesSop:edit")
  75. @PostMapping(value = "save")
  76. @ResponseBody
  77. public String save(@Validated MesSopWay mesSopWay) {
  78. mesSopWayService.save(mesSopWay);
  79. return renderResult(Global.TRUE, text("保存指导书成功!"));
  80. }
  81. /**
  82. * 停用数据
  83. */
  84. @RequiresPermissions("mes:mesSop:edit")
  85. @RequestMapping(value = "disable")
  86. @ResponseBody
  87. public String disable(MesSopWay mesSopWay) {
  88. mesSopWay.setStatus(MesSopWay.STATUS_DISABLE);
  89. mesSopWayService.updateStatus(mesSopWay);
  90. return renderResult(Global.TRUE, text("停用指导书成功"));
  91. }
  92. /**
  93. * 启用数据
  94. */
  95. @RequiresPermissions("mes:mesSop:edit")
  96. @RequestMapping(value = "enable")
  97. @ResponseBody
  98. public String enable(MesSopWay mesSopWay) {
  99. mesSopWay.setStatus(MesSopWay.STATUS_NORMAL);
  100. mesSopWayService.updateStatus(mesSopWay);
  101. return renderResult(Global.TRUE, text("启用指导书成功"));
  102. }
  103. /**
  104. * 删除数据
  105. */
  106. @RequiresPermissions("mes:mesSop:edit")
  107. @RequestMapping(value = "delete")
  108. @ResponseBody
  109. public String delete(MesSopWay mesSopWay) {
  110. mesSopWayService.delete(mesSopWay);
  111. return renderResult(Global.TRUE, text("删除指导书成功!"));
  112. }
  113. }