feat(databus): 限制部门数据查询只统计特定来源
- 在游标分页查询中添加部门来源过滤条件 - 在总数统计查询中添加部门来源过滤条件 - 在部门计数接口中添加部门来源过滤条件 - 确保只统计部门来源为3的数据记录
This commit is contained in:
@@ -41,7 +41,7 @@ public class DatabusDeptProviderApiImpl implements DatabusDeptProviderApi {
|
|||||||
public CommonResult<CursorPageResult<DatabusDeptData>> getPageByCursor(CursorPageReqDTO reqDTO) {
|
public CommonResult<CursorPageResult<DatabusDeptData>> getPageByCursor(CursorPageReqDTO reqDTO) {
|
||||||
// 构建游标查询条件
|
// 构建游标查询条件
|
||||||
LambdaQueryWrapper<DeptDO> queryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<DeptDO> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
queryWrapper.eq(DeptDO::getDeptSource, 3);
|
||||||
// 游标条件:create_time > cursorTime OR (create_time = cursorTime AND id > cursorId)
|
// 游标条件:create_time > cursorTime OR (create_time = cursorTime AND id > cursorId)
|
||||||
if (!reqDTO.isFirstPage()) {
|
if (!reqDTO.isFirstPage()) {
|
||||||
queryWrapper.and(w -> w
|
queryWrapper.and(w -> w
|
||||||
@@ -105,6 +105,7 @@ public class DatabusDeptProviderApiImpl implements DatabusDeptProviderApi {
|
|||||||
Long total = null;
|
Long total = null;
|
||||||
if (reqDTO.isFirstPage()) {
|
if (reqDTO.isFirstPage()) {
|
||||||
LambdaQueryWrapper<DeptDO> countWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<DeptDO> countWrapper = new LambdaQueryWrapper<>();
|
||||||
|
countWrapper.eq(DeptDO::getDeptSource, 3);
|
||||||
if (reqDTO.getTenantId() != null) {
|
if (reqDTO.getTenantId() != null) {
|
||||||
countWrapper.eq(DeptDO::getTenantId, reqDTO.getTenantId());
|
countWrapper.eq(DeptDO::getTenantId, reqDTO.getTenantId());
|
||||||
}
|
}
|
||||||
@@ -175,6 +176,8 @@ public class DatabusDeptProviderApiImpl implements DatabusDeptProviderApi {
|
|||||||
@Override
|
@Override
|
||||||
public CommonResult<Long> count(Long tenantId) {
|
public CommonResult<Long> count(Long tenantId) {
|
||||||
LambdaQueryWrapper<DeptDO> queryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<DeptDO> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
// ⚠️ 只统计 userSource = 3 的用户
|
||||||
|
queryWrapper.eq(DeptDO::getDeptSource, 3);
|
||||||
if (tenantId != null) {
|
if (tenantId != null) {
|
||||||
queryWrapper.eq(DeptDO::getTenantId, tenantId);
|
queryWrapper.eq(DeptDO::getTenantId, tenantId);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user