SearchHistoryController.java 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. package com.kmall.admin.controller;
  2. import com.kmall.admin.entity.SearchHistoryEntity;
  3. import com.kmall.admin.service.SearchHistoryService;
  4. import com.kmall.common.utils.PageUtils;
  5. import com.kmall.common.utils.Query;
  6. import com.kmall.common.utils.R;
  7. import org.apache.shiro.authz.annotation.RequiresPermissions;
  8. import org.springframework.beans.factory.annotation.Autowired;
  9. import org.springframework.web.bind.annotation.*;
  10. import java.util.List;
  11. import java.util.Map;
  12. /**
  13. * @author Scott
  14. * @email
  15. * @date 2017-08-13 10:41:10
  16. */
  17. @RestController
  18. @RequestMapping("searchhistory")
  19. public class SearchHistoryController {
  20. @Autowired
  21. private SearchHistoryService searchHistoryService;
  22. /**
  23. * 列表
  24. */
  25. @RequestMapping("/list")
  26. @RequiresPermissions("searchhistory:list")
  27. public R list(@RequestParam Map<String, Object> params) {
  28. //查询列表数据
  29. Query query = new Query(params);
  30. List<SearchHistoryEntity> searchHistoryList = searchHistoryService.queryList(query);
  31. int total = searchHistoryService.queryTotal(query);
  32. PageUtils pageUtil = new PageUtils(searchHistoryList, total, query.getLimit(), query.getPage());
  33. return R.ok().put("page", pageUtil);
  34. }
  35. /**
  36. * 信息
  37. */
  38. @RequestMapping("/info/{id}")
  39. @RequiresPermissions("searchhistory:info")
  40. public R info(@PathVariable("id") Integer id) {
  41. SearchHistoryEntity searchHistory = searchHistoryService.queryObject(id);
  42. return R.ok().put("searchHistory", searchHistory);
  43. }
  44. /**
  45. * 保存
  46. */
  47. @RequestMapping("/save")
  48. @RequiresPermissions("searchhistory:save")
  49. public R save(@RequestBody SearchHistoryEntity searchHistory) {
  50. searchHistoryService.save(searchHistory);
  51. return R.ok();
  52. }
  53. /**
  54. * 修改
  55. */
  56. @RequestMapping("/update")
  57. @RequiresPermissions("searchhistory:update")
  58. public R update(@RequestBody SearchHistoryEntity searchHistory) {
  59. searchHistoryService.update(searchHistory);
  60. return R.ok();
  61. }
  62. /**
  63. * 删除
  64. */
  65. @RequestMapping("/delete")
  66. @RequiresPermissions("searchhistory:delete")
  67. public R delete(@RequestBody Integer[] ids) {
  68. searchHistoryService.deleteBatch(ids);
  69. return R.ok();
  70. }
  71. }