2 次代码提交 d51b846c16 ... 2cfc140bb7

作者 SHA1 备注 提交日期
  ezhizao_zx 2cfc140bb7 Merge remote-tracking branch 'origin/master' 2 周之前
  ezhizao_zx 915bd5a605 提交 2 周之前

+ 11 - 6
src/main/java/cn/ezhizao/project/business/supplier/controller/BizSupplierController.java

@@ -11,6 +11,7 @@ import cn.ezhizao.project.business.outsourceBalanceAccount.service.IBizOutsource
 import cn.ezhizao.project.business.supplier.domain.*;
 import cn.ezhizao.project.business.supplier.service.*;
 import cn.ezhizao.project.system.domain.SysDept;
+import cn.ezhizao.project.system.service.ISysConfigService;
 import cn.ezhizao.project.system.service.ISysDeptService;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.fasterxml.jackson.core.JsonProcessingException;
@@ -49,6 +50,8 @@ public class BizSupplierController extends BaseController {
     private ISysDeptService sysDeptService;
     @Resource
     private HttpServletRequest request;
+    @Resource
+    private ISysConfigService configService;
 
     /**
      * 查询外协商列表
@@ -57,10 +60,12 @@ public class BizSupplierController extends BaseController {
     @Log(title = "外协商单位查询", businessType = BusinessType.SELECT)
     @GetMapping("/list")
     public TableDataInfo list(BizSupplier data) throws NoSuchFieldException, IllegalAccessException, JsonProcessingException {
-//        String tenantId = request.getHeader("tenantId");
-//        if (tenantId != null && !"0".equals(tenantId)) {
-//            data.setTenantId(Long.parseLong(tenantId));
-//        }
+
+        String config = configService.selectConfigByKey("switch_data_source");
+        String tenantId = request.getHeader("tenantId");
+        if ("true".equals(config) && tenantId != null && !"0".equals(tenantId)) {
+            data.setTenantId(Long.parseLong(tenantId));
+        }
         startPage();
         List<BizSupplier> list = iBizSupplierService.getList(data);
         return getDataTable(list);
@@ -105,11 +110,11 @@ public class BizSupplierController extends BaseController {
         queryWrapper.eq("tenant_id", Long.valueOf(tenantId));
         queryWrapper.eq("name", bizSupplier.getName());
         if(bizSupplier.getId() == null) {
-            List<BizSupplier> supplierList = iBizSupplierService.query().eq("code", bizSupplier.getCode()).list();
+            List<BizSupplier> supplierList = iBizSupplierService.query().eq("code", bizSupplier.getCode()).eq("tenant_id", tenantId).list();
             if (!supplierList.isEmpty()) {
                 return AjaxResult.error("供应商编号不能重复");
             }
-            supplierList = iBizSupplierService.query().eq("mnemonic_code", bizSupplier.getMnemonicCode()).list();
+            supplierList = iBizSupplierService.query().eq("mnemonic_code", bizSupplier.getMnemonicCode()).eq("tenant_id", tenantId).list();
             if (!supplierList.isEmpty()) {
                 return AjaxResult.error("助记码不能重复");
             }