SettlementController.java 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. package org.dromara.web.controller;
  2. import cn.dev33.satoken.annotation.SaCheckPermission;
  3. import jakarta.servlet.http.HttpServletResponse;
  4. import jakarta.validation.constraints.NotEmpty;
  5. import jakarta.validation.constraints.NotNull;
  6. import lombok.RequiredArgsConstructor;
  7. import org.dromara.common.core.domain.R;
  8. import org.dromara.common.core.validate.AddGroup;
  9. import org.dromara.common.core.validate.EditGroup;
  10. import org.dromara.common.excel.utils.ExcelUtil;
  11. import org.dromara.common.idempotent.annotation.RepeatSubmit;
  12. import org.dromara.common.log.annotation.Log;
  13. import org.dromara.common.log.enums.BusinessType;
  14. import org.dromara.common.mybatis.core.page.PageQuery;
  15. import org.dromara.common.mybatis.core.page.TableDataInfo;
  16. import org.dromara.common.web.core.BaseController;
  17. import org.dromara.web.domain.bo.SettlementBo;
  18. import org.dromara.web.domain.vo.SettlementVo;
  19. import org.dromara.web.service.ISettlementService;
  20. import org.springframework.validation.annotation.Validated;
  21. import org.springframework.web.bind.annotation.DeleteMapping;
  22. import org.springframework.web.bind.annotation.GetMapping;
  23. import org.springframework.web.bind.annotation.PathVariable;
  24. import org.springframework.web.bind.annotation.PostMapping;
  25. import org.springframework.web.bind.annotation.PutMapping;
  26. import org.springframework.web.bind.annotation.RequestBody;
  27. import org.springframework.web.bind.annotation.RequestMapping;
  28. import org.springframework.web.bind.annotation.RestController;
  29. import java.util.List;
  30. /**
  31. * 结算管理
  32. *
  33. * @author Lion Li
  34. * @date 2025-07-22
  35. */
  36. @Validated
  37. @RequiredArgsConstructor
  38. @RestController
  39. @RequestMapping("/system/settlement")
  40. public class SettlementController extends BaseController {
  41. private final ISettlementService settlementService;
  42. /**
  43. * 查询结算管理列表
  44. */
  45. @SaCheckPermission("system:settlement:list")
  46. @GetMapping("/list")
  47. public TableDataInfo<SettlementVo> list(SettlementBo bo, PageQuery pageQuery) {
  48. return settlementService.queryPageList(bo, pageQuery);
  49. }
  50. /**
  51. * 导出结算管理列表
  52. */
  53. @SaCheckPermission("system:settlement:export")
  54. @Log(title = "结算管理", businessType = BusinessType.EXPORT)
  55. @PostMapping("/export")
  56. public void export(SettlementBo bo, HttpServletResponse response) {
  57. List<SettlementVo> list = settlementService.queryList(bo);
  58. ExcelUtil.exportExcel(list, "结算管理", SettlementVo.class, response);
  59. }
  60. /**
  61. * 获取结算管理详细信息
  62. *
  63. * @param id 主键
  64. */
  65. @SaCheckPermission("system:settlement:query")
  66. @GetMapping("/{id}")
  67. public R<SettlementVo> getInfo(@NotNull(message = "主键不能为空")
  68. @PathVariable Long id) {
  69. return R.ok(settlementService.queryById(id));
  70. }
  71. /**
  72. * 新增结算管理
  73. */
  74. @SaCheckPermission("system:settlement:add")
  75. @Log(title = "结算管理", businessType = BusinessType.INSERT)
  76. @RepeatSubmit()
  77. @PostMapping()
  78. public R<Void> add(@Validated(AddGroup.class) @RequestBody SettlementBo bo) {
  79. return toAjax(settlementService.insertByBo(bo));
  80. }
  81. /**
  82. * 修改结算管理
  83. */
  84. @SaCheckPermission("system:settlement:edit")
  85. @Log(title = "结算管理", businessType = BusinessType.UPDATE)
  86. @RepeatSubmit()
  87. @PutMapping()
  88. public R<Void> edit(@Validated(EditGroup.class) @RequestBody SettlementBo bo) {
  89. return toAjax(settlementService.updateByBo(bo));
  90. }
  91. /**
  92. * 删除结算管理
  93. *
  94. * @param ids 主键串
  95. */
  96. @SaCheckPermission("system:settlement:remove")
  97. @Log(title = "结算管理", businessType = BusinessType.DELETE)
  98. @DeleteMapping("/{ids}")
  99. public R<Void> remove(@NotEmpty(message = "主键不能为空")
  100. @PathVariable Long[] ids) {
  101. return toAjax(settlementService.deleteWithValidByIds(List.of(ids), true));
  102. }
  103. }