FilesController.java 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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 com.trade.finance.controller;
  18. import com.baomidou.mybatisplus.core.metadata.IPage;
  19. import com.trade.finance.entity.Files;
  20. import com.trade.finance.service.IFilesService;
  21. import com.trade.finance.vo.FilesVO;
  22. import io.swagger.annotations.Api;
  23. import io.swagger.annotations.ApiOperation;
  24. import io.swagger.annotations.ApiParam;
  25. import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
  26. import lombok.AllArgsConstructor;
  27. import javax.validation.Valid;
  28. import org.springblade.core.mp.support.Condition;
  29. import org.springblade.core.mp.support.Query;
  30. import org.springblade.core.tool.api.R;
  31. import org.springblade.core.tool.utils.Func;
  32. import org.springframework.web.bind.annotation.*;
  33. import org.springblade.core.boot.ctrl.BladeController;
  34. /**
  35. * 结算文件 控制器
  36. *
  37. * @author BladeX
  38. * @since 2021-11-03
  39. */
  40. @RestController
  41. @AllArgsConstructor
  42. @RequestMapping("/files")
  43. @Api(value = "结算文件", tags = "结算文件接口")
  44. public class FilesController extends BladeController {
  45. private final IFilesService filesService;
  46. /**
  47. * 详情
  48. */
  49. @GetMapping("/detail")
  50. @ApiOperationSupport(order = 1)
  51. @ApiOperation(value = "详情", notes = "传入files")
  52. public R<Files> detail(Files files) {
  53. Files detail = filesService.getOne(Condition.getQueryWrapper(files));
  54. return R.data(detail);
  55. }
  56. /**
  57. * 分页 结算文件
  58. */
  59. @GetMapping("/list")
  60. @ApiOperationSupport(order = 2)
  61. @ApiOperation(value = "分页", notes = "传入files")
  62. public R<IPage<Files>> list(Files files, Query query) {
  63. IPage<Files> pages = filesService.page(Condition.getPage(query), Condition.getQueryWrapper(files));
  64. return R.data(pages);
  65. }
  66. /**
  67. * 自定义分页 结算文件
  68. */
  69. @GetMapping("/page")
  70. @ApiOperationSupport(order = 3)
  71. @ApiOperation(value = "分页", notes = "传入files")
  72. public R<IPage<FilesVO>> page(FilesVO files, Query query) {
  73. IPage<FilesVO> pages = filesService.selectFilesPage(Condition.getPage(query), files);
  74. return R.data(pages);
  75. }
  76. /**
  77. * 新增 结算文件
  78. */
  79. @PostMapping("/save")
  80. @ApiOperationSupport(order = 4)
  81. @ApiOperation(value = "新增", notes = "传入files")
  82. public R save(@Valid @RequestBody Files files) {
  83. return R.status(filesService.save(files));
  84. }
  85. /**
  86. * 修改 结算文件
  87. */
  88. @PostMapping("/update")
  89. @ApiOperationSupport(order = 5)
  90. @ApiOperation(value = "修改", notes = "传入files")
  91. public R update(@Valid @RequestBody Files files) {
  92. return R.status(filesService.updateById(files));
  93. }
  94. /**
  95. * 新增或修改 结算文件
  96. */
  97. @PostMapping("/submit")
  98. @ApiOperationSupport(order = 6)
  99. @ApiOperation(value = "新增或修改", notes = "传入files")
  100. public R submit(@Valid @RequestBody Files files) {
  101. return R.status(filesService.saveOrUpdate(files));
  102. }
  103. /**
  104. * 删除 结算文件
  105. */
  106. @PostMapping("/remove")
  107. @ApiOperationSupport(order = 8)
  108. @ApiOperation(value = "删除", notes = "传入ids")
  109. public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
  110. return R.status(filesService.removeByIds(Func.toLongList(ids)));
  111. }
  112. }