首页>代码>ssm进销存流程管理系统>/erp/src/cn/erp/controller/GoodsController.java
package cn.erp.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

import cn.erp.dto.GoodsDto;
import cn.erp.pojo.TblGoodstype;
import cn.erp.pojo.TblSupplier;
import cn.erp.service.GoodsService;
import cn.erp.service.GoodstypeService;
import cn.erp.service.SupplierService;

/**
 * 商品
 * @author Administrator
 *
 */
@Controller
@RequestMapping(value="/goods")
public class GoodsController {

	@Autowired
	private SupplierService supplierService;
	@Autowired
	private GoodsService goodsService;
	@Autowired
	private GoodstypeService goodstypeService;
	
	
	
	//到商品列表//待调整
	@RequestMapping(value="/goodsList.do")
	public String goodsList(ModelMap model,Long gysId,String name,String producer,String unit){
		List<TblSupplier> suppliers = supplierService.selAllSupplier();
		List<GoodsDto> goods = goodsService.selGoods(gysId,name,producer,unit);
		model.addAttribute("suppliers", suppliers);
		model.addAttribute("goods", goods);
		return "goods/list";
	}
	//到新增页面
	@RequestMapping(value="/toAddGoods.do")
	public String toAddGoods(ModelMap model){
		//获得所有供应商
		List<TblSupplier> supplierAll = supplierService.selAllSupplier();
		//获得所有商品类别
		List<TblGoodstype> goodstypeAll = goodstypeService.selAll();
		model.addAttribute("supplierAll", supplierAll);
		model.addAttribute("goodstypeAll", goodstypeAll);
		return "goods/input";
	}
	//新增前台页面需要改为供应商联动
	@RequestMapping(value="/addGoods.do")
	public String addGoods(Long supplier,Long goodstype,String name,String origin,String producer,String unit,
			Double inPrice,Double outPrice,Integer useNum){
		goodsService.addGoods(supplier,goodstype,name,origin,producer,unit,inPrice,outPrice,useNum);
		
		return "redirect:/goods/goodsList.do";
	}
	//到修改页面
	@RequestMapping(value="/toGoodsEdit.do")
	public String toGoodsEdit(ModelMap model,Long uuid){
		//所有供应商
		List<TblSupplier> supplierAll = supplierService.selAllSupplier();
		//所有商品类别
		List<TblGoodstype> goodstypeAll = goodstypeService.selAll();
		model.addAttribute("supplierAll", supplierAll);
		model.addAttribute("goodstypeAll", goodstypeAll);
		GoodsDto goods = goodsService.selGoodsById(uuid);
		model.addAttribute("goods", goods);
		return "goods/edit";
	}
	//修改//前台页面带调整
	@RequestMapping(value="/GoodsEdit.do")
	public String GoodsEdit(ModelMap model,Long supplier,Long goodstype,String name,String origin,String producer,String unit,
			Double inPrice,Double outPrice,Integer useNum,Long uuid){
		goodsService.updateGoods(supplier,goodstype,name,origin,producer,unit,inPrice,outPrice,useNum,uuid);
		return "redirect:/goods/goodsList.do";
	}
	
	
}
最近下载更多
lqzixi  LV4 2024年10月9日
Zyy19820821  LV2 2024年9月17日
过往烟尘  LV1 2024年7月31日
murphy  LV7 2024年7月14日
小海脑洞大开  LV11 2024年2月4日
微信网友_5986558820093952  LV4 2023年12月28日
2017143155  LV12 2023年7月20日
西域行者  LV3 2023年4月24日
我睡觉时不困  LV7 2022年12月10日
dlgaotao  LV2 2022年11月9日
最近浏览更多
benben2020 3月19日
暂无贡献等级
rxj515  LV2 3月17日
wlax99  LV12 2月17日
krispeng  LV14 1月2日
2072376767  LV2 2024年12月26日
三秋桂子  LV1 2024年12月21日
微信网友_7303446832484352 2024年12月19日
暂无贡献等级
dongandmin  LV8 2024年12月18日
WenMeng  LV9 2024年12月2日
我是你唯一的执着  LV4 2024年11月28日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友