package com.example.qiyeerp.controller; import com.example.qiyeerp.common.AjaxResult; import com.example.qiyeerp.common.ApplicationVariable; import com.example.qiyeerp.common.ToolsForAll; import com.example.qiyeerp.info.*; import com.example.qiyeerp.mapper.ProductMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; import java.util.List; @RestController @RequestMapping("/product") public class ProductController { @Autowired ProductMapper productMapper; @RequestMapping("/ShengChanList") public AjaxResult ShengChanList(HttpServletRequest request){ String works="第一生产车间"; HttpSession session=request.getSession(); UserInfo info=(UserInfo)session.getAttribute(ApplicationVariable.SESSION_USERINFO_KEY); System.out.println("info->"+info); // List<ShengchanList> list=productMapper.ShengChanList(info.getDepartment()); List<ShengchanList> list=productMapper.ShengChanList(works); return AjaxResult.success(list); } @RequestMapping("/confirmMission") public AjaxResult confirmMission(Integer id,String status){ int result=productMapper.confirmMission(id, status); return AjaxResult.success(result); } @RequestMapping("/showJingDu") public AjaxResult showJingDu(HttpServletRequest request){ HttpSession session=request.getSession(); UserInfo info=(UserInfo)session.getAttribute(ApplicationVariable.SESSION_USERINFO_KEY); ShengchanJingDu jingDu=productMapper.showJingDu(info.getDepartment(),"进行中"); jingDu.setCurrent_number(10); System.out.println(jingDu); return AjaxResult.success(jingDu); } @RequestMapping("/applicationMaterials") public AjaxResult applicationMaterials(HttpServletRequest request){ ToolsForAll tools=new ToolsForAll(); getMaterials materials= tools.getNeedMaterials(request,productMapper); return AjaxResult.success(materials); } @RequestMapping("/confirmMaterials") public AjaxResult confirmMaterials(HttpServletRequest request){ HttpSession session=request.getSession(); UserInfo info=(UserInfo)session.getAttribute(ApplicationVariable.SESSION_USERINFO_KEY); ToolsForAll tools=new ToolsForAll(); getMaterials materials= tools.getNeedMaterials(request,productMapper); //1.将任务状态更新成“进行中” productMapper.confirmMission(materials.getMission().getId(),"进行中"); //2.将该操作记录到材料申请表 application_materials a=new application_materials(); a.setMession_id(materials.getMission().getId()); a.setApplicatier(info.getPhone()); productMapper.addApplicationMaterials(a); //3.将原料库的数量更新 for (material_relationship ship: materials.getRelationships()){ productMapper.updateMaterials(ship.getMaterial_name(),ship.getNeedCount()); } //4.返回结果 return AjaxResult.success(1); } }
标签:11,info,AjaxResult,23,2023,request,materials,productMapper,import From: https://www.cnblogs.com/wllovelmbforever/p/17847578.html