首页>代码>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 10月9日
Zyy19820821  LV2 9月17日
过往烟尘  LV1 7月31日
murphy  LV7 7月14日
小海脑洞大开  LV11 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日
最近浏览更多
lz88888  LV12 昨天
lqzixi  LV4 10月9日
Zyy19820821  LV2 9月16日
chn-lei  LV2 8月5日
过往烟尘  LV1 7月31日
murphy  LV7 7月14日
一只小鲤鱼  LV8 7月13日
zhengguangshun  LV4 6月25日
abcadmin123  LV2 6月24日
暂无贡献等级
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友