diff --git a/pom.xml b/pom.xml
index 26dec77cf..86f894f4a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -15,12 +15,12 @@
yudao-module-system
yudao-module-infra
-
+ yudao-module-member
-
-
+ yudao-module-pay
+ yudao-module-mall
yudao-module-crm
diff --git a/yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/mapper/BaseMapperX.java b/yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/mapper/BaseMapperX.java
index b0c0f784e..e466f5ed7 100644
--- a/yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/mapper/BaseMapperX.java
+++ b/yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/mapper/BaseMapperX.java
@@ -48,8 +48,10 @@ public interface BaseMapperX extends MPJBaseMapper {
return new PageResult<>(list, (long) list.size());
}
+ // MyBatis Plus Join 查询
IPage mpPage = MyBatisUtils.buildPage(pageParam);
mpPage = selectJoinPage(mpPage, clazz, lambdaWrapper);
+ // 转换返回
return new PageResult<>(mpPage.getRecords(), mpPage.getTotal());
}
diff --git a/yudao-module-crm/yudao-module-crm-api/src/main/java/cn/iocoder/yudao/module/crm/enums/common/CrmSceneTypeEnum.java b/yudao-module-crm/yudao-module-crm-api/src/main/java/cn/iocoder/yudao/module/crm/enums/common/CrmSceneTypeEnum.java
index dc714250d..945d7c6a3 100644
--- a/yudao-module-crm/yudao-module-crm-api/src/main/java/cn/iocoder/yudao/module/crm/enums/common/CrmSceneTypeEnum.java
+++ b/yudao-module-crm/yudao-module-crm-api/src/main/java/cn/iocoder/yudao/module/crm/enums/common/CrmSceneTypeEnum.java
@@ -17,9 +17,8 @@ import java.util.Arrays;
public enum CrmSceneTypeEnum implements IntArrayValuable {
OWNER(1, "我负责的"),
- FOLLOW(2, "我关注的"),
- INVOLVED(3, "我参与的"),
- SUBORDINATE(4, "下属负责的");
+ INVOLVED(2, "我参与的"),
+ SUBORDINATE(3, "下属负责的");
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(CrmSceneTypeEnum::getType).toArray();
@@ -36,10 +35,6 @@ public enum CrmSceneTypeEnum implements IntArrayValuable {
return ObjUtil.equal(OWNER.getType(), type);
}
- public static boolean isFollow(Integer type) {
- return ObjUtil.equal(FOLLOW.getType(), type);
- }
-
public static boolean isInvolved(Integer type) {
return ObjUtil.equal(INVOLVED.getType(), type);
}
diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/business/CrmBusinessPageReqVO.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/business/CrmBusinessPageReqVO.java
index eb208b252..579026047 100644
--- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/business/CrmBusinessPageReqVO.java
+++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/business/CrmBusinessPageReqVO.java
@@ -20,12 +20,9 @@ public class CrmBusinessPageReqVO extends PageParam {
@Schema(description = "客户编号", example = "10795")
private Long customerId;
- /**
- * 场景类型,为 null 时则表示全部
- */
@Schema(description = "场景类型", example = "1")
@InEnum(CrmSceneTypeEnum.class)
- private Integer sceneType;
+ private Integer sceneType; // 场景类型,为 null 时则表示全部
@Schema(description = "是否为公海数据", requiredMode = Schema.RequiredMode.REQUIRED, example = "false")
private Boolean pool; // null 则表示为不是公海数据
diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/clue/vo/CrmCluePageReqVO.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/clue/vo/CrmCluePageReqVO.java
index 3bc841c2b..0b6e7a50a 100644
--- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/clue/vo/CrmCluePageReqVO.java
+++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/clue/vo/CrmCluePageReqVO.java
@@ -23,12 +23,9 @@ public class CrmCluePageReqVO extends PageParam {
@Schema(description = "手机号", example = "18000000000")
private String mobile;
- /**
- * 场景类型,为 null 时则表示全部
- */
@Schema(description = "场景类型", example = "1")
@InEnum(CrmSceneTypeEnum.class)
- private Integer sceneType;
+ private Integer sceneType; // 场景类型,为 null 时则表示全部
@Schema(description = "是否为公海数据", requiredMode = Schema.RequiredMode.REQUIRED, example = "false")
private Boolean pool; // null 则表示为不是公海数据
diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contact/vo/CrmContactPageReqVO.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contact/vo/CrmContactPageReqVO.java
index 3d68c6f98..eb6ebd76c 100644
--- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contact/vo/CrmContactPageReqVO.java
+++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contact/vo/CrmContactPageReqVO.java
@@ -35,12 +35,9 @@ public class CrmContactPageReqVO extends PageParam {
@Schema(description = "微信", example = "zzZ98373")
private String wechat;
- /**
- * 场景类型,为 null 时则表示全部
- */
@Schema(description = "场景类型", example = "1")
@InEnum(CrmSceneTypeEnum.class)
- private Integer sceneType;
+ private Integer sceneType; // 场景类型,为 null 时则表示全部
@Schema(description = "是否为公海数据", requiredMode = Schema.RequiredMode.REQUIRED, example = "false")
private Boolean pool; // null 则表示为不是公海数据
diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contract/vo/CrmContractPageReqVO.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contract/vo/CrmContractPageReqVO.java
index 97f9b70cd..2b3123bd9 100644
--- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contract/vo/CrmContractPageReqVO.java
+++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contract/vo/CrmContractPageReqVO.java
@@ -26,14 +26,11 @@ public class CrmContractPageReqVO extends PageParam {
@Schema(description = "商机编号", example = "10864")
private Long businessId;
- /**
- * 场景类型,为 null 时则表示全部
- */
@Schema(description = "场景类型", example = "1")
@InEnum(CrmSceneTypeEnum.class)
- private Integer sceneType;
+ private Integer sceneType; // 场景类型,为 null 时则表示全部
@Schema(description = "是否为公海数据", requiredMode = Schema.RequiredMode.REQUIRED, example = "false")
- private Boolean pool; // null 则表示为不是公海数据
+ private Boolean pool; // null 则表示为不是公海数据 TODO @puhui999:合同没有公海。目前只有【客户】【线索】有公海,其它都没
}
diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/CrmCustomerPageReqVO.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/CrmCustomerPageReqVO.java
index 830b7da6d..bded50473 100644
--- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/CrmCustomerPageReqVO.java
+++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/CrmCustomerPageReqVO.java
@@ -29,12 +29,9 @@ public class CrmCustomerPageReqVO extends PageParam {
@Schema(description = "客户来源", example = "1")
private Integer source;
- /**
- * 场景类型,为 null 时则表示全部
- */
@Schema(description = "场景类型", example = "1")
@InEnum(CrmSceneTypeEnum.class)
- private Integer sceneType;
+ private Integer sceneType; // 场景类型,为 null 时则表示全部
@Schema(description = "是否为公海数据", requiredMode = Schema.RequiredMode.REQUIRED, example = "false")
private Boolean pool; // null 则表示为不是公海数据
diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/plan/CrmReceivablePlanPageReqVO.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/plan/CrmReceivablePlanPageReqVO.java
index f4987248e..16681ba3c 100644
--- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/plan/CrmReceivablePlanPageReqVO.java
+++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/plan/CrmReceivablePlanPageReqVO.java
@@ -21,12 +21,9 @@ public class CrmReceivablePlanPageReqVO extends PageParam {
@Schema(description = "合同名称", example = "3473")
private Long contractId;
- /**
- * 场景类型,为 null 时则表示全部
- */
@Schema(description = "场景类型", example = "1")
@InEnum(CrmSceneTypeEnum.class)
- private Integer sceneType;
+ private Integer sceneType; // 场景类型,为 null 时则表示全部
@Schema(description = "是否为公海数据", requiredMode = Schema.RequiredMode.REQUIRED, example = "false")
private Boolean pool; // null 则表示为不是公海数据
diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/receivable/CrmReceivablePageReqVO.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/receivable/CrmReceivablePageReqVO.java
index 5999d4e34..3eef5d013 100644
--- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/receivable/CrmReceivablePageReqVO.java
+++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/receivable/CrmReceivablePageReqVO.java
@@ -23,12 +23,9 @@ public class CrmReceivablePageReqVO extends PageParam {
@Schema(description = "客户编号", example = "4963")
private Long customerId;
- /**
- * 场景类型,为 null 时则表示全部
- */
@Schema(description = "场景类型", example = "1")
@InEnum(CrmSceneTypeEnum.class)
- private Integer sceneType;
+ private Integer sceneType; // 场景类型,为 null 时则表示全部
@Schema(description = "是否为公海数据", requiredMode = Schema.RequiredMode.REQUIRED, example = "false")
private Boolean pool; // null 则表示为不是公海数据
diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/package-info.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/package-info.java
new file mode 100644
index 000000000..8354b3176
--- /dev/null
+++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/package-info.java
@@ -0,0 +1,6 @@
+/**
+ * 提供 RESTful API 给前端:
+ * 1. admin 包:提供给管理后台 yudao-ui-admin 前端项目
+ * 2. app 包:提供给用户 APP yudao-ui-app 前端项目,它的 Controller 和 VO 都要添加 App 前缀,用于和管理后台进行区分
+ */
+package cn.iocoder.yudao.module.crm.controller;
diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/business/CrmBusinessConvert.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/business/CrmBusinessConvert.java
index 72acdd094..3effb21e0 100644
--- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/business/CrmBusinessConvert.java
+++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/business/CrmBusinessConvert.java
@@ -38,9 +38,7 @@ public interface CrmBusinessConvert {
List convertList02(List list);
- @Mappings({
- @Mapping(target = "bizId", source = "reqVO.id")
- })
+ @Mapping(target = "bizId", source = "reqVO.id")
CrmPermissionTransferReqBO convert(CrmBusinessTransferReqVO reqVO, Long userId);
default PageResult convertPage(PageResult page, List customerList,
diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/customer/CrmCustomerConvert.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/customer/CrmCustomerConvert.java
index 0e21b26b8..55e2a3518 100644
--- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/customer/CrmCustomerConvert.java
+++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/customer/CrmCustomerConvert.java
@@ -54,9 +54,7 @@ public interface CrmCustomerConvert {
List convertList02(List list);
- @Mappings({
- @Mapping(target = "bizId", source = "reqVO.id")
- })
+ @Mapping(target = "bizId", source = "reqVO.id")
CrmPermissionTransferReqBO convert(CrmCustomerTransferReqVO reqVO, Long userId);
PageResult convertPage(PageResult page);
diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/business/CrmBusinessMapper.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/business/CrmBusinessMapper.java
index 8e5d6750a..7c06e57a0 100644
--- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/business/CrmBusinessMapper.java
+++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/business/CrmBusinessMapper.java
@@ -28,22 +28,23 @@ public interface CrmBusinessMapper extends BaseMapperX {
}
default PageResult selectPage(CrmBusinessPageReqVO pageReqVO, Long userId) {
- MPJLambdaWrapperX mpjLambdaWrapperX = new MPJLambdaWrapperX<>();
- // 构建数据权限连表条件
- CrmQueryWrapperUtils.builderPageQuery(mpjLambdaWrapperX, CrmBizTypeEnum.CRM_BUSINESS.getType(), CrmBusinessDO::getId,
+ MPJLambdaWrapperX query = new MPJLambdaWrapperX<>();
+ // 拼接数据权限的查询条件
+ CrmQueryWrapperUtils.builderPageQuery(query, CrmBizTypeEnum.CRM_BUSINESS.getType(), CrmBusinessDO::getId,
userId, pageReqVO.getSceneType(), pageReqVO.getPool());
- mpjLambdaWrapperX.selectAll(CrmBusinessDO.class)
+ // 拼接自身的查询条件
+ query.selectAll(CrmBusinessDO.class)
.eqIfPresent(CrmBusinessDO::getCustomerId, pageReqVO.getCustomerId()) // 指定客户编号
.likeIfPresent(CrmBusinessDO::getName, pageReqVO.getName())
.orderByDesc(CrmBusinessDO::getId);
- return selectJoinPage(pageReqVO, CrmBusinessDO.class, mpjLambdaWrapperX);
+ return selectJoinPage(pageReqVO, CrmBusinessDO.class, query);
}
default List selectBatchIds(Collection ids, Long userId) {
- MPJLambdaWrapperX mpjLambdaWrapperX = new MPJLambdaWrapperX<>();
- // 构建数据权限连表条件
- CrmQueryWrapperUtils.builderListQueryBatch(mpjLambdaWrapperX, CrmBizTypeEnum.CRM_BUSINESS.getType(), ids, userId);
- return selectJoinList(CrmBusinessDO.class, mpjLambdaWrapperX);
+ MPJLambdaWrapperX query = new MPJLambdaWrapperX<>();
+ // 拼接数据权限的查询条件
+ CrmQueryWrapperUtils.builderListQueryBatch(query, CrmBizTypeEnum.CRM_BUSINESS.getType(), ids, userId);
+ return selectJoinList(CrmBusinessDO.class, query);
}
}
diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/clue/CrmClueMapper.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/clue/CrmClueMapper.java
index 1d33d5814..479a12f1a 100644
--- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/clue/CrmClueMapper.java
+++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/clue/CrmClueMapper.java
@@ -28,23 +28,24 @@ public interface CrmClueMapper extends BaseMapperX {
}
default PageResult selectPage(CrmCluePageReqVO pageReqVO, Long userId) {
- MPJLambdaWrapperX mpjLambdaWrapperX = new MPJLambdaWrapperX<>();
- // 构建数据权限连表条件
- CrmQueryWrapperUtils.builderPageQuery(mpjLambdaWrapperX, CrmBizTypeEnum.CRM_LEADS.getType(), CrmClueDO::getId,
+ MPJLambdaWrapperX query = new MPJLambdaWrapperX<>();
+ // 拼接数据权限的查询条件
+ CrmQueryWrapperUtils.builderPageQuery(query, CrmBizTypeEnum.CRM_LEADS.getType(), CrmClueDO::getId,
userId, pageReqVO.getSceneType(), pageReqVO.getPool());
- mpjLambdaWrapperX.selectAll(CrmClueDO.class)
+ // 拼接自身的查询条件
+ query.selectAll(CrmClueDO.class)
.likeIfPresent(CrmClueDO::getName, pageReqVO.getName())
.likeIfPresent(CrmClueDO::getTelephone, pageReqVO.getTelephone())
.likeIfPresent(CrmClueDO::getMobile, pageReqVO.getMobile())
.orderByDesc(CrmClueDO::getId);
- return selectJoinPage(pageReqVO, CrmClueDO.class, mpjLambdaWrapperX);
+ return selectJoinPage(pageReqVO, CrmClueDO.class, query);
}
default List selectBatchIds(Collection ids, Long userId) {
- MPJLambdaWrapperX mpjLambdaWrapperX = new MPJLambdaWrapperX<>();
- // 构建数据权限连表条件
- CrmQueryWrapperUtils.builderListQueryBatch(mpjLambdaWrapperX, CrmBizTypeEnum.CRM_LEADS.getType(), ids, userId);
- return selectJoinList(CrmClueDO.class, mpjLambdaWrapperX);
+ MPJLambdaWrapperX query = new MPJLambdaWrapperX<>();
+ // 拼接数据权限的查询条件
+ CrmQueryWrapperUtils.builderListQueryBatch(query, CrmBizTypeEnum.CRM_LEADS.getType(), ids, userId);
+ return selectJoinList(CrmClueDO.class, query);
}
}
diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/contact/CrmContactMapper.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/contact/CrmContactMapper.java
index 266aceaa6..189f36f08 100644
--- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/contact/CrmContactMapper.java
+++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/contact/CrmContactMapper.java
@@ -28,11 +28,12 @@ public interface CrmContactMapper extends BaseMapperX {
}
default PageResult selectPage(CrmContactPageReqVO pageReqVO, Long userId) {
- MPJLambdaWrapperX mpjLambdaWrapperX = new MPJLambdaWrapperX<>();
- // 构建数据权限连表条件
- CrmQueryWrapperUtils.builderPageQuery(mpjLambdaWrapperX, CrmBizTypeEnum.CRM_CONTACT.getType(), CrmContactDO::getId,
+ MPJLambdaWrapperX query = new MPJLambdaWrapperX<>();
+ // 拼接数据权限的查询条件
+ CrmQueryWrapperUtils.builderPageQuery(query, CrmBizTypeEnum.CRM_CONTACT.getType(), CrmContactDO::getId,
userId, pageReqVO.getSceneType(), pageReqVO.getPool());
- mpjLambdaWrapperX.selectAll(CrmContactDO.class)
+ // 拼接自身的查询条件
+ query.selectAll(CrmContactDO.class)
.eqIfPresent(CrmContactDO::getCustomerId, pageReqVO.getCustomerId()) // 指定客户编号
.likeIfPresent(CrmContactDO::getName, pageReqVO.getName())
.eqIfPresent(CrmContactDO::getMobile, pageReqVO.getMobile())
@@ -41,14 +42,14 @@ public interface CrmContactMapper extends BaseMapperX {
.eqIfPresent(CrmContactDO::getQq, pageReqVO.getQq())
.eqIfPresent(CrmContactDO::getWechat, pageReqVO.getWechat())
.orderByDesc(CrmContactDO::getId);
- return selectJoinPage(pageReqVO, CrmContactDO.class, mpjLambdaWrapperX);
+ return selectJoinPage(pageReqVO, CrmContactDO.class, query);
}
default List selectBatchIds(Collection ids, Long userId) {
- MPJLambdaWrapperX mpjLambdaWrapperX = new MPJLambdaWrapperX<>();
- // 构建数据权限连表条件
- CrmQueryWrapperUtils.builderListQueryBatch(mpjLambdaWrapperX, CrmBizTypeEnum.CRM_CONTACT.getType(), ids, userId);
- return selectJoinList(CrmContactDO.class, mpjLambdaWrapperX);
+ MPJLambdaWrapperX query = new MPJLambdaWrapperX<>();
+ // 拼接数据权限的查询条件
+ CrmQueryWrapperUtils.builderListQueryBatch(query, CrmBizTypeEnum.CRM_CONTACT.getType(), ids, userId);
+ return selectJoinList(CrmContactDO.class, query);
}
}
diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/customer/CrmCustomerMapper.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/customer/CrmCustomerMapper.java
index 9c29c668f..86c8617b7 100644
--- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/customer/CrmCustomerMapper.java
+++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/customer/CrmCustomerMapper.java
@@ -28,24 +28,25 @@ public interface CrmCustomerMapper extends BaseMapperX {
}
default PageResult selectPage(CrmCustomerPageReqVO pageReqVO, Long userId) {
- MPJLambdaWrapperX mpjLambdaWrapperX = new MPJLambdaWrapperX<>();
- // 构建数据权限连表条件
- CrmQueryWrapperUtils.builderPageQuery(mpjLambdaWrapperX, CrmBizTypeEnum.CRM_CUSTOMER.getType(), CrmCustomerDO::getId,
+ MPJLambdaWrapperX query = new MPJLambdaWrapperX<>();
+ // 拼接数据权限的查询条件
+ CrmQueryWrapperUtils.builderPageQuery(query, CrmBizTypeEnum.CRM_CUSTOMER.getType(), CrmCustomerDO::getId,
userId, pageReqVO.getSceneType(), pageReqVO.getPool());
- mpjLambdaWrapperX.selectAll(CrmCustomerDO.class)
+ // 拼接自身的查询条件
+ query.selectAll(CrmCustomerDO.class)
.likeIfPresent(CrmCustomerDO::getName, pageReqVO.getName())
.eqIfPresent(CrmCustomerDO::getMobile, pageReqVO.getMobile())
.eqIfPresent(CrmCustomerDO::getIndustryId, pageReqVO.getIndustryId())
.eqIfPresent(CrmCustomerDO::getLevel, pageReqVO.getLevel())
.eqIfPresent(CrmCustomerDO::getSource, pageReqVO.getSource());
- return selectJoinPage(pageReqVO, CrmCustomerDO.class, mpjLambdaWrapperX);
+ return selectJoinPage(pageReqVO, CrmCustomerDO.class, query);
}
default List selectBatchIds(Collection ids, Long userId) {
- MPJLambdaWrapperX mpjLambdaWrapperX = new MPJLambdaWrapperX<>();
- // 构建数据权限连表条件
- CrmQueryWrapperUtils.builderListQueryBatch(mpjLambdaWrapperX, CrmBizTypeEnum.CRM_CUSTOMER.getType(), ids, userId);
- return selectJoinList(CrmCustomerDO.class, mpjLambdaWrapperX);
+ MPJLambdaWrapperX query = new MPJLambdaWrapperX<>();
+ // 拼接数据权限的查询条件
+ CrmQueryWrapperUtils.builderListQueryBatch(query, CrmBizTypeEnum.CRM_CUSTOMER.getType(), ids, userId);
+ return selectJoinList(CrmCustomerDO.class, query);
}
}
diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/business/CrmBusinessServiceImpl.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/business/CrmBusinessServiceImpl.java
index 6e43944eb..98630ffdf 100644
--- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/business/CrmBusinessServiceImpl.java
+++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/business/CrmBusinessServiceImpl.java
@@ -112,9 +112,9 @@ public class CrmBusinessServiceImpl implements CrmBusinessService {
@Override
public PageResult getBusinessPageByCustomer(CrmBusinessPageReqVO pageReqVO, Long userId) {
- // 校验客户存在
+ // 校验客户存在 TODO @puhui999:这里不校验
customerService.validateCustomer(pageReqVO.getCustomerId());
-
+ // TODO @puhui999:感觉这里貌似不太复用用 selectPage,因为他可能没商机权限,只是因为能看 customer,所以可以看到列表
return businessMapper.selectPage(pageReqVO, userId);
}
diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/clue/CrmClueServiceImpl.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/clue/CrmClueServiceImpl.java
index 3c463fa75..63e2fcbd2 100644
--- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/clue/CrmClueServiceImpl.java
+++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/clue/CrmClueServiceImpl.java
@@ -35,6 +35,7 @@ public class CrmClueServiceImpl implements CrmClueService {
@Resource
private CrmClueMapper clueMapper;
+
@Resource
private CrmCustomerService customerService;
@Resource
diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/contact/CrmContactServiceImpl.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/contact/CrmContactServiceImpl.java
index 9220a9e66..39aac0e11 100644
--- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/contact/CrmContactServiceImpl.java
+++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/contact/CrmContactServiceImpl.java
@@ -137,7 +137,7 @@ public class CrmContactServiceImpl implements CrmContactService {
public PageResult getContactPageByCustomerId(CrmContactPageReqVO pageVO, Long userId) {
// 校验用户存在
customerService.validateCustomer(pageVO.getCustomerId());
-
+ // TODO @puhui999:getBusinessPageByCustomer 同理
return contactMapper.selectPage(pageVO, userId);
}
diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/permission/CrmPermissionServiceImpl.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/permission/CrmPermissionServiceImpl.java
index e29e05fb0..d7ebb572b 100644
--- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/permission/CrmPermissionServiceImpl.java
+++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/permission/CrmPermissionServiceImpl.java
@@ -126,9 +126,9 @@ public class CrmPermissionServiceImpl implements CrmPermissionService {
@Override
@Transactional(rollbackFor = Exception.class)
public void deletePermission(Integer bizType, Long bizId, Integer level) {
+ // 校验存在
List permissions = crmPermissionMapper.selectListByBizTypeAndBizIdAndLevel(
bizType, bizId, level);
- // 校验存在
if (CollUtil.isEmpty(permissions)) {
throw exception(CRM_PERMISSION_NOT_EXISTS);
}
@@ -139,6 +139,7 @@ public class CrmPermissionServiceImpl implements CrmPermissionService {
@Override
public void deletePermission(Integer bizType, Long bizId) {
+ // TODO @puhui999:这种直接写条件删除;不需要先查询,再删除
List permissionList = crmPermissionMapper.selectByBizTypeAndBizId(bizType, bizId);
if (CollUtil.isEmpty(permissionList)) {
return;
diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/util/CrmQueryWrapperUtils.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/util/CrmQueryWrapperUtils.java
index 0ffa8572e..5eb80b292 100644
--- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/util/CrmQueryWrapperUtils.java
+++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/util/CrmQueryWrapperUtils.java
@@ -26,67 +26,74 @@ public class CrmQueryWrapperUtils {
/**
* 构造 CRM 数据类型数据分页查询条件
*
- * @param queryMapper 连表查询对象
+ * @param query 连表查询对象
* @param bizType 数据类型 {@link CrmBizTypeEnum}
* @param bizId 数据编号
* @param userId 用户编号
* @param sceneType 场景类型
* @param pool 公海
*/
- public static , S> void builderPageQuery(
- T queryMapper, Integer bizType, SFunction bizId, Long userId, Integer sceneType, Boolean pool) {
+ // TODO @puhui999:bizId 直接传递会不会简单点
+ // TODO @puhui999:builderPageQuery 应该不仅仅适合于分页查询,应该适用于所有的查询;可以改成 appendPermissionCondition
+ public static , S> void builderPageQuery(T query, Integer bizType, SFunction bizId,
+ Long userId, Integer sceneType, Boolean pool) {
// 1. 构建数据权限连表条件
if (ObjUtil.notEqual(validateAdminUser(userId), Boolean.TRUE)) { // 管理员不需要数据权限
- queryMapper.innerJoin(CrmPermissionDO.class, on ->
+ query.innerJoin(CrmPermissionDO.class, on ->
on.eq(CrmPermissionDO::getBizType, bizType).eq(CrmPermissionDO::getBizId, bizId)
.eq(CrmPermissionDO::getUserId, userId));
}
- // 1.2 场景一:我负责的数据
+ // 2.1 场景一:我负责的数据
if (CrmSceneTypeEnum.isOwner(sceneType)) {
- queryMapper.eq("owner_user_id", userId);
+ query.eq("owner_user_id", userId);
}
- // 1.3 场景一:我参与的数据
+ // 2.2 场景二:我参与的数据
+ // TODO @puhui999:参与,指的是有读写权限噢;可以把 1. 的合并到 2.2 里;因为 2.1 不需要;
if (CrmSceneTypeEnum.isInvolved(sceneType)) {
- queryMapper.ne("owner_user_id", userId);
+ query.ne("owner_user_id", userId);
}
- // 1.4 场景二:下属负责的数据
+ // 2.3 场景三:下属负责的数据
if (CrmSceneTypeEnum.isSubordinate(sceneType)) {
List subordinateUsers = getAdminUserApi().getUserListBySubordinate(userId);
+ // TODO @puhui999:如果为空,不拼接,就是查询了所有数据呀?
if (CollUtil.isNotEmpty(subordinateUsers)) {
- queryMapper.in("owner_user_id", convertSet(subordinateUsers, AdminUserRespDTO::getId));
+ query.in("owner_user_id", convertSet(subordinateUsers, AdminUserRespDTO::getId));
}
}
// 2. 拼接公海的查询条件
if (ObjUtil.equal(pool, Boolean.TRUE)) { // 情况一:公海
- queryMapper.isNull("owner_user_id");
+ query.isNull("owner_user_id");
} else { // 情况二:不是公海
- queryMapper.isNotNull("owner_user_id");
+ query.isNotNull("owner_user_id");
}
}
/**
* 构造 CRM 数据类型批量数据查询条件
*
- * @param queryMapper 连表查询对象
+ * @param query 连表查询对象
* @param bizType 数据类型 {@link CrmBizTypeEnum}
* @param bizIds 数据编号
* @param userId 用户编号
*/
- public static , S> void builderListQueryBatch(
- T queryMapper, Integer bizType, Collection bizIds, Long userId) {
- // 1. 构建数据权限连表条件
+ // TODO @puhui999:可以改成 appendPermissionCondition
+ // TODO @puhui999:S 是不是可以删除
+ public static , S> void builderListQueryBatch(T query, Integer bizType, Collection bizIds, Long userId) {
+ // TODO @puhui999:这里先 if return 简单点
if (ObjUtil.notEqual(validateAdminUser(userId), Boolean.TRUE)) { // 管理员不需要数据权限
- queryMapper.innerJoin(CrmPermissionDO.class, on ->
+ query.innerJoin(CrmPermissionDO.class, on ->
on.eq(CrmPermissionDO::getBizType, bizType).in(CrmPermissionDO::getBizId, bizIds)
.in(CollUtil.isNotEmpty(bizIds), CrmPermissionDO::getUserId, userId));
}
}
+ // TODO @puhui999:需要加个变量,不用每次都拿哈;
private static AdminUserApi getAdminUserApi() {
return SpringUtil.getBean(AdminUserApi.class);
}
+ // TODO @puhui999:需要实现;
/**
* 校验用户是否是管理员
*
diff --git a/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/user/AdminUserApi.java b/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/user/AdminUserApi.java
index c4510ba08..b6cab3030 100644
--- a/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/user/AdminUserApi.java
+++ b/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/user/AdminUserApi.java
@@ -22,7 +22,6 @@ public interface AdminUserApi {
*/
AdminUserRespDTO getUser(Long id);
- // TODO @puhui999:这里返回 List 方法名可以改成 getUserListBySubordinate
/**
* 通过用户 ID 查询用户下属
*
diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/user/AdminUserApiImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/user/AdminUserApiImpl.java
index c7055114e..3fce326fe 100644
--- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/user/AdminUserApiImpl.java
+++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/user/AdminUserApiImpl.java
@@ -39,13 +39,11 @@ public class AdminUserApiImpl implements AdminUserApi {
@Override
public List getUserListBySubordinate(Long userId) {
- // 1. 获取用户信息
+ // 1.1 获取用户负责的部门
AdminUserDO user = userService.getUser(userId);
if (user == null) {
return Collections.emptyList();
}
-
- // 2.1 获取用户负责的部门
ArrayList deptIds = new ArrayList<>();
DeptDO dept = deptService.getDept(user.getDeptId());
if (dept == null) {
@@ -54,13 +52,14 @@ public class AdminUserApiImpl implements AdminUserApi {
if (ObjUtil.notEqual(dept.getLeaderUserId(), userId)) { // 校验为负责人
return Collections.emptyList();
}
- deptIds.add(dept.getId()); // 加入此部门
- // 2.2 获取所有子部门
+ deptIds.add(dept.getId());
+ // 1.2 获取所有子部门
List childDeptList = deptService.getChildDeptList(dept.getId());
if (CollUtil.isNotEmpty(childDeptList)) {
deptIds.addAll(convertSet(childDeptList, DeptDO::getId));
}
- // 2.3 获取用户信息
+
+ // 2. 获取部门对应的用户信息
List users = userService.getUserListByDeptIds(deptIds);
users.removeIf(item -> ObjUtil.equal(item.getId(), userId)); // 排除自己
return BeanUtils.toBean(users, AdminUserRespDTO.class);
diff --git a/yudao-server/pom.xml b/yudao-server/pom.xml
index 40086477b..85b284c3c 100644
--- a/yudao-server/pom.xml
+++ b/yudao-server/pom.xml
@@ -37,11 +37,11 @@
-
-
-
-
-
+
+ cn.iocoder.boot
+ yudao-module-member-biz
+ ${revision}
+
@@ -56,11 +56,11 @@
-
-
-
-
-
+
+ cn.iocoder.boot
+ yudao-module-pay-biz
+ ${revision}
+
@@ -70,26 +70,26 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+ cn.iocoder.boot
+ yudao-module-promotion-biz
+ ${revision}
+
+
+ cn.iocoder.boot
+ yudao-module-product-biz
+ ${revision}
+
+
+ cn.iocoder.boot
+ yudao-module-trade-biz
+ ${revision}
+
+
+ cn.iocoder.boot
+ yudao-module-statistics-biz
+ ${revision}
+