java校园二手市场小程序源码
作者:互联网
随着微信小程序跳一跳的出现,微信小程序瞬间变得火爆起来,大家纷纷涌入到小程序开发的行业,下面给大家讲解下如用java作为服务端来开发微信校园二手商城小程序。
小城端主要功能:
发布二手商品、查看商品、购买商品、个人中心、我的发布、我的订单、我的收货地址等
后台采用springboot+mybatis
给前台提供restful api
后台代码
@RestController
@RequestMapping("/api/goods")
@Api("商品接口")
public class ApiGoodsController {
@Autowired
private GoodsService goodsService;
@AuthIgnore
@GetMapping("list")
@ApiOperation(value = "获取商品信息")
public R list(@RequestParam Map<String, Object> map){
List<GoodsEntity> goodsList = goodsService.queryList(map);
return R.ok().put("goodsList", goodsList);
}
@AuthIgnore
@GetMapping("detail")
@ApiOperation(value = "获取商品详情")
public R detail(int id){
GoodsEntity goods = goodsService.queryObject(id);
return R.ok().put("goods", goods);
}
@PostMapping("save")
@ApiOperation(value = "保存商品")
public R add(@LoginUser UserEntity user, @RequestBody GoodsEntity goods) {
goods.setUserId(user.getId());
goods.setStatus(0);
goods.setCreateTime(new Date());
goodsService.save(goods);
return R.ok();
}
@GetMapping("myPublish")
@ApiOperation(value = "获取商品信息")
public R myPublish(@LoginUser UserEntity user, @RequestParam Map<String, Object> map){
map.put("userId", user.getId());
List<GoodsEntity> goodsList = goodsService.queryList(map);
return R.ok().put("goodsList", goodsList);
}
}
微服汇 发布了4 篇原创文章 · 获赞 17 · 访问量 3万+ 私信 关注
标签:map,goodsList,java,goodsService,return,二手市场,goods,源码,public 来源: https://blog.csdn.net/mm89934266/article/details/89681583