From 74a33ecb8525f4072795b4ba92794804370bc257 Mon Sep 17 00:00:00 2001 From: perry <292303709@qq.com> Date: Fri, 26 May 2023 15:01:46 +0800 Subject: [PATCH] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tenant/core/context/TenantContextHolder.java | 5 ++++- .../admin/recharge/RechargeOrderController.java | 4 ++++ .../controller/admin/tenant/TenantController.java | 12 +++++++++++- .../admin/tenant/vo/tenant/TenantExportReqVO.java | 2 ++ .../module/system/dal/mysql/tenant/TenantMapper.java | 1 + 5 files changed, 22 insertions(+), 2 deletions(-) diff --git a/yudao-framework/yudao-spring-boot-starter-biz-tenant/src/main/java/cn/iocoder/yudao/framework/tenant/core/context/TenantContextHolder.java b/yudao-framework/yudao-spring-boot-starter-biz-tenant/src/main/java/cn/iocoder/yudao/framework/tenant/core/context/TenantContextHolder.java index c16336992..03e911160 100644 --- a/yudao-framework/yudao-spring-boot-starter-biz-tenant/src/main/java/cn/iocoder/yudao/framework/tenant/core/context/TenantContextHolder.java +++ b/yudao-framework/yudao-spring-boot-starter-biz-tenant/src/main/java/cn/iocoder/yudao/framework/tenant/core/context/TenantContextHolder.java @@ -9,7 +9,10 @@ import com.alibaba.ttl.TransmittableThreadLocal; * @author 芋道源码 */ public class TenantContextHolder { - + /** + * 套餐编号 - 系统 + */ + public static final Long ID_SYSTEM = 1L; /** * 当前租户编号 */ diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/recharge/RechargeOrderController.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/recharge/RechargeOrderController.java index c970237ea..974b8e9ad 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/recharge/RechargeOrderController.java +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/recharge/RechargeOrderController.java @@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.shop.controller.admin.recharge; import cn.iocoder.yudao.framework.security.core.annotations.PreAuthenticated; import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore; +import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder; import cn.iocoder.yudao.module.shop.controller.admin.recharge.method.Excel; import cn.iocoder.yudao.module.shop.convert.recharge.RechargeOrderInfoConvert; import cn.iocoder.yudao.module.shop.dal.dataobject.recharge.RechargeOrderInfoDO; @@ -102,6 +103,9 @@ public class RechargeOrderController { @PreAuthorize("@ss.hasPermission('shop:recharge-order:query')") @TenantIgnore public CommonResult> getRechargeOrderPage(@Valid RechargeOrderPageReqVO pageVO) { + if(!TenantContextHolder.ID_SYSTEM.equals(TenantContextHolder.getRequiredTenantId())){ + pageVO.setTenantId(TenantContextHolder.getRequiredTenantId()); + } pageVO.setTenantId(SecurityFrameworkUtils.getLoginUser().getTenantId()); PageResult pageResult = rechargeOrderService.getRechargeOrderPage(pageVO); return success(pageResult); diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/tenant/TenantController.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/tenant/TenantController.java index 7c9c6ab85..0660a03c5 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/tenant/TenantController.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/tenant/TenantController.java @@ -5,6 +5,7 @@ import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; +import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder; import cn.iocoder.yudao.module.system.controller.admin.tenant.vo.tenant.*; import cn.iocoder.yudao.module.system.convert.tenant.TenantConvert; import cn.iocoder.yudao.module.system.dal.dataobject.tenant.TenantDO; @@ -96,7 +97,16 @@ public class TenantController { PageResult pageResult = tenantService.getTenantPage(pageVO); return success(TenantConvert.INSTANCE.convertPage(pageResult)); } - + @GetMapping("/list") + @Operation(summary = "获取所有商户") + public CommonResult> list(@Valid TenantExportReqVO pageVO) { + List pageResult = null; + if(!TenantContextHolder.ID_SYSTEM.equals(TenantContextHolder.getRequiredTenantId())){ + pageVO.setTenantId(TenantContextHolder.getRequiredTenantId()); + } + pageResult = tenantService.getTenantList(pageVO); + return success(TenantConvert.INSTANCE.convertList(pageResult)); + } @GetMapping("/export-excel") @Operation(summary = "导出租户 Excel") @PreAuthorize("@ss.hasPermission('system:tenant:export')") diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/tenant/vo/tenant/TenantExportReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/tenant/vo/tenant/TenantExportReqVO.java index 706337276..363ca615b 100755 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/tenant/vo/tenant/TenantExportReqVO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/tenant/vo/tenant/TenantExportReqVO.java @@ -14,6 +14,8 @@ public class TenantExportReqVO { @Schema(description = "租户名", example = "芋道") private String name; + @Schema(description = "tenantId", example = "芋道") + private Long tenantId; @Schema(description = "联系人", example = "芋艿") private String contactName; diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/tenant/TenantMapper.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/tenant/TenantMapper.java index 611e3af0e..c0dcc005a 100755 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/tenant/TenantMapper.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/tenant/TenantMapper.java @@ -36,6 +36,7 @@ public interface TenantMapper extends BaseMapperX { .likeIfPresent(TenantDO::getContactName, reqVO.getContactName()) .likeIfPresent(TenantDO::getContactMobile, reqVO.getContactMobile()) .eqIfPresent(TenantDO::getStatus, reqVO.getStatus()) + .eqIfPresent(TenantDO::getId, reqVO.getTenantId()) .betweenIfPresent(TenantDO::getCreateTime, reqVO.getCreateTime()) .orderByDesc(TenantDO::getId)); }