LogApiController.java 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*
  2. * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
  3. *
  4. * Redistribution and use in source and binary forms, with or without
  5. * modification, are permitted provided that the following conditions are met:
  6. *
  7. * Redistributions of source code must retain the above copyright notice,
  8. * this list of conditions and the following disclaimer.
  9. * Redistributions in binary form must reproduce the above copyright
  10. * notice, this list of conditions and the following disclaimer in the
  11. * documentation and/or other materials provided with the distribution.
  12. * Neither the name of the dreamlu.net developer nor the names of its
  13. * contributors may be used to endorse or promote products derived from
  14. * this software without specific prior written permission.
  15. * Author: Chill 庄骞 (smallchill@163.com)
  16. */
  17. package org.springblade.modules.system.controller;
  18. import com.baomidou.mybatisplus.core.metadata.IPage;
  19. import lombok.AllArgsConstructor;
  20. import org.springblade.core.launch.constant.AppConstant;
  21. import org.springblade.core.log.model.LogApi;
  22. import org.springblade.core.mp.support.Condition;
  23. import org.springblade.core.mp.support.Query;
  24. import org.springblade.core.tenant.annotation.NonDS;
  25. import org.springblade.core.tool.api.R;
  26. import org.springblade.modules.system.service.ILogApiService;
  27. import org.springframework.web.bind.annotation.GetMapping;
  28. import org.springframework.web.bind.annotation.RequestMapping;
  29. import org.springframework.web.bind.annotation.RequestParam;
  30. import org.springframework.web.bind.annotation.RestController;
  31. import springfox.documentation.annotations.ApiIgnore;
  32. import java.util.Map;
  33. /**
  34. * 控制器
  35. *
  36. * @author Chill
  37. */
  38. @NonDS
  39. @ApiIgnore
  40. @RestController
  41. @AllArgsConstructor
  42. @RequestMapping(AppConstant.APPLICATION_LOG_NAME + "/constant")
  43. public class LogApiController {
  44. private final ILogApiService logService;
  45. /**
  46. * 查询单条
  47. */
  48. @GetMapping("/detail")
  49. public R<LogApi> detail(LogApi log) {
  50. return R.data(logService.getOne(Condition.getQueryWrapper(log)));
  51. }
  52. /**
  53. * 查询多条(分页)
  54. */
  55. @GetMapping("/list")
  56. public R<IPage<LogApi>> list(@ApiIgnore @RequestParam Map<String, Object> log, Query query) {
  57. IPage<LogApi> pages = logService.page(Condition.getPage(query.setDescs("create_time")), Condition.getQueryWrapper(log, LogApi.class));
  58. return R.data(pages);
  59. }
  60. }