2026-07-01 6b5f7c66fc40d7f6099d561e31a34fbd50dd20d3
yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/CrmBusinessController.java
@@ -138,6 +138,26 @@
                        .setCustomerId(business.getCustomerId())));
    }
    @GetMapping("/list-by-customer")
    @Operation(summary = "获得商机列表,基于指定客户")
    @Parameter(name = "customerId", description = "客户编号", required = true)
    @PreAuthorize("@ss.hasPermission('crm:business:query')")
    public CommonResult<List<CrmBusinessRespVO>> getBusinessListByCustomer(@RequestParam("customerId") Long customerId) {
        List<CrmBusinessDO> list = businessService.getBusinessListByCustomerId(customerId);
        return success(convertList(list, business -> // 只返回 id、name 字段
                new CrmBusinessRespVO().setId(business.getId()).setName(business.getName())
                        .setCustomerId(business.getCustomerId())));
    }
    @GetMapping("/list-by-contact")
    @Operation(summary = "获得商机列表,基于指定联系人")
    @Parameter(name = "contactId", description = "联系人编号", required = true)
    @PreAuthorize("@ss.hasPermission('crm:business:query')")
    public CommonResult<List<CrmBusinessRespVO>> getBusinessListByContact(@RequestParam("contactId") Long contactId) {
        List<CrmBusinessDO> list = businessService.getBusinessListByContact(contactId);
        return success(buildBusinessDetailList(list));
    }
    @GetMapping("/page")
    @Operation(summary = "获得商机分页")
    @PreAuthorize("@ss.hasPermission('crm:business:query')")