UserLogController.java 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  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.bank.userlog.controller;
  18. import io.swagger.annotations.Api;
  19. import io.swagger.annotations.ApiOperation;
  20. import io.swagger.annotations.ApiParam;
  21. import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
  22. import lombok.AllArgsConstructor;
  23. import javax.validation.Valid;
  24. import org.springblade.core.mp.support.Condition;
  25. import org.springblade.core.mp.support.Query;
  26. import org.springblade.core.tool.api.R;
  27. import org.springblade.core.tool.utils.Func;
  28. import org.springframework.web.bind.annotation.*;
  29. import org.springframework.web.bind.annotation.RequestParam;
  30. import com.baomidou.mybatisplus.core.metadata.IPage;
  31. import org.springblade.bank.userlog.entity.UserLog;
  32. import org.springblade.bank.userlog.vo.UserLogVO;
  33. import org.springblade.bank.userlog.wrapper.UserLogWrapper;
  34. import org.springblade.bank.userlog.service.IUserLogService;
  35. import org.springblade.core.boot.ctrl.BladeController;
  36. import java.util.List;
  37. /**
  38. * 用戶軌跡 控制器
  39. *
  40. * @author BladeX
  41. * @since 2021-09-10
  42. */
  43. @RestController
  44. @AllArgsConstructor
  45. @RequestMapping("bank/userlog")
  46. @Api(value = "用戶軌跡", tags = "用戶軌跡接口")
  47. public class UserLogController extends BladeController {
  48. private final IUserLogService userLogService;
  49. /**
  50. * 详情
  51. */
  52. @GetMapping("/detail")
  53. @ApiOperationSupport(order = 1)
  54. @ApiOperation(value = "详情", notes = "传入userLog")
  55. public R<UserLogVO> detail(UserLog userLog) {
  56. UserLog detail = userLogService.getOne(Condition.getQueryWrapper(userLog));
  57. return R.data(UserLogWrapper.build().entityVO(detail));
  58. }
  59. /**
  60. * 分页 用戶軌跡
  61. */
  62. @GetMapping("/list")
  63. @ApiOperationSupport(order = 2)
  64. @ApiOperation(value = "分页", notes = "传入userLog")
  65. public R<IPage<UserLogVO>> list(UserLog userLog, Query query) {
  66. IPage<UserLog> pages = userLogService.page(Condition.getPage(query), Condition.getQueryWrapper(userLog));
  67. return R.data(UserLogWrapper.build().pageVO(pages));
  68. }
  69. /**
  70. * 自定义分页 用戶軌跡
  71. */
  72. @GetMapping("/page")
  73. @ApiOperationSupport(order = 3)
  74. @ApiOperation(value = "分页", notes = "传入userLog")
  75. public R<IPage<UserLogVO>> page(UserLogVO userLog, Query query) {
  76. userLog.setCreateTime_end(userLog.getCreateTime_end() + " 23:59:59");
  77. IPage<UserLogVO> pages = userLogService.selectUserLogPage(Condition.getPage(query), userLog);
  78. return R.data(pages);
  79. }
  80. /**
  81. * 新增 用戶軌跡
  82. */
  83. @PostMapping("/save")
  84. @ApiOperationSupport(order = 4)
  85. @ApiOperation(value = "新增", notes = "传入userLog")
  86. public R save(@Valid @RequestBody UserLog userLog) {
  87. return R.status(userLogService.save(userLog));
  88. }
  89. /**
  90. * 修改 用戶軌跡
  91. */
  92. @PostMapping("/update")
  93. @ApiOperationSupport(order = 5)
  94. @ApiOperation(value = "修改", notes = "传入userLog")
  95. public R update(@Valid @RequestBody UserLog userLog) {
  96. return R.status(userLogService.updateById(userLog));
  97. }
  98. /**
  99. * 新增或修改 用戶軌跡
  100. */
  101. @PostMapping("/submit")
  102. @ApiOperationSupport(order = 6)
  103. @ApiOperation(value = "新增或修改", notes = "传入userLog")
  104. public R submit(@Valid @RequestBody UserLog userLog) {
  105. return R.status(userLogService.saveOrUpdate(userLog));
  106. }
  107. /**
  108. * 删除 用戶軌跡
  109. */
  110. @PostMapping("/remove")
  111. @ApiOperationSupport(order = 7)
  112. @ApiOperation(value = "逻辑删除", notes = "传入ids")
  113. public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
  114. return R.status(userLogService.deleteLogic(Func.toLongList(ids)));
  115. }
  116. /**
  117. * 記錄下載excel 用戶軌跡
  118. */
  119. @GetMapping("/getList")
  120. @ApiOperationSupport(order = 3)
  121. @ApiOperation(value = "分页", notes = "传入userLog")
  122. public R getList(UserLogVO userLog, Query query) {
  123. List<UserLog> list = userLogService.selectUserLogPage(userLog);
  124. return R.data(list);
  125. }
  126. }