/**
* 根据 ID 获取实体
* @param id
* @return
*/
public Goods findOne(Long id);
@Override
public Goods findOne(Long id) {
Goods goods=new Goods();
TbGoods tbGoods = goodsMapper.selectByPrimaryKey(id);
goods.setGoods(tbGoods);
TbGoodsDesc tbGoodsDesc = goodsDescMapper.selectByPrimaryKey(id);
goods.setGoodsDesc(tbGoodsDesc);
return goods;
}
/**
* 获取实体
* @param id
* @return
*/
@RequestMapping("/findOne")
public Goods findOne(Long id){
return goodsService.findOne(id);
}
//商品控制层(商家后台)
app.controller('goodsController',function($scope,$controller,$location,goodsService
,uploadService,item_catService,type_templateService){
......
//查询实体
$scope.findOne=function(){
var id= $location.search()['id'];//获取参数值
if(id==null){
return ;
}
goodsService.findOne(id).success(
function(response){
$scope.entity= response;
}
);
}
<body
class="hold-transition skin-red sidebar-mini"
ng-app="pinyougou"
ng-controller="goodsController" ng-init="selectItemCat1List();findOne()">
欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/) | 黑马程序员IT技术论坛 X3.2 |