Kaynağa Gözat

Merge branch 'ljy'

Lijingyang 1 ay önce
ebeveyn
işleme
eb6909f663

+ 5 - 5
ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/controller/SupplierAddressController.java

@@ -40,7 +40,7 @@ public class SupplierAddressController extends BaseController {
     /**
     /**
      * 根据supplierID查询地址信息
      * 根据supplierID查询地址信息
      */
      */
-    @SaCheckPermission("supplierAddress:supplieraddress:list")
+    //@SaCheckPermission("supplierAddress:supplieraddress:list")
     @GetMapping("/supplierAddressById")
     @GetMapping("/supplierAddressById")
     public R<List<SupplierAddressVo>> list(SupplierAddressBo bo) {
     public R<List<SupplierAddressVo>> list(SupplierAddressBo bo) {
         return R.ok(supplierAddressService.getSupplierAddressById(bo));
         return R.ok(supplierAddressService.getSupplierAddressById(bo));
@@ -57,7 +57,7 @@ public class SupplierAddressController extends BaseController {
     /**
     /**
      * 导出供应商地址列表
      * 导出供应商地址列表
      */
      */
-    @SaCheckPermission("supplierAddress:supplieraddress:export")
+    //@SaCheckPermission("supplierAddress:supplieraddress:export")
     @Log(title = "供应商地址", businessType = BusinessType.EXPORT)
     @Log(title = "供应商地址", businessType = BusinessType.EXPORT)
     @PostMapping("/export")
     @PostMapping("/export")
     public void export(SupplierAddressBo bo, HttpServletResponse response) {
     public void export(SupplierAddressBo bo, HttpServletResponse response) {
@@ -70,7 +70,7 @@ public class SupplierAddressController extends BaseController {
      *
      *
      * @param id 主键
      * @param id 主键
      */
      */
-    @SaCheckPermission("supplierAddress:supplieraddress:query")
+    //@SaCheckPermission("supplierAddress:supplieraddress:query")
     @GetMapping("/{id}")
     @GetMapping("/{id}")
     public R<SupplierAddressVo> getInfo(@NotNull(message = "主键不能为空")
     public R<SupplierAddressVo> getInfo(@NotNull(message = "主键不能为空")
                                      @PathVariable("id") Long id) {
                                      @PathVariable("id") Long id) {
@@ -80,7 +80,7 @@ public class SupplierAddressController extends BaseController {
     /**
     /**
      * 新增供应商地址
      * 新增供应商地址
      */
      */
-    @SaCheckPermission("supplierAddress:supplieraddress:add")
+    //@SaCheckPermission("supplierAddress:supplieraddress:add")
     @Log(title = "供应商地址", businessType = BusinessType.INSERT)
     @Log(title = "供应商地址", businessType = BusinessType.INSERT)
     @RepeatSubmit()
     @RepeatSubmit()
     @PostMapping()
     @PostMapping()
@@ -91,7 +91,7 @@ public class SupplierAddressController extends BaseController {
     /**
     /**
      * 修改供应商地址
      * 修改供应商地址
      */
      */
-    @SaCheckPermission("supplierAddress:supplieraddress:edit")
+    //@SaCheckPermission("supplierAddress:supplieraddress:edit")
     @Log(title = "供应商地址", businessType = BusinessType.UPDATE)
     @Log(title = "供应商地址", businessType = BusinessType.UPDATE)
     @RepeatSubmit()
     @RepeatSubmit()
     @PutMapping()
     @PutMapping()

+ 5 - 0
ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/controller/SupplierInfoController.java

@@ -56,6 +56,11 @@ public class SupplierInfoController extends BaseController {
         return supplierInfoService.queryPageList(bo, pageQuery);
         return supplierInfoService.queryPageList(bo, pageQuery);
     }
     }
 
 
+    @GetMapping("/getNameList")
+    public R<List<SupplierInfoVo>> getNameList() {
+        return R.ok(supplierInfoService.getNameList());
+    }
+
     /**
     /**
      * 供应商信息 获取供应商信息列表
      * 供应商信息 获取供应商信息列表
      * @param bo
      * @param bo

+ 5 - 0
ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/domain/vo/SupplierAddressVo.java

@@ -121,5 +121,10 @@ public class SupplierAddressVo implements Serializable {
     @ExcelProperty(value = "地址编码")
     @ExcelProperty(value = "地址编码")
     private String addressNo;
     private String addressNo;
 
 
+    /**
+     * 企业名称
+     */
+    private String enterpriseName;
+
 
 
 }
 }

+ 3 - 0
ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/service/ISupplierInfoService.java

@@ -11,6 +11,7 @@ import org.dromara.customer.domain.vo.SupplierInfoVo;
 import org.dromara.customer.domain.bo.SupplierInfoBo;
 import org.dromara.customer.domain.bo.SupplierInfoBo;
 import org.dromara.common.mybatis.core.page.TableDataInfo;
 import org.dromara.common.mybatis.core.page.TableDataInfo;
 import org.dromara.common.mybatis.core.page.PageQuery;
 import org.dromara.common.mybatis.core.page.PageQuery;
+import org.dromara.customer.domain.vo.SupplierInformationVo;
 
 
 import java.util.Collection;
 import java.util.Collection;
 import java.util.List;
 import java.util.List;
@@ -111,4 +112,6 @@ public interface ISupplierInfoService extends IService<SupplierInfo>{
      * @param bo
      * @param bo
      */
      */
     Boolean register(CustomerRegisterBo bo);
     Boolean register(CustomerRegisterBo bo);
+
+    List<SupplierInfoVo> getNameList();
 }
 }

+ 37 - 3
ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/service/impl/SupplierAddressServiceImpl.java

@@ -1,5 +1,6 @@
 package org.dromara.customer.service.impl;
 package org.dromara.customer.service.impl;
 
 
+import cn.hutool.core.collection.CollUtil;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.dromara.common.core.utils.MapstructUtils;
 import org.dromara.common.core.utils.MapstructUtils;
 import org.dromara.common.core.utils.StringUtils;
 import org.dromara.common.core.utils.StringUtils;
@@ -10,6 +11,9 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import lombok.RequiredArgsConstructor;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
+import org.dromara.customer.domain.SupplierInfo;
+import org.dromara.customer.domain.vo.SupplierInfoVo;
+import org.dromara.customer.mapper.SupplierInfoMapper;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 import org.dromara.customer.domain.bo.SupplierAddressBo;
 import org.dromara.customer.domain.bo.SupplierAddressBo;
 import org.dromara.customer.domain.vo.SupplierAddressVo;
 import org.dromara.customer.domain.vo.SupplierAddressVo;
@@ -17,9 +21,8 @@ import org.dromara.customer.domain.SupplierAddress;
 import org.dromara.customer.mapper.SupplierAddressMapper;
 import org.dromara.customer.mapper.SupplierAddressMapper;
 import org.dromara.customer.service.ISupplierAddressService;
 import org.dromara.customer.service.ISupplierAddressService;
 
 
-import java.util.List;
-import java.util.Map;
-import java.util.Collection;
+import java.util.*;
+import java.util.stream.Collectors;
 
 
 /**
 /**
  * 供应商地址Service业务层处理
  * 供应商地址Service业务层处理
@@ -34,6 +37,8 @@ public class SupplierAddressServiceImpl  extends ServiceImpl<SupplierAddressMapp
 
 
     private final SupplierAddressMapper baseMapper;
     private final SupplierAddressMapper baseMapper;
 
 
+    private final SupplierInfoMapper supplierInfoMapper;
+
     /**
     /**
      * 查询供应商地址
      * 查询供应商地址
      *
      *
@@ -56,6 +61,35 @@ public class SupplierAddressServiceImpl  extends ServiceImpl<SupplierAddressMapp
     public TableDataInfo<SupplierAddressVo> queryPageList(SupplierAddressBo bo, PageQuery pageQuery) {
     public TableDataInfo<SupplierAddressVo> queryPageList(SupplierAddressBo bo, PageQuery pageQuery) {
         LambdaQueryWrapper<SupplierAddress> lqw = buildQueryWrapper(bo);
         LambdaQueryWrapper<SupplierAddress> lqw = buildQueryWrapper(bo);
         Page<SupplierAddressVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
         Page<SupplierAddressVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
+        List<SupplierAddressVo> records = result.getRecords();
+        if (CollUtil.isNotEmpty(records)) {
+
+            // 1️⃣ 收集 supplierId 集合
+            Set<Long> supplierIds = records.stream()
+                .map(SupplierAddressVo::getSupplierId)
+                .filter(Objects::nonNull)
+                .collect(Collectors.toSet());
+
+            if (CollUtil.isNotEmpty(supplierIds)) {
+
+                // 2️⃣ 批量查询企业信息
+                List<SupplierInfoVo> enterprises = supplierInfoMapper.selectVoByIds(supplierIds);
+
+                // 3️⃣ 转成 Map<id, enterpriseName>
+                Map<Long, String> enterpriseMap = enterprises.stream()
+                    .collect(Collectors.toMap(
+                        SupplierInfoVo::getId,
+                        SupplierInfoVo::getEnterpriseName
+                    ));
+
+                // 4️⃣ 回填 enterpriseName
+                records.forEach(vo -> {
+                    vo.setEnterpriseName(
+                        enterpriseMap.get(vo.getSupplierId())
+                    );
+                });
+            }
+        }
         return TableDataInfo.build(result);
         return TableDataInfo.build(result);
     }
     }
 
 

+ 6 - 0
ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/service/impl/SupplierInfoServiceImpl.java

@@ -2039,4 +2039,10 @@ public class SupplierInfoServiceImpl  extends ServiceImpl<SupplierInfoMapper, Su
         log.info("客户注册成功,客户ID:{},客户名称:{}", supplierId, bo.getCustomerName());
         log.info("客户注册成功,客户ID:{},客户名称:{}", supplierId, bo.getCustomerName());
         return true;
         return true;
     }
     }
+
+    @Override
+    public List<SupplierInfoVo> getNameList() {
+        List<SupplierInfoVo> supplierInfoVos = baseMapper.selectVoList(new LambdaQueryWrapper<SupplierInfo>().select(SupplierInfo::getId, SupplierInfo::getEnterpriseName,SupplierInfo::getSupplierNo));
+        return supplierInfoVos;
+    }
 }
 }