MngChangeController.java 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. package com.kmall.admin.controller;
  2. import java.util.List;
  3. import java.util.Map;
  4. import com.kmall.admin.entity.MngChangeEntity;
  5. import com.kmall.admin.service.MngChangeService;
  6. import com.kmall.admin.utils.ParamUtils;
  7. import com.kmall.common.utils.PageUtils;
  8. import com.kmall.common.utils.Query;
  9. import com.kmall.common.utils.R;
  10. import org.apache.shiro.authz.annotation.RequiresPermissions;
  11. import org.springframework.beans.factory.annotation.Autowired;
  12. import org.springframework.stereotype.Controller;
  13. import org.springframework.web.bind.annotation.*;
  14. /**
  15. * 库存变化表Controller
  16. *
  17. * @author huangyq
  18. * @email admin@qhdswl.com
  19. * @date 2019-03-11 10:29:49
  20. */
  21. @Controller
  22. @RequestMapping("mngchange")
  23. public class MngChangeController {
  24. @Autowired
  25. private MngChangeService mngChangeService;
  26. /**
  27. * 查看列表
  28. */
  29. @RequestMapping("/list")
  30. @RequiresPermissions("mngchange:list")
  31. @ResponseBody
  32. public R list(@RequestParam Map<String, Object> params) {
  33. ParamUtils.setQueryPowerByRoleType(params, "storeId", "merchSn", "thirdPartyMerchCode");
  34. //查询列表数据
  35. Query query = new Query(params);
  36. List<MngChangeEntity> mngChangeList = mngChangeService.queryList(query);
  37. int total = mngChangeService.queryTotal(query);
  38. PageUtils pageUtil = new PageUtils(mngChangeList, total, query.getLimit(), query.getPage());
  39. return R.ok().put("page", pageUtil);
  40. }
  41. /**
  42. * 查看信息
  43. */
  44. @RequestMapping("/info/{id}")
  45. @RequiresPermissions("mngchange:info")
  46. @ResponseBody
  47. public R info(@PathVariable("id") Integer id) {
  48. MngChangeEntity mngChange = mngChangeService.queryObject(id);
  49. return R.ok().put("mngChange", mngChange);
  50. }
  51. /**
  52. * 保存
  53. */
  54. @RequestMapping("/save")
  55. @RequiresPermissions("mngchange:save")
  56. @ResponseBody
  57. public R save(@RequestBody MngChangeEntity mngChange) {
  58. mngChangeService.save(mngChange);
  59. return R.ok();
  60. }
  61. /**
  62. * 修改
  63. */
  64. @RequestMapping("/update")
  65. @RequiresPermissions("mngchange:update")
  66. @ResponseBody
  67. public R update(@RequestBody MngChangeEntity mngChange) {
  68. mngChangeService.update(mngChange);
  69. return R.ok();
  70. }
  71. /**
  72. * 删除
  73. */
  74. @RequestMapping("/delete")
  75. @RequiresPermissions("mngchange:delete")
  76. @ResponseBody
  77. public R delete(@RequestBody Integer[]ids) {
  78. mngChangeService.deleteBatch(ids);
  79. return R.ok();
  80. }
  81. /**
  82. * 查看所有列表
  83. */
  84. @RequestMapping("/queryAll")
  85. @ResponseBody
  86. public R queryAll(@RequestParam Map<String, Object> params) {
  87. ParamUtils.setQueryPowerByRoleType(params, "storeId", "merchSn", "thirdPartyMerchCode");
  88. List<MngChangeEntity> list = mngChangeService.queryList(params);
  89. return R.ok().put("list", list);
  90. }
  91. }