Commit ca367c376fc74f80bb1060cc1383327d1943ae76
1 parent
296eb22b
feat(crm):新增 contact/business 的 list-by-customer 接口(含 @CrmPermission 数据权限)
Showing
7 changed files
with
54 additions
and
0 deletions
yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/CrmBusinessController.java
| @@ -138,6 +138,17 @@ public class CrmBusinessController { | @@ -138,6 +138,17 @@ public class CrmBusinessController { | ||
| 138 | .setCustomerId(business.getCustomerId()))); | 138 | .setCustomerId(business.getCustomerId()))); |
| 139 | } | 139 | } |
| 140 | 140 | ||
| 141 | + @GetMapping("/list-by-customer") | ||
| 142 | + @Operation(summary = "获得商机列表,基于指定客户") | ||
| 143 | + @Parameter(name = "customerId", description = "客户编号", required = true) | ||
| 144 | + @PreAuthorize("@ss.hasPermission('crm:business:query')") | ||
| 145 | + public CommonResult<List<CrmBusinessRespVO>> getBusinessListByCustomer(@RequestParam("customerId") Long customerId) { | ||
| 146 | + List<CrmBusinessDO> list = businessService.getBusinessListByCustomerId(customerId); | ||
| 147 | + return success(convertList(list, business -> // 只返回 id、name 字段 | ||
| 148 | + new CrmBusinessRespVO().setId(business.getId()).setName(business.getName()) | ||
| 149 | + .setCustomerId(business.getCustomerId()))); | ||
| 150 | + } | ||
| 151 | + | ||
| 141 | @GetMapping("/page") | 152 | @GetMapping("/page") |
| 142 | @Operation(summary = "获得商机分页") | 153 | @Operation(summary = "获得商机分页") |
| 143 | @PreAuthorize("@ss.hasPermission('crm:business:query')") | 154 | @PreAuthorize("@ss.hasPermission('crm:business:query')") |
yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contact/CrmContactController.java
| @@ -114,6 +114,17 @@ public class CrmContactController { | @@ -114,6 +114,17 @@ public class CrmContactController { | ||
| 114 | .setCustomerId(contact.getCustomerId()))); | 114 | .setCustomerId(contact.getCustomerId()))); |
| 115 | } | 115 | } |
| 116 | 116 | ||
| 117 | + @GetMapping("/list-by-customer") | ||
| 118 | + @Operation(summary = "获得联系人列表,基于指定客户") | ||
| 119 | + @Parameter(name = "customerId", description = "客户编号", required = true) | ||
| 120 | + @PreAuthorize("@ss.hasPermission('crm:contact:query')") | ||
| 121 | + public CommonResult<List<CrmContactRespVO>> getContactListByCustomer(@RequestParam("customerId") Long customerId) { | ||
| 122 | + List<CrmContactDO> list = contactService.getContactListByCustomerId(customerId); | ||
| 123 | + return success(convertList(list, contact -> // 只返回 id、name 字段 | ||
| 124 | + new CrmContactRespVO().setId(contact.getId()).setName(contact.getName()) | ||
| 125 | + .setCustomerId(contact.getCustomerId()))); | ||
| 126 | + } | ||
| 127 | + | ||
| 117 | @GetMapping("/page") | 128 | @GetMapping("/page") |
| 118 | @Operation(summary = "获得联系人分页") | 129 | @Operation(summary = "获得联系人分页") |
| 119 | @PreAuthorize("@ss.hasPermission('crm:contact:query')") | 130 | @PreAuthorize("@ss.hasPermission('crm:contact:query')") |
yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/business/CrmBusinessMapper.java
| @@ -65,6 +65,10 @@ public interface CrmBusinessMapper extends BaseMapperX<CrmBusinessDO> { | @@ -65,6 +65,10 @@ public interface CrmBusinessMapper extends BaseMapperX<CrmBusinessDO> { | ||
| 65 | .eq(CrmBusinessDO::getOwnerUserId, ownerUserId)); | 65 | .eq(CrmBusinessDO::getOwnerUserId, ownerUserId)); |
| 66 | } | 66 | } |
| 67 | 67 | ||
| 68 | + default List<CrmBusinessDO> selectListByCustomerId(Long customerId) { | ||
| 69 | + return selectList(CrmBusinessDO::getCustomerId, customerId); | ||
| 70 | + } | ||
| 71 | + | ||
| 68 | default PageResult<CrmBusinessDO> selectPage(CrmStatisticsFunnelReqVO pageVO) { | 72 | default PageResult<CrmBusinessDO> selectPage(CrmStatisticsFunnelReqVO pageVO) { |
| 69 | return selectPage(pageVO, new LambdaQueryWrapperX<CrmBusinessDO>() | 73 | return selectPage(pageVO, new LambdaQueryWrapperX<CrmBusinessDO>() |
| 70 | .in(CrmBusinessDO::getOwnerUserId, pageVO.getUserIds()) | 74 | .in(CrmBusinessDO::getOwnerUserId, pageVO.getUserIds()) |
yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/service/business/CrmBusinessService.java
| @@ -196,6 +196,14 @@ public interface CrmBusinessService { | @@ -196,6 +196,14 @@ public interface CrmBusinessService { | ||
| 196 | List<CrmBusinessDO> getBusinessListByCustomerIdOwnerUserId(Long customerId, Long ownerUserId); | 196 | List<CrmBusinessDO> getBusinessListByCustomerIdOwnerUserId(Long customerId, Long ownerUserId); |
| 197 | 197 | ||
| 198 | /** | 198 | /** |
| 199 | + * 获得商机列表,基于指定客户 | ||
| 200 | + * | ||
| 201 | + * @param customerId 客户编号 | ||
| 202 | + * @return 商机列表 | ||
| 203 | + */ | ||
| 204 | + List<CrmBusinessDO> getBusinessListByCustomerId(Long customerId); | ||
| 205 | + | ||
| 206 | + /** | ||
| 199 | * 获得商机分页,目前用于【数据统计】 | 207 | * 获得商机分页,目前用于【数据统计】 |
| 200 | * | 208 | * |
| 201 | * @param pageVO 请求 | 209 | * @param pageVO 请求 |
yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/service/business/CrmBusinessServiceImpl.java
| @@ -378,6 +378,12 @@ public class CrmBusinessServiceImpl implements CrmBusinessService { | @@ -378,6 +378,12 @@ public class CrmBusinessServiceImpl implements CrmBusinessService { | ||
| 378 | } | 378 | } |
| 379 | 379 | ||
| 380 | @Override | 380 | @Override |
| 381 | + @CrmPermission(bizType = CrmBizTypeEnum.CRM_CUSTOMER, bizId = "#customerId", level = CrmPermissionLevelEnum.READ) | ||
| 382 | + public List<CrmBusinessDO> getBusinessListByCustomerId(Long customerId) { | ||
| 383 | + return businessMapper.selectListByCustomerId(customerId); | ||
| 384 | + } | ||
| 385 | + | ||
| 386 | + @Override | ||
| 381 | public PageResult<CrmBusinessDO> getBusinessPageByDate(CrmStatisticsFunnelReqVO pageVO) { | 387 | public PageResult<CrmBusinessDO> getBusinessPageByDate(CrmStatisticsFunnelReqVO pageVO) { |
| 382 | return businessMapper.selectPage(pageVO); | 388 | return businessMapper.selectPage(pageVO); |
| 383 | } | 389 | } |
yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/service/contact/CrmContactService.java
| @@ -169,4 +169,12 @@ public interface CrmContactService { | @@ -169,4 +169,12 @@ public interface CrmContactService { | ||
| 169 | */ | 169 | */ |
| 170 | List<CrmContactDO> getContactListByCustomerIdOwnerUserId(Long customerId, Long ownerUserId); | 170 | List<CrmContactDO> getContactListByCustomerIdOwnerUserId(Long customerId, Long ownerUserId); |
| 171 | 171 | ||
| 172 | + /** | ||
| 173 | + * 获得联系人列表,基于指定客户 | ||
| 174 | + * | ||
| 175 | + * @param customerId 客户编号 | ||
| 176 | + * @return 联系人列表 | ||
| 177 | + */ | ||
| 178 | + List<CrmContactDO> getContactListByCustomerId(Long customerId); | ||
| 179 | + | ||
| 172 | } | 180 | } |
yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/service/contact/CrmContactServiceImpl.java
| @@ -304,4 +304,10 @@ public class CrmContactServiceImpl implements CrmContactService { | @@ -304,4 +304,10 @@ public class CrmContactServiceImpl implements CrmContactService { | ||
| 304 | return contactMapper.selectListByCustomerIdOwnerUserId(customerId, ownerUserId); | 304 | return contactMapper.selectListByCustomerIdOwnerUserId(customerId, ownerUserId); |
| 305 | } | 305 | } |
| 306 | 306 | ||
| 307 | + @Override | ||
| 308 | + @CrmPermission(bizType = CrmBizTypeEnum.CRM_CUSTOMER, bizId = "#customerId", level = CrmPermissionLevelEnum.READ) | ||
| 309 | + public List<CrmContactDO> getContactListByCustomerId(Long customerId) { | ||
| 310 | + return contactMapper.selectListByCustomerId(customerId); | ||
| 311 | + } | ||
| 312 | + | ||
| 307 | } | 313 | } |