LiveGoodsController.java 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. package com.ym.mec.web.controller;
  2. import com.ym.mec.biz.dal.entity.LiveGoods;
  3. import com.ym.mec.biz.dal.page.LiveGoodsQueryInfo;
  4. import com.ym.mec.biz.service.LiveGoodsService;
  5. import com.ym.mec.common.controller.BaseController;
  6. import com.ym.mec.common.entity.HttpResponseResult;
  7. import io.swagger.annotations.Api;
  8. import io.swagger.annotations.ApiOperation;
  9. import org.springframework.beans.factory.annotation.Autowired;
  10. import org.springframework.security.access.prepost.PreAuthorize;
  11. import org.springframework.web.bind.annotation.*;
  12. @Api(tags = "直播间商品管理")
  13. @RequestMapping("liveGoods")
  14. @RestController
  15. public class LiveGoodsController extends BaseController {
  16. @Autowired
  17. private LiveGoodsService liveGoodsService;
  18. @ApiOperation("获取商品详情")
  19. @GetMapping(value = "/get")
  20. @PreAuthorize("@pcs.hasPermissions('liveGoods/get')")
  21. public HttpResponseResult get(Integer goodsId) {
  22. return succeed(liveGoodsService.get(goodsId));
  23. }
  24. @ApiOperation("分页查询直播间商品")
  25. @PostMapping(value = "/page")
  26. @PreAuthorize("@pcs.hasPermissions('liveGoods/page')")
  27. public HttpResponseResult page(LiveGoodsQueryInfo queryInfo) {
  28. return succeed(liveGoodsService.queryGoodsPage(queryInfo));
  29. }
  30. @ApiOperation("新增直播间商品")
  31. @PostMapping("/add")
  32. @PreAuthorize("@pcs.hasPermissions('liveGoods/add')")
  33. public HttpResponseResult add(@RequestBody LiveGoods liveGoods) {
  34. liveGoodsService.insert(liveGoods);
  35. return succeed();
  36. }
  37. @ApiOperation("修改直播间商品")
  38. @PostMapping(value = "/update")
  39. @PreAuthorize("@pcs.hasPermissions('liveGoods/update')")
  40. public HttpResponseResult update(@RequestBody LiveGoods liveGoods) {
  41. liveGoodsService.updateLiveGoods(liveGoods);
  42. return succeed();
  43. }
  44. @ApiOperation("删除直播间商品")
  45. @PostMapping(value = "/delete")
  46. @PreAuthorize("@pcs.hasPermissions('liveGoods/delete')")
  47. public HttpResponseResult delete(Integer goodsId) {
  48. liveGoodsService.deleteLiveGoods(goodsId);
  49. return succeed();
  50. }
  51. // @ApiOperation("上架、下架直播间商品")
  52. // @PostMapping("/updateStatus")
  53. // @PreAuthorize("@pcs.hasPermissions('liveGoods/updateStatus')")
  54. // public HttpResponseResult updateStatus(Integer liveGoodsId, Boolean status) {
  55. // liveGoodsService.updateStatus(liveGoodsId, status);
  56. // return succeed();
  57. // }
  58. }