diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/permission/CrmPermissionConvert.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/permission/CrmPermissionConvert.java index 5e2522849..0f3c77e5f 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/permission/CrmPermissionConvert.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/permission/CrmPermissionConvert.java @@ -23,7 +23,7 @@ import static cn.iocoder.yudao.framework.common.util.collection.MapUtils.findAnd /** * Crm 数据权限 Convert * - * @author Wanwan + * @author HUIHUI */ @Mapper public interface CrmPermissionConvert { 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 f996b8601..1bd039fb2 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 @@ -25,47 +25,25 @@ import java.util.List; @Mapper public interface CrmCustomerMapper extends BaseMapperX { - static void appendQueryParams(MPJLambdaWrapperX mpjLambdaWrapperX, CrmCustomerPageReqVO pageReqVO, Long userId) { - if (pageReqVO.getPool()) { // 情况一:公海 - mpjLambdaWrapperX.isNull(CrmCustomerDO::getOwnerUserId); - } else { // 情况二:不是公海 - mpjLambdaWrapperX.isNotNull(CrmCustomerDO::getOwnerUserId); - } - // TODO 场景数据过滤 - if (CrmSceneEnum.isOwner(pageReqVO.getSceneType())) { // 场景一:我负责的数据 - mpjLambdaWrapperX.eq(CrmCustomerDO::getOwnerUserId, userId); - } - } - - static void appendQueryParams(LambdaQueryWrapperX lambdaQueryWrapperX, CrmCustomerPageReqVO pageReqVO, Long userId) { - if (pageReqVO.getPool()) { // 情况一:公海 - lambdaQueryWrapperX.isNull(CrmCustomerDO::getOwnerUserId); - } else { // 情况二:不是公海 - lambdaQueryWrapperX.isNotNull(CrmCustomerDO::getOwnerUserId); - } - // TODO 场景数据过滤 - if (CrmSceneEnum.isOwner(pageReqVO.getSceneType())) { // 场景一:我负责的数据 - lambdaQueryWrapperX.eq(CrmCustomerDO::getOwnerUserId, userId); - } - } - default int updateOwnerUserIdById(Long id, Long ownerUserId) { return update(new LambdaUpdateWrapper() .eq(CrmCustomerDO::getId, id) .set(CrmCustomerDO::getOwnerUserId, ownerUserId)); } - default PageResult selectPage(CrmCustomerPageReqVO pageReqVO, Long userId, Boolean admin) { - if (admin) { // 情况一:管理员查看 - LambdaQueryWrapperX queryWrapperX = new LambdaQueryWrapperX<>(); - appendQueryParams(queryWrapperX, pageReqVO, userId); - return selectPage(pageReqVO, queryWrapperX - .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())); - } + default PageResult selectPageWithAdmin(CrmCustomerPageReqVO pageReqVO, Long userId) { + // 情况一:管理员查看 + LambdaQueryWrapperX queryWrapperX = new LambdaQueryWrapperX<>(); + appendQueryParams(queryWrapperX, pageReqVO, userId); + return selectPage(pageReqVO, queryWrapperX + .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())); + } + + default PageResult selectPage(CrmCustomerPageReqVO pageReqVO, Long userId) { // 情况二:获取当前用户能看的分页数据 IPage mpPage = MyBatisUtils.buildPage(pageReqVO); MPJLambdaWrapperX mpjLambdaWrapperX = new MPJLambdaWrapperX<>(); @@ -91,4 +69,28 @@ public interface CrmCustomerMapper extends BaseMapperX { return new PageResult<>(mpPage.getRecords(), mpPage.getTotal()); } + static void appendQueryParams(MPJLambdaWrapperX mpjLambdaWrapperX, CrmCustomerPageReqVO pageReqVO, Long userId) { + if (pageReqVO.getPool()) { // 情况一:公海 + mpjLambdaWrapperX.isNull(CrmCustomerDO::getOwnerUserId); + } else { // 情况二:不是公海 + mpjLambdaWrapperX.isNotNull(CrmCustomerDO::getOwnerUserId); + } + // TODO 场景数据过滤 + if (CrmSceneEnum.isOwner(pageReqVO.getSceneType())) { // 场景一:我负责的数据 + mpjLambdaWrapperX.eq(CrmCustomerDO::getOwnerUserId, userId); + } + } + + static void appendQueryParams(LambdaQueryWrapperX lambdaQueryWrapperX, CrmCustomerPageReqVO pageReqVO, Long userId) { + if (pageReqVO.getPool()) { // 情况一:公海 + lambdaQueryWrapperX.isNull(CrmCustomerDO::getOwnerUserId); + } else { // 情况二:不是公海 + lambdaQueryWrapperX.isNotNull(CrmCustomerDO::getOwnerUserId); + } + // TODO 场景数据过滤 + if (CrmSceneEnum.isOwner(pageReqVO.getSceneType())) { // 场景一:我负责的数据 + lambdaQueryWrapperX.eq(CrmCustomerDO::getOwnerUserId, userId); + } + } + } diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/customer/CrmCustomerServiceImpl.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/customer/CrmCustomerServiceImpl.java index bb389ac20..d12943321 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/customer/CrmCustomerServiceImpl.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/customer/CrmCustomerServiceImpl.java @@ -100,9 +100,12 @@ public class CrmCustomerServiceImpl implements CrmCustomerService { @Override public PageResult getCustomerPage(CrmCustomerPageReqVO pageReqVO, Long userId) { - // 1.1. TODO 如果是超级管理员 boolean admin = false; - return customerMapper.selectPage(pageReqVO, userId, admin); + if (admin) { // 1.1. 情况一: TODO 如果是管理员 + customerMapper.selectPageWithAdmin(pageReqVO, userId); + } + // 1.2. 情况二:获取当前用户能看的分页数据 + return customerMapper.selectPage(pageReqVO, userId); } /** diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/banner/vo/BannerPageReqVO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/banner/vo/BannerPageReqVO.java index d4efa0df1..c2ac49d71 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/banner/vo/BannerPageReqVO.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/banner/vo/BannerPageReqVO.java @@ -19,11 +19,10 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_ @ToString(callSuper = true) public class BannerPageReqVO extends PageParam { - // TODO @puhui999:example - @Schema(description = "标题") + @Schema(description = "标题", example = "这是一个标题") private String title; - @Schema(description = "状态") + @Schema(description = "状态", example = "1") @InEnum(CommonStatusEnum.class) private Integer status;