package cn.edu.nuc.shop.controller;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import cn.edu.nuc.shop.entiry.Forder;
import cn.edu.nuc.shop.service.interfaces.ForderService;
@Controller
@RequestMapping("/forder")
public class ForderController {
	@Autowired
	private ForderService forderMapper;
	
	@RequestMapping(value="/order",method=RequestMethod.GET)
	public String toorder(){
		
		return "redirect:/order.jsp";
	}
	
	@RequestMapping(value="/order",method=RequestMethod.POST)
	public String order(Forder forder,HttpSession session,HttpServletRequest request){
		
		Forder sessionforder = (Forder)session.getAttribute("forder");
		
		int count=0;
		try {
			
			count = forderMapper.insertOrder(forder,sessionforder);
			
		} catch (Exception e) {
			
			request.setAttribute("msg", "商品数量不足");
			
			return "forward:/msg.jsp";
		}
		
		 System.out.println(forder.getFid());
		 
		 System.out.println(count+"--------------------------");
		 
		 request.setAttribute("msg", "提交订单成功");
		 
		 request.removeAttribute("forder");
		 session.removeAttribute("forder");
		
		
		return "forward:/msg.jsp";
	}
	
}
 最近下载更多
最近下载更多
                
                vincemokea     LV9
                9月2日
            
            
        
                Xppasdf     LV3
                2024年10月29日
            
            
        
                qiulai     LV1
                2024年5月30日
            
            
        
                fdeded     LV1
                2024年4月20日
            
            
        
                zhufbing     LV1
                2024年1月29日
            
            
        
                yuanchuang     LV22
                2023年12月28日
            
            
        
                微信网友_6680567232876544     LV8
                2023年10月10日
            
            
        
                SDLFJL     LV6
                2023年8月17日
            
            
        
                微信网友_6436772032335872     LV3
                2023年4月17日
            
            
        
                2643028272     LV1
                2023年3月6日
            
            
         最近浏览更多
最近浏览更多
                
                不爱吃香菜    
                10月17日
            
            
                    暂无贡献等级
            
        
                1231578     LV9
                9月28日
            
            
        
                vincemokea     LV9
                9月2日
            
            
        
                微信网友_6956978011000832     LV2
                7月27日
            
            
        
                486900    
                6月17日
            
            
                    暂无贡献等级
            
        
                阿莫斯     LV1
                2月25日
            
            
        
                orang801     LV2
                2月24日
            
            
        
                微信网友_7310057461567488    
                2024年12月24日
            
            
                    暂无贡献等级
            
        
                ma406805131     LV19
                2024年12月18日
            
            
        
                微信网友_6377331253415936     LV3
                2024年11月24日
            
            
        
 
                 
     
                