SupplierController.java 2.9 KB

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