【代码优化】CRM:移除多余的 selectBatchIds 逻辑

This commit is contained in:
YunaiV 2024-10-02 10:51:06 +08:00
parent 945d379625
commit 7cbd447b69
7 changed files with 0 additions and 72 deletions

View File

@ -10,9 +10,6 @@ import cn.iocoder.yudao.module.crm.enums.common.CrmSceneTypeEnum;
import cn.iocoder.yudao.module.crm.util.CrmPermissionUtils; import cn.iocoder.yudao.module.crm.util.CrmPermissionUtils;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import java.util.Collection;
import java.util.List;
/** /**
* 线索 Mapper * 线索 Mapper
* *
@ -40,15 +37,6 @@ public interface CrmClueMapper extends BaseMapperX<CrmClueDO> {
return selectJoinPage(pageReqVO, CrmClueDO.class, query); return selectJoinPage(pageReqVO, CrmClueDO.class, query);
} }
default List<CrmClueDO> selectBatchIds(Collection<Long> ids, Long userId) {
MPJLambdaWrapperX<CrmClueDO> query = new MPJLambdaWrapperX<>();
// 拼接数据权限的查询条件
CrmPermissionUtils.appendPermissionCondition(query, CrmBizTypeEnum.CRM_CLUE.getType(), ids, userId);
query.selectAll(CrmClueDO.class).in(CrmClueDO::getId, ids).orderByDesc(CrmClueDO::getId);
// 拼接自身的查询条件
return selectJoinList(CrmClueDO.class, query);
}
default Long selectCountByFollow(Long userId) { default Long selectCountByFollow(Long userId) {
MPJLambdaWrapperX<CrmClueDO> query = new MPJLambdaWrapperX<>(); MPJLambdaWrapperX<CrmClueDO> query = new MPJLambdaWrapperX<>();
// 我负责的 + 非公海 // 我负责的 + 非公海

View File

@ -15,7 +15,6 @@ import cn.iocoder.yudao.module.crm.util.CrmPermissionUtils;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.Collection;
import java.util.List; import java.util.List;
/** /**
@ -77,15 +76,6 @@ public interface CrmContractMapper extends BaseMapperX<CrmContractDO> {
return selectJoinPage(pageReqVO, CrmContractDO.class, query); return selectJoinPage(pageReqVO, CrmContractDO.class, query);
} }
default List<CrmContractDO> selectBatchIds(Collection<Long> ids, Long userId) {
MPJLambdaWrapperX<CrmContractDO> query = new MPJLambdaWrapperX<>();
// 构建数据权限连表条件
CrmPermissionUtils.appendPermissionCondition(query, CrmBizTypeEnum.CRM_CONTRACT.getType(), ids, userId);
// 拼接自身的查询条件
query.selectAll(CrmContractDO.class).in(CrmContractDO::getId, ids).orderByDesc(CrmContractDO::getId);
return selectJoinList(CrmContractDO.class, query);
}
default Long selectCountByContactId(Long contactId) { default Long selectCountByContactId(Long contactId) {
return selectCount(CrmContractDO::getSignContactId, contactId); return selectCount(CrmContractDO::getSignContactId, contactId);
} }

View File

@ -20,7 +20,6 @@ import org.springframework.lang.Nullable;
import org.springframework.util.Assert; import org.springframework.util.Assert;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.Collection;
import java.util.List; import java.util.List;
/** /**
@ -85,15 +84,6 @@ public interface CrmCustomerMapper extends BaseMapperX<CrmCustomerDO> {
return selectJoinPage(pageReqVO, CrmCustomerDO.class, query); return selectJoinPage(pageReqVO, CrmCustomerDO.class, query);
} }
default List<CrmCustomerDO> selectBatchIds(Collection<Long> ids, Long ownerUserId) {
MPJLambdaWrapperX<CrmCustomerDO> query = new MPJLambdaWrapperX<>();
// 拼接数据权限的查询条件
CrmPermissionUtils.appendPermissionCondition(query, CrmBizTypeEnum.CRM_CUSTOMER.getType(), ids, ownerUserId);
// 拼接自身的查询条件
query.selectAll(CrmCustomerDO.class).in(CrmCustomerDO::getId, ids).orderByDesc(CrmCustomerDO::getId);
return selectJoinList(CrmCustomerDO.class, query);
}
default CrmCustomerDO selectByCustomerName(String name) { default CrmCustomerDO selectByCustomerName(String name) {
return selectOne(CrmCustomerDO::getName, name); return selectOne(CrmCustomerDO::getName, name);
} }

View File

@ -59,15 +59,6 @@ public interface CrmReceivableMapper extends BaseMapperX<CrmReceivableDO> {
return selectJoinPage(pageReqVO, CrmReceivableDO.class, query); return selectJoinPage(pageReqVO, CrmReceivableDO.class, query);
} }
default List<CrmReceivableDO> selectBatchIds(Collection<Long> ids, Long userId) {
MPJLambdaWrapperX<CrmReceivableDO> query = new MPJLambdaWrapperX<>();
// 拼接数据权限的查询条件
CrmPermissionUtils.appendPermissionCondition(query, CrmBizTypeEnum.CRM_RECEIVABLE.getType(), ids, userId);
// 拼接自身的查询条件
query.selectAll(CrmReceivableDO.class).in(CrmReceivableDO::getId, ids).orderByDesc(CrmReceivableDO::getId);
return selectJoinList(CrmReceivableDO.class, query);
}
default Long selectCountByAudit(Long userId) { default Long selectCountByAudit(Long userId) {
MPJLambdaWrapperX<CrmReceivableDO> query = new MPJLambdaWrapperX<>(); MPJLambdaWrapperX<CrmReceivableDO> query = new MPJLambdaWrapperX<>();
// 我负责的 + 非公海 // 我负责的 + 非公海

View File

@ -13,8 +13,6 @@ import cn.iocoder.yudao.module.crm.util.CrmPermissionUtils;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.Collection;
import java.util.List;
import java.util.Objects; import java.util.Objects;
/** /**
@ -74,15 +72,6 @@ public interface CrmReceivablePlanMapper extends BaseMapperX<CrmReceivablePlanDO
return selectJoinPage(pageReqVO, CrmReceivablePlanDO.class, query); return selectJoinPage(pageReqVO, CrmReceivablePlanDO.class, query);
} }
default List<CrmReceivablePlanDO> selectBatchIds(Collection<Long> ids, Long userId) {
MPJLambdaWrapperX<CrmReceivablePlanDO> query = new MPJLambdaWrapperX<>();
// 拼接数据权限的查询条件
CrmPermissionUtils.appendPermissionCondition(query, CrmBizTypeEnum.CRM_RECEIVABLE_PLAN.getType(), ids, userId);
// 拼接自身的查询条件
query.selectAll(CrmReceivablePlanDO.class).in(CrmReceivablePlanDO::getId, ids).orderByDesc(CrmReceivablePlanDO::getId);
return selectJoinList(CrmReceivablePlanDO.class, query);
}
default Long selectReceivablePlanCountByRemind(Long userId) { default Long selectReceivablePlanCountByRemind(Long userId) {
MPJLambdaWrapperX<CrmReceivablePlanDO> query = new MPJLambdaWrapperX<>(); MPJLambdaWrapperX<CrmReceivablePlanDO> query = new MPJLambdaWrapperX<>();
// 我负责的 + 非公海 // 我负责的 + 非公海

View File

@ -8,8 +8,6 @@ import cn.iocoder.yudao.module.crm.dal.dataobject.clue.CrmClueDO;
import jakarta.validation.Valid; import jakarta.validation.Valid;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.Collection;
import java.util.List;
/** /**
* 线索 Service 接口 * 线索 Service 接口
@ -57,14 +55,6 @@ public interface CrmClueService {
*/ */
CrmClueDO getClue(Long id); CrmClueDO getClue(Long id);
/**
* 获得线索列表
*
* @param ids 编号
* @return 线索列表
*/
List<CrmClueDO> getClueList(Collection<Long> ids, Long userId);
/** /**
* 获得线索分页 * 获得线索分页
* *

View File

@ -1,7 +1,6 @@
package cn.iocoder.yudao.module.crm.service.clue; package cn.iocoder.yudao.module.crm.service.clue;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.lang.Assert; import cn.hutool.core.lang.Assert;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils; import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
@ -32,7 +31,6 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
@ -220,14 +218,6 @@ public class CrmClueServiceImpl implements CrmClueService {
return clueMapper.selectById(id); return clueMapper.selectById(id);
} }
@Override
public List<CrmClueDO> getClueList(Collection<Long> ids, Long userId) {
if (CollUtil.isEmpty(ids)) {
return ListUtil.empty();
}
return clueMapper.selectBatchIds(ids, userId);
}
@Override @Override
public PageResult<CrmClueDO> getCluePage(CrmCluePageReqVO pageReqVO, Long userId) { public PageResult<CrmClueDO> getCluePage(CrmCluePageReqVO pageReqVO, Long userId) {
return clueMapper.selectPage(pageReqVO, userId); return clueMapper.selectPage(pageReqVO, userId);