CRM:商机接入合同列表

This commit is contained in:
YunaiV 2024-02-24 16:08:07 +08:00
parent 29f1eb2c18
commit b6098cff83
4 changed files with 36 additions and 1 deletions

View File

@ -138,6 +138,14 @@ public class CrmContractController {
return success(BeanUtils.toBean(pageResult, CrmContractRespVO.class).setList(buildContractDetailList(pageResult.getList())));
}
@GetMapping("/page-by-business")
@Operation(summary = "获得合同分页,基于指定商机")
public CommonResult<PageResult<CrmContractRespVO>> getContractPageByBusiness(@Valid CrmContractPageReqVO pageVO) {
Assert.notNull(pageVO.getBusinessId(), "商机编号不能为空");
PageResult<CrmContractDO> pageResult = contractService.getContractPageByBusinessId(pageVO);
return success(BeanUtils.toBean(pageResult, CrmContractRespVO.class).setList(buildContractDetailList(pageResult.getList())));
}
@GetMapping("/export-excel")
@Operation(summary = "导出合同 Excel")
@PreAuthorize("@ss.hasPermission('crm:contract:export')")

View File

@ -39,6 +39,16 @@ public interface CrmContractMapper extends BaseMapperX<CrmContractDO> {
.orderByDesc(CrmContractDO::getId));
}
default PageResult<CrmContractDO> selectPageByBusinessId(CrmContractPageReqVO pageReqVO) {
return selectPage(pageReqVO, new LambdaQueryWrapperX<CrmContractDO>()
.eq(CrmContractDO::getBusinessId, pageReqVO.getBusinessId())
.likeIfPresent(CrmContractDO::getNo, pageReqVO.getNo())
.likeIfPresent(CrmContractDO::getName, pageReqVO.getName())
.eqIfPresent(CrmContractDO::getCustomerId, pageReqVO.getCustomerId())
.eqIfPresent(CrmContractDO::getBusinessId, pageReqVO.getBusinessId())
.orderByDesc(CrmContractDO::getId));
}
default PageResult<CrmContractDO> selectPage(CrmContractPageReqVO pageReqVO, Long userId) {
MPJLambdaWrapperX<CrmContractDO> query = new MPJLambdaWrapperX<>();
// 拼接数据权限的查询条件

View File

@ -4,6 +4,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.CrmContractPageReqVO;
import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.CrmContractSaveReqVO;
import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.CrmContractTransferReqVO;
import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessDO;
import cn.iocoder.yudao.module.crm.dal.dataobject.contract.CrmContractDO;
import cn.iocoder.yudao.module.crm.dal.dataobject.contract.CrmContractProductDO;
import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO;
@ -109,10 +110,20 @@ public interface CrmContractService {
* 数据权限基于 {@link CrmCustomerDO} 读取
*
* @param pageReqVO 分页查询
* @return 联系人分页
* @return 合同分页
*/
PageResult<CrmContractDO> getContractPageByCustomerId(CrmContractPageReqVO pageReqVO);
/**
* 获得合同分页基于指定商机
*
* 数据权限基于 {@link CrmBusinessDO} 读取
*
* @param pageReqVO 分页查询
* @return 合同分页
*/
PageResult<CrmContractDO> getContractPageByBusinessId(CrmContractPageReqVO pageReqVO);
/**
* 查询属于某个联系人的合同数量
*

View File

@ -341,6 +341,12 @@ public class CrmContractServiceImpl implements CrmContractService {
return contractMapper.selectPageByCustomerId(pageReqVO);
}
@Override
@CrmPermission(bizType = CrmBizTypeEnum.CRM_BUSINESS, bizId = "#pageReqVO.businessId", level = CrmPermissionLevelEnum.READ)
public PageResult<CrmContractDO> getContractPageByBusinessId(CrmContractPageReqVO pageReqVO) {
return contractMapper.selectPageByBusinessId(pageReqVO);
}
@Override
public Long getContractCountByContactId(Long contactId) {
return contractMapper.selectCountByContactId(contactId);