首页>代码>ssm整合easyui实现简单的进销存管理系统(适合新手学习easyui)>/phoneInventory/src/main/java/com/chen/controller/BuyOrderAction.java
package com.chen.controller; import java.util.Arrays; import javax.annotation.Resource; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import com.chen.entity.BuyOrder; import com.chen.entity.BuyOrderDetail; import com.chen.service.BuyOrderService; import com.fasterxml.jackson.databind.ObjectMapper; @Controller @RequestMapping("/buyOrder") public class BuyOrderAction extends BaseController { @Resource private BuyOrderService buyOrderService; @RequestMapping(value="/insert") @ResponseBody //如果返回json格式,需要这个注解,这里用来测试环境 public Object insert(BuyOrder buyOrder){ System.out.println("---action.buyOrder:"+buyOrder); // System.out.println("---action.rows:"+rows); //提供json格式数据转java对象 ObjectMapper mapper = new ObjectMapper(); int i = 0; try { BuyOrderDetail [] buyOrderDetails = mapper.readValue(buyOrder.getRows(), BuyOrderDetail[].class); buyOrder.setBuyOrderDetails(Arrays.asList(buyOrderDetails)); i =buyOrderService.insertBuyOrder(buyOrder); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } return i; } }
最近下载更多
weilaizhisheng LV21
3月21日
oldfox LV18
2023年7月28日
cunbie LV4
2023年6月13日
yeyuuu LV6
2023年5月18日
微信网友_6481263246938112 LV2
2023年5月18日
2102565387 LV1
2022年12月17日
184445428 LV6
2022年11月28日
计算机暴龙战士 LV16
2022年11月27日
lwp011 LV27
2022年9月19日
13645180698 LV4
2022年8月4日
最近浏览更多
pangzhihui LV12
4月17日
来了来了拉
4月17日
暂无贡献等级
weilaizhisheng LV21
3月21日
h G24741 LV2
3月12日
midyn203 LV2
2月5日
XiaoSong888 LV2
1月10日
沈从文 LV2
1月1日
202105013142 LV1
2023年12月17日
durianmoto
2023年12月2日
暂无贡献等级
1437047954
2023年11月29日
暂无贡献等级