GoodsBatchController.java 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. package com.kmall.admin.controller;
  2. import com.kmall.admin.entity.GoodsBatchEntity;
  3. import com.kmall.admin.service.GoodsBatchService;
  4. import com.kmall.common.utils.PageUtils;
  5. import com.kmall.common.utils.Query;
  6. import com.kmall.common.utils.R;
  7. import org.springframework.beans.factory.annotation.Autowired;
  8. import org.springframework.stereotype.Controller;
  9. import org.springframework.web.bind.annotation.*;
  10. import java.util.List;
  11. import java.util.Map;
  12. /**
  13. * 批次(多)— SKU(多)Controller
  14. *
  15. * @author emato
  16. * @email admin@qhdswl.com
  17. * @date 2020-06-13 09:58:15
  18. */
  19. @Controller
  20. @RequestMapping("goodsbatch")
  21. public class GoodsBatchController {
  22. @Autowired
  23. private GoodsBatchService goodsBatchService;
  24. /**
  25. * 查看列表
  26. */
  27. @RequestMapping("/list")
  28. // @RequiresPermissions("goodsbatch:list")
  29. @ResponseBody
  30. public R list(@RequestParam Map<String, Object> params) {
  31. //查询列表数据
  32. Query query = new Query(params);
  33. List<GoodsBatchEntity> goodsBatchList = goodsBatchService.queryList(query);
  34. int total = goodsBatchService.queryTotal(query);
  35. PageUtils pageUtil = new PageUtils(goodsBatchList, total, query.getLimit(), query.getPage());
  36. return R.ok().put("page", pageUtil);
  37. }
  38. /**
  39. * 查看信息
  40. */
  41. @RequestMapping("/info/{id}")
  42. // @RequiresPermissions("goodsbatch:info")
  43. @ResponseBody
  44. public R info(@PathVariable("id") Integer id) {
  45. GoodsBatchEntity goodsBatch = goodsBatchService.queryObject(id);
  46. return R.ok().put("goodsBatch", goodsBatch);
  47. }
  48. /**
  49. * 保存
  50. */
  51. @RequestMapping("/save")
  52. // @RequiresPermissions("goodsbatch:save")
  53. @ResponseBody
  54. public R save(@RequestBody GoodsBatchEntity goodsBatch) {
  55. goodsBatchService.save(goodsBatch);
  56. return R.ok();
  57. }
  58. /**
  59. * 修改
  60. */
  61. @RequestMapping("/update")
  62. // @RequiresPermissions("goodsbatch:update")
  63. @ResponseBody
  64. public R update(@RequestBody GoodsBatchEntity goodsBatch) {
  65. goodsBatchService.update(goodsBatch);
  66. return R.ok();
  67. }
  68. /**
  69. * 删除
  70. */
  71. @RequestMapping("/delete")
  72. // @RequiresPermissions("goodsbatch:delete")
  73. @ResponseBody
  74. public R delete(@RequestBody Integer[]ids) {
  75. goodsBatchService.deleteBatch(ids);
  76. return R.ok();
  77. }
  78. /**
  79. * 查看所有列表
  80. */
  81. @RequestMapping("/queryAll")
  82. @ResponseBody
  83. public R queryAll(@RequestParam Map<String, Object> params) {
  84. List<GoodsBatchEntity> list = goodsBatchService.queryList(params);
  85. return R.ok().put("list", list);
  86. }
  87. /**
  88. * 根据sku查批次列表
  89. * @param sku
  90. * @return
  91. */
  92. @RequestMapping("/queryListBySku")
  93. @ResponseBody
  94. public R queryListBySku(@RequestParam String sku) {
  95. List<GoodsBatchEntity> list = goodsBatchService.queryListBySku(sku);
  96. return R.ok().put("list",list);
  97. }
  98. }