package com.jeesite.modules.mes.web; import java.util.List; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.jeesite.modules.mes.entity.MesSop; import com.jeesite.modules.mes.service.MesSopService; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import com.jeesite.common.config.Global; import com.jeesite.common.entity.Page; import com.jeesite.common.web.BaseController; import com.jeesite.modules.mes.entity.MesSopWay; import com.jeesite.modules.mes.service.MesSopWayService; /** * 指导书Controller * @author hzd * @version 2023-07-17 */ @Controller @RequestMapping(value = "${adminPath}/mes/mesSopWay") public class MesSopWayController extends BaseController { @Autowired private MesSopWayService mesSopWayService; @Autowired private MesSopService mesSopService; /** * 获取数据 */ @ModelAttribute public MesSopWay get(String id, boolean isNewRecord) { return mesSopWayService.get(id, isNewRecord); } /** * 查询列表 */ @RequiresPermissions("mes:mesSop:edit") @RequestMapping(value = {"list", ""}) public String list(MesSopWay mesSopWay, Model model) { model.addAttribute("mesSopWay", mesSopWay); MesSop mesSop = mesSopService.get(mesSopWay.getSopId()); model.addAttribute("mesSop", mesSop); return "modules/mes/mesSopWayList"; } /** * 查询列表数据 */ @RequiresPermissions("mes:mesSop:edit") @RequestMapping(value = "listData") @ResponseBody public Page listData(MesSopWay mesSopWay, HttpServletRequest request, HttpServletResponse response) { mesSopWay.setPage(new Page<>(request, response)); Page page = mesSopWayService.findPage(mesSopWay); return page; } /** * 查看编辑表单 */ @RequiresPermissions("mes:mesSop:edit") @RequestMapping(value = "form") public String form(MesSopWay mesSopWay, Model model) { model.addAttribute("mesSopWay", mesSopWay); return "modules/mes/mesSopWayForm"; } /** * 保存数据 */ @RequiresPermissions("mes:mesSop:edit") @PostMapping(value = "save") @ResponseBody public String save(@Validated MesSopWay mesSopWay) { mesSopWayService.save(mesSopWay); return renderResult(Global.TRUE, text("保存指导书成功!")); } /** * 停用数据 */ @RequiresPermissions("mes:mesSop:edit") @RequestMapping(value = "disable") @ResponseBody public String disable(MesSopWay mesSopWay) { mesSopWay.setStatus(MesSopWay.STATUS_DISABLE); mesSopWayService.updateStatus(mesSopWay); return renderResult(Global.TRUE, text("停用指导书成功")); } /** * 启用数据 */ @RequiresPermissions("mes:mesSop:edit") @RequestMapping(value = "enable") @ResponseBody public String enable(MesSopWay mesSopWay) { mesSopWay.setStatus(MesSopWay.STATUS_NORMAL); mesSopWayService.updateStatus(mesSopWay); return renderResult(Global.TRUE, text("启用指导书成功")); } /** * 删除数据 */ @RequiresPermissions("mes:mesSop:edit") @RequestMapping(value = "delete") @ResponseBody public String delete(MesSopWay mesSopWay) { mesSopWayService.delete(mesSopWay); return renderResult(Global.TRUE, text("删除指导书成功!")); } }