diff --git a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/tenantbalance/TenantBalanceController.java b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/tenantbalance/TenantBalanceController.java index a109ce1..a3fb0ec 100644 --- a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/tenantbalance/TenantBalanceController.java +++ b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/tenantbalance/TenantBalanceController.java @@ -117,4 +117,20 @@ public class TenantBalanceController { tenantBalanceService.transferToTenant(transferReqVO); return success(true); } + + @GetMapping("/get-self-amount") + @Operation(summary = "获得自己的余额") + @PreAuthorize("@ss.hasPermission('system:tenant-balance:self-amount')") + public CommonResult getTenantBalance() { + TenantBalanceDO tenantBalance = tenantBalanceService.getSelfBalance(); + return success(BeanUtils.toBean(tenantBalance, TenantBalanceRespVO.class)); + } + + @GetMapping("/get-self-subordinate-amount-page") + @Operation(summary = "获得自己下级余额的分页") + @PreAuthorize("@ss.hasPermission('system:tenant-balance:self-subordinate')") + public CommonResult> getSelfSubordinate(@Valid TenantBalancePageReqVO pageReqVO) { + PageResult tenantBalancePage = tenantBalanceService.getSelfSubordinateTenantBalancePage(pageReqVO); + return success(BeanUtils.toBean(tenantBalancePage, TenantBalanceRespVO.class)); + } } \ No newline at end of file diff --git a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/tenantbalance/vo/TenantBalanceRespVO.java b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/tenantbalance/vo/TenantBalanceRespVO.java index 0dabf15..6bd4922 100644 --- a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/tenantbalance/vo/TenantBalanceRespVO.java +++ b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/tenantbalance/vo/TenantBalanceRespVO.java @@ -20,10 +20,6 @@ public class TenantBalanceRespVO { @ExcelProperty("当前积分余额") private Integer balance; - @Schema(description = "乐观锁版本号", requiredMode = Schema.RequiredMode.REQUIRED) - @ExcelProperty("乐观锁版本号") - private Integer version; - @Schema(description = "更新时间", requiredMode = Schema.RequiredMode.REQUIRED) @ExcelProperty("更新时间") private LocalDateTime updatedAt; diff --git a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/tenantbalance/TenantBalanceMapper.java b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/tenantbalance/TenantBalanceMapper.java index 59715cb..5cd453d 100644 --- a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/tenantbalance/TenantBalanceMapper.java +++ b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/tenantbalance/TenantBalanceMapper.java @@ -45,4 +45,6 @@ public interface TenantBalanceMapper extends BaseMapperX { IPage selectPageWithTenantName(IPage iPage,@Param("req") TenantBalancePageReqVO pageReqVO); + + IPage selectPageWithSelfSubordinateTenant(@Param("iPage") IPage iPage, @Param("pageReqVO") TenantBalancePageReqVO pageReqVO, @Param("tenantId") Long tenantId); } \ No newline at end of file diff --git a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/tenantbalance/TenantBalanceService.java b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/tenantbalance/TenantBalanceService.java index 4522248..9e2b19d 100644 --- a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/tenantbalance/TenantBalanceService.java +++ b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/tenantbalance/TenantBalanceService.java @@ -62,4 +62,8 @@ public interface TenantBalanceService { void addTenantBalance(@Valid TenantBalanceAddReqVO updateReqVO); void transferToTenant(@Valid TenantBalanceTransferReqVO transferReqVO); + + TenantBalanceDO getSelfBalance(); + + PageResult getSelfSubordinateTenantBalancePage(@Valid TenantBalancePageReqVO pageReqVO); } \ No newline at end of file diff --git a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/tenantbalance/TenantBalanceServiceImpl.java b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/tenantbalance/TenantBalanceServiceImpl.java index b286ef1..7000ede 100644 --- a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/tenantbalance/TenantBalanceServiceImpl.java +++ b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/tenantbalance/TenantBalanceServiceImpl.java @@ -259,4 +259,22 @@ public class TenantBalanceServiceImpl implements TenantBalanceService { } + @Override + public TenantBalanceDO getSelfBalance() { + Long tenantId = TenantContextHolder.getTenantId(); + TenantBalanceDO tenantBalance = tenantBalanceMapper.selectById(tenantId); + if (tenantBalance == null) { + throw exception(TENANT_WALLET_NOT_EXISTS); + } + return tenantBalance; + } + + @Override + public PageResult getSelfSubordinateTenantBalancePage(TenantBalancePageReqVO pageReqVO) { + Long tenantId = TenantContextHolder.getTenantId(); + IPage iPage = new Page<>(pageReqVO.getPageNo(),pageReqVO.getPageSize()); + IPage tenantBalanceRespVOIPage = tenantBalanceMapper.selectPageWithSelfSubordinateTenant(iPage, pageReqVO,tenantId); + return new PageResult<>(tenantBalanceRespVOIPage.getRecords(),tenantBalanceRespVOIPage.getTotal()); + } + } \ No newline at end of file diff --git a/yudao-module-system/src/main/resources/mapper/TenantBalanceMapper.xml b/yudao-module-system/src/main/resources/mapper/TenantBalanceMapper.xml index b7cb654..ffcfe10 100644 --- a/yudao-module-system/src/main/resources/mapper/TenantBalanceMapper.xml +++ b/yudao-module-system/src/main/resources/mapper/TenantBalanceMapper.xml @@ -21,4 +21,17 @@ order by stb.id desc + + \ No newline at end of file