Commit b6098cff83184edb23da95a7325263ce3bbd771d
1 parent
29f1eb2c
✨ CRM:商机接入合同列表
Showing
4 changed files
with
36 additions
and
1 deletions
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contract/CrmContractController.java
| ... | ... | @@ -138,6 +138,14 @@ public class CrmContractController { |
| 138 | 138 | return success(BeanUtils.toBean(pageResult, CrmContractRespVO.class).setList(buildContractDetailList(pageResult.getList()))); |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | + @GetMapping("/page-by-business") | |
| 142 | + @Operation(summary = "获得合同分页,基于指定商机") | |
| 143 | + public CommonResult<PageResult<CrmContractRespVO>> getContractPageByBusiness(@Valid CrmContractPageReqVO pageVO) { | |
| 144 | + Assert.notNull(pageVO.getBusinessId(), "商机编号不能为空"); | |
| 145 | + PageResult<CrmContractDO> pageResult = contractService.getContractPageByBusinessId(pageVO); | |
| 146 | + return success(BeanUtils.toBean(pageResult, CrmContractRespVO.class).setList(buildContractDetailList(pageResult.getList()))); | |
| 147 | + } | |
| 148 | + | |
| 141 | 149 | @GetMapping("/export-excel") |
| 142 | 150 | @Operation(summary = "导出合同 Excel") |
| 143 | 151 | @PreAuthorize("@ss.hasPermission('crm:contract:export')") | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/contract/CrmContractMapper.java
| ... | ... | @@ -39,6 +39,16 @@ public interface CrmContractMapper extends BaseMapperX<CrmContractDO> { |
| 39 | 39 | .orderByDesc(CrmContractDO::getId)); |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | + default PageResult<CrmContractDO> selectPageByBusinessId(CrmContractPageReqVO pageReqVO) { | |
| 43 | + return selectPage(pageReqVO, new LambdaQueryWrapperX<CrmContractDO>() | |
| 44 | + .eq(CrmContractDO::getBusinessId, pageReqVO.getBusinessId()) | |
| 45 | + .likeIfPresent(CrmContractDO::getNo, pageReqVO.getNo()) | |
| 46 | + .likeIfPresent(CrmContractDO::getName, pageReqVO.getName()) | |
| 47 | + .eqIfPresent(CrmContractDO::getCustomerId, pageReqVO.getCustomerId()) | |
| 48 | + .eqIfPresent(CrmContractDO::getBusinessId, pageReqVO.getBusinessId()) | |
| 49 | + .orderByDesc(CrmContractDO::getId)); | |
| 50 | + } | |
| 51 | + | |
| 42 | 52 | default PageResult<CrmContractDO> selectPage(CrmContractPageReqVO pageReqVO, Long userId) { |
| 43 | 53 | MPJLambdaWrapperX<CrmContractDO> query = new MPJLambdaWrapperX<>(); |
| 44 | 54 | // 拼接数据权限的查询条件 | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/contract/CrmContractService.java
| ... | ... | @@ -4,6 +4,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | 4 | import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.CrmContractPageReqVO; |
| 5 | 5 | import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.CrmContractSaveReqVO; |
| 6 | 6 | import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.CrmContractTransferReqVO; |
| 7 | +import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessDO; | |
| 7 | 8 | import cn.iocoder.yudao.module.crm.dal.dataobject.contract.CrmContractDO; |
| 8 | 9 | import cn.iocoder.yudao.module.crm.dal.dataobject.contract.CrmContractProductDO; |
| 9 | 10 | import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; |
| ... | ... | @@ -109,11 +110,21 @@ public interface CrmContractService { |
| 109 | 110 | * 数据权限:基于 {@link CrmCustomerDO} 读取 |
| 110 | 111 | * |
| 111 | 112 | * @param pageReqVO 分页查询 |
| 112 | - * @return 联系人分页 | |
| 113 | + * @return 合同分页 | |
| 113 | 114 | */ |
| 114 | 115 | PageResult<CrmContractDO> getContractPageByCustomerId(CrmContractPageReqVO pageReqVO); |
| 115 | 116 | |
| 116 | 117 | /** |
| 118 | + * 获得合同分页,基于指定商机 | |
| 119 | + * | |
| 120 | + * 数据权限:基于 {@link CrmBusinessDO} 读取 | |
| 121 | + * | |
| 122 | + * @param pageReqVO 分页查询 | |
| 123 | + * @return 合同分页 | |
| 124 | + */ | |
| 125 | + PageResult<CrmContractDO> getContractPageByBusinessId(CrmContractPageReqVO pageReqVO); | |
| 126 | + | |
| 127 | + /** | |
| 117 | 128 | * 查询属于某个联系人的合同数量 |
| 118 | 129 | * |
| 119 | 130 | * @param contactId 联系人ID | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/contract/CrmContractServiceImpl.java
| ... | ... | @@ -342,6 +342,12 @@ public class CrmContractServiceImpl implements CrmContractService { |
| 342 | 342 | } |
| 343 | 343 | |
| 344 | 344 | @Override |
| 345 | + @CrmPermission(bizType = CrmBizTypeEnum.CRM_BUSINESS, bizId = "#pageReqVO.businessId", level = CrmPermissionLevelEnum.READ) | |
| 346 | + public PageResult<CrmContractDO> getContractPageByBusinessId(CrmContractPageReqVO pageReqVO) { | |
| 347 | + return contractMapper.selectPageByBusinessId(pageReqVO); | |
| 348 | + } | |
| 349 | + | |
| 350 | + @Override | |
| 345 | 351 | public Long getContractCountByContactId(Long contactId) { |
| 346 | 352 | return contractMapper.selectCountByContactId(contactId); |
| 347 | 353 | } | ... | ... |