SysTenantController.java 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. package com.zhongzheng.controller.system;
  2. import java.util.List;
  3. import java.util.Arrays;
  4. import com.zhongzheng.modules.system.bo.*;
  5. import com.zhongzheng.modules.system.service.ISysTenantService;
  6. import com.zhongzheng.modules.system.vo.SysTenantBankAccountVo;
  7. import com.zhongzheng.modules.system.vo.SysTenantVo;
  8. import lombok.RequiredArgsConstructor;
  9. import org.springframework.security.access.prepost.PreAuthorize;
  10. import org.springframework.beans.factory.annotation.Autowired;
  11. import org.springframework.validation.annotation.Validated;
  12. import org.springframework.web.bind.annotation.GetMapping;
  13. import org.springframework.web.bind.annotation.PostMapping;
  14. import org.springframework.web.bind.annotation.PutMapping;
  15. import org.springframework.web.bind.annotation.DeleteMapping;
  16. import org.springframework.web.bind.annotation.PathVariable;
  17. import org.springframework.web.bind.annotation.RequestBody;
  18. import org.springframework.web.bind.annotation.RequestMapping;
  19. import org.springframework.web.bind.annotation.RestController;
  20. import com.zhongzheng.common.annotation.Log;
  21. import com.zhongzheng.common.core.controller.BaseController;
  22. import com.zhongzheng.common.core.domain.AjaxResult;
  23. import com.zhongzheng.common.enums.BusinessType;
  24. import com.zhongzheng.common.utils.poi.ExcelUtil;
  25. import com.zhongzheng.common.core.page.TableDataInfo;
  26. import io.swagger.annotations.Api;
  27. import io.swagger.annotations.ApiOperation;
  28. /**
  29. * 系统商户Controller
  30. *
  31. * @author hjl
  32. * @date 2021-08-03
  33. */
  34. @Api(value = "系统商户控制器", tags = {"系统商户管理"})
  35. @RequiredArgsConstructor(onConstructor_ = @Autowired)
  36. @RestController
  37. @RequestMapping("/system/tenant")
  38. public class SysTenantController extends BaseController {
  39. private final ISysTenantService iSysTenantService;
  40. /**
  41. * 查询系统商户列表
  42. */
  43. @ApiOperation("查询系统商户列表")
  44. @PreAuthorize("@ss.hasPermi('system:tenant:list')")
  45. @GetMapping("/list")
  46. public TableDataInfo<SysTenantVo> list(SysTenantQueryBo bo) {
  47. startPage();
  48. List<SysTenantVo> list = iSysTenantService.queryList(bo);
  49. return getDataTable(list);
  50. }
  51. /**
  52. * 导出系统商户列表
  53. */
  54. /* @ApiOperation("导出系统商户列表")
  55. @PreAuthorize("@ss.hasPermi('system:tenant:export')")
  56. @Log(title = "系统商户", businessType = BusinessType.EXPORT)
  57. @GetMapping("/export")
  58. public AjaxResult<SysTenantVo> export(SysTenantQueryBo bo) {
  59. List<SysTenantVo> list = iSysTenantService.queryList(bo);
  60. ExcelUtil<SysTenantVo> util = new ExcelUtil<SysTenantVo>(SysTenantVo.class);
  61. return util.exportExcel(list, "系统商户");
  62. }*/
  63. /**
  64. * 获取系统商户详细信息
  65. */
  66. @ApiOperation("获取系统商户详细信息")
  67. @PreAuthorize("@ss.hasPermi('system:tenant:query')")
  68. @GetMapping("/{tenantId}")
  69. public AjaxResult<SysTenantVo> getInfo(@PathVariable("tenantId" ) Long tenantId) {
  70. return AjaxResult.success(iSysTenantService.queryById(tenantId));
  71. }
  72. /**
  73. * 获取系统商户银行账号信息
  74. */
  75. @ApiOperation("获取系统商户银行账号信息")
  76. @GetMapping("/bank/{tenantId}")
  77. public AjaxResult<List<SysTenantBankAccountVo>> getBankAccountList(@PathVariable("tenantId" ) String tenantId) {
  78. return AjaxResult.success(iSysTenantService.getBankAccountList(tenantId));
  79. }
  80. /**
  81. * 新增系统商户
  82. */
  83. @ApiOperation("新增系统商户")
  84. @PreAuthorize("@ss.hasPermi('system:tenant:add')")
  85. @Log(title = "系统商户", businessType = BusinessType.INSERT)
  86. @PostMapping()
  87. public AjaxResult<Void> add(@Validated @RequestBody SysTenantAddBo bo) {
  88. return toAjax(iSysTenantService.insertByAddBo(bo) ? 1 : 0);
  89. }
  90. /**
  91. * 总平台新增系统商户
  92. */
  93. @ApiOperation("总平台新增系统商户")
  94. @PostMapping("/add")
  95. public AjaxResult<Void> addTopTenant(@Validated @RequestBody SysTopTenantAddBo bo) {
  96. return toAjax(iSysTenantService.addTopTenant(bo) ? 1 : 0);
  97. }
  98. /**
  99. * 修改系统商户
  100. */
  101. @ApiOperation("修改系统商户")
  102. @PreAuthorize("@ss.hasPermi('system:tenant:edit')")
  103. @Log(title = "系统商户", businessType = BusinessType.UPDATE)
  104. @PostMapping("/edit")
  105. public AjaxResult<Void> edit(@RequestBody SysTenantEditBo bo) {
  106. return toAjax(iSysTenantService.updateByEditBo(bo) ? 1 : 0);
  107. }
  108. /**
  109. * 总平台修改系统商户
  110. */
  111. @ApiOperation("总平台修改系统商户")
  112. @PostMapping("/edit/top")
  113. public AjaxResult<Void> editTopTenant(@RequestBody SysTopTenantEditBo bo) {
  114. return toAjax(iSysTenantService.editTopTenant(bo) ? 1 : 0);
  115. }
  116. /**
  117. * 删除系统商户
  118. */
  119. /* @ApiOperation("删除系统商户")
  120. @PreAuthorize("@ss.hasPermi('system:tenant:remove')")
  121. @Log(title = "系统商户" , businessType = BusinessType.DELETE)
  122. @DeleteMapping("/{tenantIds}")
  123. public AjaxResult<Void> remove(@PathVariable Long[] tenantIds) {
  124. return toAjax(iSysTenantService.deleteWithValidByIds(Arrays.asList(tenantIds), true) ? 1 : 0);
  125. }*/
  126. }