Commit 58d59ad7 by 章家宝

feat(store):我已办查询逻辑修改

1 parent 2261b46c
...@@ -69,10 +69,19 @@ public class StoreApprovalServiceImpl implements StoreApprovalService { ...@@ -69,10 +69,19 @@ public class StoreApprovalServiceImpl implements StoreApprovalService {
@Override @Override
public PageResult<StoreApprovalTaskVO> pageDone(StoreApprovalTaskQueryDTO query) { public PageResult<StoreApprovalTaskVO> pageDone(StoreApprovalTaskQueryDTO query) {
// 从审批日志反查当前用户参与过审批(PASS / REJECT)的 listingId,
// 避免多级审批时 approveUserId 被末级覆盖导致前级审批人查不到已办记录
List<Long> doneListingIds = storeApprovalLogMapper
.selectList(new LambdaQueryWrapper<StoreApprovalLog>()
.eq(StoreApprovalLog::getOperatorId, CurrentUserHolder.getUserId())
.in(StoreApprovalLog::getAction,
List.of(ApprovalActionEnum.PASS.name(), ApprovalActionEnum.REJECT.name()))
.select(StoreApprovalLog::getListingId)
.groupBy(StoreApprovalLog::getListingId))
.stream().map(StoreApprovalLog::getListingId).distinct().toList();
LambdaQueryWrapper<StoreListing> wrapper = buildWrapper(query) LambdaQueryWrapper<StoreListing> wrapper = buildWrapper(query)
.eq(StoreListing::getApproveUserId, CurrentUserHolder.getUserId()) .in(StoreListing::getListingId, doneListingIds.isEmpty() ? List.of(-1L) : doneListingIds)
.in(StoreListing::getStatus,
List.of(StoreStatusEnum.APPROVED.getCode(), StoreStatusEnum.REJECTED.getCode()))
.orderByDesc(StoreListing::getApproveTime); .orderByDesc(StoreListing::getApproveTime);
return pageTask(query, wrapper); return pageTask(query, wrapper);
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!