|
@@ -1,10 +1,12 @@
|
|
|
package cn.iocoder.yudao.module.bpm.dal.mysql.oa.business;
|
|
|
|
|
|
+import cn.hutool.core.collection.CollUtil;
|
|
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
|
-import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
|
|
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
|
|
+import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
|
|
import cn.iocoder.yudao.module.bpm.controller.admin.oa.business.vo.OaBusinessPageReqVO;
|
|
|
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.business.OaBusinessDO;
|
|
|
+import cn.iocoder.yudao.module.system.api.permission.dto.DeptDataPermissionRespDTO;
|
|
|
import org.apache.ibatis.annotations.Mapper;
|
|
|
|
|
|
/**
|
|
@@ -16,33 +18,42 @@ import org.apache.ibatis.annotations.Mapper;
|
|
|
public interface OaBusinessMapper extends BaseMapperX<OaBusinessDO> {
|
|
|
|
|
|
default PageResult<OaBusinessDO> selectPage(OaBusinessPageReqVO reqVO) {
|
|
|
- return selectPage(reqVO, new LambdaQueryWrapperX<OaBusinessDO>()
|
|
|
- .eqIfPresent(OaBusinessDO::getId, reqVO.getId())
|
|
|
- .eqIfPresent(OaBusinessDO::getBusinessId, reqVO.getBusinessId())
|
|
|
- .eqIfPresent(OaBusinessDO::getEmployeeId, reqVO.getEmployeeId())
|
|
|
+ LambdaQueryWrapperX<OaBusinessDO> lambdaQueryWrapperX = new LambdaQueryWrapperX<OaBusinessDO>()
|
|
|
.likeIfPresent(OaBusinessDO::getEmployeeName, reqVO.getEmployeeName())
|
|
|
.eqIfPresent(OaBusinessDO::getEmployeePhone, reqVO.getEmployeePhone())
|
|
|
.eqIfPresent(OaBusinessDO::getUserId, reqVO.getUserId())
|
|
|
.eqIfPresent(OaBusinessDO::getDeptId, reqVO.getDeptId())
|
|
|
.eqIfPresent(OaBusinessDO::getPostId, reqVO.getPostId())
|
|
|
- .eqIfPresent(OaBusinessDO::getReason, reqVO.getReason())
|
|
|
.eqIfPresent(OaBusinessDO::getDestination, reqVO.getDestination())
|
|
|
.betweenIfPresent(OaBusinessDO::getStartDate, reqVO.getStartDate())
|
|
|
.betweenIfPresent(OaBusinessDO::getEndDate, reqVO.getEndDate())
|
|
|
- .eqIfPresent(OaBusinessDO::getDay, reqVO.getDay())
|
|
|
- .eqIfPresent(OaBusinessDO::getEstimatedCost, reqVO.getEstimatedCost())
|
|
|
- .eqIfPresent(OaBusinessDO::getRemarks, reqVO.getRemarks())
|
|
|
- .eqIfPresent(OaBusinessDO::getProcInstId, reqVO.getProcInstId())
|
|
|
.eqIfPresent(OaBusinessDO::getAuditStatus, reqVO.getAuditStatus())
|
|
|
- .eqIfPresent(OaBusinessDO::getCurrentAuditEmployeeId, reqVO.getCurrentAuditEmployeeId())
|
|
|
- .likeIfPresent(OaBusinessDO::getCurrentAuditEmployeeName, reqVO.getCurrentAuditEmployeeName())
|
|
|
- .eqIfPresent(OaBusinessDO::getCurrentAuditUserId, reqVO.getCurrentAuditUserId())
|
|
|
- .betweenIfPresent(OaBusinessDO::getFinalAuditDate, reqVO.getFinalAuditDate())
|
|
|
- .eqIfPresent(OaBusinessDO::getStartUserSelectAssignees, reqVO.getStartUserSelectAssignees())
|
|
|
- .eqIfPresent(OaBusinessDO::getApplyEmployeeId, reqVO.getApplyEmployeeId())
|
|
|
.likeIfPresent(OaBusinessDO::getApplyEmployeeName, reqVO.getApplyEmployeeName())
|
|
|
.betweenIfPresent(OaBusinessDO::getCreateTime, reqVO.getCreateTime())
|
|
|
- .orderByDesc(OaBusinessDO::getId));
|
|
|
+ .orderByDesc(OaBusinessDO::getId);
|
|
|
+ // 数据权限
|
|
|
+ DeptDataPermissionRespDTO deptDataPermission = reqVO.getDeptDataPermission();
|
|
|
+ if (deptDataPermission != null) {
|
|
|
+ if (deptDataPermission.getAll()) {
|
|
|
+ // 全部数据权限
|
|
|
+ } else {
|
|
|
+ if (CollUtil.isNotEmpty(deptDataPermission.getDeptIds()) && deptDataPermission.getSelf()) {
|
|
|
+ lambdaQueryWrapperX.and(wrapper ->
|
|
|
+ wrapper.in(OaBusinessDO::getDeptId, deptDataPermission.getDeptIds()))
|
|
|
+ .or(wrapper -> wrapper.eq(OaBusinessDO::getCreator, reqVO.getUserId()));
|
|
|
+ } else if (CollUtil.isNotEmpty(deptDataPermission.getDeptIds())) {
|
|
|
+ lambdaQueryWrapperX.in(OaBusinessDO::getCreator, deptDataPermission.getDeptIds());
|
|
|
+ } else if (deptDataPermission.getSelf()) {
|
|
|
+ lambdaQueryWrapperX.eq(OaBusinessDO::getCreator, reqVO.getUserId());
|
|
|
+ } else {
|
|
|
+ return PageResult.empty();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ return PageResult.empty();
|
|
|
+ }
|
|
|
+ return selectPage(reqVO, lambdaQueryWrapperX);
|
|
|
+
|
|
|
}
|
|
|
|
|
|
}
|